[Openchrome-devel] xf86-video-openchrome: 6 commits - src/via_ums.c

Kevin Brace kevinbrace at kemper.freedesktop.org
Thu Apr 7 03:53:48 UTC 2016


 src/via_ums.c |  177 +++++++++++++++++++++++++++++++++-------------------------
 1 file changed, 102 insertions(+), 75 deletions(-)

New commits:
commit f458b864dd0605cc3b191bab2209774de39540c0
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Wed Apr 6 19:09:43 2016 -0700

    Removing dead code from VIAMapMMIO
    
    Since there already are prior error checks that will catch either pointer
    being null (i.e., failed to register the memory address with X Server), this
    if statement will never be satisfied. Hence, this if statement block is
    removed.
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_ums.c b/src/via_ums.c
index 8b39f3b..73ff050 100644
--- a/src/via_ums.c
+++ b/src/via_ums.c
@@ -160,12 +160,6 @@ VIAMapMMIO(ScrnInfoPtr pScrn)
     }
 #endif
 
-    if (!pVia->MapBase || !pVia->BltBase) {
-        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-                   "BitBLT could not be mapped.\n");
-        goto fail;
-    }
-
     /* Memory mapped IO for mpeg engine. */
     pVia->MpegMapBase = pVia->MapBase + 0xc00;
 
commit 99c94b237d2ec51a7ce477580c0d7459e1c2ed06
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Wed Apr 6 19:05:43 2016 -0700

    Incrementing the copyright year inside via_ums.c
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_ums.c b/src/via_ums.c
index 02c248c..8b39f3b 100644
--- a/src/via_ums.c
+++ b/src/via_ums.c
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2015 The Openchrome Project
+ * Copyright 2011-2016 The Openchrome Project
  *                     [http://www.freedesktop.org/wiki/Openchrome]
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
commit 5b8f7fc4cf6a3b7ea35468bda8b3501510e96fd1
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Wed Apr 6 19:03:55 2016 -0700

    Major clean up of debug messages within VIAMapMMIO
    
    This function is located inside via_ums.c.
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_ums.c b/src/via_ums.c
index b56eaf4..02c248c 100644
--- a/src/via_ums.c
+++ b/src/via_ums.c
@@ -91,6 +91,9 @@ VIAMapMMIO(ScrnInfoPtr pScrn)
 {
     VIAPtr pVia = VIAPTR(pScrn);
 
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered VIAMapMMIO.\n"));
+
 #ifdef HAVE_PCIACCESS
     pVia->MmioBase = pVia->PciInfo->regions[1].base_addr;
     int err;
@@ -98,59 +101,69 @@ VIAMapMMIO(ScrnInfoPtr pScrn)
     pVia->MmioBase = pVia->PciInfo->memBase[1];
 #endif
 
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAMapMMIO\n"));
-
     xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
-               "mapping MMIO @ 0x%lx with size 0x%x\n",
-               pVia->MmioBase, VIA_MMIO_REGSIZE);
+                "Mapping MMIO at address 0x%lx with "
+                "size %d.\n",
+                pVia->MmioBase, VIA_MMIO_REGSIZE);
 
 #ifdef HAVE_PCIACCESS
     err = pci_device_map_range(pVia->PciInfo,
                                pVia->MmioBase,
-                               VIA_MMIO_REGSIZE,
-                               PCI_DEV_MAP_FLAG_WRITABLE,
+                               VIA_MMIO_REGSIZE, PCI_DEV_MAP_FLAG_WRITABLE,
                                (void **)&pVia->MapBase);
 
     if (err) {
         xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-                   "Unable to map mmio BAR. %s (%d)\n", strerror(err), err);
-        return FALSE;
+                    "Unable to map MMIO.\n"
+                    "Error: %s (%d)\n",
+                    strerror(err), err);
+        goto fail;
     }
 #else
-    pVia->MapBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, pVia->PciTag,
-                                  pVia->MmioBase, VIA_MMIO_REGSIZE);
-    if (!pVia->MapBase)
-        return FALSE;
+    pVia->MapBase = xf86MapPciMem(pScrn->scrnIndex,
+                                    VIDMEM_MMIO, pVia->PciTag,
+                                    pVia->MmioBase, VIA_MMIO_REGSIZE);
+    if (!pVia->MapBase) {
+        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+                   "Unable to map MMIO.\n");
+        goto fail;
+    }
 #endif
 
     xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
-               "mapping BitBlt MMIO @ 0x%lx with size 0x%x\n",
+               "Mapping 2D Host BitBLT space at address 0x%lx with "
+               "size %d.\n",
                pVia->MmioBase + VIA_MMIO_BLTBASE, VIA_MMIO_BLTSIZE);
 
 #ifdef HAVE_PCIACCESS
     err = pci_device_map_range(pVia->PciInfo,
                                pVia->MmioBase + VIA_MMIO_BLTBASE,
-                               VIA_MMIO_BLTSIZE,
-                               PCI_DEV_MAP_FLAG_WRITABLE,
+                               VIA_MMIO_BLTSIZE, PCI_DEV_MAP_FLAG_WRITABLE,
                                (void **)&pVia->BltBase);
 
     if (err) {
         xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-                   "Unable to map blt BAR. %s (%d)\n", strerror(err), err);
-        return FALSE;
+                    "Unable to map 2D Host BitBLT space.\n"
+                    "Error: %s (%d)\n",
+                    strerror(err), err);
+        goto fail;
     }
 #else
-    pVia->BltBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, pVia->PciTag,
-                                  pVia->MmioBase + VIA_MMIO_BLTBASE,
-                                  VIA_MMIO_BLTSIZE);
-    if (!pVia->BltBase)
-        return FALSE;
+    pVia->BltBase = xf86MapPciMem(pScrn->scrnIndex,
+                                    VIDMEM_MMIO, pVia->PciTag,
+                                    pVia->MmioBase + VIA_MMIO_BLTBASE,
+                                    VIA_MMIO_BLTSIZE);
+    if (!pVia->BltBase) {
+        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+                   "Unable to map 2D Host BitBLT space.\n");
+        goto fail;
+    }
 #endif
 
     if (!pVia->MapBase || !pVia->BltBase) {
         xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-                   "BitBlit could not be mapped.\n");
-        return FALSE;
+                   "BitBLT could not be mapped.\n");
+        goto fail;
     }
 
     /* Memory mapped IO for mpeg engine. */
@@ -181,7 +194,15 @@ VIAMapMMIO(ScrnInfoPtr pScrn)
 
         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
commit 834b7bc8e6bd02ec2b84f3c0b109df3c215495f3
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Wed Apr 6 17:50:10 2016 -0700

    Rearranging the position of VIAMapMMIO and VIAUnmapMMIO
    
    These functions are located inside via_ums.c.
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_ums.c b/src/via_ums.c
index 3d8c084..b56eaf4 100644
--- a/src/via_ums.c
+++ b/src/via_ums.c
@@ -86,46 +86,6 @@ ViaMMIODisable(ScrnInfoPtr pScrn)
                         "Exiting ViaMMIODisable.\n"));
 }
 
-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
 VIAMapMMIO(ScrnInfoPtr pScrn)
 {
@@ -224,6 +184,46 @@ VIAMapMMIO(ScrnInfoPtr pScrn)
     return TRUE;
 }
 
+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)
 {
commit 8c2973299dc29406b7f56c2483e7d58e8e86aa3c
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Wed Apr 6 17:37:05 2016 -0700

    Rearranging the position of ViaMMIOEnable and ViaMMIODisable
    
    These functions are located inside via_ums.c.
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_ums.c b/src/via_ums.c
index efb19c1..3d8c084 100644
--- a/src/via_ums.c
+++ b/src/via_ums.c
@@ -30,6 +30,36 @@
 #include "via_driver.h"
 
 static void
+ViaMMIOEnable(ScrnInfoPtr pScrn)
+{
+    VIAPtr pVia = VIAPTR(pScrn);
+    vgaHWPtr hwp = VGAHWPTR(pScrn);
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered ViaMMIOEnable.\n"));
+
+    switch (pVia->Chipset) {
+        case VIA_CX700:
+        case VIA_K8M890:
+        case VIA_P4M900:
+        case VIA_VX800:
+        case VIA_VX855:
+        case VIA_VX900:
+            ViaSeqMask(hwp, 0x1A, 0x08, 0x08);
+            break;
+        default:
+            if (pVia->IsSecondary)
+                ViaSeqMask(hwp, 0x1A, 0x38, 0x38);
+            else
+                ViaSeqMask(hwp, 0x1A, 0x68, 0x68);
+            break;
+    }
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting ViaMMIOEnable.\n"));
+}
+
+static void
 ViaMMIODisable(ScrnInfoPtr pScrn)
 {
     VIAPtr pVia = VIAPTR(pScrn);
@@ -96,36 +126,6 @@ VIAUnmapMMIO(ScrnInfoPtr pScrn)
                         "Exiting VIAUnmapMMIO.\n"));
 }
 
-static void
-ViaMMIOEnable(ScrnInfoPtr pScrn)
-{
-    VIAPtr pVia = VIAPTR(pScrn);
-    vgaHWPtr hwp = VGAHWPTR(pScrn);
-
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Entered ViaMMIOEnable.\n"));
-
-    switch (pVia->Chipset) {
-        case VIA_CX700:
-        case VIA_K8M890:
-        case VIA_P4M900:
-        case VIA_VX800:
-        case VIA_VX855:
-        case VIA_VX900:
-            ViaSeqMask(hwp, 0x1A, 0x08, 0x08);
-            break;
-        default:
-            if (pVia->IsSecondary)
-                ViaSeqMask(hwp, 0x1A, 0x38, 0x38);
-            else
-                ViaSeqMask(hwp, 0x1A, 0x68, 0x68);
-            break;
-    }
-
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                        "Exiting ViaMMIOEnable.\n"));
-}
-
 static Bool
 VIAMapMMIO(ScrnInfoPtr pScrn)
 {
commit 3ae6dcf8f6033dbee1f1b5b8da2b6e8e675d927c
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Wed Apr 6 17:11:05 2016 -0700

    Added debug messages to ViaMMIOEnable and ViaMMIODisable
    
    These functions are located inside via_ums.c.
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_ums.c b/src/via_ums.c
index c66f53f..efb19c1 100644
--- a/src/via_ums.c
+++ b/src/via_ums.c
@@ -35,6 +35,9 @@ ViaMMIODisable(ScrnInfoPtr pScrn)
     VIAPtr pVia = VIAPTR(pScrn);
     vgaHWPtr hwp = VGAHWPTR(pScrn);
 
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered ViaMMIODisable.\n"));
+
     switch (pVia->Chipset) {
         case VIA_CX700:
         case VIA_K8M890:
@@ -48,6 +51,9 @@ ViaMMIODisable(ScrnInfoPtr pScrn)
             ViaSeqMask(hwp, 0x1A, 0x00, 0x60);
             break;
     }
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting ViaMMIODisable.\n"));
 }
 
 void
@@ -96,6 +102,9 @@ ViaMMIOEnable(ScrnInfoPtr pScrn)
     VIAPtr pVia = VIAPTR(pScrn);
     vgaHWPtr hwp = VGAHWPTR(pScrn);
 
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered ViaMMIOEnable.\n"));
+
     switch (pVia->Chipset) {
         case VIA_CX700:
         case VIA_K8M890:
@@ -112,6 +121,9 @@ ViaMMIOEnable(ScrnInfoPtr pScrn)
                 ViaSeqMask(hwp, 0x1A, 0x68, 0x68);
             break;
     }
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting ViaMMIOEnable.\n"));
 }
 
 static Bool


More information about the Openchrome-devel mailing list