Changed type of vga and svga_cirrus plugins to PLUGTYPE_VGA. Modified vga
extension option init to make this work correctly. The choices "none" and "vbe" load the vga plugin, "cirrus" loads svga_cirrus.
This commit is contained in:
parent
442d7256bf
commit
8aaf9d858e
@ -47,7 +47,8 @@
|
||||
|
||||
|
||||
const char **display_library_list;
|
||||
const char **vga_extension_list;
|
||||
const char **vga_extension_names;
|
||||
const char **vga_extension_plugins;
|
||||
int bochsrc_include_level = 0;
|
||||
|
||||
#define LOG_THIS genlog->
|
||||
@ -62,7 +63,7 @@ static int get_floppy_type_from_image(const char *filename);
|
||||
static Bit64s bx_param_handler(bx_param_c *param, bool set, Bit64s val)
|
||||
{
|
||||
char pname[BX_PATHNAME_LEN];
|
||||
Bit8u device;
|
||||
Bit8u device, vga_ext_id;
|
||||
Bit64s oldval;
|
||||
|
||||
bx_list_c *base = (bx_list_c*) param->get_parent();
|
||||
@ -94,12 +95,9 @@ static Bit64s bx_param_handler(bx_param_c *param, bool set, Bit64s val)
|
||||
if (set) {
|
||||
oldval = ((bx_param_enum_c*)param)->get();
|
||||
if (val != oldval) {
|
||||
if (oldval >= BX_VGA_EXTENSION_OTHER) {
|
||||
PLUG_unload_opt_plugin(((bx_param_enum_c*)param)->get_selected());
|
||||
}
|
||||
if (val >= BX_VGA_EXTENSION_OTHER) {
|
||||
PLUG_load_vga_plugin(((bx_param_enum_c*)param)->get_choice((int)val));
|
||||
}
|
||||
vga_ext_id = (Bit8u)((bx_param_enum_c*)param)->get();
|
||||
PLUG_unload_opt_plugin(vga_extension_plugins[vga_ext_id]);
|
||||
PLUG_load_vga_plugin(vga_extension_plugins[(Bit8u)val]);
|
||||
}
|
||||
}
|
||||
} else if ((!strcmp(pname, BXPN_FLOPPYA_TYPE)) ||
|
||||
@ -306,16 +304,25 @@ void bx_init_displaylib_list()
|
||||
void bx_init_vgaext_list()
|
||||
{
|
||||
Bit8u i, count = 0;
|
||||
const char *plugname;
|
||||
|
||||
count = PLUG_get_plugins_count(PLUGTYPE_VGA);
|
||||
vga_extension_list = (const char**) malloc((count + 4) * sizeof(char*));
|
||||
vga_extension_list[0] = "none";
|
||||
vga_extension_list[1] = "vbe";
|
||||
vga_extension_list[2] = "cirrus";
|
||||
vga_extension_names = (const char**) malloc((count + 2) * sizeof(char*));
|
||||
vga_extension_plugins = (const char**) malloc((count + 1) * sizeof(char*));
|
||||
vga_extension_names[0] = "none";
|
||||
vga_extension_plugins[0] = "vga";
|
||||
for (i = 0; i < count; i++) {
|
||||
vga_extension_list[i + 3] = PLUG_get_plugin_name(PLUGTYPE_VGA, i);
|
||||
plugname = PLUG_get_plugin_name(PLUGTYPE_VGA, i);
|
||||
vga_extension_plugins[i + 1] = plugname;
|
||||
if (!strcmp(plugname, "vga")) {
|
||||
vga_extension_names[i + 1] = "vbe";
|
||||
} else if (!strcmp(plugname, "svga_cirrus")) {
|
||||
vga_extension_names[i + 1] = plugname + 5;
|
||||
} else {
|
||||
vga_extension_names[i + 1] = plugname;
|
||||
}
|
||||
}
|
||||
vga_extension_list[count + 3] = NULL;
|
||||
vga_extension_names[count + 2] = NULL;
|
||||
}
|
||||
|
||||
void bx_init_options()
|
||||
@ -998,9 +1005,9 @@ void bx_init_options()
|
||||
"vga_extension",
|
||||
"VGA Extension",
|
||||
"Name of the VGA extension",
|
||||
vga_extension_list,
|
||||
BX_VGA_EXTENSION_VBE,
|
||||
BX_VGA_EXTENSION_NONE);
|
||||
vga_extension_names,
|
||||
0, 0);
|
||||
vga_extension->set_by_name("vbe");
|
||||
vga_extension->set_handler(bx_param_handler);
|
||||
display->set_options(display->SHOW_PARENT);
|
||||
|
||||
|
@ -459,13 +459,6 @@ enum {
|
||||
BX_RUN_START
|
||||
};
|
||||
|
||||
enum {
|
||||
BX_VGA_EXTENSION_NONE,
|
||||
BX_VGA_EXTENSION_VBE,
|
||||
BX_VGA_EXTENSION_CIRRUS,
|
||||
BX_VGA_EXTENSION_OTHER
|
||||
};
|
||||
|
||||
enum {
|
||||
BX_DDC_MODE_DISABLED,
|
||||
BX_DDC_MODE_BUILTIN,
|
||||
|
@ -111,7 +111,6 @@ void bx_devices_c::init(BX_MEM_C *newmem)
|
||||
unsigned max_pci_slots = BX_N_PCI_SLOTS;
|
||||
#endif
|
||||
unsigned i, argc;
|
||||
Bit8u vga_ext_id;
|
||||
const char def_name[] = "Default";
|
||||
const char *options;
|
||||
char *argv[16];
|
||||
@ -240,17 +239,8 @@ void bx_devices_c::init(BX_MEM_C *newmem)
|
||||
PLUG_load_plugin(dma, PLUGTYPE_CORE);
|
||||
PLUG_load_plugin(pic, PLUGTYPE_CORE);
|
||||
PLUG_load_plugin(pit, PLUGTYPE_CORE);
|
||||
vga_ext_id = (Bit8u)SIM->get_param_enum(BXPN_VGA_EXTENSION)->get();
|
||||
if (vga_ext_id == BX_VGA_EXTENSION_CIRRUS) {
|
||||
#if BX_SUPPORT_CLGD54XX
|
||||
PLUG_load_plugin(svga_cirrus, PLUGTYPE_CORE);
|
||||
#else
|
||||
BX_PANIC(("Bochs is not compiled with Cirrus support"));
|
||||
#endif
|
||||
} else if (vga_ext_id <= BX_VGA_EXTENSION_VBE) {
|
||||
PLUG_load_plugin(vga, PLUGTYPE_CORE);
|
||||
} else if (pluginVgaDevice == &stubVga) {
|
||||
BX_PANIC(("No VGA compatible display adapter present"));
|
||||
if (pluginVgaDevice == &stubVga) {
|
||||
PLUG_load_vga_plugin(BX_PLUGIN_VGA);
|
||||
}
|
||||
PLUG_load_plugin(floppy, PLUGTYPE_CORE);
|
||||
|
||||
|
@ -215,17 +215,13 @@ static bx_svga_cirrus_c *theSvga = NULL;
|
||||
PLUGIN_ENTRY_FOR_MODULE(svga_cirrus)
|
||||
{
|
||||
if (mode == PLUGIN_INIT) {
|
||||
if (type == PLUGTYPE_CORE) {
|
||||
theSvga = new bx_svga_cirrus_c();
|
||||
bx_devices.pluginVgaDevice = theSvga;
|
||||
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theSvga, BX_PLUGIN_CIRRUS);
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
theSvga = new bx_svga_cirrus_c();
|
||||
bx_devices.pluginVgaDevice = theSvga;
|
||||
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theSvga, BX_PLUGIN_CIRRUS);
|
||||
} else if (mode == PLUGIN_FINI) {
|
||||
delete theSvga;
|
||||
} else {
|
||||
return (int)PLUGTYPE_CORE;
|
||||
return (int)PLUGTYPE_VGA;
|
||||
}
|
||||
return 0; // Success
|
||||
}
|
||||
|
@ -47,17 +47,13 @@ bx_vga_c *theVga = NULL;
|
||||
PLUGIN_ENTRY_FOR_MODULE(vga)
|
||||
{
|
||||
if (mode == PLUGIN_INIT) {
|
||||
if (type == PLUGTYPE_CORE) {
|
||||
theVga = new bx_vga_c();
|
||||
bx_devices.pluginVgaDevice = theVga;
|
||||
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theVga, BX_PLUGIN_VGA);
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
theVga = new bx_vga_c();
|
||||
bx_devices.pluginVgaDevice = theVga;
|
||||
BX_REGISTER_DEVICE_DEVMODEL(plugin, type, theVga, BX_PLUGIN_VGA);
|
||||
} else if (mode == PLUGIN_FINI) {
|
||||
delete theVga;
|
||||
} else {
|
||||
return (int)PLUGTYPE_CORE;
|
||||
return (int)PLUGTYPE_VGA;
|
||||
}
|
||||
return 0; // Success
|
||||
}
|
||||
@ -87,7 +83,7 @@ bool bx_vga_c::init_vga_extension(void)
|
||||
BX_VGA_THIS vbe.dac_8bit = 0;
|
||||
BX_VGA_THIS vbe.ddc_enabled = 0;
|
||||
BX_VGA_THIS vbe.base_address = 0x0000;
|
||||
if (BX_VGA_THIS vga_ext_id == BX_VGA_EXTENSION_VBE) {
|
||||
if (!strcmp(BX_VGA_THIS vga_ext->get_selected(), "vbe")) {
|
||||
BX_VGA_THIS put("BXVGA");
|
||||
for (addr=VBE_DISPI_IOPORT_INDEX; addr<=VBE_DISPI_IOPORT_DATA; addr++) {
|
||||
DEV_register_ioread_handler(this, vbe_read_handler, addr, "vga video", 7);
|
||||
|
@ -85,7 +85,7 @@ void bx_vgacore_c::init(void)
|
||||
{
|
||||
unsigned x,y;
|
||||
|
||||
BX_VGA_THIS vga_ext_id = (Bit8u)SIM->get_param_enum(BXPN_VGA_EXTENSION)->get();
|
||||
BX_VGA_THIS vga_ext = SIM->get_param_enum(BXPN_VGA_EXTENSION);
|
||||
BX_VGA_THIS pci_enabled = 0;
|
||||
|
||||
BX_VGA_THIS init_standard_vga();
|
||||
|
@ -266,7 +266,7 @@ protected:
|
||||
int timer_id;
|
||||
bool update_realtime;
|
||||
bool vsync_realtime;
|
||||
Bit8u vga_ext_id;
|
||||
bx_param_enum_c *vga_ext;
|
||||
bool pci_enabled;
|
||||
};
|
||||
|
||||
|
@ -1024,6 +1024,10 @@ plugin_t bx_builtin_plugins[] = {
|
||||
#endif
|
||||
#if BX_SUPPORT_USB_XHCI
|
||||
BUILTIN_OPT_PLUGIN_ENTRY(usb_xhci),
|
||||
#endif
|
||||
BUILTIN_VGA_PLUGIN_ENTRY(vga),
|
||||
#if BX_SUPPORT_CLGD54XX
|
||||
BUILTIN_VGA_PLUGIN_ENTRY(svga_cirrus),
|
||||
#endif
|
||||
#if BX_SUPPORT_VOODOO
|
||||
BUILTIN_VGA_PLUGIN_ENTRY(voodoo),
|
||||
|
Loading…
Reference in New Issue
Block a user