Start of boot video mode support. Not finished.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26749 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
François Revol 2008-08-03 01:40:57 +00:00
parent e1ebbfbbd8
commit e07a1266f0
2 changed files with 106 additions and 0 deletions

View File

@ -16,6 +16,7 @@
#include <boot/kernel_args.h>
#include <util/list.h>
#include <drivers/driver_settings.h>
#include <GraphicsDefs.h>
#include <stdio.h>
#include <stdlib.h>
@ -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;
}

View File

@ -8,6 +8,13 @@
#include <SupportDefs.h>
/* 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;