[openchrome-devel] xf86-video-openchrome: 3 commits - src/via_driver.c src/via_driver.h src/via_memmgr.c src/via_memmgr.h src/via_ums.c src/via_xvmc.c

Kevin Brace kevinbrace at kemper.freedesktop.org
Tue Jan 7 16:33:17 UTC 2020


 src/via_driver.c |   21 ++++++++++++++++-----
 src/via_driver.h |    2 +-
 src/via_memmgr.c |   16 ----------------
 src/via_memmgr.h |    2 --
 src/via_ums.c    |    5 +++--
 src/via_xvmc.c   |    2 +-
 6 files changed, 21 insertions(+), 27 deletions(-)

New commits:
commit a7a37bcc97c6be8b95b1b3134e6f034259e3aee5
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Tue Jan 7 10:32:46 2020 -0600

    Discontinue drm_bo_manager_init()
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_driver.c b/src/via_driver.c
index db8d66b..c366312 100644
--- a/src/via_driver.c
+++ b/src/via_driver.c
@@ -1417,8 +1417,19 @@ VIAScreenInit(SCREEN_INIT_ARGS_DECL)
     }
 #endif
 
-    if (!drm_bo_manager_init(pScrn))
-        return FALSE;
+    if (pVia->directRenderingType != DRI_2) {
+        if (!viaUMSCreate(pScrn)) {
+            return FALSE;
+        }
+
+#ifdef HAVE_DRI
+        if (pVia->directRenderingType == DRI_1) {
+            if (!VIADRIKernelInit(pScrn)) {
+                return FALSE;
+            }
+        }
+#endif
+    }
 
     if ((!pVia->NoAccel) &&
         ((pVia->directRenderingType == DRI_NONE)
diff --git a/src/via_memmgr.c b/src/via_memmgr.c
index 0c3127d..d37c917 100644
--- a/src/via_memmgr.c
+++ b/src/via_memmgr.c
@@ -275,19 +275,3 @@ drm_bo_free(ScrnInfoPtr pScrn, struct buffer_object *obj)
         free(obj);
     }
 }
-
-Bool
-drm_bo_manager_init(ScrnInfoPtr pScrn)
-{
-    VIAPtr pVia = VIAPTR(pScrn);
-    Bool ret = TRUE;
-
-    if (pVia->directRenderingType == DRI_2)
-        return ret;
-    ret = viaUMSCreate(pScrn);
-#ifdef HAVE_DRI
-    if (pVia->directRenderingType == DRI_1)
-        ret = VIADRIKernelInit(pScrn);
-#endif
-    return ret;
-}
diff --git a/src/via_memmgr.h b/src/via_memmgr.h
index e80cb84..c7f72fc 100644
--- a/src/via_memmgr.h
+++ b/src/via_memmgr.h
@@ -40,8 +40,6 @@ struct buffer_object {
     int             domain;
 };
 
-/* In via_memory.c */
-Bool drm_bo_manager_init(ScrnInfoPtr pScrn);
 
 struct buffer_object *
 drm_bo_alloc_surface(ScrnInfoPtr pScrn, unsigned int width, unsigned int height,
commit a138c2d0dd353788b4c9fd5adc82eedbf8429553
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Tue Jan 7 10:32:23 2020 -0600

    Get rid of Bpp variable from VIARec struct
    
    Obtain bpp (bytes per pixel) from pScrn->bitsPerPixel instead.
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_driver.c b/src/via_driver.c
index cd956b6..db8d66b 100644
--- a/src/via_driver.c
+++ b/src/via_driver.c
@@ -1152,8 +1152,7 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags)
     }
 
     /* Set up screen parameters. */
-    pVia->Bpp = pScrn->bitsPerPixel >> 3;
-    pVia->Bpl = pScrn->virtualX * pVia->Bpp;
+    pVia->Bpl = pScrn->virtualX * (pScrn->bitsPerPixel >> 3);
 
     /* Set the current mode to the first in the list */
     pScrn->currentMode = pScrn->modes;
diff --git a/src/via_driver.h b/src/via_driver.h
index 6da2f59..c7e1fe9 100644
--- a/src/via_driver.h
+++ b/src/via_driver.h
@@ -189,7 +189,7 @@ typedef struct _twodContext {
 } ViaTwodContext;
 
 typedef struct _VIA {
-    int                 Bpp, Bpl;
+    int                 Bpl;
 
     Bool                KMS;
     Bool                FirstInit;
diff --git a/src/via_ums.c b/src/via_ums.c
index 4993e9f..5c595a4 100644
--- a/src/via_ums.c
+++ b/src/via_ums.c
@@ -739,8 +739,9 @@ viaUMSCreate(ScrnInfoPtr pScrn)
             "Frame Buffer From (%d,%d) To (%d,%d)\n",
             AvailFBArea.x1, AvailFBArea.y1, AvailFBArea.x2, AvailFBArea.y2));
 
-    offset = (pVia->FBFreeStart + pVia->Bpp - 1) / pVia->Bpp;
-    size = pVia->FBFreeEnd / pVia->Bpp - offset;
+    offset = (pVia->FBFreeStart + ((pScrn->bitsPerPixel >> 3) - 1)) /
+                (pScrn->bitsPerPixel >> 3);
+    size = pVia->FBFreeEnd / ((pScrn->bitsPerPixel >> 3) - offset);
     if (size > 0)
         xf86InitFBManagerLinear(pScreen, offset, size);
 
diff --git a/src/via_xvmc.c b/src/via_xvmc.c
index a69c944..56b2602 100644
--- a/src/via_xvmc.c
+++ b/src/via_xvmc.c
@@ -504,7 +504,7 @@ ViaXvMCCreateContext(ScrnInfoPtr pScrn, XvMCContextPtr pContext,
     contextRec->chipId = pVia->ChipId;
     contextRec->screen = pScrn->scrnIndex;
     contextRec->depth = pScrn->bitsPerPixel;
-    contextRec->stride = pVia->Bpp * pScrn->virtualX;
+    contextRec->stride = pScrn->virtualX * (pScrn->bitsPerPixel >> 3);
 
     vXvMC->nContexts++;
     vXvMC->contexts[ctxNo] = pContext->context_id;
commit 96b3f7f1b642f76cd52b82f01e378aa31463059b
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Tue Jan 7 10:31:03 2020 -0600

    Initialize pScreen of pScrn struct inside VIAScreenInit() a little later
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_driver.c b/src/via_driver.c
index 6291dea..cd956b6 100644
--- a/src/via_driver.c
+++ b/src/via_driver.c
@@ -1389,12 +1389,13 @@ VIAScreenInit(SCREEN_INIT_ARGS_DECL)
     VIAPtr pVia = VIAPTR(pScrn);
     int format;
 
-    pScrn->pScreen = pScreen;
     pScrn->displayWidth = pScrn->virtualX;
 
     DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
                         "Entered %s.\n", __func__));
 
+    pScrn->pScreen = pScreen;
+
 #ifdef HAVE_DRI
     if (pVia->KMS) {
         if (drmSetMaster(pVia->drmmode.fd)) {


More information about the openchrome-devel mailing list