xserver: Branch 'master' - 3 commits

Adam Jackson ajax at kemper.freedesktop.org
Tue Dec 1 10:19:22 PST 2015


 hw/xfree86/common/xf86Module.h |    2 -
 randr/rrcrtc.c                 |   76 +++++++++++++++++++++++++++--------------
 2 files changed, 52 insertions(+), 26 deletions(-)

New commits:
commit 8d3f0e964e399dcfa8eb5e85d405217fdc5dbcd4
Author: agoins <agoins at nvidia.com>
Date:   Wed Nov 25 18:39:27 2015 -0800

    xf86: Bump ABI version to 21
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Alex Goins <agoins at nvidia.com>

diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h
index 9e5dc6d..7a8b7ab 100644
--- a/hw/xfree86/common/xf86Module.h
+++ b/hw/xfree86/common/xf86Module.h
@@ -80,7 +80,7 @@ typedef enum {
  * mask is 0xFFFF0000.
  */
 #define ABI_ANSIC_VERSION	SET_ABI_VERSION(0, 4)
-#define ABI_VIDEODRV_VERSION	SET_ABI_VERSION(20, 0)
+#define ABI_VIDEODRV_VERSION	SET_ABI_VERSION(21, 0)
 #define ABI_XINPUT_VERSION	SET_ABI_VERSION(22, 1)
 #define ABI_EXTENSION_VERSION	SET_ABI_VERSION(9, 0)
 #define ABI_FONT_VERSION	SET_ABI_VERSION(0, 6)
commit 7006b4e7ff759c899d5391b7d12db889cbc0b535
Author: agoins <agoins at nvidia.com>
Date:   Wed Nov 25 18:39:26 2015 -0800

    randr: Factor out shared pixmap creation
    
    The old version of rrCreateSharedPixmap(), in addition to actually creating
    a shared pixmap with scanout, also set up pixmap tracking on the source
    driver.
    
    I will be needing to create multiple shared pixmaps for PRIME double
    buffering, so factor the part that does shared pixmap creation into its own
    function, the new rrCreateSharedPixmap(). Rename the old
    rrCreateSharedPixmap() to rrSetupPixmapSharing(), a function that
    replicates the old functionality of rrCreateSharedPixmap() using the new
    rrCreateSharedPixmap().
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Alex Goins <agoins at nvidia.com>

diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index cbd03d0..6e459ed 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -392,17 +392,46 @@ RRCrtcDetachScanoutPixmap(RRCrtcPtr crtc)
     RRCrtcChanged(crtc, TRUE);
 }
 
-static Bool
-rrCreateSharedPixmap(RRCrtcPtr crtc, int width, int height,
+static PixmapPtr
+rrCreateSharedPixmap(RRCrtcPtr crtc, ScreenPtr master,
+                     int width, int height, int depth,
                      int x, int y, Rotation rotation)
 {
+    Bool ret;
     PixmapPtr mpix, spix;
+    rrScrPriv(crtc->pScreen);
+
+    mpix = master->CreatePixmap(master, width, height, depth,
+                                CREATE_PIXMAP_USAGE_SHARED);
+    if (!mpix)
+        return NULL;
+
+    spix = PixmapShareToSlave(mpix, crtc->pScreen);
+    if (spix == NULL) {
+        master->DestroyPixmap(mpix);
+        return NULL;
+    }
+
+    ret = pScrPriv->rrCrtcSetScanoutPixmap(crtc, spix);
+    if (ret == FALSE) {
+        rrDestroySharedPixmap(crtc, spix);
+        ErrorF("randr: failed to set shadow slave pixmap\n");
+        return NULL;
+    }
+
+    return spix;
+}
+
+static Bool
+rrSetupPixmapSharing(RRCrtcPtr crtc, int width, int height,
+                     int x, int y, Rotation rotation)
+{
     ScreenPtr master = crtc->pScreen->current_master;
-    Bool ret;
     int depth;
     PixmapPtr mscreenpix;
     PixmapPtr protopix = master->GetScreenPixmap(master);
     rrScrPriv(crtc->pScreen);
+    PixmapPtr spix;
 
     /* create a pixmap on the master screen,
        then get a shared handle for it
@@ -422,20 +451,10 @@ rrCreateSharedPixmap(RRCrtcPtr crtc, int width, int height,
         return TRUE;
     }
 
-    mpix = master->CreatePixmap(master, width, height, depth,
-                                CREATE_PIXMAP_USAGE_SHARED);
-    if (!mpix)
-        return FALSE;
-
-    spix = PixmapShareToSlave(mpix, crtc->pScreen);
+    spix = rrCreateSharedPixmap(crtc, master,
+                                width, height, depth,
+                                x, y, rotation);
     if (spix == NULL) {
-        master->DestroyPixmap(mpix);
-        return FALSE;
-    }
-
-    ret = pScrPriv->rrCrtcSetScanoutPixmap(crtc, spix);
-    if (ret == FALSE) {
-        ErrorF("randr: failed to set shadow slave pixmap\n");
         return FALSE;
     }
 
@@ -599,7 +618,7 @@ RRCrtcSet(RRCrtcPtr crtc,
                 return FALSE;
 
             if (pScreen->current_master) {
-                ret = rrCreateSharedPixmap(crtc, width, height, x, y, rotation);
+                ret = rrSetupPixmapSharing(crtc, width, height, x, y, rotation);
             }
         }
 #if RANDR_12_INTERFACE
commit cf5d6414e0c21140f763d618bde1e91ad2b1cb49
Author: agoins <agoins at nvidia.com>
Date:   Wed Nov 25 18:39:25 2015 -0800

    randr: Factor out shared pixmap destruction
    
    Shared pixmap destruction is done by unrefing the master pixmap twice: once
    for the original reference, and once for the reference implicitly added by
    PixmapShareToSlave. Then, unrefing the slave pixmap once.
    
    When I add PRIME double buffering and synchronization, I will need to do
    this in multiple places. To avoid duplication of code and comments
    explaining it everywhere, factor it out into its own function and use that
    in place of where it was before.
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Alex Goins <agoins at nvidia.com>

diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index 9bc456b..cbd03d0 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -361,6 +361,20 @@ RRComputeContiguity(ScreenPtr pScreen)
     pScrPriv->discontiguous = discontiguous;
 }
 
+static void
+rrDestroySharedPixmap(RRCrtcPtr crtc, PixmapPtr pPixmap) {
+    if (crtc->pScreen->current_master && pPixmap->master_pixmap) {
+        /*
+         * Unref the pixmap twice: once for the original reference, and once
+         * for the reference implicitly added by PixmapShareToSlave.
+         */
+        crtc->pScreen->current_master->DestroyPixmap(pPixmap->master_pixmap);
+        crtc->pScreen->current_master->DestroyPixmap(pPixmap->master_pixmap);
+    }
+
+    crtc->pScreen->DestroyPixmap(pPixmap);
+}
+
 void
 RRCrtcDetachScanoutPixmap(RRCrtcPtr crtc)
 {
@@ -372,14 +386,7 @@ RRCrtcDetachScanoutPixmap(RRCrtcPtr crtc)
 
     pScrPriv->rrCrtcSetScanoutPixmap(crtc, NULL);
     if (crtc->scanout_pixmap) {
-        master->StopPixmapTracking(mscreenpix, crtc->scanout_pixmap);
-        /*
-         * Unref the pixmap twice: once for the original reference, and once
-         * for the reference implicitly added by PixmapShareToSlave.
-         */
-        master->DestroyPixmap(crtc->scanout_pixmap->master_pixmap);
-        master->DestroyPixmap(crtc->scanout_pixmap->master_pixmap);
-        crtc->pScreen->DestroyPixmap(crtc->scanout_pixmap);
+        rrDestroySharedPixmap(crtc, crtc->scanout_pixmap);
     }
     crtc->scanout_pixmap = NULL;
     RRCrtcChanged(crtc, TRUE);


More information about the xorg-commit mailing list