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

Kevin Brace kevinbrace at kemper.freedesktop.org
Mon Sep 4 22:44:30 UTC 2017


 configure.ac     |    2 -
 src/via_driver.c |   73 +++++++++++++++++++++++++++++++++++++------------------
 2 files changed, 51 insertions(+), 24 deletions(-)

New commits:
commit be0515a1c847fc8502d1431830edce4a0a568455
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Mon Sep 4 15:31:19 2017 -0700

    Version bumped to 0.6.159
    
    VT switch fix for the next generation OpenChrome DRM (drm-openchrome).
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/configure.ac b/configure.ac
index 5032d07..3dbaf35 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ(2.57)
 AC_INIT([xf86-video-openchrome],
-        [0.6.158],
+        [0.6.159],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=Driver/openchrome],
         [xf86-video-openchrome])
 
commit ae3d37f2178c424de4e890a7723bacb377c686a0
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Mon Sep 4 15:28:36 2017 -0700

    VT switch fix for drm-openchrome
    
    The changes made to the code with commit 7095fd0 was leading to
    a null pointer crash. This crash will take down the X Server all
    together. This commit was made in order to accommodate Linux 4.5
    or later’s change in memory mapping related to vesafb. In reality,
    the code itself was not separating legacy mode setting (UMS) and
    DRM based mode setting (KMS) very well prior to commit 7095fd0 to
    begin with, so this additional commit is necessary. It will not be
    surprising if more commits like this one will be necessary in order
    to stabilize the DDX code.
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/src/via_driver.c b/src/via_driver.c
index f47abe9..ce77910 100644
--- a/src/via_driver.c
+++ b/src/via_driver.c
@@ -303,29 +303,36 @@ VIAEnterVT_internal(ScrnInfoPtr pScrn, int flags)
     VIAPtr pVia = VIAPTR(pScrn);
     int i;
 
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAEnterVT\n"));
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered %s.\n", __func__));
 
     for (i = 0; i < xf86_config->num_crtc; i++) {
         xf86CrtcPtr crtc = xf86_config->crtc[i];
 
-        if (crtc->funcs->save)
+        if (crtc->funcs->save) {
             crtc->funcs->save(crtc);
+        }
     }
 
     for (i = 0; i < xf86_config->num_output; i++) {
         xf86OutputPtr output = xf86_config->output[i];
 
-        if (output->funcs->save)
+        if (output->funcs->save) {
             output->funcs->save(output);
+        }
     }
 
-    if (!xf86SetDesiredModes(pScrn))
+    if (!xf86SetDesiredModes(pScrn)) {
+        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                            "Exiting %s.\n", __func__));
         return FALSE;
+    }
 
     if (!flags) {
         /* Restore video status. */
-        if (!pVia->IsSecondary)
+        if ((!pVia->IsSecondary) && (!pVia->KMS)) {
             viaRestoreVideo(pScrn);
+        }
 
 #ifdef HAVE_DRI
         if (pVia->directRenderingType == DRI_1) {
@@ -336,6 +343,9 @@ VIAEnterVT_internal(ScrnInfoPtr pScrn, int flags)
         }
 #endif
     }
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting %s.\n", __func__));
     return TRUE;
 }
 
@@ -347,50 +357,67 @@ VIAEnterVT(VT_FUNC_ARGS_DECL)
 }
 
 static void
-VIALeaveVT(VT_FUNC_ARGS_DECL)
+VIALeaveVT_internal(ScrnInfoPtr pScrn, int flags)
 {
-    SCRN_INFO_PTR(arg);
     xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
     VIAPtr pVia = VIAPTR(pScrn);
     int i;
 
-    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIALeaveVT\n"));
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Entered %s.\n", __func__));
 
+    if (!flags) {
 #ifdef HAVE_DRI
-    if (pVia->directRenderingType == DRI_1) {
-        volatile drm_via_sarea_t *saPriv = (drm_via_sarea_t *) DRIGetSAREAPrivate(pScrn->pScreen);
+        if (pVia->directRenderingType == DRI_1) {
+            volatile drm_via_sarea_t *saPriv = (drm_via_sarea_t *) DRIGetSAREAPrivate(pScrn->pScreen);
 
-        DRILock(xf86ScrnToScreen(pScrn), 0);
-        saPriv->ctxOwner = ~0;
+            DRILock(xf86ScrnToScreen(pScrn), 0);
+            saPriv->ctxOwner = ~0;
 
-        viaAccelSync(pScrn);
+            viaAccelSync(pScrn);
 
-        VIADRIRingBufferCleanup(pScrn);
-        viaDRIOffscreenSave(pScrn);
+            VIADRIRingBufferCleanup(pScrn);
+            viaDRIOffscreenSave(pScrn);
 
-        if (pVia->VQEnable)
-            viaDisableVQ(pScrn);
-    }
+            if ((pVia->VQEnable) && (!pVia->KMS)) {
+                viaDisableVQ(pScrn);
+            }
+        }
 #endif
 
-    /* Save video status and turn off all video activities. */
-    if (!pVia->IsSecondary)
-        viaSaveVideo(pScrn);
+        /* Save video status and turn off all video activities. */
+        if ((!pVia->IsSecondary) && (!pVia->KMS)){
+            viaSaveVideo(pScrn);
+        }
+    }
 
     for (i = 0; i < xf86_config->num_output; i++) {
         xf86OutputPtr output = xf86_config->output[i];
 
-        if (output->funcs->restore)
+        if (output->funcs->restore) {
             output->funcs->restore(output);
+        }
     }
 
     for (i = 0; i < xf86_config->num_crtc; i++) {
         xf86CrtcPtr crtc = xf86_config->crtc[i];
 
-        if (crtc->funcs->restore)
+        if (crtc->funcs->restore) {
             crtc->funcs->restore(crtc);
+        }
     }
+
     pScrn->vtSema = FALSE;
+
+    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+                        "Exiting %s.\n", __func__));
+}
+
+static void
+VIALeaveVT(VT_FUNC_ARGS_DECL)
+{
+    SCRN_INFO_PTR(arg);
+    VIALeaveVT_internal(pScrn, 0);
 }
 
 static void


More information about the Openchrome-devel mailing list