diff --git a/bochs/iodev/display/voodoo.cc b/bochs/iodev/display/voodoo.cc index fbeb80781..0451dfa2c 100644 --- a/bochs/iodev/display/voodoo.cc +++ b/bochs/iodev/display/voodoo.cc @@ -161,8 +161,8 @@ BX_THREAD_FUNC(fifo_thread, indata) while (1) { if (fifo_wait_for_event(&fifo_wakeup)) { // TODO: process PCI FIFO / memory FIFO data here - if (v->fbi.cmdfifo[0].enable) { - while (v->fbi.cmdfifo[0].enable && (v->fbi.cmdfifo[0].depth >= v->fbi.cmdfifo[0].depth_needed)) { + if (v->fbi.cmdfifo[0].enabled) { + while (v->fbi.cmdfifo[0].enabled && (v->fbi.cmdfifo[0].depth >= v->fbi.cmdfifo[0].depth_needed)) { cmdfifo_process(); } BX_LOCK(cmdfifo_mutex); @@ -393,7 +393,7 @@ void bx_voodoo_c::register_state(void) for (i = 0; i < 2; i++) { sprintf(name, "%d", i); bx_list_c *num = new bx_list_c(cmdfifo, name, ""); - new bx_shadow_bool_c(num, "enable", &v->fbi.cmdfifo[i].enable, BASE_HEX); + new bx_shadow_bool_c(num, "enabled", &v->fbi.cmdfifo[i].enabled, BASE_HEX); new bx_shadow_num_c(num, "base", &v->fbi.cmdfifo[i].base, BASE_HEX); new bx_shadow_num_c(num, "end", &v->fbi.cmdfifo[i].end, BASE_HEX); new bx_shadow_num_c(num, "rdptr", &v->fbi.cmdfifo[i].rdptr, BASE_HEX); @@ -768,6 +768,11 @@ void bx_voodoo_c::pci_write_handler(Bit8u address, Bit32u value, unsigned io_len case 0x41: case 0x42: case 0x43: + if (((address+i) == 0x40) && ((value8 ^ oldval) & 0x02)) { + v->pci.fifo.enabled = ((value8 & 0x02) > 0); + BX_INFO(("PCI FIFO now %sabled (not implemented yet)", + v->pci.fifo.enabled ? "en":"dis")); + } if (((address+i) == 0x41) && (BX_VOODOO_THIS s.model == VOODOO_2)) { value8 &= 0x0f; value8 |= 0x50; diff --git a/bochs/iodev/display/voodoo_data.h b/bochs/iodev/display/voodoo_data.h index 3be5f8579..0e543d455 100644 --- a/bochs/iodev/display/voodoo_data.h +++ b/bochs/iodev/display/voodoo_data.h @@ -1430,6 +1430,7 @@ typedef struct typedef struct _fifo_state fifo_state; struct _fifo_state { + bx_bool enabled; /* enabled? */ Bit32u* base; /* base of the FIFO */ Bit32s size; /* size of the FIFO */ Bit32s in; /* input pointer */ @@ -1440,7 +1441,7 @@ struct _fifo_state typedef struct _cmdfifo_info cmdfifo_info; struct _cmdfifo_info { - bx_bool enable; /* enabled? */ + bx_bool enabled; /* enabled? */ Bit8u count_holes; /* count holes? */ Bit32u base; /* base address in framebuffer RAM */ Bit32u end; /* end address in framebuffer RAM */ diff --git a/bochs/iodev/display/voodoo_func.h b/bochs/iodev/display/voodoo_func.h index dba9e7850..c2b07c4ce 100644 --- a/bochs/iodev/display/voodoo_func.h +++ b/bochs/iodev/display/voodoo_func.h @@ -1289,7 +1289,7 @@ void recompute_video_memory(voodoo_state *v) fifo_last_page = v->fbi.mask / 0x1000; /* is it valid and enabled? */ - if (fifo_start_page <= fifo_last_page && FBIINIT0_ENABLE_MEMORY_FIFO(v->reg[fbiInit0].u)) + if ((fifo_start_page <= fifo_last_page) && v->fbi.fifo.enabled) { v->fbi.fifo.base = (Bit32u *)(v->fbi.ram + fifo_start_page * 0x1000); v->fbi.fifo.size = (fifo_last_page + 1 - fifo_start_page) * 0x1000 / 4; @@ -2787,6 +2787,11 @@ void register_w_common(Bit32u offset, Bit32u data) poly_wait(v->poly, v->regnames[regnum]); if (v->type <= VOODOO_2 && (chips & 1) && INITEN_ENABLE_HW_INIT(v->pci.init_enable)) { Voodoo_Output_Enable(data & 1); + if (v->fbi.fifo.enabled != FBIINIT0_ENABLE_MEMORY_FIFO(data)) { + v->fbi.fifo.enabled = FBIINIT0_ENABLE_MEMORY_FIFO(data); + BX_INFO(("memory FIFO now %sabled (not implemented yet)", + v->fbi.fifo.enabled ? "en" : "dis")); + } v->reg[fbiInit0].u = data; if (FBIINIT0_GRAPHICS_RESET(data)) soft_reset(v); @@ -2829,9 +2834,9 @@ void register_w_common(Bit32u offset, Bit32u data) if (v->type == VOODOO_2 && (chips & 1) && INITEN_ENABLE_HW_INIT(v->pci.init_enable)) { - if (v->fbi.cmdfifo[0].enable != FBIINIT7_CMDFIFO_ENABLE(data)) { - v->fbi.cmdfifo[0].enable = FBIINIT7_CMDFIFO_ENABLE(data); - BX_INFO(("CMDFIFO now %sabled", v->fbi.cmdfifo[0].enable ? "en" : "dis")); + if (v->fbi.cmdfifo[0].enabled != FBIINIT7_CMDFIFO_ENABLE(data)) { + v->fbi.cmdfifo[0].enabled = FBIINIT7_CMDFIFO_ENABLE(data); + BX_INFO(("CMDFIFO now %sabled", v->fbi.cmdfifo[0].enabled ? "en" : "dis")); } v->reg[regnum].u = data; } @@ -2934,7 +2939,7 @@ Bit32u register_r(Bit32u offset) result |= 1 << 9; if (v->type == VOODOO_2) { - if (v->fbi.cmdfifo[0].enable && v->fbi.cmdfifo[0].depth > 0) + if (v->fbi.cmdfifo[0].enabled && v->fbi.cmdfifo[0].depth > 0) result |= 7 << 7; } /* Banshee is different starting here */ @@ -2944,7 +2949,7 @@ Bit32u register_r(Bit32u offset) result |= v->fbi.frontbuf << 10; /* bits 27:12 indicate memory FIFO freespace */ - if (!FBIINIT0_ENABLE_MEMORY_FIFO(v->reg[fbiInit0].u) || fifo_empty(&v->fbi.fifo)) + if (!v->fbi.fifo.enabled || fifo_empty(&v->fbi.fifo)) result |= 0xffff << 12; else { @@ -2959,11 +2964,11 @@ Bit32u register_r(Bit32u offset) /* bit 10 is 2D busy */ /* bit 11 is cmd FIFO 0 busy */ - if (v->fbi.cmdfifo[0].enable && v->fbi.cmdfifo[0].depth > 0) + if (v->fbi.cmdfifo[0].enabled && v->fbi.cmdfifo[0].depth > 0) result |= 1 << 11; /* bit 12 is cmd FIFO 1 busy */ - if (v->fbi.cmdfifo[1].enable && v->fbi.cmdfifo[1].depth > 0) + if (v->fbi.cmdfifo[1].enabled && v->fbi.cmdfifo[1].depth > 0) result |= 1 << 12; }