diff --git a/bochs/iodev/display/Makefile.in b/bochs/iodev/display/Makefile.in index b71261b58..9bcc6428b 100644 --- a/bochs/iodev/display/Makefile.in +++ b/bochs/iodev/display/Makefile.in @@ -111,7 +111,7 @@ bx_svga_cirrus.dll: svga_cirrus.o vgacore.o @LINK_DLL@ svga_cirrus.o vgacore.o $(WIN32_DLL_IMPORT_LIBRARY) bx_voodoo.dll: voodoo.o vgacore.o - @LINK_DLL@ voodoo.o $(WIN32_DLL_IMPORT_LIBRARY) + @LINK_DLL@ voodoo.o vgacore.o $(WIN32_DLL_IMPORT_LIBRARY) ##### end DLL section diff --git a/bochs/iodev/display/voodoo.cc b/bochs/iodev/display/voodoo.cc index 0251bb9dc..a0e226da9 100644 --- a/bochs/iodev/display/voodoo.cc +++ b/bochs/iodev/display/voodoo.cc @@ -1321,7 +1321,8 @@ void bx_voodoo_c::banshee_mem_write(bx_phy_address addr, unsigned len, void *dat if (v->fbi.cmdfifo[0].enabled && (offset >= v->fbi.cmdfifo[0].base) && (offset < v->fbi.cmdfifo[0].end)) { cmdfifo_w(offset, value); - } else if (v->fbi.cmdfifo[1].enabled) { + } else if (v->fbi.cmdfifo[1].enabled && (offset >= v->fbi.cmdfifo[1].base) && + (offset < v->fbi.cmdfifo[1].end)) { BX_INFO(("TODO: CMDFIFO #1 write")); } else { for (unsigned i = 0; i < len; i++) { @@ -1378,6 +1379,7 @@ void bx_voodoo_c::banshee_agp_reg_write(Bit8u reg, Bit32u value) switch (reg) { case cmdBaseAddr0: case cmdBaseAddr1: + BX_LOCK(cmdfifo_mutex); v->fbi.cmdfifo[fifo_idx].base = (value << 12); if (fifo_idx == 0) { v->fbi.cmdfifo[0].end = v->fbi.cmdfifo[0].base + @@ -1386,15 +1388,18 @@ void bx_voodoo_c::banshee_agp_reg_write(Bit8u reg, Bit32u value) v->fbi.cmdfifo[1].end = v->fbi.cmdfifo[1].base + (((v->banshee.agp[cmdBaseSize1] & 0xff) + 1) << 12); } + BX_UNLOCK(cmdfifo_mutex); break; case cmdBaseSize0: case cmdBaseSize1: + BX_LOCK(cmdfifo_mutex); if (fifo_idx == 0) { v->fbi.cmdfifo[0].end = v->fbi.cmdfifo[0].base + (((value & 0xff) + 1) << 12); } else { v->fbi.cmdfifo[1].end = v->fbi.cmdfifo[1].base + (((value & 0xff) + 1) << 12); } v->fbi.cmdfifo[fifo_idx].enabled = ((value >> 8) & 1); + BX_UNLOCK(cmdfifo_mutex); break; case cmdBump0: case cmdBump1: @@ -1404,7 +1409,9 @@ void bx_voodoo_c::banshee_agp_reg_write(Bit8u reg, Bit32u value) break; case cmdRdPtrL0: case cmdRdPtrL1: + BX_LOCK(cmdfifo_mutex); v->fbi.cmdfifo[fifo_idx].rdptr = value; + BX_UNLOCK(cmdfifo_mutex); break; case cmdRdPtrH0: case cmdRdPtrH1: @@ -1422,7 +1429,9 @@ void bx_voodoo_c::banshee_agp_reg_write(Bit8u reg, Bit32u value) break; case cmdFifoDepth0: case cmdFifoDepth1: + BX_LOCK(cmdfifo_mutex); v->fbi.cmdfifo[fifo_idx].depth = value & 0xfffff; + BX_UNLOCK(cmdfifo_mutex); break; case cmdHoleCnt0: case cmdHoleCnt1: @@ -1741,10 +1750,8 @@ void bx_voodoo_vga_c::banshee_draw_hwcursor(unsigned xc, unsigned yc, bx_svga_ti case 16: colour = *vid_ptr; colour |= (*(vid_ptr + 1)) << 8; - colour = MAKE_COLOUR( - colour & 0x001f, 5, 8, 0x0000ff, - colour & 0x07e0, 11, 16, 0x00ff00, - colour & 0xf800, 16, 24, 0xff0000); + colour = (((colour & 0xf800) << 8) | ((colour & 0x07e0) << 5) | + ((colour & 0x001f) << 3)); break; case 24: case 32: diff --git a/bochs/iodev/display/voodoo_func.h b/bochs/iodev/display/voodoo_func.h index b1b46ce31..eed6a497f 100644 --- a/bochs/iodev/display/voodoo_func.h +++ b/bochs/iodev/display/voodoo_func.h @@ -2469,7 +2469,7 @@ void cmdfifo_process(void) { Bit32u command, data, mask, nwords, regaddr; Bit8u type, code, nvertex, smode; - bx_bool inc, pcolor; + bx_bool blt, inc, pcolor; voodoo_reg reg; int i; setup_vertex svert = {0}; @@ -2492,11 +2492,16 @@ void cmdfifo_process(void) case 1: nwords = (command >> 16); regaddr = (command & 0x7ff8) >> 3; + blt = (regaddr >> 11) & 1; inc = (command >> 15) & 1; for (i = 0; i < (int)nwords; i++) { data = cmdfifo_r(); BX_UNLOCK(cmdfifo_mutex); - register_w(regaddr, data, 1); + if ((v->type < VOODOO_BANSHEE) || !blt) { + register_w(regaddr, data, 1); + } else { + Voodoo_Banshee_2D_write(regaddr & 0xff, data); + } BX_LOCK(cmdfifo_mutex); if (inc) regaddr++; } @@ -2511,13 +2516,13 @@ void cmdfifo_process(void) while (mask) { if (mask & 1) { data = cmdfifo_r(); + BX_UNLOCK(cmdfifo_mutex); if (v->type < VOODOO_BANSHEE) { - BX_UNLOCK(cmdfifo_mutex); register_w(regaddr, data, 1); - BX_LOCK(cmdfifo_mutex); } else { Voodoo_Banshee_2D_write(regaddr, data); } + BX_LOCK(cmdfifo_mutex); } regaddr++; mask >>= 1; @@ -2620,11 +2625,16 @@ void cmdfifo_process(void) nwords = (command >> 29); mask = (command >> 15) & 0x3fff; regaddr = (command & 0x7ff8) >> 3; + blt = (regaddr >> 11) & 1; while (mask) { if (mask & 1) { data = cmdfifo_r(); BX_UNLOCK(cmdfifo_mutex); - register_w(regaddr, data, 1); + if ((v->type < VOODOO_BANSHEE) || !blt) { + register_w(regaddr, data, 1); + } else { + Voodoo_Banshee_2D_write(regaddr & 0xff, data); + } BX_LOCK(cmdfifo_mutex); } regaddr++;