]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
PCem RTG updates (Voodoo/Virge)
authorToni Wilen <twilen@winuae.net>
Sat, 9 Jan 2021 15:00:00 +0000 (17:00 +0200)
committerToni Wilen <twilen@winuae.net>
Sat, 9 Jan 2021 15:00:00 +0000 (17:00 +0200)
expansion.cpp
gfxboard.cpp
pcem/vid_s3_virge.cpp
pcem/vid_svga.cpp
pcem/vid_voodoo_banshee.cpp

index db98be0af77d363006cb72661fdb2631c2414280..113ce524743e1873cd9eb862b5a47f39329d6bc5 100644 (file)
@@ -5853,14 +5853,12 @@ const struct expansionromtype expansionroms[] = {
                false, 0, voodoo_settings
        },
 #endif
-#if 0
        {
                _T("s3virge"), _T("Virge"), _T("S3"),
                NULL, NULL, NULL, NULL, ROMTYPE_S3VIRGE | ROMTYPE_NONE, 0, 0, BOARD_IGNORE, false,
                NULL, 0,
                false, EXPANSIONTYPE_RTG
        },
-#endif
        {
                _T("x86vga"), _T("x86 VGA"), NULL,
                NULL, NULL, NULL, NULL, ROMTYPE_x86_VGA | ROMTYPE_NONE, 0, 0, BOARD_IGNORE, true,
index a4d0fef82cdf90e0240b19948203e76ea01e7099..c1b17de0ce139d0cf5837c3031e840bac1af64cd 100644 (file)
@@ -264,7 +264,6 @@ static const struct gfxboard boards[] =
                0, NULL, &voodoo_5_5500_device, 0, true
        },
 #endif
-#if 0
        {
                GFXBOARD_ID_S3VIRGE_PCI,
                _T("Virge [PCI]"), _T("S3"), _T("S3VIRGE_PCI"),
@@ -272,7 +271,6 @@ static const struct gfxboard boards[] =
                0x00000000, 0x00400000, 0x00400000, 0x10000000, 0, 0, -1, false,
                0, 0, NULL, &s3_virge_device, 0, true
        },
-#endif
        {
                GFXBOARD_ID_VGA,
                _T("x86 bridgeboard VGA [ISA]"), _T("x86"), _T("VGA"),
@@ -378,7 +376,8 @@ struct rtggfxboard
        struct gfxboard_func *func;
 
        device_t *pcemdev;
-       void *pcemobject, *pcemobject2;
+       void *pcemobject; // device_t
+       void *pcemobject2; // svga_t
        int pcem_mmio_offset;
        int pcem_mmio_mask;
        bool pcem_pci_configured;
@@ -391,6 +390,7 @@ struct rtggfxboard
        uae_u8 *bios;
        uae_u32 bios_mask;
        int lfbbyteswapmode;
+       int mmiobyteswapmode;
        struct pci_board_state *pcibs;
        bool pcem_direct;
 
@@ -665,7 +665,7 @@ void gfxboard_free_vram(int index)
 }
 
 extern uae_u8 *getpcembuffer32(int, int, int);
-extern int svga_get_vtotal(void);
+extern int svga_get_vtotal(void *p);
 extern int svga_poll(void *p);
 extern void voodoo_callback(void *p);
 
@@ -765,9 +765,9 @@ static void gfxboard_hsync_handler(void)
                if (gb->func && gb->userdata) {
                        gb->func->hsync(gb->userdata);
                }
-               if (gb->pcemdev && gb->pcemobject && !gb->pcem_vblank) {
+               if (gb->pcemdev && gb->pcemobject2 && !gb->pcem_vblank) {
                        static int pollcnt;
-                       int total = svga_get_vtotal();
+                       int total = svga_get_vtotal(gb->pcemobject2);
                        if (total <= 0)
                                total = p96syncrate;
                        int pollsize = (total << 8) / p96syncrate;
@@ -1462,8 +1462,8 @@ void gfxboard_vsync_handler(bool full_redraw_required, bool redraw_required)
 
                        if (gb->pcemdev) {
                                static int fcount;
-                               if (!gb->pcem_vblank && gb->pcemobject) {
-                                       int max = svga_get_vtotal();
+                               if (!gb->pcem_vblank && gb->pcemobject2) {
+                                       int max = svga_get_vtotal(gb->pcemobject2);
                                        while (max-- > 0) {
                                                if (gfxboard_pcem_poll(gb))
                                                        break;
@@ -1485,8 +1485,8 @@ void gfxboard_vsync_handler(bool full_redraw_required, bool redraw_required)
                                        }
                                }
                                if (gb->board->pci && gb->vram) {
-                                       bool svga_on(voidp);
-                                       set_monswitch(gb, svga_on(gb->pcemobject));
+                                       bool svga_on(void *p);
+                                       set_monswitch(gb, svga_on(gb->pcemobject2));
                                }
                        }
 
@@ -3832,6 +3832,15 @@ void gfxboard_s3virge_lfb_endianswap(int m)
                }
        }
 }
+void gfxboard_s3virge_lfb_endianswap2(int m)
+{
+       for (int i = 0; i < MAX_RTG_BOARDS; i++) {
+               struct rtggfxboard *gb = &rtggfxboards[i];
+               if (gb->active && gb->board->pci) {
+                       gb->mmiobyteswapmode = m;
+               }
+       }
+}
 
 static int s3virgeaddr(struct pci_board_state *pcibs, uaecptr *addrp)
 {
@@ -3844,7 +3853,7 @@ static int s3virgeaddr(struct pci_board_state *pcibs, uaecptr *addrp)
        } else if (addr >= pcibs->bar[0] + 0x03000000 && addr < pcibs->bar[0] + 0x04000000) {
                // MMIO BE
                addr = ((addr - pcibs->bar[0]) & 0xffff) + pcibs->bar[0] + 0x01000000;
-               swap = 1;
+               swap = addr & 0x8000 ? 1 : 2;
        } else if (addr >= pcibs->bar[0] + 0x00000000 && addr < pcibs->bar[0] + 0x01000000) {
                // LFB LE
                addr = ((addr - pcibs->bar[0]) & 0x3fffff) + pcibs->bar[0];
@@ -3860,7 +3869,8 @@ static void REGPARAM2 s3virge_mb0_lput(struct pci_board_state *pcibs, uaecptr ad
 {
        int swap = s3virgeaddr(pcibs, &addr);
        if (swap > 0) {
-               b = do_byteswap_32(b);
+               if (swap == 1)
+                       b = do_byteswap_32(b);
        } else if (swap < 0) {
                struct rtggfxboard *gb = getgfxboard(addr);
                int m = gb->lfbbyteswapmode;
@@ -3881,7 +3891,8 @@ static void REGPARAM2 s3virge_mb0_wput(struct pci_board_state *pcibs, uaecptr ad
 {
        int swap = s3virgeaddr(pcibs, &addr);
        if (swap > 0) {
-               b = do_byteswap_16(b);
+               if (swap == 1)
+                       b = do_byteswap_16(b);
        } else if (swap < 0) {
                struct rtggfxboard *gb = getgfxboard(addr);
                int m = gb->lfbbyteswapmode;
@@ -3907,7 +3918,8 @@ static uae_u32 REGPARAM2 s3virge_mb0_lget(struct pci_board_state *pcibs, uaecptr
        int swap = s3virgeaddr(pcibs, &addr);
        uae_u32 v = get_mem_pcem(addr, 2);
        if (swap > 0) {
-               v = do_byteswap_32(v);
+               if (swap == 1)
+                       v = do_byteswap_32(v);
        } else if (swap < 0) {
                struct rtggfxboard *gb = getgfxboard(addr);
                int m = gb->lfbbyteswapmode;
@@ -3929,7 +3941,8 @@ static uae_u32 REGPARAM2 s3virge_mb0_wget(struct pci_board_state *pcibs, uaecptr
        int swap = s3virgeaddr(pcibs, &addr);
        uae_u32 v = get_mem_pcem(addr, 1);
        if (swap > 0) {
-               v = do_byteswap_16(v);
+               if (swap == 1)
+                       v = do_byteswap_16(v);
        } else if (swap < 0) {
                struct rtggfxboard *gb = getgfxboard(addr);
                int m = gb->lfbbyteswapmode;
index fdf628bf5aa3694f5bd5e1cd8b0f7040cfcf9b7e..1acab18e8296bd332e25414db49ebfee931e1283 100644 (file)
@@ -480,6 +480,8 @@ static void s3_virge_out(uint16_t addr, uint8_t val, void *p)
                         break;
 
                         case 0x54:
+                            extern void gfxboard_s3virge_lfb_endianswap2(int);
+                            gfxboard_s3virge_lfb_endianswap2((val >> 0) & 3);
                             break;
                         case 0x61:
                             break;
index 01a4aaa1255a503d111e9dd50ee15219bf5825d1..f75d48d4e2c374be64141b4a15206588213b15ec 100644 (file)
@@ -23,14 +23,15 @@ static svga_t *svga_pri;
 
 bool svga_on(void *p)
 {
-    svga_tsvga = (svga_t*)p;
-    return svga->scrblank == 0;
+    svga_t *svga = (svga_t*)p;
+    return svga->scrblank == 0 && svga->hdisp >= 128;
 }
 
-int svga_get_vtotal(void)
+int svga_get_vtotal(void *p)
 {
-    int v = svga_pri->vtotal;
-    if (svga_pri->crtc[0x17] & 4)
+    svga_t *svga = (svga_t*)p;
+    int v = svga->vtotal;
+    if (svga->crtc[0x17] & 4)
         v *= 2;
     return v;
 }
@@ -319,6 +320,7 @@ void svga_recalctimings(svga_t *svga)
 {
         double crtcconst;
         double _dispontime, _dispofftime, disptime;
+        int text = 0;
 
         svga->vtotal = svga->crtc[6];
         svga->dispend = svga->crtc[0x12];
@@ -393,6 +395,7 @@ void svga_recalctimings(svga_t *svga)
                 svga->hdisp *= (svga->seqregs[1] & 1) ? 8 : 9;
             }
             svga->hdisp_old = svga->hdisp;
+            text = 1;
         }
         else
         {
@@ -460,17 +463,32 @@ void svga_recalctimings(svga_t *svga)
         if (svga->vblankstart < svga->dispend)
                 svga->dispend = svga->vblankstart;
 
-        if (svga->horizontal_linedbl) {
-            if (svga->render == svga_render_8bpp_highres)
-                svga->render = svga_render_8bpp_lowres;
-            if (svga->render == svga_render_15bpp_highres)
-                svga->render = svga_render_15bpp_lowres;
-            if (svga->render == svga_render_16bpp_highres)
-                svga->render = svga_render_16bpp_lowres;
-            if (svga->render == svga_render_24bpp_highres)
-                svga->render = svga_render_24bpp_lowres;
-            if (svga->render == svga_render_32bpp_highres)
-                svga->render = svga_render_32bpp_lowres;
+        if (!text) {
+            if (!svga->lowres) {
+                if (svga->render == svga_render_8bpp_lowres)
+                    svga->render = svga_render_8bpp_highres;
+                if (svga->render == svga_render_15bpp_lowres)
+                    svga->render = svga_render_15bpp_highres;
+                if (svga->render == svga_render_16bpp_lowres)
+                    svga->render = svga_render_16bpp_highres;
+                if (svga->render == svga_render_24bpp_lowres)
+                    svga->render = svga_render_24bpp_highres;
+                if (svga->render == svga_render_32bpp_lowres)
+                    svga->render = svga_render_32bpp_highres;
+            }
+
+            if (svga->horizontal_linedbl) {
+                if (svga->render == svga_render_8bpp_highres)
+                    svga->render = svga_render_8bpp_lowres;
+                if (svga->render == svga_render_15bpp_highres)
+                    svga->render = svga_render_15bpp_lowres;
+                if (svga->render == svga_render_16bpp_highres)
+                    svga->render = svga_render_16bpp_lowres;
+                if (svga->render == svga_render_24bpp_highres)
+                    svga->render = svga_render_24bpp_lowres;
+                if (svga->render == svga_render_32bpp_highres)
+                    svga->render = svga_render_32bpp_lowres;
+            }
         }
 
         crtcconst = svga->clock * svga->char_width;
index 9c77608a09760bec4ba35af412acb1713df30c55..f84376ce09c5236b8892aa858f8157210a70a741 100644 (file)
@@ -150,6 +150,7 @@ enum
 
 #define VGAINIT0_EXTENDED_SHIFT_OUT (1 << 12)
 
+#define VIDPROCCFG_VIDPROCON (1 << 0)
 #define VIDPROCCFG_CURSOR_MODE (1 << 1)
 #define VIDPROCCFG_INTERLACE (1 << 3)
 #define VIDPROCCFG_HALF_MODE (1 << 4)
@@ -431,8 +432,12 @@ static void banshee_recalctimings(svga_t *svga)
 //        pclog("svga->hdisp=%i\n", svga->hdisp);
 
         svga->interlace = 0;
-        if (banshee->vgaInit0 & VGAINIT0_EXTENDED_SHIFT_OUT)
+//        if (banshee->vgaInit0 & VGAINIT0_EXTENDED_SHIFT_OUT)
+        if (banshee->vidProcCfg & VIDPROCCFG_VIDPROCON)
         {
+                // this is some VGA-only feature? G-REX driver sets it and still expects normal 640x480 display.
+                svga->lowres = 0;
+
                 switch (VIDPROCCFG_DESKTOP_PIX_FORMAT)
                 {
                         case PIX_FORMAT_8:
@@ -587,7 +592,7 @@ static void banshee_ext_outl(uint16_t addr, uint32_t val, void *p)
                         
                 case Init_lfbMemoryConfig:
                 banshee->lfbMemoryConfig = val;
-                pclog("lfbMemoryConfig=%08x\n", val);
+//                pclog("lfbMemoryConfig=%08x\n", val);
                 voodoo->tile_base = (val & 0x1fff) << 12;
                 voodoo->tile_stride = 1024 << ((val >> 13) & 7);
                 voodoo->tile_stride_shift = 10 + ((val >> 13) & 7);