- new gui function get_capabilities() returns the maximum values for xres, yres

and bpp (done for the x display library)
- new switch VBE_DISPI_GETCAPS. The xres, yres and bpp registers return the gui
  capabilities if enabled.
- VBE_DISPI_ID3 defined
This commit is contained in:
Volker Ruppert 2004-02-22 13:03:02 +00:00
parent 3f3dd2c985
commit d748f22ed0
5 changed files with 72 additions and 12 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: gui.cc,v 1.76 2004-02-07 14:34:34 vruppert Exp $
// $Id: gui.cc,v 1.77 2004-02-22 13:02:54 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -600,7 +600,7 @@ bx_gui_c::beep_off()
BX_INFO(( "GUI Beep OFF"));
}
int
int
bx_gui_c::register_statusitem(const char *text)
{
if (statusitem_count < BX_MAX_STATUSITEMS) {
@ -611,3 +611,11 @@ bx_gui_c::register_statusitem(const char *text)
return -1;
}
}
void
bx_gui_c::get_capabilities(Bit16u *xres, Bit16u *yres, Bit16u *bpp)
{
*xres = 1024;
*yres = 768;
*bpp = 32;
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: gui.h,v 1.42 2004-02-07 14:34:34 vruppert Exp $
// $Id: gui.h,v 1.43 2004-02-22 13:02:56 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -88,6 +88,7 @@ public:
#endif
virtual void beep_on(float frequency);
virtual void beep_off();
virtual void get_capabilities(Bit16u *xres, Bit16u *yres, Bit16u *bpp);
// The following function(s) are defined already, and your
// GUI code calls them

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: x.cc,v 1.79 2004-02-15 19:46:13 vruppert Exp $
// $Id: x.cc,v 1.80 2004-02-22 13:02:56 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -64,6 +64,7 @@ public:
virtual void beep_on(float frequency);
virtual void beep_off();
virtual void statusbar_setitem(int element, bx_bool active);
virtual void get_capabilities(Bit16u *xres, Bit16u *yres, Bit16u *bpp);
};
// declare one instance of the gui object and call macro to insert the
@ -1931,4 +1932,12 @@ bx_x_gui_c::beep_off()
BX_INFO(( "X11 Beep OFF"));
}
void
bx_x_gui_c::get_capabilities(Bit16u *xres, Bit16u *yres, Bit16u *bpp)
{
*xres = 1024;
*yres = 768;
*bpp = imBPP;
}
#endif /* if BX_WITH_X11 */

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: vga.cc,v 1.95 2004-01-24 20:50:45 vruppert Exp $
// $Id: vga.cc,v 1.96 2004-02-22 13:02:59 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -123,6 +123,9 @@ bx_vga_c::init(void)
{
unsigned i;
unsigned x,y;
#if BX_SUPPORT_VBE
Bit16u max_xres, max_yres, max_bpp;
#endif
unsigned addr;
for (addr=0x03B4; addr<=0x03B5; addr++) {
@ -283,7 +286,24 @@ bx_vga_c::init(void)
BX_VGA_THIS s.vbe_virtual_start=0;
BX_VGA_THIS s.vbe_line_byte_width=640;
BX_VGA_THIS s.vbe_lfb_enabled=0;
BX_VGA_THIS s.vbe_get_capabilities=0;
bx_gui->get_capabilities(&max_xres, &max_yres,
&max_bpp);
if (max_xres > VBE_DISPI_MAX_XRES) {
BX_VGA_THIS s.vbe_max_xres=VBE_DISPI_MAX_XRES;
} else {
BX_VGA_THIS s.vbe_max_xres=max_xres;
}
if (max_yres > VBE_DISPI_MAX_YRES) {
BX_VGA_THIS s.vbe_max_yres=VBE_DISPI_MAX_YRES;
} else {
BX_VGA_THIS s.vbe_max_yres=max_yres;
}
if (max_bpp > VBE_DISPI_MAX_BPP) {
BX_VGA_THIS s.vbe_max_bpp=VBE_DISPI_MAX_BPP;
} else {
BX_VGA_THIS s.vbe_max_bpp=max_bpp;
}
BX_INFO(("VBE Bochs Display Extension Enabled"));
#endif
@ -2592,22 +2612,35 @@ bx_vga_c::vbe_read(Bit32u address, unsigned io_len)
case VBE_DISPI_INDEX_XRES: // x resolution
{
return BX_VGA_THIS s.vbe_xres;
if (BX_VGA_THIS s.vbe_get_capabilities) {
return BX_VGA_THIS s.vbe_max_xres;
} else {
return BX_VGA_THIS s.vbe_xres;
}
} break;
case VBE_DISPI_INDEX_YRES: // y resolution
{
return BX_VGA_THIS s.vbe_yres;
if (BX_VGA_THIS s.vbe_get_capabilities) {
return BX_VGA_THIS s.vbe_max_yres;
} else {
return BX_VGA_THIS s.vbe_yres;
}
} break;
case VBE_DISPI_INDEX_BPP: // bpp
{
return BX_VGA_THIS s.vbe_bpp;
if (BX_VGA_THIS s.vbe_get_capabilities) {
return BX_VGA_THIS s.vbe_max_bpp;
} else {
return BX_VGA_THIS s.vbe_bpp;
}
} break;
case VBE_DISPI_INDEX_ENABLE: // vbe enabled
{
return BX_VGA_THIS s.vbe_enabled;
return BX_VGA_THIS s.vbe_enabled |
(BX_VGA_THIS s.vbe_get_capabilities << 1);
} break;
case VBE_DISPI_INDEX_BANK: // current bank
@ -2686,7 +2719,8 @@ bx_vga_c::vbe_write(Bit32u address, Bit32u value, unsigned io_len)
{
if ( (value == VBE_DISPI_ID0) ||
(value == VBE_DISPI_ID1) ||
(value == VBE_DISPI_ID2) )
(value == VBE_DISPI_ID2) ||
(value == VBE_DISPI_ID3) )
{
// allow backwards compatible with previous dispi bioses
BX_VGA_THIS s.vbe_cur_dispi=value;
@ -2892,6 +2926,7 @@ bx_vga_c::vbe_write(Bit32u address, Bit32u value, unsigned io_len)
BX_VGA_THIS s.vbe_lfb_enabled=0;
}
BX_VGA_THIS s.vbe_enabled=(bx_bool)(value & VBE_DISPI_ENABLED);
BX_VGA_THIS s.vbe_get_capabilities=(bx_bool)(value & VBE_DISPI_GETCAPS);
} break;
case VBE_DISPI_INDEX_X_OFFSET:

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: vga.h,v 1.36 2003-12-31 10:33:27 vruppert Exp $
// $Id: vga.h,v 1.37 2004-02-22 13:03:02 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -32,6 +32,7 @@
#define VBE_DISPI_MAX_XRES 1024
#define VBE_DISPI_MAX_YRES 768
#define VBE_DISPI_MAX_BPP 32
#define VBE_DISPI_IOPORT_INDEX 0x01CE
#define VBE_DISPI_IOPORT_DATA 0x01CF
@ -53,6 +54,7 @@
#define VBE_DISPI_ID0 0xB0C0
#define VBE_DISPI_ID1 0xB0C1
#define VBE_DISPI_ID2 0xB0C2
#define VBE_DISPI_ID3 0xB0C3
#define VBE_DISPI_BPP_4 0x04
#define VBE_DISPI_BPP_8 0x08
@ -63,6 +65,7 @@
#define VBE_DISPI_DISABLED 0x00
#define VBE_DISPI_ENABLED 0x01
#define VBE_DISPI_GETCAPS 0x02
#define VBE_DISPI_NOCLEARMEM 0x80
#define VBE_DISPI_LFB_ENABLED 0x40
@ -252,6 +255,9 @@ private:
Bit16u vbe_xres;
Bit16u vbe_yres;
Bit16u vbe_bpp;
Bit16u vbe_max_xres;
Bit16u vbe_max_yres;
Bit16u vbe_max_bpp;
Bit16u vbe_bank;
bx_bool vbe_enabled;
Bit16u vbe_curindex;
@ -264,6 +270,7 @@ private:
Bit32u vbe_virtual_start; /**< For dealing with bpp>8, this is where the virtual screen starts. */
Bit8u vbe_bpp_multiplier; /**< We have to save this b/c sometimes we need to recalculate stuff with it. */
bx_bool vbe_lfb_enabled;
bx_bool vbe_get_capabilities;
#endif
} s; // state information