Preparing improved VGA extension support and some VGA / Cirrus cleanups.
- Treat VGA extension name other than "none", "vbe" or "cirrus" as a VGA compatible device plugin and try to load it. - Added new plugin type PLUGTYPE_VGA for such a plugins (interally handled like a core plugin). - Added panic in devices init for the case no VGA compatible plugin is present. - Added new method vga_redraw_area() that handles the non-VGA and null size case. The specific method redraw_area() is called otherwise. - Moved init_systemtimer() call from extension code to init_standard_vga(). - TODO: Implement VGA subsystem in the Voodoo code to test the new feature. Voodoo Banshee 2D accelerator code needs to be written to make this really useful.
This commit is contained in:
parent
6dba96d10a
commit
d25e85c21a
@ -2724,7 +2724,12 @@ static int parse_line_formatted(const char *context, int num_params, char *param
|
||||
}
|
||||
for (i=1; i<num_params; i++) {
|
||||
if (!strncmp(params[i], "extension=", 10)) {
|
||||
SIM->get_param_string(BXPN_VGA_EXTENSION)->set(¶ms[i][10]);
|
||||
const char *vgaext = ¶ms[i][10];
|
||||
SIM->get_param_string(BXPN_VGA_EXTENSION)->set(vgaext);
|
||||
if ((strlen(vgaext) > 0) &&
|
||||
(strcmp(vgaext, "none") && strcmp(vgaext, "vbe") && strcmp(vgaext, "cirrus"))) {
|
||||
PLUG_load_vga_plugin(vgaext);
|
||||
}
|
||||
} else if (!strncmp(params[i], "update_freq=", 12)) {
|
||||
SIM->get_param_num(BXPN_VGA_UPDATE_FREQUENCY)->set(atol(¶ms[i][12]));
|
||||
} else if (!strncmp(params[i], "realtime=", 9)) {
|
||||
|
@ -35,6 +35,7 @@ enum plugintype_t {
|
||||
PLUGTYPE_SOUND,
|
||||
PLUGTYPE_NETWORK,
|
||||
PLUGTYPE_USBDEV,
|
||||
PLUGTYPE_VGA,
|
||||
PLUGTYPE_USER
|
||||
};
|
||||
|
||||
|
@ -210,8 +210,10 @@ void bx_devices_c::init(BX_MEM_C *newmem)
|
||||
#else
|
||||
BX_PANIC(("Bochs is not compiled with Cirrus support"));
|
||||
#endif
|
||||
} else {
|
||||
} else if (!strcmp(vga_ext, "vbe") || !strcmp(vga_ext, "none")) {
|
||||
PLUG_load_plugin(vga, PLUGTYPE_CORE);
|
||||
} else if (pluginVgaDevice == &stubVga) {
|
||||
BX_PANIC(("No VGA compatible display adapter present"));
|
||||
}
|
||||
PLUG_load_plugin(floppy, PLUGTYPE_CORE);
|
||||
|
||||
|
@ -257,7 +257,6 @@ void bx_svga_cirrus_c::init_vga_extension(void)
|
||||
BX_CIRRUS_THIS put("CIRRUS");
|
||||
// initialize SVGA stuffs.
|
||||
BX_CIRRUS_THIS bx_vgacore_c::init_iohandlers(svga_read_handler, svga_write_handler);
|
||||
BX_CIRRUS_THIS bx_vgacore_c::init_systemtimer();
|
||||
BX_CIRRUS_THIS pci_enabled = SIM->is_pci_device("cirrus");
|
||||
BX_CIRRUS_THIS svga_init_members();
|
||||
#if BX_SUPPORT_PCI
|
||||
@ -438,20 +437,11 @@ void bx_svga_cirrus_c::after_restore_state(void)
|
||||
}
|
||||
}
|
||||
|
||||
void bx_svga_cirrus_c::redraw_area(unsigned x0, unsigned y0,
|
||||
unsigned width, unsigned height)
|
||||
void bx_svga_cirrus_c::redraw_area(unsigned x0, unsigned y0, unsigned width,
|
||||
unsigned height)
|
||||
{
|
||||
unsigned xti, yti, xt0, xt1, yt0, yt1;
|
||||
|
||||
if ((width == 0) || (height == 0)) {
|
||||
return;
|
||||
}
|
||||
#if BX_SUPPORT_PCI
|
||||
if (BX_CIRRUS_THIS s.vga_override && (BX_CIRRUS_THIS s.nvgadev != NULL)) {
|
||||
BX_CIRRUS_THIS s.nvgadev->redraw_area(x0, y0, width, height);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if ((BX_CIRRUS_THIS sequencer.reg[0x07] & 0x01) == CIRRUS_SR7_BPP_VGA) {
|
||||
BX_CIRRUS_THIS bx_vgacore_c::redraw_area(x0,y0,width,height);
|
||||
return;
|
||||
@ -1802,8 +1792,8 @@ void bx_svga_cirrus_c::svga_write_sequencer(Bit32u address, unsigned index, Bit8
|
||||
}
|
||||
|
||||
if (update_cursor) {
|
||||
BX_CIRRUS_THIS redraw_area(x, y, size, size);
|
||||
BX_CIRRUS_THIS redraw_area(BX_CIRRUS_THIS hw_cursor.x, BX_CIRRUS_THIS hw_cursor.y, BX_CIRRUS_THIS hw_cursor.size, BX_CIRRUS_THIS hw_cursor.size);
|
||||
BX_CIRRUS_THIS vga_redraw_area(x, y, size, size);
|
||||
BX_CIRRUS_THIS vga_redraw_area(BX_CIRRUS_THIS hw_cursor.x, BX_CIRRUS_THIS hw_cursor.y, BX_CIRRUS_THIS hw_cursor.size, BX_CIRRUS_THIS hw_cursor.size);
|
||||
}
|
||||
|
||||
if (index <= CIRRUS_SEQENCER_MAX) {
|
||||
|
@ -92,7 +92,6 @@ void bx_vga_c::init_vga_extension(void)
|
||||
Bit16u max_xres, max_yres, max_bpp;
|
||||
|
||||
BX_VGA_THIS init_iohandlers(read_handler, write_handler);
|
||||
BX_VGA_THIS init_systemtimer();
|
||||
BX_VGA_THIS pci_enabled = SIM->is_pci_device("pcivga");
|
||||
|
||||
// The following is for the VBE display extension
|
||||
@ -722,19 +721,10 @@ void bx_vga_c::mem_write(bx_phy_address addr, Bit8u value)
|
||||
}
|
||||
|
||||
void bx_vga_c::redraw_area(unsigned x0, unsigned y0, unsigned width,
|
||||
unsigned height)
|
||||
unsigned height)
|
||||
{
|
||||
unsigned xti, yti, xt0, xt1, yt0, yt1, xmax, ymax;
|
||||
|
||||
if (width == 0 || height == 0) {
|
||||
return;
|
||||
}
|
||||
#if BX_SUPPORT_PCI
|
||||
if (BX_VGA_THIS s.vga_override && (BX_VGA_THIS s.nvgadev != NULL)) {
|
||||
BX_VGA_THIS s.nvgadev->redraw_area(x0, y0, width, height);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (BX_VGA_THIS vbe.enabled) {
|
||||
BX_VGA_THIS s.vga_mem_updated = 1;
|
||||
xmax = BX_VGA_THIS vbe.xres;
|
||||
|
@ -173,6 +173,8 @@ void bx_vgacore_c::init_standard_vga(void)
|
||||
|
||||
// video card with BIOS ROM
|
||||
DEV_cmos_set_reg(0x14, (DEV_cmos_get_reg(0x14) & 0xcf) | 0x00);
|
||||
|
||||
BX_VGA_THIS init_systemtimer();
|
||||
}
|
||||
|
||||
void bx_vgacore_c::init_gui(void)
|
||||
@ -374,7 +376,7 @@ void bx_vgacore_c::after_restore_state(void)
|
||||
if (!BX_VGA_THIS s.vga_override) {
|
||||
BX_VGA_THIS s.last_xres = BX_VGA_THIS s.max_xres;
|
||||
BX_VGA_THIS s.last_yres = BX_VGA_THIS s.max_yres;
|
||||
BX_VGA_THIS redraw_area(0, 0, BX_VGA_THIS s.max_xres, BX_VGA_THIS s.max_yres);
|
||||
BX_VGA_THIS vga_redraw_area(0, 0, BX_VGA_THIS s.max_xres, BX_VGA_THIS s.max_yres);
|
||||
}
|
||||
BX_VGA_THIS update();
|
||||
bx_gui->flush();
|
||||
@ -1287,7 +1289,7 @@ void bx_vgacore_c::write(Bit32u address, Bit32u value, unsigned io_len, bx_bool
|
||||
}
|
||||
if (needs_update) {
|
||||
// Mark all video as updated so the changes will go through
|
||||
BX_VGA_THIS redraw_area(0, 0, BX_VGA_THIS s.last_xres, BX_VGA_THIS s.last_yres);
|
||||
BX_VGA_THIS vga_redraw_area(0, 0, BX_VGA_THIS s.last_xres, BX_VGA_THIS s.last_yres);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1300,7 +1302,7 @@ void bx_vgacore_c::set_override(bx_bool enabled, void *dev)
|
||||
if (!enabled) {
|
||||
bx_gui->dimension_update(BX_VGA_THIS s.last_xres, BX_VGA_THIS s.last_yres,
|
||||
BX_VGA_THIS s.last_fh, BX_VGA_THIS s.last_fw, BX_VGA_THIS s.last_bpp);
|
||||
BX_VGA_THIS redraw_area(0, 0, BX_VGA_THIS s.last_xres, BX_VGA_THIS s.last_yres);
|
||||
BX_VGA_THIS vga_redraw_area(0, 0, BX_VGA_THIS s.last_xres, BX_VGA_THIS s.last_yres);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2336,13 +2338,24 @@ void bx_vgacore_c::debug_dump(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
void bx_vgacore_c::redraw_area(unsigned x0, unsigned y0, unsigned width, unsigned height)
|
||||
void bx_vgacore_c::vga_redraw_area(unsigned x0, unsigned y0, unsigned width,
|
||||
unsigned height)
|
||||
{
|
||||
unsigned xti, yti, xt0, xt1, yt0, yt1, xmax, ymax;
|
||||
|
||||
if (width == 0 || height == 0) {
|
||||
return;
|
||||
}
|
||||
#if BX_SUPPORT_PCI
|
||||
if (BX_VGA_THIS s.vga_override && (BX_VGA_THIS s.nvgadev != NULL)) {
|
||||
BX_VGA_THIS s.nvgadev->redraw_area(x0, y0, width, height);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
redraw_area(x0, y0, width, height);
|
||||
}
|
||||
|
||||
void bx_vgacore_c::redraw_area(unsigned x0, unsigned y0, unsigned width, unsigned height)
|
||||
{
|
||||
unsigned xti, yti, xt0, xt1, yt0, yt1, xmax, ymax;
|
||||
|
||||
BX_VGA_THIS s.vga_mem_updated = 1;
|
||||
|
||||
@ -2385,7 +2398,7 @@ void bx_vgacore_c::refresh_display(void *this_ptr, bx_bool redraw)
|
||||
}
|
||||
#endif
|
||||
if (redraw) {
|
||||
redraw_area(0, 0, vgadev->s.last_xres, vgadev->s.last_yres);
|
||||
vga_redraw_area(0, 0, vgadev->s.last_xres, vgadev->s.last_yres);
|
||||
}
|
||||
vga_timer_handler(vgadev);
|
||||
}
|
||||
|
@ -72,8 +72,10 @@ public:
|
||||
virtual void debug_dump(void);
|
||||
#endif
|
||||
|
||||
virtual void redraw_area(unsigned x0, unsigned y0,
|
||||
unsigned width, unsigned height);
|
||||
virtual void vga_redraw_area(unsigned x0, unsigned y0, unsigned width,
|
||||
unsigned height);
|
||||
virtual void redraw_area(unsigned x0, unsigned y0, unsigned width,
|
||||
unsigned height);
|
||||
virtual void refresh_display(void *this_ptr, bx_bool redraw);
|
||||
virtual void get_text_snapshot(Bit8u **text_snapshot, unsigned *txHeight,
|
||||
unsigned *txWidth);
|
||||
|
@ -242,9 +242,9 @@ class BOCHSAPI bx_vga_stub_c
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
virtual void redraw_area(unsigned x0, unsigned y0,
|
||||
unsigned width, unsigned height) {
|
||||
STUBFUNC(vga, redraw_area);
|
||||
virtual void vga_redraw_area(unsigned x0, unsigned y0, unsigned width,
|
||||
unsigned height) {
|
||||
STUBFUNC(vga, vga_redraw_area);
|
||||
}
|
||||
virtual Bit8u mem_read(bx_phy_address addr) {
|
||||
STUBFUNC(vga, mem_read); return 0;
|
||||
|
@ -515,6 +515,7 @@ void pluginRegisterDeviceDevmodel(plugin_t *plugin, plugintype_t type, bx_devmod
|
||||
|
||||
switch (type) {
|
||||
case PLUGTYPE_CORE:
|
||||
case PLUGTYPE_VGA:
|
||||
devlist = &core_devices;
|
||||
break;
|
||||
case PLUGTYPE_STANDARD:
|
||||
@ -797,6 +798,7 @@ typedef struct {
|
||||
#define BUILTIN_SND_PLUGIN_ENTRY(mod) {#mod, PLUGTYPE_SOUND, lib##mod##_sound_plugin_init, lib##mod##_sound_plugin_fini, 0}
|
||||
#define BUILTIN_NET_PLUGIN_ENTRY(mod) {#mod, PLUGTYPE_NETWORK, lib##mod##_net_plugin_init, lib##mod##_net_plugin_fini, 0}
|
||||
#define BUILTIN_USB_PLUGIN_ENTRY(mod) {#mod, PLUGTYPE_USBDEV, lib##mod##_dev_plugin_init, lib##mod##_dev_plugin_fini, 0}
|
||||
#define BUILTIN_VGA_PLUGIN_ENTRY(mod) {#mod, PLUGTYPE_VGA, lib##mod##_LTX_plugin_init, lib##mod##_LTX_plugin_fini, 0}
|
||||
|
||||
static builtin_plugin_t builtin_plugins[] = {
|
||||
#if BX_WITH_AMIGAOS
|
||||
@ -884,6 +886,7 @@ static builtin_plugin_t builtin_plugins[] = {
|
||||
BUILTIN_OPT_PLUGIN_ENTRY(usb_xhci),
|
||||
#endif
|
||||
#if BX_SUPPORT_VOODOO
|
||||
BUILTIN_VGA_PLUGIN_ENTRY(voodoo),
|
||||
BUILTIN_OPT_PLUGIN_ENTRY(voodoo),
|
||||
#endif
|
||||
#if BX_SUPPORT_SOUNDLOW
|
||||
|
@ -89,6 +89,7 @@ extern "C" {
|
||||
#define PLUG_load_snd_plugin(name) bx_load_plugin(name,PLUGTYPE_SOUND)
|
||||
#define PLUG_load_net_plugin(name) bx_load_plugin(name,PLUGTYPE_NETWORK)
|
||||
#define PLUG_load_usb_plugin(name) bx_load_plugin(name,PLUGTYPE_USBDEV)
|
||||
#define PLUG_load_vga_plugin(name) bx_load_plugin(name,PLUGTYPE_VGA)
|
||||
#define PLUG_load_user_plugin(name) {bx_load_plugin(name,PLUGTYPE_USER);}
|
||||
#define PLUG_unload_plugin(name) {bx_unload_plugin(#name,1);}
|
||||
#define PLUG_unload_opt_plugin(name) bx_unload_plugin(name,1)
|
||||
@ -121,6 +122,7 @@ extern "C" {
|
||||
#define PLUG_load_snd_plugin(name) bx_load_plugin2(name,PLUGTYPE_SOUND)
|
||||
#define PLUG_load_net_plugin(name) bx_load_plugin2(name,PLUGTYPE_NETWORK)
|
||||
#define PLUG_load_usb_plugin(name) bx_load_plugin2(name,PLUGTYPE_USBDEV)
|
||||
#define PLUG_load_vga_plugin(name) bx_load_plugin2(name,PLUGTYPE_VGA)
|
||||
#define PLUG_unload_plugin(name) {lib##name##_LTX_plugin_fini();}
|
||||
#define PLUG_unload_opt_plugin(name) bx_unload_opt_plugin(name,1);
|
||||
|
||||
@ -227,7 +229,7 @@ extern "C" {
|
||||
#define DEV_vga_mem_read(addr) (bx_devices.pluginVgaDevice->mem_read(addr))
|
||||
#define DEV_vga_mem_write(addr, val) (bx_devices.pluginVgaDevice->mem_write(addr, val))
|
||||
#define DEV_vga_redraw_area(left, top, right, bottom) \
|
||||
(bx_devices.pluginVgaDevice->redraw_area(left, top, right, bottom))
|
||||
(bx_devices.pluginVgaDevice->vga_redraw_area(left, top, right, bottom))
|
||||
#define DEV_vga_get_text_snapshot(rawsnap, height, width) \
|
||||
(bx_devices.pluginVgaDevice->get_text_snapshot(rawsnap, height, width))
|
||||
#define DEV_vga_refresh(a) \
|
||||
|
Loading…
Reference in New Issue
Block a user