This commit is contained in:
OBattler
2023-07-06 19:59:54 +02:00
140 changed files with 2899 additions and 1754 deletions

View File

@@ -77,7 +77,7 @@ cga_out(uint16_t addr, uint8_t val, void *p)
cga->cgamode = val;
if (old ^ val) {
if ((old ^ val) & 0x05)
if ((old ^ val) & 0x07)
update_cga16_color(val);
cga_recalctimings(cga);
@@ -352,10 +352,7 @@ cga_poll(void *p)
x = (cga->crtc[1] << 4) + 16;
if (cga->composite) {
if (cga->cgamode & 0x10)
border = 0x00;
else
border = cga->cgacol & 0x0f;
border = ((cga->cgamode & 0x12) == 0x12) ? 0 : (cga->cgacol & 15);
Composite_Process(cga->cgamode, border, x >> 2, buffer32->line[cga->displine << 1]);
Composite_Process(cga->cgamode, border, x >> 2, buffer32->line[(cga->displine << 1) + 1]);
@@ -536,6 +533,7 @@ cga_standalone_init(const device_t *info)
cga->rgb_type = device_get_config_int("rgb_type");
cga_palette = (cga->rgb_type << 1);
cgapal_rebuild();
update_cga16_color(cga->cgamode);
return cga;
}

View File

@@ -323,9 +323,9 @@ banshee_vblank_start(svga_t *svga)
}
static void
banshee_out(uint16_t addr, uint8_t val, void *p)
banshee_out(uint16_t addr, uint8_t val, void *priv)
{
banshee_t *banshee = (banshee_t *) p;
banshee_t *banshee = (banshee_t *) priv;
svga_t *svga = &banshee->svga;
uint8_t old;
@@ -375,13 +375,16 @@ banshee_out(uint16_t addr, uint8_t val, void *p)
}
static uint8_t
banshee_in(uint16_t addr, void *p)
banshee_in(uint16_t addr, void *priv)
{
banshee_t *banshee = (banshee_t *) p;
banshee_t *banshee = (banshee_t *) priv;
svga_t *svga = &banshee->svga;
uint8_t temp;
// if (addr != 0x3da) banshee_log("banshee_in : %04X ", addr);
#if 0
if (addr != 0x3da)
banshee_log("banshee_in : %04X ", addr);
#endif
if (((addr & 0xfff0) == 0x3d0 || (addr & 0xfff0) == 0x3b0) && !(svga->miscout & 1))
addr ^= 0x60;
@@ -405,7 +408,10 @@ banshee_in(uint16_t addr, void *p)
temp = svga_in(addr, svga);
break;
}
// if (addr != 0x3da) banshee_log("%02X %04X:%04X %i\n", temp, CS,cpu_state.pc, ins);
#if 0
if (addr != 0x3da)
banshee_log("%02X %04X:%04X %i\n", temp, CS,cpu_state.pc, ins);
#endif
return temp;
}
@@ -524,7 +530,9 @@ banshee_recalctimings(svga_t *svga)
svga->vblankstart += 0x400;
if (svga->crtc[0x1b] & 0x40)
svga->vsyncstart += 0x400;
// banshee_log("svga->hdisp=%i\n", svga->hdisp);
#if 0
banshee_log("svga->hdisp=%i\n", svga->hdisp);
#endif
svga->interlace = 0;
@@ -559,7 +567,9 @@ banshee_recalctimings(svga_t *svga)
svga->rowoffset = (banshee->vidDesktopOverlayStride & 0x3fff) >> 3;
svga->ma_latch = banshee->vidDesktopStartAddr >> 2;
banshee->desktop_stride_tiled = (banshee->vidDesktopOverlayStride & 0x3fff) * 128 * 32;
// banshee_log("Extended shift out %i rowoffset=%i %02x\n", VIDPROCCFG_DESKTOP_PIX_FORMAT, svga->rowoffset, svga->crtc[1]);
#if 0
banshee_log("Extended shift out %i rowoffset=%i %02x\n", VIDPROCCFG_DESKTOP_PIX_FORMAT, svga->rowoffset, svga->crtc[1]);
#endif
svga->char_width = 8;
svga->split = 99999;
@@ -583,11 +593,13 @@ banshee_recalctimings(svga_t *svga)
if (svga->overlay.cur_xsize <= 0 || svga->overlay.cur_ysize <= 0)
svga->overlay.ena = 0;
if (svga->overlay.ena) {
/* banshee_log("Overlay enabled : start=%i,%i end=%i,%i size=%i,%i pitch=%x\n",
voodoo->overlay.start_x, voodoo->overlay.start_y,
voodoo->overlay.end_x, voodoo->overlay.end_y,
voodoo->overlay.size_x, voodoo->overlay.size_y,
svga->overlay.pitch);*/
#if 0
banshee_log("Overlay enabled : start=%i,%i end=%i,%i size=%i,%i pitch=%x\n",
voodoo->overlay.start_x, voodoo->overlay.start_y,
voodoo->overlay.end_x, voodoo->overlay.end_y,
voodoo->overlay.size_x, voodoo->overlay.size_y,
svga->overlay.pitch);
#endif
if (!voodoo->overlay.start_x && !voodoo->overlay.start_y && svga->hdisp == voodoo->overlay.size_x && svga->dispend == voodoo->overlay.size_y) {
/*Overlay is full screen, so don't bother rendering the desktop
behind it*/
@@ -596,7 +608,9 @@ banshee_recalctimings(svga_t *svga)
}
}
} else {
// banshee_log("Normal shift out\n");
#if 0
banshee_log("Normal shift out\n");
#endif
svga->bpp = 8;
}
@@ -609,19 +623,27 @@ banshee_recalctimings(svga_t *svga)
double freq = (((double) n + 2) / (((double) m + 2) * (double) (1 << k))) * 14318184.0;
svga->clock = (cpuclock * (float) (1ULL << 32)) / freq;
// svga->clock = cpuclock / freq;
#if 0
svga->clock = cpuclock / freq;
#endif
// banshee_log("svga->clock = %g %g m=%i k=%i n=%i\n", freq, freq / 1000000.0, m, k, n);
#if 0
banshee_log("svga->clock = %g %g m=%i k=%i n=%i\n", freq, freq / 1000000.0, m, k, n);
#endif
}
}
static void
banshee_ext_out(uint16_t addr, uint8_t val, void *p)
banshee_ext_out(uint16_t addr, uint8_t val, void *priv)
{
// banshee_t *banshee = (banshee_t *)p;
// svga_t *svga = &banshee->svga;
#if 0
banshee_t *banshee = (banshee_t *)priv;
svga_t *svga = &banshee->svga;
#endif
// banshee_log("banshee_ext_out: addr=%04x val=%02x\n", addr, val);
#if 0
banshee_log("banshee_ext_out: addr=%04x val=%02x\n", addr, val);
#endif
switch (addr & 0xff) {
case 0xb0:
@@ -672,7 +694,7 @@ banshee_ext_out(uint16_t addr, uint8_t val, void *p)
case 0xdd:
case 0xde:
case 0xdf:
banshee_out((addr & 0xff) + 0x300, val, p);
banshee_out((addr & 0xff) + 0x300, val, priv);
break;
default:
@@ -680,13 +702,15 @@ banshee_ext_out(uint16_t addr, uint8_t val, void *p)
}
}
static void
banshee_ext_outl(uint16_t addr, uint32_t val, void *p)
banshee_ext_outl(uint16_t addr, uint32_t val, void *priv)
{
banshee_t *banshee = (banshee_t *) p;
banshee_t *banshee = (banshee_t *) priv;
voodoo_t *voodoo = banshee->voodoo;
svga_t *svga = &banshee->svga;
// banshee_log("banshee_ext_outl: addr=%04x val=%08x %04x(%08x):%08x\n", addr, val, CS,cs,cpu_state.pc);
#if 0
banshee_log("banshee_ext_outl: addr=%04x val=%08x %04x(%08x):%08x\n", addr, val, CS,cs,cpu_state.pc);
#endif
switch (addr & 0xff) {
case Init_pciInit0:
@@ -698,7 +722,9 @@ banshee_ext_outl(uint16_t addr, uint32_t val, void *p)
case Init_lfbMemoryConfig:
banshee->lfbMemoryConfig = val;
// banshee_log("lfbMemoryConfig=%08x\n", val);
#if 0
banshee_log("lfbMemoryConfig=%08x\n", val);
#endif
voodoo->tile_base = (val & 0x1fff) << 12;
voodoo->tile_stride = 1024 << ((val >> 13) & 7);
voodoo->tile_stride_shift = 10 + ((val >> 13) & 7);
@@ -764,7 +790,9 @@ banshee_ext_outl(uint16_t addr, uint32_t val, void *p)
case Video_vidProcCfg:
banshee->vidProcCfg = val;
// banshee_log("vidProcCfg=%08x\n", val);
#if 0
banshee_log("vidProcCfg=%08x\n", val);
#endif
banshee->overlay_pix_fmt = (val & VIDPROCCFG_OVERLAY_PIX_FORMAT_MASK) >> VIDPROCCFG_OVERLAY_PIX_FORMAT_SHIFT;
svga->hwcursor.ena = val & VIDPROCCFG_HWCURSOR_ENA;
svga->fullchange = changeframecount;
@@ -797,7 +825,9 @@ banshee_ext_outl(uint16_t addr, uint32_t val, void *p)
svga->hwcursor.addr = (banshee->hwCurPatAddr & 0xfffff0) + (svga->hwcursor.yoff * 16);
svga->hwcursor.cur_xsize = 64;
svga->hwcursor.cur_ysize = 64;
// banshee_log("hwCurLoc %08x %i\n", val, svga->hwcursor.y);
#if 0
banshee_log("hwCurLoc %08x %i\n", val, svga->hwcursor.y);
#endif
break;
case Video_hwCurC0:
banshee->hwCurC0 = val;
@@ -808,7 +838,9 @@ banshee_ext_outl(uint16_t addr, uint32_t val, void *p)
case Video_vidSerialParallelPort:
banshee->vidSerialParallelPort = val;
// banshee_log("vidSerialParallelPort: write %08x %08x %04x(%08x):%08x\n", val, val & (VIDSERIAL_DDC_DCK_W | VIDSERIAL_DDC_DDA_W), CS,cs,cpu_state.pc);
#if 0
banshee_log("vidSerialParallelPort: write %08x %08x %04x(%08x):%08x\n", val, val & (VIDSERIAL_DDC_DCK_W | VIDSERIAL_DDC_DDA_W), CS,cs,cpu_state.pc);
#endif
i2c_gpio_set(banshee->i2c_ddc, !!(val & VIDSERIAL_DDC_DCK_W), !!(val & VIDSERIAL_DDC_DDA_W));
i2c_gpio_set(banshee->i2c, !!(val & VIDSERIAL_I2C_SCK_W), !!(val & VIDSERIAL_I2C_SDA_W));
break;
@@ -836,16 +868,22 @@ banshee_ext_outl(uint16_t addr, uint32_t val, void *p)
break;
case Video_vidOverlayDudx:
voodoo->overlay.vidOverlayDudx = val & VID_DUDX_MASK;
// banshee_log("vidOverlayDudx=%08x\n", val);
#if 0
banshee_log("vidOverlayDudx=%08x\n", val);
#endif
break;
case Video_vidOverlayDudxOffsetSrcWidth:
voodoo->overlay.vidOverlayDudxOffsetSrcWidth = val;
voodoo->overlay.overlay_bytes = (val & OVERLAY_SRC_WIDTH_MASK) >> OVERLAY_SRC_WIDTH_SHIFT;
// banshee_log("vidOverlayDudxOffsetSrcWidth=%08x\n", val);
#if 0
banshee_log("vidOverlayDudxOffsetSrcWidth=%08x\n", val);
#endif
break;
case Video_vidOverlayDvdy:
voodoo->overlay.vidOverlayDvdy = val & VID_DVDY_MASK;
// banshee_log("vidOverlayDvdy=%08x\n", val);
#if 0
banshee_log("vidOverlayDvdy=%08x\n", val);
#endif
break;
case Video_vidOverlayDvdyOffset:
voodoo->overlay.vidOverlayDvdyOffset = val;
@@ -853,26 +891,34 @@ banshee_ext_outl(uint16_t addr, uint32_t val, void *p)
case Video_vidDesktopStartAddr:
banshee->vidDesktopStartAddr = val & 0xffffff;
// banshee_log("vidDesktopStartAddr=%08x\n", val);
#if 0
banshee_log("vidDesktopStartAddr=%08x\n", val);
#endif
svga->fullchange = changeframecount;
svga_recalctimings(svga);
break;
case Video_vidDesktopOverlayStride:
banshee->vidDesktopOverlayStride = val;
// banshee_log("vidDesktopOverlayStride=%08x\n", val);
#if 0
banshee_log("vidDesktopOverlayStride=%08x\n", val);
#endif
svga->fullchange = changeframecount;
svga_recalctimings(svga);
break;
// default:
// fatal("bad banshee_ext_outl: addr=%04x val=%08x\n", addr, val);
#if 0
default:
fatal("bad banshee_ext_outl: addr=%04x val=%08x\n", addr, val);
#endif
}
}
static uint8_t
banshee_ext_in(uint16_t addr, void *p)
banshee_ext_in(uint16_t addr, void *priv)
{
banshee_t *banshee = (banshee_t *) p;
// svga_t *svga = &banshee->svga;
banshee_t *banshee = (banshee_t *) priv;
#if 0
svga_t *svga = &banshee->svga;
#endif
uint8_t ret = 0xff;
switch (addr & 0xff) {
@@ -881,7 +927,9 @@ banshee_ext_in(uint16_t addr, void *p)
case Init_status + 2:
case Init_status + 3:
ret = (banshee_status(banshee) >> ((addr & 3) * 8)) & 0xff;
// banshee_log("Read status reg! %04x(%08x):%08x\n", CS, cs, cpu_state.pc);
#if 0
banshee_log("Read status reg! %04x(%08x):%08x\n", CS, cs, cpu_state.pc);
#endif
break;
case 0xb0:
@@ -932,7 +980,7 @@ banshee_ext_in(uint16_t addr, void *p)
case 0xdd:
case 0xde:
case 0xdf:
ret = banshee_in((addr & 0xff) + 0x300, p);
ret = banshee_in((addr & 0xff) + 0x300, priv);
break;
default:
@@ -979,15 +1027,17 @@ banshee_status(banshee_t *banshee)
if (!voodoo->voodoo_busy)
voodoo_wake_fifo_thread(voodoo);
// banshee_log("banshee_status: busy %i %i (%i %i) %i %i %i %04x(%08x):%08x %08x\n", busy, written, voodoo->cmd_written, voodoo->cmd_written_fifo, voodoo->cmd_read, voodoo->cmdfifo_depth_rd, voodoo->cmdfifo_depth_wr, CS,cs,cpu_state.pc, ret);
#if 0
banshee_log("banshee_status: busy %i %i (%i %i) %i %i %i %04x(%08x):%08x %08x\n", busy, written, voodoo->cmd_written, voodoo->cmd_written_fifo, voodoo->cmd_read, voodoo->cmdfifo_depth_rd, voodoo->cmdfifo_depth_wr, CS,cs,cpu_state.pc, ret);
#endif
return ret;
}
static uint32_t
banshee_ext_inl(uint16_t addr, void *p)
banshee_ext_inl(uint16_t addr, void *priv)
{
banshee_t *banshee = (banshee_t *) p;
banshee_t *banshee = (banshee_t *) priv;
voodoo_t *voodoo = banshee->voodoo;
svga_t *svga = &banshee->svga;
uint32_t ret = 0xffffffff;
@@ -997,7 +1047,9 @@ banshee_ext_inl(uint16_t addr, void *p)
switch (addr & 0xff) {
case Init_status:
ret = banshee_status(banshee);
// banshee_log("Read status reg! %04x(%08x):%08x\n", CS, cs, cpu_state.pc);
#if 0
banshee_log("Read status reg! %04x(%08x):%08x\n", CS, cs, cpu_state.pc);
#endif
break;
case Init_pciInit0:
ret = banshee->pciInit0;
@@ -1090,7 +1142,9 @@ banshee_ext_inl(uint16_t addr, void *p)
if (i2c_gpio_get_sda(banshee->i2c))
ret |= VIDSERIAL_I2C_SDA_R;
}
// banshee_log("vidSerialParallelPort: read %08x %08x %04x(%08x):%08x\n", ret, ret & (VIDSERIAL_DDC_DCK_R | VIDSERIAL_DDC_DDA_R), CS,cs,cpu_state.pc);
#if 0
banshee_log("vidSerialParallelPort: read %08x %08x %04x(%08x):%08x\n", ret, ret & (VIDSERIAL_DDC_DCK_R | VIDSERIAL_DDC_DDA_R), CS,cs,cpu_state.pc);
#endif
break;
case Video_vidScreenSize:
@@ -1135,20 +1189,24 @@ banshee_ext_inl(uint16_t addr, void *p)
return ret;
}
static uint32_t banshee_reg_readl(uint32_t addr, void *p);
static uint32_t banshee_reg_readl(uint32_t addr, void *priv);
static uint8_t
banshee_reg_read(uint32_t addr, void *p)
banshee_reg_read(uint32_t addr, void *priv)
{
// banshee_log("banshee_reg_read: addr=%08x\n", addr);
return banshee_reg_readl(addr & ~3, p) >> (8 * (addr & 3));
#if 0
banshee_log("banshee_reg_read: addr=%08x\n", addr);
#endif
return banshee_reg_readl(addr & ~3, priv) >> (8 * (addr & 3));
}
static uint16_t
banshee_reg_readw(uint32_t addr, void *p)
banshee_reg_readw(uint32_t addr, void *priv)
{
// banshee_log("banshee_reg_readw: addr=%08x\n", addr);
return banshee_reg_readl(addr & ~3, p) >> (8 * (addr & 2));
#if 0
banshee_log("banshee_reg_readw: addr=%08x\n", addr);
#endif
return banshee_reg_readl(addr & ~3, priv) >> (8 * (addr & 2));
}
static uint32_t
@@ -1212,9 +1270,9 @@ banshee_cmd_read(banshee_t *banshee, uint32_t addr)
}
static uint32_t
banshee_reg_readl(uint32_t addr, void *p)
banshee_reg_readl(uint32_t addr, void *priv)
{
banshee_t *banshee = (banshee_t *) p;
banshee_t *banshee = (banshee_t *) priv;
voodoo_t *voodoo = banshee->voodoo;
uint32_t ret = 0xffffffff;
@@ -1372,7 +1430,7 @@ banshee_reg_readl(uint32_t addr, void *p)
}
static void
banshee_reg_write(uint32_t addr, uint8_t val, void *p)
banshee_reg_write(UNUSED(uint32_t addr), UNUSED(uint8_t val), UNUSED(void *priv))
{
#if 0
banshee_log("banshee_reg_writeb: addr=%08x val=%02x\n", addr, val);
@@ -1380,9 +1438,9 @@ banshee_reg_write(uint32_t addr, uint8_t val, void *p)
}
static void
banshee_reg_writew(uint32_t addr, uint16_t val, void *p)
banshee_reg_writew(uint32_t addr, uint16_t val, void *priv)
{
banshee_t *banshee = (banshee_t *) p;
banshee_t *banshee = (banshee_t *) priv;
voodoo_t *voodoo = banshee->voodoo;
cycles -= voodoo->write_time;
@@ -1498,9 +1556,9 @@ banshee_cmd_write(banshee_t *banshee, uint32_t addr, uint32_t val)
}
static void
banshee_reg_writel(uint32_t addr, uint32_t val, void *p)
banshee_reg_writel(uint32_t addr, uint32_t val, void *priv)
{
banshee_t *banshee = (banshee_t *) p;
banshee_t *banshee = (banshee_t *) priv;
voodoo_t *voodoo = banshee->voodoo;
if (addr == voodoo->last_write_addr + 4)
@@ -1625,9 +1683,9 @@ banshee_reg_writel(uint32_t addr, uint32_t val, void *p)
}
static uint8_t
banshee_read_linear(uint32_t addr, void *p)
banshee_read_linear(uint32_t addr, void *priv)
{
banshee_t *banshee = (banshee_t *) p;
banshee_t *banshee = (banshee_t *) priv;
voodoo_t *voodoo = banshee->voodoo;
svga_t *svga = &banshee->svga;
@@ -1663,14 +1721,14 @@ banshee_read_linear(uint32_t addr, void *p)
}
static uint16_t
banshee_read_linear_w(uint32_t addr, void *p)
banshee_read_linear_w(uint32_t addr, void *priv)
{
banshee_t *banshee = (banshee_t *) p;
banshee_t *banshee = (banshee_t *) priv;
voodoo_t *voodoo = banshee->voodoo;
svga_t *svga = &banshee->svga;
if (addr & 1)
return banshee_read_linear(addr, p) | (banshee_read_linear(addr + 1, p) << 8);
return banshee_read_linear(addr, priv) | (banshee_read_linear(addr + 1, priv) << 8);
cycles -= voodoo->read_time;
if ((banshee->pci_regs[0x30] & 0x01) && addr >= banshee->bios_rom.mapping.base && addr < (banshee->bios_rom.mapping.base + banshee->bios_rom.sz)) {
@@ -1703,14 +1761,14 @@ banshee_read_linear_w(uint32_t addr, void *p)
}
static uint32_t
banshee_read_linear_l(uint32_t addr, void *p)
banshee_read_linear_l(uint32_t addr, void *priv)
{
banshee_t *banshee = (banshee_t *) p;
banshee_t *banshee = (banshee_t *) priv;
voodoo_t *voodoo = banshee->voodoo;
svga_t *svga = &banshee->svga;
if (addr & 3)
return banshee_read_linear_w(addr, p) | (banshee_read_linear_w(addr + 2, p) << 16);
return banshee_read_linear_w(addr, priv) | (banshee_read_linear_w(addr + 2, priv) << 16);
cycles -= voodoo->read_time;
@@ -1744,9 +1802,9 @@ banshee_read_linear_l(uint32_t addr, void *p)
}
static void
banshee_write_linear(uint32_t addr, uint8_t val, void *p)
banshee_write_linear(uint32_t addr, uint8_t val, void *priv)
{
banshee_t *banshee = (banshee_t *) p;
banshee_t *banshee = (banshee_t *) priv;
voodoo_t *voodoo = banshee->voodoo;
svga_t *svga = &banshee->svga;
@@ -1779,15 +1837,15 @@ banshee_write_linear(uint32_t addr, uint8_t val, void *p)
}
static void
banshee_write_linear_w(uint32_t addr, uint16_t val, void *p)
banshee_write_linear_w(uint32_t addr, uint16_t val, void *priv)
{
banshee_t *banshee = (banshee_t *) p;
banshee_t *banshee = (banshee_t *) priv;
voodoo_t *voodoo = banshee->voodoo;
svga_t *svga = &banshee->svga;
if (addr & 1) {
banshee_write_linear(addr, val, p);
banshee_write_linear(addr + 1, val >> 8, p);
banshee_write_linear(addr, val, priv);
banshee_write_linear(addr + 1, val >> 8, priv);
return;
}
@@ -1819,16 +1877,16 @@ banshee_write_linear_w(uint32_t addr, uint16_t val, void *p)
}
static void
banshee_write_linear_l(uint32_t addr, uint32_t val, void *p)
banshee_write_linear_l(uint32_t addr, uint32_t val, void *priv)
{
banshee_t *banshee = (banshee_t *) p;
banshee_t *banshee = (banshee_t *) priv;
voodoo_t *voodoo = banshee->voodoo;
svga_t *svga = &banshee->svga;
int timing;
if (addr & 3) {
banshee_write_linear_w(addr, val, p);
banshee_write_linear_w(addr + 2, val >> 16, p);
banshee_write_linear_w(addr, val, priv);
banshee_write_linear_w(addr + 2, val >> 16, priv);
return;
}
@@ -2510,9 +2568,9 @@ banshee_overlay_draw(svga_t *svga, int displine)
}
void
banshee_set_overlay_addr(void *p, uint32_t addr)
banshee_set_overlay_addr(void *priv, UNUSED(uint32_t addr))
{
banshee_t *banshee = (banshee_t *) p;
banshee_t *banshee = (banshee_t *) priv;
voodoo_t *voodoo = banshee->voodoo;
banshee->svga.overlay.addr = banshee->voodoo->leftOverlayBuf & 0xfffffff;
@@ -2548,10 +2606,12 @@ banshee_vsync_callback(svga_t *svga)
}
static uint8_t
banshee_pci_read(int func, int addr, void *p)
banshee_pci_read(int func, int addr, void *priv)
{
banshee_t *banshee = (banshee_t *) p;
// svga_t *svga = &banshee->svga;
banshee_t *banshee = (banshee_t *) priv;
#if 0
svga_t *svga = &banshee->svga;
#endif
uint8_t ret = 0;
if (func)
@@ -2751,9 +2811,9 @@ banshee_pci_read(int func, int addr, void *p)
}
static void
banshee_pci_write(int func, int addr, uint8_t val, void *p)
banshee_pci_write(int func, int addr, uint8_t val, void *priv)
{
banshee_t *banshee = (banshee_t *) p;
banshee_t *banshee = (banshee_t *) priv;
#if 0
svga_t *svga = &banshee->svga;
#endif
@@ -3357,9 +3417,9 @@ velocity_200_available(void)
}
static void
banshee_close(void *p)
banshee_close(void *priv)
{
banshee_t *banshee = (banshee_t *) p;
banshee_t *banshee = (banshee_t *) priv;
voodoo_card_close(banshee->voodoo);
svga_close(&banshee->svga);
@@ -3371,17 +3431,17 @@ banshee_close(void *p)
}
static void
banshee_speed_changed(void *p)
banshee_speed_changed(void *priv)
{
banshee_t *banshee = (banshee_t *) p;
banshee_t *banshee = (banshee_t *) priv;
svga_recalctimings(&banshee->svga);
}
static void
banshee_force_redraw(void *p)
banshee_force_redraw(void *priv)
{
banshee_t *banshee = (banshee_t *) p;
banshee_t *banshee = (banshee_t *) priv;
banshee->svga.fullchange = changeframecount;
}

View File

@@ -207,7 +207,7 @@ get_addr(voodoo_t *voodoo, int x, int y, int src_notdst, uint32_t src_stride)
}
static void
PLOT(voodoo_t *voodoo, int x, int y, int pat_x, int pat_y, uint8_t pattern_mask, uint8_t rop, uint32_t src, int src_colorkey)
PLOT(voodoo_t *voodoo, int x, int y, int pat_x, int pat_y, uint8_t pattern_mask, UNUSED(uint8_t rop), uint32_t src, int src_colorkey)
{
switch (voodoo->banshee_blt.dstFormat & DST_FORMAT_COL_MASK) {
case DST_FORMAT_COL_8_BPP:
@@ -254,7 +254,7 @@ PLOT(voodoo_t *voodoo, int x, int y, int pat_x, int pat_y, uint8_t pattern_mask,
}
static void
PLOT_LINE(voodoo_t *voodoo, int x, int y, uint8_t rop, uint32_t pattern, int src_colorkey)
PLOT_LINE(voodoo_t *voodoo, int x, int y, UNUSED(uint8_t rop), uint32_t pattern, int src_colorkey)
{
switch (voodoo->banshee_blt.dstFormat & DST_FORMAT_COL_MASK) {
case DST_FORMAT_COL_8_BPP:
@@ -984,7 +984,7 @@ banshee_do_screen_to_screen_stretch_blt(voodoo_t *voodoo)
}
static void
banshee_do_host_to_screen_stretch_blt(voodoo_t *voodoo, int count, uint32_t data)
banshee_do_host_to_screen_stretch_blt(voodoo_t *voodoo, UNUSED(int count), uint32_t data)
{
#if 0
if (voodoo->banshee_blt.dstBaseAddr == 0xee5194)

View File

@@ -166,8 +166,10 @@ voodoo_v2_blit_start(voodoo_t *voodoo)
int x;
int y;
/* voodooblt_log("blit_start: command=%08x srcX=%i srcY=%i dstX=%i dstY=%i sizeX=%i sizeY=%i color=%04x,%04x\n",
voodoo->bltCommand, voodoo->bltSrcX, voodoo->bltSrcY, voodoo->bltDstX, voodoo->bltDstY, voodoo->bltSizeX, voodoo->bltSizeY, voodoo->bltColorFg, voodoo->bltColorBg);*/
#if 0
voodooblt_log("blit_start: command=%08x srcX=%i srcY=%i dstX=%i dstY=%i sizeX=%i sizeY=%i color=%04x,%04x\n",
voodoo->bltCommand, voodoo->bltSrcX, voodoo->bltSrcY, voodoo->bltDstX, voodoo->bltDstY, voodoo->bltSizeX, voodoo->bltSizeY, voodoo->bltColorFg, voodoo->bltColorBg);
#endif
voodoo_wait_for_render_thread_idle(voodoo);

View File

@@ -141,10 +141,11 @@ voodoo_calc_clutData(voodoo_t *voodoo)
int r = (c >> 8) & 0xf8;
int g = (c >> 3) & 0xfc;
int b = (c << 3) & 0xf8;
// r |= (r >> 5);
// g |= (g >> 6);
// b |= (b >> 5);
#if 0
r |= (r >> 5);
g |= (g >> 6);
b |= (b >> 5);
#endif
voodoo->video_16to32[c] = (voodoo->clutData256[r].r << 16) | (voodoo->clutData256[g].g << 8) | voodoo->clutData256[b].b;
}
}
@@ -442,7 +443,7 @@ voodoo_filterline_v1(voodoo_t *voodoo, uint8_t *fil, int column, uint16_t *src,
}
static void
voodoo_filterline_v2(voodoo_t *voodoo, uint8_t *fil, int column, uint16_t *src, int line)
voodoo_filterline_v2(voodoo_t *voodoo, uint8_t *fil, int column, uint16_t *src, UNUSED(int line))
{
int x;
@@ -506,9 +507,9 @@ voodoo_filterline_v2(voodoo_t *voodoo, uint8_t *fil, int column, uint16_t *src,
}
void
voodoo_callback(void *p)
voodoo_callback(void *priv)
{
voodoo_t *voodoo = (voodoo_t *) p;
voodoo_t *voodoo = (voodoo_t *) priv;
monitor_t *monitor = &monitors[voodoo->monitor_index];
if (voodoo->fbiInit0 & FBIINIT0_VGA_PASS) {
@@ -576,7 +577,9 @@ voodoo_callback(void *p)
}
skip_draw:
if (voodoo->line == voodoo->v_disp) {
// voodoodisp_log("retrace %i %i %08x %i\n", voodoo->retrace_count, voodoo->swap_interval, voodoo->swap_offset, voodoo->swap_pending);
#if 0
voodoodisp_log("retrace %i %i %08x %i\n", voodoo->retrace_count, voodoo->swap_interval, voodoo->swap_offset, voodoo->swap_pending);
#endif
voodoo->retrace_count++;
if (SLI_ENABLED && (voodoo->fbiInit2 & FBIINIT2_SWAP_ALGORITHM_MASK) == FBIINIT2_SWAP_ALGORITHM_SLI_SYNC) {
if (voodoo == voodoo->set->voodoos[0]) {

View File

@@ -59,9 +59,9 @@ voodoo_fb_log(const char *fmt, ...)
#endif
uint16_t
voodoo_fb_readw(uint32_t addr, void *p)
voodoo_fb_readw(uint32_t addr, void *priv)
{
voodoo_t *voodoo = (voodoo_t *) p;
voodoo_t *voodoo = (voodoo_t *) priv;
int x;
int y;
uint32_t read_addr;
@@ -100,9 +100,9 @@ voodoo_fb_readw(uint32_t addr, void *p)
return temp;
}
uint32_t
voodoo_fb_readl(uint32_t addr, void *p)
voodoo_fb_readl(uint32_t addr, void *priv)
{
voodoo_t *voodoo = (voodoo_t *) p;
voodoo_t *voodoo = (voodoo_t *) priv;
int x;
int y;
uint32_t read_addr;
@@ -168,9 +168,9 @@ do_dither(voodoo_params_t *params, rgba8_t col, int x, int y)
}
void
voodoo_fb_writew(uint32_t addr, uint16_t val, void *p)
voodoo_fb_writew(uint32_t addr, uint16_t val, void *priv)
{
voodoo_t *voodoo = (voodoo_t *) p;
voodoo_t *voodoo = (voodoo_t *) priv;
voodoo_params_t *params = &voodoo->params;
int x;
int y;
@@ -186,10 +186,14 @@ voodoo_fb_writew(uint32_t addr, uint16_t val, void *p)
depth_data = voodoo->params.zaColor & 0xffff;
alpha_data = voodoo->params.zaColor >> 24;
// while (!RB_EMPTY)
// thread_reset_event(voodoo->not_full_event);
#if 0
while (!RB_EMPTY)
thread_reset_event(voodoo->not_full_event);
#endif
// voodoo_fb_log("voodoo_fb_writew : %08X %04X\n", addr, val);
#if 0
voodoo_fb_log("voodoo_fb_writew : %08X %04X\n", addr, val);
#endif
switch (voodoo->lfbMode & LFB_FORMAT_MASK) {
case LFB_FORMAT_RGB565:
@@ -304,9 +308,9 @@ skip_pixel:
}
void
voodoo_fb_writel(uint32_t addr, uint32_t val, void *p)
voodoo_fb_writel(uint32_t addr, uint32_t val, void *priv)
{
voodoo_t *voodoo = (voodoo_t *) p;
voodoo_t *voodoo = (voodoo_t *) priv;
voodoo_params_t *params = &voodoo->params;
int x;
int y;
@@ -320,10 +324,14 @@ voodoo_fb_writel(uint32_t addr, uint32_t val, void *p)
depth_data[0] = depth_data[1] = voodoo->params.zaColor & 0xffff;
alpha_data[0] = alpha_data[1] = voodoo->params.zaColor >> 24;
// while (!RB_EMPTY)
// thread_reset_event(voodoo->not_full_event);
#if 0
while (!RB_EMPTY)
thread_reset_event(voodoo->not_full_event);
#endif
// voodoo_fb_log("voodoo_fb_writel : %08X %08X\n", addr, val);
#if 0
voodoo_fb_log("voodoo_fb_writel : %08X %08X\n", addr, val);
#endif
switch (voodoo->lfbMode & LFB_FORMAT_MASK) {
case LFB_FORMAT_RGB565:
@@ -393,12 +401,12 @@ voodoo_fb_writel(uint32_t addr, uint32_t val, void *p)
else
write_addr_aux = voodoo->params.aux_offset + x + (y * voodoo->row_width);
// voodoo_fb_log("fb_writel %08x x=%i y=%i rw=%i %08x wo=%08x\n", addr, x, y, voodoo->row_width, write_addr, voodoo->fb_write_offset);
#if 0
voodoo_fb_log("fb_writel %08x x=%i y=%i rw=%i %08x wo=%08x\n", addr, x, y, voodoo->row_width, write_addr, voodoo->fb_write_offset);
#endif
if (voodoo->lfbMode & 0x100) {
int c;
for (c = 0; c < count; c++) {
for (int c = 0; c < count; c++) {
rgba8_t write_data = colour_data[c];
uint16_t new_depth = depth_data[c];

View File

@@ -81,9 +81,9 @@ voodoo_wake_fifo_thread_now(voodoo_t *voodoo)
}
void
voodoo_wake_timer(void *p)
voodoo_wake_timer(void *priv)
{
voodoo_t *voodoo = (voodoo_t *) p;
voodoo_t *voodoo = (voodoo_t *) priv;
thread_set_event(voodoo->wake_fifo_thread); /*Wake up FIFO thread if moving from idle*/
}
@@ -295,21 +295,27 @@ voodoo_fifo_thread(void *param)
int num_verticies;
int v_num;
// voodoo_fifo_log(" CMDFIFO header %08x at %08x\n", header, voodoo->cmdfifo_rp);
#if 0
voodoo_fifo_log(" CMDFIFO header %08x at %08x\n", header, voodoo->cmdfifo_rp);
#endif
voodoo->cmd_status &= ~7;
voodoo->cmd_status |= (header & 7);
voodoo->cmd_status |= (1 << 11);
switch (header & 7) {
case 0:
// voodoo_fifo_log("CMDFIFO0\n");
#if 0
voodoo_fifo_log("CMDFIFO0\n");
#endif
voodoo->cmd_status = (voodoo->cmd_status & 0xffff8fff) | (((header >> 3) & 7) << 12);
switch ((header >> 3) & 7) {
case 0: /*NOP*/
break;
case 1: /*JSR*/
// voodoo_fifo_log("JSR %08x\n", (header >> 4) & 0xfffffc);
#if 0
voodoo_fifo_log("JSR %08x\n", (header >> 4) & 0xfffffc);
#endif
voodoo->cmdfifo_ret_addr = voodoo->cmdfifo_rp;
voodoo->cmdfifo_rp = (header >> 4) & 0xfffffc;
voodoo->cmdfifo_in_sub = 1;
@@ -322,7 +328,9 @@ voodoo_fifo_thread(void *param)
case 3: /*JMP local frame buffer*/
voodoo->cmdfifo_rp = (header >> 4) & 0xfffffc;
// voodoo_fifo_log("JMP to %08x %04x\n", voodoo->cmdfifo_rp, header);
#if 0
voodoo_fifo_log("JMP to %08x %04x\n", voodoo->cmdfifo_rp, header);
#endif
break;
default:
@@ -334,13 +342,20 @@ voodoo_fifo_thread(void *param)
case 1:
num = header >> 16;
addr = (header & 0x7ff8) >> 1;
// voodoo_fifo_log("CMDFIFO1 addr=%08x\n",addr);
#if 0
voodoo_fifo_log("CMDFIFO1 addr=%08x\n",addr);
#endif
while (num--) {
uint32_t val = cmdfifo_get(voodoo);
if ((addr & (1 << 13)) && voodoo->type >= VOODOO_BANSHEE) {
// if (voodoo->type != VOODOO_BANSHEE)
// fatal("CMDFIFO1: Not Banshee\n");
// voodoo_fifo_log("CMDFIFO1: write %08x %08x\n", addr, val);
#if 0
if (voodoo->type != VOODOO_BANSHEE)
fatal("CMDFIFO1: Not Banshee\n");
#endif
#if 0
voodoo_fifo_log("CMDFIFO1: write %08x %08x\n", addr, val);
#endif
voodoo_2d_reg_writel(voodoo, addr, val);
} else {
if ((addr & 0x3ff) == SST_triangleCMD || (addr & 0x3ff) == SST_ftriangleCMD || (addr & 0x3ff) == SST_fastfillCMD || (addr & 0x3ff) == SST_nopCMD)
@@ -382,8 +397,10 @@ voodoo_fifo_thread(void *param)
v_num = 0;
if (((header >> 3) & 7) == 2)
v_num = 1;
// voodoo_fifo_log("CMDFIFO3: num=%i verts=%i mask=%02x\n", num, num_verticies, (header >> 10) & 0xff);
// voodoo_fifo_log("CMDFIFO3 %02x %i\n", (header >> 10), (header >> 3) & 7);
#if 0
voodoo_fifo_log("CMDFIFO3: num=%i verts=%i mask=%02x\n", num, num_verticies, (header >> 10) & 0xff);
voodoo_fifo_log("CMDFIFO3 %02x %i\n", (header >> 10), (header >> 3) & 7);
#endif
while (num_verticies--) {
voodoo->verts[3].sVx = cmdfifo_get_f(voodoo);
@@ -435,7 +452,9 @@ voodoo_fifo_thread(void *param)
num = (header >> 29) & 7;
mask = (header >> 15) & 0x3fff;
addr = (header & 0x7ff8) >> 1;
// voodoo_fifo_log("CMDFIFO4 addr=%08x\n",addr);
#if 0
voodoo_fifo_log("CMDFIFO4 addr=%08x\n",addr);
#endif
while (mask) {
if (mask & 1) {
uint32_t val = cmdfifo_get(voodoo);
@@ -443,7 +462,10 @@ voodoo_fifo_thread(void *param)
if ((addr & (1 << 13)) && voodoo->type >= VOODOO_BANSHEE) {
if (voodoo->type < VOODOO_BANSHEE)
fatal("CMDFIFO1: Not Banshee\n");
// voodoo_fifo_log("CMDFIFO1: write %08x %08x\n", addr, val);
#if 0
voodoo_fifo_log("CMDFIFO1: write %08x %08x\n", addr, val);
#endif
voodoo_2d_reg_writel(voodoo, addr, val);
} else {
if ((addr & 0x3ff) == SST_triangleCMD || (addr & 0x3ff) == SST_ftriangleCMD || (addr & 0x3ff) == SST_fastfillCMD || (addr & 0x3ff) == SST_nopCMD)
@@ -463,22 +485,30 @@ voodoo_fifo_thread(void *param)
break;
case 5:
// if (header & 0x3fc00000)
// fatal("CMDFIFO packet 5 has byte disables set %08x\n", header);
#if 0
if (header & 0x3fc00000)
fatal("CMDFIFO packet 5 has byte disables set %08x\n", header);
#endif
num = (header >> 3) & 0x7ffff;
addr = cmdfifo_get(voodoo) & 0xffffff;
if (!num)
num = 1;
// voodoo_fifo_log("CMDFIFO5 addr=%08x num=%i\n", addr, num);
#if 0
voodoo_fifo_log("CMDFIFO5 addr=%08x num=%i\n", addr, num);
#endif
switch (header >> 30) {
case 0: /*Linear framebuffer (Banshee)*/
case 1: /*Planar YUV*/
if (voodoo->texture_present[0][(addr & voodoo->texture_mask) >> TEX_DIRTY_SHIFT]) {
// voodoo_fifo_log("texture_present at %08x %i\n", addr, (addr & voodoo->texture_mask) >> TEX_DIRTY_SHIFT);
#if 0
voodoo_fifo_log("texture_present at %08x %i\n", addr, (addr & voodoo->texture_mask) >> TEX_DIRTY_SHIFT);
#endif
flush_texture_cache(voodoo, addr & voodoo->texture_mask, 0);
}
if (voodoo->texture_present[1][(addr & voodoo->texture_mask) >> TEX_DIRTY_SHIFT]) {
// voodoo_fifo_log("texture_present at %08x %i\n", addr, (addr & voodoo->texture_mask) >> TEX_DIRTY_SHIFT);
#if 0
voodoo_fifo_log("texture_present at %08x %i\n", addr, (addr & voodoo->texture_mask) >> TEX_DIRTY_SHIFT);
#endif
flush_texture_cache(voodoo, addr & voodoo->texture_mask, 1);
}
while (num--) {

View File

@@ -70,9 +70,9 @@ voodoo_reg_log(const char *fmt, ...)
#endif
void
voodoo_reg_writel(uint32_t addr, uint32_t val, void *p)
voodoo_reg_writel(uint32_t addr, uint32_t val, void *priv)
{
voodoo_t *voodoo = (voodoo_t *) p;
voodoo_t *voodoo = (voodoo_t *) priv;
void (*voodoo_recalc_tex)(voodoo_t * voodoo, int tmu) = NULL;
union {
uint32_t i;
@@ -89,7 +89,9 @@ voodoo_reg_writel(uint32_t addr, uint32_t val, void *p)
voodoo_recalc_tex = voodoo_recalc_tex12;
tempif.i = val;
// voodoo_reg_log("voodoo_reg_write_l: addr=%08x val=%08x(%f) chip=%x\n", addr, val, tempif.f, chip);
#if 0
voodoo_reg_log("voodoo_reg_write_l: addr=%08x val=%08x(%f) chip=%x\n", addr, val, tempif.f, chip);
#endif
addr &= 0x3fc;
if ((voodoo->fbiInit3 & FBIINIT3_REMAP) && addr < 0x100 && ad21)
@@ -97,7 +99,9 @@ voodoo_reg_writel(uint32_t addr, uint32_t val, void *p)
switch (addr) {
case SST_swapbufferCMD:
if (voodoo->type >= VOODOO_BANSHEE) {
// voodoo_reg_log("swapbufferCMD %08x %08x\n", val, voodoo->leftOverlayBuf);
#if 0
voodoo_reg_log("swapbufferCMD %08x %08x\n", val, voodoo->leftOverlayBuf);
#endif
voodoo_wait_for_render_thread_idle(voodoo);
if (!(val & 1)) {
@@ -136,8 +140,10 @@ voodoo_reg_writel(uint32_t addr, uint32_t val, void *p)
voodoo->params.swapbufferCMD = val;
// voodoo_reg_log("Swap buffer %08x %d %p %i\n", val, voodoo->swap_count, &voodoo->swap_count, (voodoo == voodoo->set->voodoos[1]) ? 1 : 0);
// voodoo->front_offset = params->front_offset;
#if 0
voodoo_reg_log("Swap buffer %08x %d %p %i\n", val, voodoo->swap_count, &voodoo->swap_count, (voodoo == voodoo->set->voodoos[1]) ? 1 : 0);
voodoo->front_offset = params->front_offset;
#endif
voodoo_wait_for_render_thread_idle(voodoo);
if (!(val & 1)) {
memset(voodoo->dirty_line, 1, sizeof(voodoo->dirty_line));
@@ -670,7 +676,9 @@ voodoo_reg_writel(uint32_t addr, uint32_t val, void *p)
if (voodoo->type >= VOODOO_BANSHEE) {
voodoo->params.draw_offset = val & 0xfffff0;
voodoo->fb_write_offset = voodoo->params.draw_offset;
// voodoo_reg_log("colorBufferAddr=%06x\n", voodoo->params.draw_offset);
#if 0
voodoo_reg_log("colorBufferAddr=%06x\n", voodoo->params.draw_offset);
#endif
}
break;
case SST_colBufferStride:
@@ -679,10 +687,14 @@ voodoo_reg_writel(uint32_t addr, uint32_t val, void *p)
voodoo->params.col_tiled = voodoo->col_tiled;
if (voodoo->col_tiled) {
voodoo->row_width = (val & 0x7f) * 128 * 32;
// voodoo_reg_log("colBufferStride tiled = %i bytes, tiled %08x\n", voodoo->row_width, val);
#if 0
voodoo_reg_log("colBufferStride tiled = %i bytes, tiled %08x\n", voodoo->row_width, val);
#endif
} else {
voodoo->row_width = val & 0x3fff;
// voodoo_reg_log("colBufferStride linear = %i bytes, linear\n", voodoo->row_width);
#if 0
voodoo_reg_log("colBufferStride linear = %i bytes, linear\n", voodoo->row_width);
#endif
}
voodoo->params.row_width = voodoo->row_width;
}
@@ -690,7 +702,9 @@ voodoo_reg_writel(uint32_t addr, uint32_t val, void *p)
case SST_auxBufferAddr:
if (voodoo->type >= VOODOO_BANSHEE) {
voodoo->params.aux_offset = val & 0xfffff0;
// pclog("auxBufferAddr=%06x\n", voodoo->params.aux_offset);
#if 0
pclog("auxBufferAddr=%06x\n", voodoo->params.aux_offset);
#endif
}
break;
case SST_auxBufferStride:
@@ -699,10 +713,14 @@ voodoo_reg_writel(uint32_t addr, uint32_t val, void *p)
voodoo->params.aux_tiled = voodoo->aux_tiled;
if (voodoo->aux_tiled) {
voodoo->aux_row_width = (val & 0x7f) * 128 * 32;
// voodoo_reg_log("auxBufferStride tiled = %i bytes, tiled\n", voodoo->aux_row_width);
#if 0
voodoo_reg_log("auxBufferStride tiled = %i bytes, tiled\n", voodoo->aux_row_width);
#endif
} else {
voodoo->aux_row_width = val & 0x3fff;
// voodoo_reg_log("auxBufferStride linear = %i bytes, linear\n", voodoo->aux_row_width);
#if 0
voodoo_reg_log("auxBufferStride linear = %i bytes, linear\n", voodoo->aux_row_width);
#endif
}
voodoo->params.aux_row_width = voodoo->aux_row_width;
}
@@ -726,12 +744,16 @@ voodoo_reg_writel(uint32_t addr, uint32_t val, void *p)
case SST_sVx:
tempif.i = val;
voodoo->verts[3].sVx = tempif.f;
// voodoo_reg_log("sVx[%i]=%f\n", voodoo->vertex_num, tempif.f);
#if 0
voodoo_reg_log("sVx[%i]=%f\n", voodoo->vertex_num, tempif.f);
#endif
break;
case SST_sVy:
tempif.i = val;
voodoo->verts[3].sVy = tempif.f;
// voodoo_reg_log("sVy[%i]=%f\n", voodoo->vertex_num, tempif.f);
#if 0
voodoo_reg_log("sVy[%i]=%f\n", voodoo->vertex_num, tempif.f);
#endif
break;
case SST_sARGB:
voodoo->verts[3].sBlue = (float) (val & 0xff);
@@ -789,7 +811,9 @@ voodoo_reg_writel(uint32_t addr, uint32_t val, void *p)
break;
case SST_sBeginTriCMD:
// voodoo_reg_log("sBeginTriCMD %i %f\n", voodoo->vertex_num, voodoo->verts[4].sVx);
#if 0
voodoo_reg_log("sBeginTriCMD %i %f\n", voodoo->vertex_num, voodoo->verts[4].sVx);
#endif
voodoo->verts[0] = voodoo->verts[3];
voodoo->verts[1] = voodoo->verts[3];
voodoo->verts[2] = voodoo->verts[3];
@@ -800,7 +824,9 @@ voodoo_reg_writel(uint32_t addr, uint32_t val, void *p)
voodoo->cull_pingpong = 0;
break;
case SST_sDrawTriCMD:
// voodoo_reg_log("sDrawTriCMD %i %i\n", voodoo->num_verticies, voodoo->sSetupMode & SETUPMODE_STRIP_MODE);
#if 0
voodoo_reg_log("sDrawTriCMD %i %i\n", voodoo->num_verticies, voodoo->sSetupMode & SETUPMODE_STRIP_MODE);
#endif
/*I'm not sure this is the vertex selection algorithm actually used in the 3dfx
chips, but this works with a number of games that switch between strip and fan
mode in the middle of a run (eg Black & White, Viper Racing)*/
@@ -840,7 +866,9 @@ voodoo_reg_writel(uint32_t addr, uint32_t val, void *p)
voodoo->num_verticies++;
if (voodoo->num_verticies == 3) {
// voodoo_reg_log("triangle_setup\n");
#if 0
voodoo_reg_log("triangle_setup\n");
#endif
voodoo_triangle_setup(voodoo);
voodoo->cull_pingpong = !voodoo->cull_pingpong;
@@ -852,7 +880,9 @@ voodoo_reg_writel(uint32_t addr, uint32_t val, void *p)
voodoo->bltSrcBaseAddr = val & 0x3fffff;
break;
case SST_bltDstBaseAddr:
// voodoo_reg_log("Write bltDstBaseAddr %08x\n", val);
#if 0
voodoo_reg_log("Write bltDstBaseAddr %08x\n", val);
#endif
voodoo->bltDstBaseAddr = val & 0x3fffff;
break;
case SST_bltXYStrides:
@@ -969,7 +999,9 @@ voodoo_reg_writel(uint32_t addr, uint32_t val, void *p)
voodoo->params.texBaseAddr[0] = val & 0xfffff0;
else
voodoo->params.texBaseAddr[0] = (val & 0x7ffff) << 3;
// voodoo_reg_log("texBaseAddr = %08x %08x\n", voodoo->params.texBaseAddr[0], val);
#if 0
voodoo_reg_log("texBaseAddr = %08x %08x\n", voodoo->params.texBaseAddr[0], val);
#endif
voodoo_recalc_tex(voodoo, 0);
}
if (chip & CHIP_TREX1) {

View File

@@ -178,7 +178,9 @@ voodoo_fls(uint16_t val)
{
int num = 0;
// voodoo_render_log("fls(%04x) = ", val);
#if 0
voodoo_render_log("fls(%04x) = ", val);
#endif
if (!(val & 0xff00)) {
num += 8;
val <<= 8;
@@ -195,7 +197,9 @@ voodoo_fls(uint16_t val)
num += 1;
val <<= 1;
}
// voodoo_render_log("%i %04x\n", num, val);
#if 0
voodoo_render_log("%i %04x\n", num, val);
#endif
return num;
}
@@ -241,7 +245,7 @@ tex_read(voodoo_state_t *state, voodoo_texture_state_t *texture_state, int tmu)
#define HIGH4(x) ((x & 0xf0) | ((x & 0xf0) >> 4))
static inline void
tex_read_4(voodoo_state_t *state, voodoo_texture_state_t *texture_state, int s, int t, int *d, int tmu, int x)
tex_read_4(voodoo_state_t *state, voodoo_texture_state_t *texture_state, int s, int t, int *d, int tmu, UNUSED(int x))
{
rgba_u dat[4];
@@ -320,36 +324,44 @@ voodoo_get_texture(voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t *st
s >>= 4;
t >>= 4;
// if (x == 80)
// if (voodoo_output)
// voodoo_render_log("s=%08x t=%08x _ds=%02x _dt=%02x\n", s, t, _ds, dt);
#if 0
if (x == 80)
if (voodoo_output)
voodoo_render_log("s=%08x t=%08x _ds=%02x _dt=%02x\n", s, t, _ds, dt);
#endif
d[0] = (16 - _ds) * (16 - dt);
d[1] = _ds * (16 - dt);
d[2] = (16 - _ds) * dt;
d[3] = _ds * dt;
// texture_state.s = s;
// texture_state.t = t;
#if 0
texture_state.s = s;
texture_state.t = t;
#endif
tex_read_4(state, &texture_state, s, t, d, tmu, x);
/* state->tex_r = (tex_samples[0].rgba.r * d[0] + tex_samples[1].rgba.r * d[1] + tex_samples[2].rgba.r * d[2] + tex_samples[3].rgba.r * d[3]) >> 8;
state->tex_g = (tex_samples[0].rgba.g * d[0] + tex_samples[1].rgba.g * d[1] + tex_samples[2].rgba.g * d[2] + tex_samples[3].rgba.g * d[3]) >> 8;
state->tex_b = (tex_samples[0].rgba.b * d[0] + tex_samples[1].rgba.b * d[1] + tex_samples[2].rgba.b * d[2] + tex_samples[3].rgba.b * d[3]) >> 8;
state->tex_a = (tex_samples[0].rgba.a * d[0] + tex_samples[1].rgba.a * d[1] + tex_samples[2].rgba.a * d[2] + tex_samples[3].rgba.a * d[3]) >> 8;*/
/* state->tex_r = tex_samples[0].r;
state->tex_g = tex_samples[0].g;
state->tex_b = tex_samples[0].b;
state->tex_a = tex_samples[0].a;*/
#if 0
state->tex_r = (tex_samples[0].rgba.r * d[0] + tex_samples[1].rgba.r * d[1] + tex_samples[2].rgba.r * d[2] + tex_samples[3].rgba.r * d[3]) >> 8;
state->tex_g = (tex_samples[0].rgba.g * d[0] + tex_samples[1].rgba.g * d[1] + tex_samples[2].rgba.g * d[2] + tex_samples[3].rgba.g * d[3]) >> 8;
state->tex_b = (tex_samples[0].rgba.b * d[0] + tex_samples[1].rgba.b * d[1] + tex_samples[2].rgba.b * d[2] + tex_samples[3].rgba.b * d[3]) >> 8;
state->tex_a = (tex_samples[0].rgba.a * d[0] + tex_samples[1].rgba.a * d[1] + tex_samples[2].rgba.a * d[2] + tex_samples[3].rgba.a * d[3]) >> 8;*/
#endif
#if 0
state->tex_r = tex_samples[0].r;
state->tex_g = tex_samples[0].g;
state->tex_b = tex_samples[0].b;
state->tex_a = tex_samples[0].a;
#endif
} else {
// rgba_t tex_samples;
// voodoo_texture_state_t texture_state;
// int s = state->tex_s >> (18+state->lod);
// int t = state->tex_t >> (18+state->lod);
// int s, t;
// state->tex_s -= 1 << (17+state->lod);
// state->tex_t -= 1 << (17+state->lod);
#if 0
rgba_t tex_samples;
voodoo_texture_state_t texture_state;
int s = state->tex_s >> (18+state->lod);
int t = state->tex_t >> (18+state->lod);
state->tex_s -= 1 << (17+state->lod);
state->tex_t -= 1 << (17+state->lod);
#endif
s = state->tex_s >> (4 + tex_lod);
t = state->tex_t >> (4 + tex_lod);
@@ -357,10 +369,12 @@ voodoo_get_texture(voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t *st
texture_state.t = t;
tex_read(state, &texture_state, tmu);
/* state->tex_r = tex_samples[0].rgba.r;
state->tex_g = tex_samples[0].rgba.g;
state->tex_b = tex_samples[0].rgba.b;
state->tex_a = tex_samples[0].rgba.a;*/
#if 0
state->tex_r = tex_samples[0].rgba.r;
state->tex_g = tex_samples[0].rgba.g;
state->tex_b = tex_samples[0].rgba.b;
state->tex_a = tex_samples[0].rgba.a;
#endif
}
}
@@ -432,8 +446,10 @@ voodoo_tmu_fetch_and_blend(voodoo_t *voodoo, voodoo_params_t *params, voodoo_sta
c_reverse = !tc_reverse_blend;
a_reverse = !tca_reverse_blend;
}
/* c_reverse1 = c_reverse;
a_reverse1 = a_reverse;*/
#if 0
c_reverse1 = c_reverse;
a_reverse1 = a_reverse;
#endif
if (tc_sub_clocal_1) {
switch (tc_mselect_1) {
case TC_MSELECT_ZERO:
@@ -639,30 +655,32 @@ int voodoo_recomp = 0;
static void
voodoo_half_triangle(voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t *state, int ystart, int yend, int odd_even)
{
/* int rgb_sel = params->fbzColorPath & 3;
int a_sel = (params->fbzColorPath >> 2) & 3;
int cc_localselect = params->fbzColorPath & (1 << 4);
int cca_localselect = (params->fbzColorPath >> 5) & 3;
int cc_localselect_override = params->fbzColorPath & (1 << 7);
int cc_zero_other = params->fbzColorPath & (1 << 8);
int cc_sub_clocal = params->fbzColorPath & (1 << 9);
int cc_mselect = (params->fbzColorPath >> 10) & 7;
int cc_reverse_blend = params->fbzColorPath & (1 << 13);
int cc_add = (params->fbzColorPath >> 14) & 3;
int cc_add_alocal = params->fbzColorPath & (1 << 15);
int cc_invert_output = params->fbzColorPath & (1 << 16);
int cca_zero_other = params->fbzColorPath & (1 << 17);
int cca_sub_clocal = params->fbzColorPath & (1 << 18);
int cca_mselect = (params->fbzColorPath >> 19) & 7;
int cca_reverse_blend = params->fbzColorPath & (1 << 22);
int cca_add = (params->fbzColorPath >> 23) & 3;
int cca_invert_output = params->fbzColorPath & (1 << 25);
int src_afunc = (params->alphaMode >> 8) & 0xf;
int dest_afunc = (params->alphaMode >> 12) & 0xf;
int alpha_func = (params->alphaMode >> 1) & 7;
int a_ref = params->alphaMode >> 24;
int depth_op = (params->fbzMode >> 5) & 7;
int dither = params->fbzMode & FBZ_DITHER;*/
#if 0
int rgb_sel = params->fbzColorPath & 3;
int a_sel = (params->fbzColorPath >> 2) & 3;
int cc_localselect = params->fbzColorPath & (1 << 4);
int cca_localselect = (params->fbzColorPath >> 5) & 3;
int cc_localselect_override = params->fbzColorPath & (1 << 7);
int cc_zero_other = params->fbzColorPath & (1 << 8);
int cc_sub_clocal = params->fbzColorPath & (1 << 9);
int cc_mselect = (params->fbzColorPath >> 10) & 7;
int cc_reverse_blend = params->fbzColorPath & (1 << 13);
int cc_add = (params->fbzColorPath >> 14) & 3;
int cc_add_alocal = params->fbzColorPath & (1 << 15);
int cc_invert_output = params->fbzColorPath & (1 << 16);
int cca_zero_other = params->fbzColorPath & (1 << 17);
int cca_sub_clocal = params->fbzColorPath & (1 << 18);
int cca_mselect = (params->fbzColorPath >> 19) & 7;
int cca_reverse_blend = params->fbzColorPath & (1 << 22);
int cca_add = (params->fbzColorPath >> 23) & 3;
int cca_invert_output = params->fbzColorPath & (1 << 25);
int src_afunc = (params->alphaMode >> 8) & 0xf;
int dest_afunc = (params->alphaMode >> 12) & 0xf;
int alpha_func = (params->alphaMode >> 1) & 7;
int a_ref = params->alphaMode >> 24;
int depth_op = (params->fbzMode >> 5) & 7;
int dither = params->fbzMode & FBZ_DITHER;*/
#endif
int texels;
#ifndef NO_CODEGEN
uint8_t (*voodoo_draw)(voodoo_state_t * state, voodoo_params_t * params, int x, int real_y);
@@ -723,7 +741,9 @@ voodoo_half_triangle(voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t *
yend = params->clipHighY;
state->y = ystart;
// yend--;
#if 0
yend--;
#endif
if (SLI_ENABLED) {
int test_y;
@@ -760,7 +780,9 @@ voodoo_half_triangle(voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t *
#endif
voodoo_render_log("dxAB=%08x dxBC=%08x dxAC=%08x\n", state->dxAB, state->dxBC, state->dxAC);
// voodoo_render_log("Start %i %i\n", ystart, voodoo->fbzMode & (1 << 17));
#if 0
voodoo_render_log("Start %i %i\n", ystart, voodoo->fbzMode & (1 << 17));
#endif
for (; state->y < yend; state->y += y_diff) {
int x;
@@ -916,7 +938,9 @@ voodoo_half_triangle(voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t *
voodoo->fbiPixelsIn++;
voodoo_render_log(" X=%03i T=%08x\n", x, state->tmu0_t);
// if (voodoo->fbzMode & FBZ_RGB_WMASK)
#if 0
if (voodoo->fbzMode & FBZ_RGB_WMASK)
#endif
{
int update = 1;
uint8_t cother_r = 0;
@@ -956,7 +980,9 @@ voodoo_half_triangle(voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t *
w_depth = 0xffff;
}
// w_depth = CLAMP16(w_depth);
#if 0
w_depth = CLAMP16(w_depth);
#endif
if (params->fbzMode & FBZ_W_BUFFER)
new_depth = w_depth;

View File

@@ -550,7 +550,9 @@ flush_texture_cache(voodoo_t *voodoo, uint32_t dirty_addr, int tmu)
int wait_for_idle = 0;
memset(voodoo->texture_present[tmu], 0, sizeof(voodoo->texture_present[0]));
// voodoo_texture_log("Evict %08x %i\n", dirty_addr, sizeof(voodoo->texture_present));
#if 0
voodoo_texture_log("Evict %08x %i\n", dirty_addr, sizeof(voodoo->texture_present));
#endif
for (uint8_t c = 0; c < TEX_CACHE_MAX; c++) {
if (voodoo->texture_cache[tmu][c].base != -1) {
for (uint8_t d = 0; d < 4; d++) {
@@ -618,8 +620,10 @@ voodoo_tex_writel(uint32_t addr, uint32_t val, void *p)
if (lod > LOD_MAX)
return;
// if (addr >= 0x200000)
// return;
#if 0
if (addr >= 0x200000)
return;
#endif
if (voodoo->params.tformat[tmu] & 8)
addr = voodoo->params.tex_base[tmu][lod] + s * 2 + (t << voodoo->params.tex_shift[tmu][lod]) * 2;
@@ -629,11 +633,15 @@ voodoo_tex_writel(uint32_t addr, uint32_t val, void *p)
addr = (addr & 0x1ffffc) + voodoo->params.tex_base[tmu][0];
if (voodoo->texture_present[tmu][(addr & voodoo->texture_mask) >> TEX_DIRTY_SHIFT]) {
// voodoo_texture_log("texture_present at %08x %i\n", addr, (addr & voodoo->texture_mask) >> TEX_DIRTY_SHIFT);
#if 0
voodoo_texture_log("texture_present at %08x %i\n", addr, (addr & voodoo->texture_mask) >> TEX_DIRTY_SHIFT);
#endif
flush_texture_cache(voodoo, addr & voodoo->texture_mask, tmu);
}
if (voodoo->type == VOODOO_3 && voodoo->texture_present[tmu ^ 1][(addr & voodoo->texture_mask) >> TEX_DIRTY_SHIFT]) {
// voodoo_texture_log("texture_present at %08x %i\n", addr, (addr & voodoo->texture_mask) >> TEX_DIRTY_SHIFT);
#if 0
voodoo_texture_log("texture_present at %08x %i\n", addr, (addr & voodoo->texture_mask) >> TEX_DIRTY_SHIFT);
#endif
flush_texture_cache(voodoo, addr & voodoo->texture_mask, tmu ^ 1);
}
*(uint32_t *) (&voodoo->tex_mem[tmu][addr & voodoo->texture_mask]) = val;