More video fixes:

ATI Mach64 is temporarily unthreaded because of blitter desyncing.
ATI Mach32 now returns to ATI mode from IBM mode and vice versa more correctly.
Make the IBM 8514/A compatible poll not run if a 3D add-on card (Voodoo1/2) takes precedence (seen on a Mach32 PCI and Voodoo2 3D combo).
Finally ended the mess ups of the TGUI9440/96x0 pitch, it actually was the CRTC offset reg (SVGA CRTC 0x13) that defined it with some shifting based on the BPP.
This commit is contained in:
TC1995
2023-10-11 18:46:15 +02:00
parent 528c269cdd
commit 6913de32c5
4 changed files with 134 additions and 185 deletions

View File

@@ -760,10 +760,18 @@ tgui_recalctimings(svga_t *svga)
case 8:
svga->render = svga_render_8bpp_highres;
if (tgui->type >= TGUI_9660) {
if ((svga->dispend == 510) || (svga->dispend == 512))
svga->hdisp = 1280;
else if ((svga->dispend == 600) && (svga->hdisp == 800) && svga->interlace)
svga->hdisp = 1600;
if (svga->dispend == ((1024 >> 1) - 2))
svga->dispend += 2;
if (svga->dispend == (1024 >> 1))
svga->hdisp <<= 1;
else if ((svga->hdisp == (1600 >> 1)) && (svga->dispend == (1200 >> 1)) && svga->interlace)
svga->hdisp <<= 1;
else if (svga->hdisp == (1024 >> 1)) {
if (svga->interlace && (svga->dispend == (768 >> 1)))
svga->hdisp <<= 1;
else if (!svga->interlace && (svga->dispend == 768))
svga->hdisp <<= 1;
}
if (ger22upper & 0x80) {
svga->htotal <<= 1;
@@ -799,7 +807,7 @@ tgui_recalctimings(svga_t *svga)
case 32:
svga->render = svga_render_32bpp_highres;
if (tgui->type >= TGUI_9660) {
if (svga->hdisp == 1024)
if (!ger22upper)
svga->rowoffset <<= 1;
}
break;
@@ -1455,15 +1463,21 @@ tgui_accel_command(int count, uint32_t cpu_dat, tgui_t *tgui)
}
}
/*For delayed mode switches.*/
if (tgui->type == TGUI_9440) {
if (tgui->accel.pitch == 800)
tgui->accel.pitch += 32;
/*See this: https://android.googlesource.com/kernel/tegra/+/android-tegra-flounder-3.10-lollipop-release/drivers/video/tridentfb.c for the pitch*/
tgui->accel.pitch = svga->rowoffset;
if (tgui->accel.bpp == 1) {
if (!ger22upper)
tgui->accel.pitch = svga->rowoffset << 2;
}
switch (svga->bpp) {
case 8:
case 24:
tgui->accel.pitch <<= 3;
break;
case 15:
case 16:
tgui->accel.pitch <<= 2;
break;
case 32:
tgui->accel.pitch <<= 1;
break;
}
#if 0
pclog("TGUI accel command = %x, ger22 = %04x, hdisp = %d, dispend = %d, vtotal = %d, rowoffset = %d, svgabpp = %d, interlace = %d, accelbpp = %d, pitch = %d.\n", tgui->accel.command, tgui->accel.ger22, svga->hdisp, svga->dispend, svga->vtotal, svga->rowoffset, svga->bpp, svga->interlace, tgui->accel.bpp, tgui->accel.pitch);
@@ -2056,7 +2070,6 @@ tgui_accel_out(uint16_t addr, uint8_t val, void *priv)
switch (addr) {
case 0x2122:
tgui->accel.ger22 = (tgui->accel.ger22 & 0xff00) | val;
tgui->accel.pitch = 0x200 << ((val >> 2) & 3);
switch (svga->bpp) {
case 8:
case 24:
@@ -2076,7 +2089,8 @@ tgui_accel_out(uint16_t addr, uint8_t val, void *priv)
break;
case 0x2123:
//pclog("Pitch IO23: val = %02x, rowoffset = %x, pitch = %d.\n", val, svga->rowoffset, tgui->accel.pitch);
tgui->accel.ger22 = (tgui->accel.ger22 & 0xff) | (val << 8);
//pclog("Pitch IO23: val = %02x, rowoffset = %x.\n", tgui->accel.ger22, svga->crtc[0x13]);
switch (svga->bpp) {
case 8:
case 24:
@@ -2090,24 +2104,6 @@ tgui_accel_out(uint16_t addr, uint8_t val, void *priv)
tgui->accel.bpp = 3;
break;
}
tgui->accel.ger22 = (tgui->accel.ger22 & 0xff) | (val << 8);
if ((val & 0x80) || ((val & 0xc0) == 0x40))
tgui->accel.pitch = svga->rowoffset << 3;
else if (tgui->accel.pitch <= 1024) {
tgui->accel.pitch = svga->rowoffset << 3;
if (!val)
tgui->accel.pitch = 1024;
}
if (tgui->accel.pitch == 800)
tgui->accel.pitch += 32;
if (tgui->accel.bpp == 1)
tgui->accel.pitch >>= 1;
else if (tgui->accel.bpp == 3)
tgui->accel.pitch >>= 2;
svga_recalctimings(svga);
break;
case 0x2124: /*Command*/
@@ -2724,59 +2720,11 @@ tgui_accel_write(uint32_t addr, uint8_t val, void *priv)
switch (addr & 0xff) {
case 0x22:
tgui->accel.ger22 = (tgui->accel.ger22 & 0xff00) | val;
tgui->accel.pitch = 0x200 << ((val >> 2) & 3);
switch (svga->bpp) {
case 8:
case 24:
tgui->accel.bpp = 0;
break;
case 15:
case 16:
tgui->accel.bpp = 1;
break;
case 32:
tgui->accel.bpp = 3;
break;
default:
break;
}
tgui_accel_out(0x2122, val, tgui);
break;
case 0x23:
switch (svga->bpp) {
case 8:
case 24:
tgui->accel.bpp = 0;
break;
case 15:
case 16:
tgui->accel.bpp = 1;
break;
case 32:
tgui->accel.bpp = 3;
break;
}
tgui->accel.ger22 = (tgui->accel.ger22 & 0xff) | (val << 8);
if ((val & 0x80) || ((val & 0xc0) == 0x40))
tgui->accel.pitch = svga->rowoffset << 3;
else if (tgui->accel.pitch <= 1024) {
tgui->accel.pitch = svga->rowoffset << 3;
if (!val)
tgui->accel.pitch = 1024;
}
if (tgui->accel.pitch == 800)
tgui->accel.pitch += 32;
if (tgui->accel.bpp == 1)
tgui->accel.pitch >>= 1;
else if (tgui->accel.bpp == 3)
tgui->accel.pitch >>= 2;
//pclog("Pitch MM23: fullval = %04x, rowoffset = %x, pitch = %d.\n", tgui->accel.ger22, svga->rowoffset, tgui->accel.pitch);
svga_recalctimings(svga);
tgui_accel_out(0x2123, val, tgui);
break;
case 0x24: /*Command*/