[openchrome-devel] xf86-video-openchrome: 2 commits - src/via_driver.c src/via_ums.c

Kevin Brace kevinbrace at kemper.freedesktop.org
Tue Dec 24 15:36:31 UTC 2019


 src/via_driver.c |   30 +++++++++++++++---------------
 src/via_ums.c    |   32 +++++++++++++++++---------------
 2 files changed, 32 insertions(+), 30 deletions(-)

New commits:
commit 3145db36b4fda2e6e048cd42d743fe1372c14dbf
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Tue Dec 24 09:35:55 2019 -0600

    Move up X Server machine independent screen initialization code
    
    Within VIAScreenInit().
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_driver.c b/src/via_driver.c
index da93ddb..cfd4bbd 100644
--- a/src/via_driver.c
+++ b/src/via_driver.c
@@ -1391,6 +1391,21 @@ VIAScreenInit(SCREEN_INIT_ARGS_DECL)
     pScrn->displayWidth = pScrn->virtualX;
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAScreenInit\n"));
 
+    miClearVisualTypes();
+
+    if (!miSetVisualTypes(pScrn->depth,
+            (pScrn->bitsPerPixel > 8) && (!pVia->IsSecondary) ?
+                TrueColorMask : miGetDefaultVisualMask(pScrn->depth),
+            pScrn->rgbBits, pScrn->defaultVisual)) {
+        return FALSE;
+    }
+
+    if (!miSetPixmapDepths()) {
+        return FALSE;
+    }
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- Visuals set up\n"));
+
 #ifdef HAVE_DRI
     if (pVia->KMS) {
         if (drmSetMaster(pVia->drmmode.fd)) {
@@ -1427,21 +1442,6 @@ VIAScreenInit(SCREEN_INIT_ARGS_DECL)
     if (!pVia->NoAccel && !umsAccelInit(pScrn->pScreen))
         return FALSE;
 
-    miClearVisualTypes();
-
-    if (!miSetVisualTypes(pScrn->depth,
-            (pScrn->bitsPerPixel > 8) && (!pVia->IsSecondary) ?
-                TrueColorMask : miGetDefaultVisualMask(pScrn->depth),
-            pScrn->rgbBits, pScrn->defaultVisual)) {
-        return FALSE;
-    }
-
-    if (!miSetPixmapDepths()) {
-        return FALSE;
-    }
-
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- Visuals set up\n"));
-
     if (pVia->shadowFB) {
         int pitch = BitmapBytePad(pScrn->bitsPerPixel * pScrn->virtualX);
 
commit 9532e3d91cf5cb5516c6a82510a683d26dc28014
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Tue Dec 24 09:35:38 2019 -0600

    Alter how the frame buffer size is reported to X Server
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_ums.c b/src/via_ums.c
index 84167a0..306478b 100644
--- a/src/via_ums.c
+++ b/src/via_ums.c
@@ -761,7 +761,8 @@ viaProbeVRAM(ScrnInfoPtr pScrn)
     struct pci_device *hostBridge = NULL;
     struct pci_device *dramController = NULL;
 #endif
-    CARD8 videoRAM;
+    uint8_t videoRAM;
+    int     detectedVideoRAM;
     CARD16 hostBridgeVendorID, hostBridgeDeviceID;
     CARD16 dramControllerVendorID;
     Bool status = TRUE;
@@ -810,7 +811,7 @@ viaProbeVRAM(ScrnInfoPtr pScrn)
 #else
         videoRAM = pciReadByte(pciTag(0, 0, 0), 0xE1);
 #endif
-        pScrn->videoRam = (1 << ((videoRAM & 0x70) >> 4)) << 10;
+        detectedVideoRAM = (1 << ((videoRAM & 0x70) >> 4)) << 10;
         break;
     case PCI_DEVICE_ID_VIA_KM400_HB:
         xf86DrvMsg(pScrn->scrnIndex, X_INFO,
@@ -820,7 +821,7 @@ viaProbeVRAM(ScrnInfoPtr pScrn)
 #else
         videoRAM = pciReadByte(pciTag(0, 0, 0), 0xE1);
 #endif
-        pScrn->videoRam = (1 << ((videoRAM & 0x70) >> 4)) << 10;
+        detectedVideoRAM = (1 << ((videoRAM & 0x70) >> 4)) << 10;
         break;
     case PCI_DEVICE_ID_VIA_P4M800_AGP:
         xf86DrvMsg(pScrn->scrnIndex, X_INFO,
@@ -830,7 +831,7 @@ viaProbeVRAM(ScrnInfoPtr pScrn)
 #else
         videoRAM = pciReadByte(pciTag(0, 0, 3), 0xA1);
 #endif
-        pScrn->videoRam = (1 << ((videoRAM & 0x70) >> 4)) << 10;
+        detectedVideoRAM = (1 << ((videoRAM & 0x70) >> 4)) << 10;
         break;
     case PCI_DEVICE_ID_VIA_P4M800_PRO_AGP:
         xf86DrvMsg(pScrn->scrnIndex, X_INFO,
@@ -840,7 +841,7 @@ viaProbeVRAM(ScrnInfoPtr pScrn)
 #else
         videoRAM = pciReadByte(pciTag(0, 0, 3), 0xA1);
 #endif
-        pScrn->videoRam = (1 << ((videoRAM & 0x70) >> 4)) << 10;
+        detectedVideoRAM = (1 << ((videoRAM & 0x70) >> 4)) << 10;
         break;
     case PCI_DEVICE_ID_VIA_PM800_AGP:
         xf86DrvMsg(pScrn->scrnIndex, X_INFO,
@@ -850,7 +851,7 @@ viaProbeVRAM(ScrnInfoPtr pScrn)
 #else
         videoRAM = pciReadByte(pciTag(0, 0, 3), 0xA1);
 #endif
-        pScrn->videoRam = (1 << ((videoRAM & 0x70) >> 4)) << 10;
+        detectedVideoRAM = (1 << ((videoRAM & 0x70) >> 4)) << 10;
         break;
     case PCI_DEVICE_ID_VIA_K8M800_AGP:
         xf86DrvMsg(pScrn->scrnIndex, X_INFO,
@@ -860,7 +861,7 @@ viaProbeVRAM(ScrnInfoPtr pScrn)
 #else
         videoRAM = pciReadByte(pciTag(0, 0, 3), 0xA1);
 #endif
-        pScrn->videoRam = (1 << ((videoRAM & 0x70) >> 4)) << 10;
+        detectedVideoRAM = (1 << ((videoRAM & 0x70) >> 4)) << 10;
         break;
     case PCI_DEVICE_ID_VIA_CX700_AGP:
         xf86DrvMsg(pScrn->scrnIndex, X_INFO,
@@ -870,7 +871,7 @@ viaProbeVRAM(ScrnInfoPtr pScrn)
 #else
         videoRAM = pciReadByte(pciTag(0, 0, 3), 0xA1);
 #endif
-        pScrn->videoRam = (1 << ((videoRAM & 0x70) >> 4)) << 12;
+        detectedVideoRAM = (1 << ((videoRAM & 0x70) >> 4)) << 12;
         break;
     case PCI_DEVICE_ID_VIA_P4M890_AGP:
         xf86DrvMsg(pScrn->scrnIndex, X_INFO,
@@ -880,7 +881,7 @@ viaProbeVRAM(ScrnInfoPtr pScrn)
 #else
         videoRAM = pciReadByte(pciTag(0, 0, 3), 0xA1);
 #endif
-        pScrn->videoRam = (1 << ((videoRAM & 0x70) >> 4)) << 12;
+        detectedVideoRAM = (1 << ((videoRAM & 0x70) >> 4)) << 12;
         break;
     case PCI_DEVICE_ID_VIA_K8M890_AGP:
         xf86DrvMsg(pScrn->scrnIndex, X_INFO,
@@ -890,7 +891,7 @@ viaProbeVRAM(ScrnInfoPtr pScrn)
 #else
         videoRAM = pciReadByte(pciTag(0, 0, 3), 0xA1);
 #endif
-        pScrn->videoRam = (1 << ((videoRAM & 0x70) >> 4)) << 12;
+        detectedVideoRAM = (1 << ((videoRAM & 0x70) >> 4)) << 12;
         break;
     case PCI_DEVICE_ID_VIA_P4M900_AGP:
         xf86DrvMsg(pScrn->scrnIndex, X_INFO,
@@ -900,7 +901,7 @@ viaProbeVRAM(ScrnInfoPtr pScrn)
 #else
         videoRAM = pciReadByte(pciTag(0, 0, 3), 0xA1);
 #endif
-        pScrn->videoRam = (1 << ((videoRAM & 0x70) >> 4)) << 12;
+        detectedVideoRAM = (1 << ((videoRAM & 0x70) >> 4)) << 12;
         break;
     case PCI_DEVICE_ID_VIA_VX800_HC:
         xf86DrvMsg(pScrn->scrnIndex, X_INFO,
@@ -910,7 +911,7 @@ viaProbeVRAM(ScrnInfoPtr pScrn)
 #else
         videoRAM = pciReadByte(pciTag(0, 0, 3), 0xA1);
 #endif
-        pScrn->videoRam = (1 << ((videoRAM & 0x70) >> 4)) << 12;
+        detectedVideoRAM = (1 << ((videoRAM & 0x70) >> 4)) << 12;
         break;
     case PCI_DEVICE_ID_VIA_VX855_HC:
         xf86DrvMsg(pScrn->scrnIndex, X_INFO,
@@ -920,7 +921,7 @@ viaProbeVRAM(ScrnInfoPtr pScrn)
 #else
         videoRAM = pciReadByte(pciTag(0, 0, 3), 0xA1);
 #endif
-        pScrn->videoRam = (1 << ((videoRAM & 0x70) >> 4)) << 12;
+        detectedVideoRAM = (1 << ((videoRAM & 0x70) >> 4)) << 12;
         break;
     case PCI_DEVICE_ID_VIA_VX900_HC:
         xf86DrvMsg(pScrn->scrnIndex, X_INFO,
@@ -930,16 +931,17 @@ viaProbeVRAM(ScrnInfoPtr pScrn)
 #else
         videoRAM = pciReadByte(pciTag(0, 0, 3), 0xA1);
 #endif
-        pScrn->videoRam = (1 << ((videoRAM & 0x70) >> 4)) << 12;
+        detectedVideoRAM = (1 << ((videoRAM & 0x70) >> 4)) << 12;
         break;
     default:
         xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                     "Could not detect available video RAM.\n");
-        pScrn->videoRam = 0;
+        detectedVideoRAM = 0;
         status = FALSE;
         break;
     }
 
+    pScrn->videoRam = detectedVideoRAM;
     if (status) {
         xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
                    "Detected Video RAM Size: %d KB\n", pScrn->videoRam);


More information about the openchrome-devel mailing list