From e07a1266f0b6d1079927591ebd1e603dc2c17c00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Sun, 3 Aug 2008 01:40:57 +0000 Subject: [PATCH] Start of boot video mode support. Not finished. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26749 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/boot/platform/atari_m68k/video.cpp | 99 +++++++++++++++++++ src/system/boot/platform/atari_m68k/video.h | 7 ++ 2 files changed, 106 insertions(+) diff --git a/src/system/boot/platform/atari_m68k/video.cpp b/src/system/boot/platform/atari_m68k/video.cpp index fd7c7045a7..c909b641fa 100644 --- a/src/system/boot/platform/atari_m68k/video.cpp +++ b/src/system/boot/platform/atari_m68k/video.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -32,6 +33,103 @@ // XXX: use falcon video monitor detection and build possible mode list there... +// which API to use to handle this mode +// cf. http://toshyp.atari.org/004.htm +enum { + MODETYPE_XBIOS_ST, + MODETYPE_XBIOS_TT, + MODETYPE_XBIOS_FALCON, + MODETYPE_CENTSCREEN, + MODETYPE_CRAZYDOTS, + MODETYPE_CT60, + MODETYPE_NATFEAT +}; + +class ModeAPI { +public: + ModeAPI(const char *name) { fName = name; }; + ~ModeAPI() {}; + const char *Name() const { return fName; }; + virtual status_t Enumerate() = 0; + virtual status_t Get(struct video_mode *mode) = 0; + virtual status_t Set(const struct video_mode *mode) = 0; +private: + const char *fName; +}; + +struct video_mode { + list_link link; + ModeAPI *ops; + color_space space; + uint16 mode; + uint16 width, height, bits_per_pixel; + uint32 bytes_per_row; +}; + +static struct list sModeList; +static video_mode *sMode, *sDefaultMode; + + +// #pragma mark - Falcon XBIOS API + +class FalconModeAPI : public ModeAPI { +public: + FalconModeAPI() : ModeAPI("Falcon XBIOS") {}; + ~FalconModeAPI() {}; + virtual status_t Enumerate(); + virtual status_t Get(struct video_mode *mode); + virtual status_t Set(const struct video_mode *mode); +}; + + +status_t +FalconModeAPI::Enumerate() +{ + int16 monitor; + monitor = VgetMonitor(); + switch (monitor) { + case 0: + panic("Monochrome ??"); + break; + //case 4 & 5: check for CT60 + case 1: + default: + dprintf("monitor type %d\n", monitor); + break; + } + return ENODEV; +} + + +status_t +FalconModeAPI::Get(struct video_mode *mode) +{ + int16 m = VsetMode(VM_INQUIRE); + int bpp; + int width = 320; + if (m < 0) + return B_ERROR; + bpp = 1 << (m & 0x0007); + if (m & 0x0008) + width *= 2; + bool vga = (m & 0x0010) != 0; + bool pal = (m & 0x0020) != 0; + bool overscan = (m & 0x0040) != 0; + bool st = (m & 0x0080) != 0; + bool interlace = (m & 0x0100) != 0; + return ENODEV; +} + + +status_t +FalconModeAPI::Set(const struct video_mode *mode) +{ + return ENODEV; +} + + +static FalconModeAPI sFalconModeAPI; + // #pragma mark - @@ -133,6 +231,7 @@ platform_init_video(void) // ToDo: implement me dprintf("current video mode: \n"); dprintf("Vsetmode(-1): 0x%08x\n", VsetMode(VM_INQUIRE)); + sFalconModeAPI.Enumerate(); return B_OK; } diff --git a/src/system/boot/platform/atari_m68k/video.h b/src/system/boot/platform/atari_m68k/video.h index 37cd88782c..bd494613b2 100644 --- a/src/system/boot/platform/atari_m68k/video.h +++ b/src/system/boot/platform/atari_m68k/video.h @@ -8,6 +8,13 @@ #include +/* 4CCs for custom colorspaces */ +// XXX: move to kernel/app_server header ? +#define ATARI_IBP1 'IBP1' +#define ATARI_IBP2 'IBP2' +#define ATARI_IBP4 'IBP4' +#define ATARI_IBP8 'IBP8' + class Menu; class MenuItem;