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

Kevin Brace kevinbrace at kemper.freedesktop.org
Tue Jun 14 08:01:25 UTC 2016


 configure.ac     |    2 
 src/via_driver.c |    4 -
 src/via_ums.c    |  210 +++++++++++++++++++++++++++++--------------------------
 3 files changed, 116 insertions(+), 100 deletions(-)

New commits:
commit fcacbe26b0df42a570ea373976e8e3e0f6155296
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Tue Jun 14 03:00:17 2016 -0500

    Version bumped to 0.4.184
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/configure.ac b/configure.ac
index d0d38f9..39be4f4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ(2.57)
 AC_INIT([xf86-video-openchrome],
-        [0.4.183],
+        [0.4.184],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=Driver/openchrome],
         [xf86-video-openchrome])
 
commit 2ba02049570ba628cfa086f092afee501e8a3844
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Tue Jun 14 02:59:13 2016 -0500

    Merging viaMapFB into viaMapMMIO
    
    Since a frame buffer is also memory mapped, the code was merged into
    viaMapMMIO function.
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_driver.c b/src/via_driver.c
index 8c310f1..3081ec1 100644
--- a/src/via_driver.c
+++ b/src/via_driver.c
@@ -1105,7 +1105,9 @@ viaPreInit(ScrnInfoPtr pScrn, int flags)
     free(busId);
 #endif
 
-    /* After umsPreInit function succeeds, all MMIOs are mapped. */
+    /* After umsPreInit function succeeds, PCI hardware resources are
+     * memory mapped. If there is an error from this point on, they will
+     * need to be explicitly relinquished. */
     if (!umsPreInit(pScrn)) {
         VIAFreeRec(pScrn);
         return FALSE;
diff --git a/src/via_ums.c b/src/via_ums.c
index d9af4dc..e2a780f 100644
--- a/src/via_ums.c
+++ b/src/via_ums.c
@@ -94,6 +94,8 @@ viaMapMMIO(ScrnInfoPtr pScrn)
     CARD8 val;
 #ifdef HAVE_PCIACCESS
     int err;
+#else
+    unsigned char *tmp;
 #endif
 
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
@@ -163,91 +165,9 @@ viaMapMMIO(ScrnInfoPtr pScrn)
     }
 #endif
 
-    /* MMIO for MPEG engine. */
-    pVia->MpegMapBase = pVia->MapBase + 0xc00;
-
-    /* Set up MMIO vgaHW. */
-    vgaHWSetMmioFuncs(hwp, pVia->MapBase, 0x8000);
-
-    val = hwp->readEnable(hwp);
-    hwp->writeEnable(hwp, val | 0x01);
-
-    val = hwp->readMiscOut(hwp);
-    hwp->writeMiscOut(hwp, val | 0x01);
-
-    /* Unlock extended I/O space. */
-    ViaSeqMask(hwp, 0x10, 0x01, 0x01);
-
-    viaMMIOEnable(pScrn);
-
-    /* Unlock CRTC. */
-    ViaCrtcMask(hwp, 0x47, 0x00, 0x01);
-
-    vgaHWGetIOBase(hwp);
-
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Exiting viaMapMMIO.\n"));
-    return TRUE;
-
-fail:
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Exiting viaMapMMIO.\n"));
-    return FALSE;
-}
-
-void
-viaUnmapMMIO(ScrnInfoPtr pScrn)
-{
-    VIAPtr pVia = VIAPTR(pScrn);
-
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Entered viaUnmapMMIO.\n"));
-
-    viaMMIODisable(pScrn);
-
-#ifdef HAVE_PCIACCESS
-    if (pVia->MapBase)
-        pci_device_unmap_range(pVia->PciInfo, (pointer) pVia->MapBase,
-                               VIA_MMIO_REGSIZE);
-
-    if (pVia->BltBase)
-        pci_device_unmap_range(pVia->PciInfo, (pointer) pVia->BltBase,
-                               VIA_MMIO_BLTSIZE);
-
-    if (pVia->FBBase)
-        pci_device_unmap_range(pVia->PciInfo, (pointer) pVia->FBBase,
-                               pVia->videoRambytes);
-#else
-    if (pVia->MapBase)
-        xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pVia->MapBase,
-                        VIA_MMIO_REGSIZE);
-
-    if (pVia->BltBase)
-        xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pVia->BltBase,
-                        VIA_MMIO_BLTSIZE);
-
-    if (pVia->FBBase)
-        xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pVia->FBBase,
-                        pVia->videoRambytes);
-#endif
-
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Exiting viaUnmapMMIO.\n"));
-}
-
-static Bool
-viaMapFB(ScrnInfoPtr pScrn)
-{
-    VIAPtr pVia = VIAPTR(pScrn);
-#ifdef HAVE_PCIACCESS
-    int err;
-#endif
-#ifndef HAVE_PCIACCESS
-    unsigned char *tmp;
-#endif
-
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Entered viaMapFB.\n"));
+    if (!(pVia->videoRambytes)) {
+        goto fail;
+    }
 
 #ifdef HAVE_PCIACCESS
     if (pVia->Chipset == VIA_VX900) {
@@ -264,13 +184,9 @@ viaMapFB(ScrnInfoPtr pScrn)
 #endif
 
     xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
-               "Mapping a frame buffer at address 0x%lx with size 0x%lx.\n",
+               "Mapping the frame buffer at address 0x%lX with size 0x%lX.\n",
                pVia->FrameBufferBase, pVia->videoRambytes);
 
-    if (!(pVia->videoRambytes)) {
-        goto fail;
-    }
-
 #ifdef HAVE_PCIACCESS
     err = pci_device_map_range(pVia->PciInfo, pVia->FrameBufferBase,
                                pVia->videoRambytes,
@@ -311,7 +227,7 @@ viaMapFB(ScrnInfoPtr pScrn)
 
     if (!pVia->FBBase) {
         xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-                   "Unable to map a frame buffer.\n");
+                   "Unable to map the frame buffer.\n");
         goto fail;
     }
 #endif
@@ -320,7 +236,7 @@ viaMapFB(ScrnInfoPtr pScrn)
     pVia->FBFreeEnd = pVia->videoRambytes;
 
     xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
-               "Frame buffer start address: %p, free start: 0x%x end: 0x%x\n",
+               "Frame buffer start address: %p, free start: 0x%X end: 0x%X\n",
                pVia->FBBase, pVia->FBFreeStart, pVia->FBFreeEnd);
 
 #ifdef HAVE_PCIACCESS
@@ -342,16 +258,115 @@ viaMapFB(ScrnInfoPtr pScrn)
         pScrn->fbOffset = pScrn->videoRam << 10;
     }
 
+    /* MMIO for MPEG engine. */
+    pVia->MpegMapBase = pVia->MapBase + 0xc00;
+
+    /* Set up MMIO vgaHW. */
+    vgaHWSetMmioFuncs(hwp, pVia->MapBase, 0x8000);
+
+    val = hwp->readEnable(hwp);
+    hwp->writeEnable(hwp, val | 0x01);
+
+    val = hwp->readMiscOut(hwp);
+    hwp->writeMiscOut(hwp, val | 0x01);
+
+    /* Unlock extended I/O space. */
+    ViaSeqMask(hwp, 0x10, 0x01, 0x01);
+
+    viaMMIOEnable(pScrn);
+
+    /* Unlock CRTC. */
+    ViaCrtcMask(hwp, 0x47, 0x00, 0x01);
+
+    vgaHWGetIOBase(hwp);
+
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Exiting viaMapFB.\n"));
+                        "Exiting viaMapMMIO.\n"));
     return TRUE;
 
 fail:
+
+#ifdef HAVE_PCIACCESS
+
+    if (pVia->FBBase) {
+        pci_device_unmap_range(pVia->PciInfo, (pointer) pVia->FBBase,
+                                pVia->videoRambytes);
+    }
+
+    if (pVia->BltBase) {
+        pci_device_unmap_range(pVia->PciInfo, (pointer) pVia->BltBase,
+                               VIA_MMIO_BLTSIZE);
+    }
+
+    if (pVia->MapBase) {
+        pci_device_unmap_range(pVia->PciInfo, (pointer) pVia->MapBase,
+                               VIA_MMIO_REGSIZE);
+    }
+#else
+    if (pVia->FBBase) {
+        xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pVia->FBBase,
+                        pVia->videoRambytes);
+    }
+
+    if (pVia->BltBase) {
+        xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pVia->BltBase,
+                        VIA_MMIO_BLTSIZE);
+    }
+
+    if (pVia->MapBase) {
+        xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pVia->MapBase,
+                        VIA_MMIO_REGSIZE);
+    }
+#endif
+
+    pVia->FBBase = NULL;
+    pVia->BltBase = NULL;
+    pVia->MapBase = NULL;
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Exiting viaMapFB.\n"));
+                        "Exiting viaMapMMIO.\n"));
     return FALSE;
 }
 
+void
+viaUnmapMMIO(ScrnInfoPtr pScrn)
+{
+    VIAPtr pVia = VIAPTR(pScrn);
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered viaUnmapMMIO.\n"));
+
+    viaMMIODisable(pScrn);
+
+#ifdef HAVE_PCIACCESS
+    if (pVia->MapBase)
+        pci_device_unmap_range(pVia->PciInfo, (pointer) pVia->MapBase,
+                               VIA_MMIO_REGSIZE);
+
+    if (pVia->BltBase)
+        pci_device_unmap_range(pVia->PciInfo, (pointer) pVia->BltBase,
+                               VIA_MMIO_BLTSIZE);
+
+    if (pVia->FBBase)
+        pci_device_unmap_range(pVia->PciInfo, (pointer) pVia->FBBase,
+                               pVia->videoRambytes);
+#else
+    if (pVia->MapBase)
+        xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pVia->MapBase,
+                        VIA_MMIO_REGSIZE);
+
+    if (pVia->BltBase)
+        xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pVia->BltBase,
+                        VIA_MMIO_BLTSIZE);
+
+    if (pVia->FBBase)
+        xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pVia->FBBase,
+                        pVia->videoRambytes);
+#endif
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting viaUnmapMMIO.\n"));
+}
+
 /*
  * Leftover from VIA's code.
  */
@@ -874,12 +889,11 @@ umsPreInit(ScrnInfoPtr pScrn)
                           pVia->PciInfo->func);
 #endif
 
-    /* Detect the amount of installed RAM */
-    if (!viaMapMMIO(pScrn))
+    /* Map PCI hardware resources to the memory map. */
+    if (!viaMapMMIO(pScrn)) {
         return FALSE;
+    }
 
-    if (!viaMapFB(pScrn))
-        return FALSE;
     return TRUE;
 }
 


More information about the Openchrome-devel mailing list