[openchrome-devel] xf86-video-openchrome: 6 commits - configure.ac src/via_memmgr.c src/via_ums.c

Kevin Brace kevinbrace at kemper.freedesktop.org
Fri Feb 14 02:58:14 UTC 2020


 configure.ac     |    2 
 src/via_memmgr.c |   76 ++++++++++++++++++++++-----
 src/via_ums.c    |  150 +++++++++++++++++++++++++++++++++----------------------
 3 files changed, 153 insertions(+), 75 deletions(-)

New commits:
commit e23828506dee12bc8f9fd1c0fc302eac914eede0
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Thu Feb 13 17:29:40 2020 -0800

    Version bumped to 0.6.215
    
    The code now uses EXA offscreen memory manager when EXA is in use and
    DRM is not available.  If EXA is not in use, X Server's offscreen
    memory manager will continued to be used.
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/configure.ac b/configure.ac
index 0ec07f2..05959b8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ([2.60])
 AC_INIT([xf86-video-openchrome],
-        [0.6.214],
+        [0.6.215],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=Driver/openchrome],
         [xf86-video-openchrome])
 
commit 6393d955b7fe946d19a6fb6853c13c3c0a2e5a5d
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Thu Feb 13 16:09:01 2020 -0800

    Rearrange some code inside viaUMSCreate()
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_ums.c b/src/via_ums.c
index d0a9c12..799f8c6 100644
--- a/src/via_ums.c
+++ b/src/via_ums.c
@@ -763,8 +763,21 @@ viaUMSCreate(ScrnInfoPtr pScrn)
     VIAPtr pVia = VIAPTR(pScrn);
     Bool ret = TRUE;
 
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered %s.\n", __func__));
+
+    if (pVia->directRenderingType == DRI_NONE) {
+        if (!pVia->useEXA) {
+            if (!viaInitFB(pScrn)) {
+                ret = FALSE;
+            }
+        } else {
+            if (!viaInitExa(pScrn->pScreen)) {
+                ret = FALSE;
+            }
+        }
 #ifdef HAVE_DRI
-    if (pVia->directRenderingType == DRI_1) {
+    } else if (pVia->directRenderingType == DRI_1) {
         if (!VIADRIKernelInit(pScrn)) {
             ret = FALSE;
             goto exit;
@@ -776,21 +789,12 @@ viaUMSCreate(ScrnInfoPtr pScrn)
                 goto exit;
             }
         }
-    } else
 #endif
-    {
-        if (!pVia->useEXA) {
-            if (!viaInitFB(pScrn)) {
-                ret = FALSE;
-            }
-        } else {
-            if (!viaInitExa(pScrn->pScreen)) {
-                ret = FALSE;
-            }
-        }
     }
 
 exit:
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting %s.\n", __func__));
     return ret;
 }
 
commit b1ac666462c2987777dfab5d7fd998c7a9d843df
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Thu Feb 13 16:00:03 2020 -0800

    Use EXA offscreen memory manger when EXA is in use
    
    EXA offscreen memory manager is used when DRM is not available.
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_memmgr.c b/src/via_memmgr.c
index 4fc42b7..6c3aa18 100644
--- a/src/via_memmgr.c
+++ b/src/via_memmgr.c
@@ -67,6 +67,30 @@ exit:
     return ret;
 }
 
+static int
+viaEXAOffscreenAlloc(ScrnInfoPtr pScrn, struct buffer_object *obj,
+                        unsigned long size)
+{
+    ExaOffscreenArea *pArea;
+    int newSize = size;
+    int ret = 0;
+
+    pArea = exaOffscreenAlloc(pScrn->pScreen, newSize,
+                               32, TRUE, NULL, NULL);
+    if (!pArea) {
+        ret = -ENOMEM;
+        goto exit;
+    }
+
+    obj->offset = pArea->offset;
+    obj->handle = (unsigned long) pArea;
+    obj->domain = TTM_PL_FLAG_VRAM;
+    obj->size = newSize;
+
+exit:
+    return ret;
+}
+
 struct buffer_object *
 drm_bo_alloc(ScrnInfoPtr pScrn, unsigned int size, unsigned int alignment, int domain)
 {
@@ -86,18 +110,35 @@ drm_bo_alloc(ScrnInfoPtr pScrn, unsigned int size, unsigned int alignment, int d
     case TTM_PL_FLAG_TT:
     case TTM_PL_FLAG_VRAM:
         if (pVia->directRenderingType == DRI_NONE) {
-            ret = viaOffScreenLinear(pScrn, obj, size);
-            if (ret) {
-                DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-                                    "Linear memory allocation "
-                                    "failed.\n"));
-            } else
-                DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                                    "%lu bytes of linear memory "
-                                    "allocated at 0x%lx, "
-                                    "handle 0x%lx.\n",
-                                    obj->size, obj->offset,
-                                    obj->handle));
+            if (!pVia->useEXA) {
+                ret = viaOffScreenLinear(pScrn, obj, size);
+                if (ret) {
+                    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+                                        "Linear memory allocation "
+                                        "failed.\n"));
+                } else {
+                    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                                        "%lu bytes of linear memory "
+                                        "allocated at 0x%lx, handle "
+                                        "0x%lx.\n",
+                                        obj->size, obj->offset,
+                                        obj->handle));
+                }
+            } else {
+                ret = viaEXAOffscreenAlloc(pScrn, obj, size);
+                if (ret) {
+                    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+                                        "EXA offscreen memory "
+                                        "allocation failed.\n"));
+                } else {
+                    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                                        "%lu bytes of EXA offscreen "
+                                        "memory allocated at 0x%lx, "
+                                        "handle 0x%lx.\n",
+                                        obj->size, obj->offset,
+                                        obj->handle));
+                }
+            }
 #ifdef HAVE_DRI
         } else if (pVia->directRenderingType == DRI_1) {
             drm_via_mem_t drm;
@@ -223,9 +264,16 @@ drm_bo_free(ScrnInfoPtr pScrn, struct buffer_object *obj)
         case TTM_PL_FLAG_VRAM:
         case TTM_PL_FLAG_TT:
             if (pVia->directRenderingType == DRI_NONE) {
-                FBLinearPtr linear = (FBLinearPtr) obj->handle;
+                if (!pVia->useEXA) {
+                    FBLinearPtr linear = (FBLinearPtr) obj->handle;
+
+                    xf86FreeOffscreenLinear(linear);
+                } else {
+                    ExaOffscreenArea *pArea =
+                                    (ExaOffscreenArea *)obj->handle;
 
-                xf86FreeOffscreenLinear(linear);
+                    exaOffscreenFree(pScrn->pScreen, pArea);
+                }
 #ifdef HAVE_DRI
             } else if (pVia->directRenderingType == DRI_1) {
                 drm_via_mem_t drm;
diff --git a/src/via_ums.c b/src/via_ums.c
index 83d8578..d0a9c12 100644
--- a/src/via_ums.c
+++ b/src/via_ums.c
@@ -769,22 +769,27 @@ viaUMSCreate(ScrnInfoPtr pScrn)
             ret = FALSE;
             goto exit;
         }
+
+        if ((!pVia->NoAccel) && (pVia->useEXA)) {
+            if (!viaInitExa(pScrn->pScreen)) {
+                ret = FALSE;
+                goto exit;
+            }
+        }
     } else
 #endif
     {
-        if (!viaInitFB(pScrn)) {
-            ret = FALSE;
-            goto exit;
-        }
-    }
-
-    if ((!pVia->NoAccel) && (pVia->useEXA)) {
-        if (!viaInitExa(pScrn->pScreen)) {
-            ret = FALSE;
+        if (!pVia->useEXA) {
+            if (!viaInitFB(pScrn)) {
+                ret = FALSE;
+            }
+        } else {
+            if (!viaInitExa(pScrn->pScreen)) {
+                ret = FALSE;
+            }
         }
     }
 
-
 exit:
     return ret;
 }
commit 6c51445bdbcd17dbc17243ffd08564f52474cd02
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Thu Feb 13 15:53:32 2020 -0800

    Move no DRM UMS FB initialization code into viaInitFB()
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_ums.c b/src/via_ums.c
index 9dfbf6f..83d8578 100644
--- a/src/via_ums.c
+++ b/src/via_ums.c
@@ -686,8 +686,8 @@ err:
     return ret;
 }
 
-Bool
-viaUMSCreate(ScrnInfoPtr pScrn)
+static Bool
+viaInitFB(ScrnInfoPtr pScrn)
 {
     VIAPtr pVia = VIAPTR(pScrn);
     BoxRec AvailFBArea;
@@ -695,6 +695,74 @@ viaUMSCreate(ScrnInfoPtr pScrn)
     int maxY;
     Bool ret = TRUE;
 
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered %s.\n", __func__));
+
+    maxY = pVia->FBFreeEnd / pVia->Bpl;
+
+    /*
+     * FBManager can't handle more than 32767 scan lines.
+     */
+    if (maxY > 32767)
+        maxY = 32767;
+
+    AvailFBArea.x1 = 0;
+    AvailFBArea.y1 = 0;
+    AvailFBArea.x2 = pScrn->displayWidth;
+    AvailFBArea.y2 = maxY;
+    pVia->FBFreeStart = (AvailFBArea.y2 + 1) * pVia->Bpl;
+
+    /*
+     * Initialization of the XFree86 framebuffer manager is done via
+     * Bool xf86InitFBManager(ScreenPtr pScreen, BoxPtr FullBox).
+     * FullBox represents the area of the frame buffer that the
+     * manager is allowed to manage.  This is typically a box with a
+     * width of pScrn->displayWidth and a height of as many lines as
+     * can be fit within the total video memory.
+     */
+    ret = xf86InitFBManager(pScrn->pScreen, &AvailFBArea);
+    if (!ret) {
+        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+                    "xf86InitFBManager initialization failed.\n");
+        goto exit;
+    }
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Frame buffer from (%d,%d) to (%d,%d).\n",
+                        AvailFBArea.x1, AvailFBArea.y1,
+                        AvailFBArea.x2, AvailFBArea.y2));
+
+    offset = (pVia->FBFreeStart +
+                ((pScrn->bitsPerPixel >> 3) - 1)) /
+                (pScrn->bitsPerPixel >> 3);
+    size = (pVia->FBFreeEnd / (pScrn->bitsPerPixel >> 3)) - offset;
+
+    if (size > 0) {
+        ret = xf86InitFBManagerLinear(pScrn->pScreen, offset, size);
+        if (!ret) {
+            xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+                        "xf86InitFBManagerLinear initialization "
+                        "failed.\n");
+            goto exit;
+        }
+    }
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Using %d lines for off screen memory.\n",
+                        AvailFBArea.y2 - pScrn->virtualY));
+
+exit:
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting %s.\n", __func__));
+    return ret;
+}
+
+Bool
+viaUMSCreate(ScrnInfoPtr pScrn)
+{
+    VIAPtr pVia = VIAPTR(pScrn);
+    Bool ret = TRUE;
+
 #ifdef HAVE_DRI
     if (pVia->directRenderingType == DRI_1) {
         if (!VIADRIKernelInit(pScrn)) {
@@ -704,57 +772,10 @@ viaUMSCreate(ScrnInfoPtr pScrn)
     } else
 #endif
     {
-        maxY = pVia->FBFreeEnd / pVia->Bpl;
-
-        /* FBManager can't handle more than 32767 scan lines */
-        if (maxY > 32767)
-            maxY = 32767;
-
-        AvailFBArea.x1 = 0;
-        AvailFBArea.y1 = 0;
-        AvailFBArea.x2 = pScrn->displayWidth;
-        AvailFBArea.y2 = maxY;
-        pVia->FBFreeStart = (AvailFBArea.y2 + 1) * pVia->Bpl;
-
-        /*
-         * Initialization of the XFree86 framebuffer manager is done
-         * via Bool xf86InitFBManager(ScreenPtr pScreen,
-         * BoxPtr FullBox).  FullBox represents the area of the
-         * frame buffer that the manager is allowed to manage.
-         * This is typically a box with a width of pScrn->displayWidth
-         * and a height of as many lines as can be fit within the
-         * total video memory.
-         */
-        ret = xf86InitFBManager(pScrn->pScreen, &AvailFBArea);
-        if (!ret) {
-            xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-                        "xf86InitFBManager initialization failed.\n");
+        if (!viaInitFB(pScrn)) {
+            ret = FALSE;
             goto exit;
         }
-
-        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                            "Frame buffer from (%d,%d) to (%d,%d).\n",
-                            AvailFBArea.x1, AvailFBArea.y1,
-                            AvailFBArea.x2, AvailFBArea.y2));
-
-        offset = (pVia->FBFreeStart +
-                    ((pScrn->bitsPerPixel >> 3) - 1)) /
-                    (pScrn->bitsPerPixel >> 3);
-        size = (pVia->FBFreeEnd / (pScrn->bitsPerPixel >> 3)) - offset;
-
-        if (size > 0) {
-            ret = xf86InitFBManagerLinear(pScrn->pScreen, offset, size);
-            if (!ret) {
-                xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-                            "xf86InitFBManagerLinear initialization "
-                            "failed.\n");
-                goto exit;
-            }
-        }
-
-        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-                "Using %d lines for off screen memory.\n",
-                AvailFBArea.y2 - pScrn->virtualY));
     }
 
     if ((!pVia->NoAccel) && (pVia->useEXA)) {
commit e1fac6888dacf74dbf749e54880da449d4667900
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Thu Feb 13 13:26:41 2020 -0800

    Use pScrn->pScreen inside viaUMSCreate()
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_ums.c b/src/via_ums.c
index 76d4f84..9dfbf6f 100644
--- a/src/via_ums.c
+++ b/src/via_ums.c
@@ -689,7 +689,6 @@ err:
 Bool
 viaUMSCreate(ScrnInfoPtr pScrn)
 {
-    ScreenPtr pScreen = pScrn->pScreen;
     VIAPtr pVia = VIAPTR(pScrn);
     BoxRec AvailFBArea;
     int offset, size;
@@ -726,7 +725,7 @@ viaUMSCreate(ScrnInfoPtr pScrn)
          * and a height of as many lines as can be fit within the
          * total video memory.
          */
-        ret = xf86InitFBManager(pScreen, &AvailFBArea);
+        ret = xf86InitFBManager(pScrn->pScreen, &AvailFBArea);
         if (!ret) {
             xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
                         "xf86InitFBManager initialization failed.\n");
@@ -744,7 +743,7 @@ viaUMSCreate(ScrnInfoPtr pScrn)
         size = (pVia->FBFreeEnd / (pScrn->bitsPerPixel >> 3)) - offset;
 
         if (size > 0) {
-            ret = xf86InitFBManagerLinear(pScreen, offset, size);
+            ret = xf86InitFBManagerLinear(pScrn->pScreen, offset, size);
             if (!ret) {
                 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
                             "xf86InitFBManagerLinear initialization "
@@ -759,7 +758,7 @@ viaUMSCreate(ScrnInfoPtr pScrn)
     }
 
     if ((!pVia->NoAccel) && (pVia->useEXA)) {
-        if (!viaInitExa(pScreen)) {
+        if (!viaInitExa(pScrn->pScreen)) {
             ret = FALSE;
         }
     }
commit 54c0d160b813539a8dc0e9798dc32610b1572b22
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Thu Feb 13 12:02:02 2020 -0800

    Change error handling code for VIADRIKernelInit() inside viaUMSCreate()
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_ums.c b/src/via_ums.c
index c646796..76d4f84 100644
--- a/src/via_ums.c
+++ b/src/via_ums.c
@@ -699,7 +699,8 @@ viaUMSCreate(ScrnInfoPtr pScrn)
 #ifdef HAVE_DRI
     if (pVia->directRenderingType == DRI_1) {
         if (!VIADRIKernelInit(pScrn)) {
-            return FALSE;
+            ret = FALSE;
+            goto exit;
         }
     } else
 #endif


More information about the openchrome-devel mailing list