xserver: Branch 'master' - 2 commits

Adam Jackson ajax at kemper.freedesktop.org
Mon Sep 21 11:52:10 PDT 2015


 hw/xfree86/modes/xf86RandR12.c |   13 ++-----
 randr/rrcrtc.c                 |   67 +++++++++++++++++++++++++++--------------
 2 files changed, 49 insertions(+), 31 deletions(-)

New commits:
commit 3cd7d33380953f2a315dd79ab74d7340c83fd80a
Author: Egbert Eich <eich at freedesktop.org>
Date:   Tue Mar 31 09:06:46 2015 +0200

    randr: Remove senseless checks for xf86RandR12Key
    
    When xf86RandR12Key is not set we will not get to the places where
    these tests are done as the functions in question are not called.
    In most cases we would have crashed before these checks anyway.
    
    Signed-off-by: Egbert Eich <eich at freedesktop.org>
    Reviewed-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index 0d446da..eae7016 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -683,11 +683,9 @@ xf86RandR12ScreenSetSize(ScreenPtr pScreen,
     Bool ret = FALSE;
     int c;
 
-    if (xf86RandR12Key) {
-        if (randrp->virtualX == -1 || randrp->virtualY == -1) {
-            randrp->virtualX = pScrn->virtualX;
-            randrp->virtualY = pScrn->virtualY;
-        }
+    if (randrp->virtualX == -1 || randrp->virtualY == -1) {
+        randrp->virtualX = pScrn->virtualX;
+        randrp->virtualY = pScrn->virtualY;
     }
     if (pRoot && pScrn->vtSema)
         (*pScrn->EnableDisableFBAccess) (pScrn, FALSE);
@@ -730,7 +728,7 @@ xf86RandR12ScreenSetSize(ScreenPtr pScreen,
     if (pRoot && pScrn->vtSema)
         (*pScrn->EnableDisableFBAccess) (pScrn, TRUE);
 #if RANDR_12_INTERFACE
-    if (xf86RandR12Key && pScreen->root && ret)
+    if (pScreen->root && ret)
         RRScreenSizeNotify(pScreen);
 #endif
     return ret;
@@ -826,9 +824,6 @@ xf86RandR12CreateScreenResources(ScreenPtr pScreen)
         xf86RandR12ScreenSetSize(pScreen, width, height, mmWidth, mmHeight);
     }
 
-    if (xf86RandR12Key == NULL)
-        return TRUE;
-
     if (randrp->virtualX == -1 || randrp->virtualY == -1) {
         randrp->virtualX = pScrn->virtualX;
         randrp->virtualY = pScrn->virtualY;
commit 245040f0d0b937efe14d947468a641a95398776a
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Oct 6 10:02:22 2014 +0100

    randr/prime: Don't stop on the first pipe when disabling ReplaceScanoutPixmap
    
    As we define sizeFits based on whether a CRTC is active, and skip trying
    to redirect the scanout on a disable pipe, we then attempt to undo it
    later and fail because crtc->scanout_pixmap != DRI2_Pixmap and
    !sizeFits. Paper over this failure by skipping unredirected CRTC when
    disabling.
    
    v2: Unwind upon failure
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=84653
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
    Cc: Dave Airlie <airlied at redhat.com>
    Reported-by: Christoph Haag <haagch at frickel.club>
    Tested-by: Christoph Haag <haagch at frickel.club>
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index 050d975..9bc456b 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -1695,23 +1695,30 @@ Bool
 RRReplaceScanoutPixmap(DrawablePtr pDrawable, PixmapPtr pPixmap, Bool enable)
 {
     rrScrPriv(pDrawable->pScreen);
-    int i;
-    Bool size_fits = FALSE;
-    Bool changed = FALSE;
     Bool ret = TRUE;
+    PixmapPtr *saved_scanout_pixmap;
+    int i;
+
+    saved_scanout_pixmap = malloc(sizeof(PixmapPtr)*pScrPriv->numCrtcs);
+    if (saved_scanout_pixmap == NULL)
+        return FALSE;
 
     for (i = 0; i < pScrPriv->numCrtcs; i++) {
         RRCrtcPtr crtc = pScrPriv->crtcs[i];
+        Bool size_fits;
+
+        saved_scanout_pixmap[i] = crtc->scanout_pixmap;
 
         if (!crtc->mode && enable)
             continue;
+        if (!crtc->scanout_pixmap && !enable)
+            continue;
 
-        changed = FALSE;
-        if (crtc->mode && crtc->x == pDrawable->x &&
-            crtc->y == pDrawable->y &&
-            crtc->mode->mode.width == pDrawable->width &&
-            crtc->mode->mode.height == pDrawable->height)
-            size_fits = TRUE;
+        size_fits = (crtc->mode &&
+                     crtc->x == pDrawable->x &&
+                     crtc->y == pDrawable->y &&
+                     crtc->mode->mode.width == pDrawable->width &&
+                     crtc->mode->mode.height == pDrawable->height);
 
         /* is the pixmap already set? */
         if (crtc->scanout_pixmap == pPixmap) {
@@ -1719,32 +1726,48 @@ RRReplaceScanoutPixmap(DrawablePtr pDrawable, PixmapPtr pPixmap, Bool enable)
             if (enable == FALSE) {
                 /* set scanout to NULL */
                 crtc->scanout_pixmap = NULL;
-                changed = TRUE;
-            } else {
-                /* if the size fits then we are already setup */
-                if (size_fits)
-                    return TRUE;
+            }
+            else if (!size_fits) {
                 /* if the size no longer fits then drop off */
                 crtc->scanout_pixmap = NULL;
-                changed = TRUE;
+                pScrPriv->rrCrtcSetScanoutPixmap(crtc, crtc->scanout_pixmap);
+
+                (*pScrPriv->rrCrtcSet) (pDrawable->pScreen, crtc, crtc->mode, crtc->x, crtc->y,
+                                        crtc->rotation, crtc->numOutputs, crtc->outputs);
+                saved_scanout_pixmap[i] = crtc->scanout_pixmap;
                 ret = FALSE;
             }
-        } else {
+            else {
+                /* if the size fits then we are already setup */
+            }
+        }
+        else {
             if (!size_fits)
-                return FALSE;
-            if (enable) {
+                ret = FALSE;
+            else if (enable)
                 crtc->scanout_pixmap = pPixmap;
-                pScrPriv->rrCrtcSetScanoutPixmap(crtc, pPixmap);
-                changed = TRUE;
-            }
+            else
+                /* reject an attempt to disable someone else's scanout_pixmap */
+                ret = FALSE;
         }
+    }
 
-        if (changed && pScrPriv->rrCrtcSet) {
+    for (i = 0; i < pScrPriv->numCrtcs; i++) {
+        RRCrtcPtr crtc = pScrPriv->crtcs[i];
+
+        if (crtc->scanout_pixmap == saved_scanout_pixmap[i])
+            continue;
+
+        if (ret) {
             pScrPriv->rrCrtcSetScanoutPixmap(crtc, crtc->scanout_pixmap);
 
             (*pScrPriv->rrCrtcSet) (pDrawable->pScreen, crtc, crtc->mode, crtc->x, crtc->y,
                                     crtc->rotation, crtc->numOutputs, crtc->outputs);
         }
+        else
+            crtc->scanout_pixmap = saved_scanout_pixmap[i];
     }
+    free(saved_scanout_pixmap);
+
     return ret;
 }


More information about the xorg-commit mailing list