[xorg-x11-server/f18] fix prime offload with DRI2 compositors

Dave Airlie airlied at fedoraproject.org
Fri Sep 7 00:56:18 UTC 2012


commit 57b5b3a9fa3db9c90acdf8be966561bfcac819fb
Author: Dave Airlie <airlied at redhat.com>
Date:   Fri Sep 7 10:55:47 2012 +1000

    fix prime offload with DRI2 compositors

 ...-invalidate-drawable-after-sharing-pixmap.patch |  124 ++++++++++++++++++++
 xorg-x11-server.spec                               |    8 +-
 2 files changed, 131 insertions(+), 1 deletions(-)
---
diff --git a/0001-dri2-invalidate-drawable-after-sharing-pixmap.patch b/0001-dri2-invalidate-drawable-after-sharing-pixmap.patch
new file mode 100644
index 0000000..2aa77a3
--- /dev/null
+++ b/0001-dri2-invalidate-drawable-after-sharing-pixmap.patch
@@ -0,0 +1,124 @@
+From e6ca9179443dcdd16d0cbfb2a571a7a9fde56a25 Mon Sep 17 00:00:00 2001
+From: Dave Airlie <airlied at redhat.com>
+Date: Thu, 6 Sep 2012 16:33:54 +1000
+Subject: [PATCH] dri2: invalidate drawable after sharing pixmap
+
+After we share the pixmap, the backing storage may have changed,
+and we need to invalidate and buffers pointing at it.
+
+This fixes GL compositors and prime windows lacking contents initially.
+
+Signed-off-by: Dave Airlie <airlied at redhat.com>
+---
+ hw/xfree86/dri2/dri2.c | 74 ++++++++++++++++++++++++++++----------------------
+ 1 file changed, 42 insertions(+), 32 deletions(-)
+
+diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
+index 23f589c..40963c3 100644
+--- a/hw/xfree86/dri2/dri2.c
++++ b/hw/xfree86/dri2/dri2.c
+@@ -766,6 +766,44 @@ static inline PixmapPtr GetDrawablePixmap(DrawablePtr drawable)
+     }
+ }
+ 
++/*
++ * A TraverseTree callback to invalidate all windows using the same
++ * pixmap
++ */
++static int
++DRI2InvalidateWalk(WindowPtr pWin, pointer data)
++{
++    if (pWin->drawable.pScreen->GetWindowPixmap(pWin) != data)
++        return WT_DONTWALKCHILDREN;
++    DRI2InvalidateDrawable(&pWin->drawable);
++    return WT_WALKCHILDREN;
++}
++
++static void
++DRI2InvalidateDrawableAll(DrawablePtr pDraw)
++{
++    if (pDraw->type == DRAWABLE_WINDOW) {
++        WindowPtr pWin = (WindowPtr) pDraw;
++        PixmapPtr pPixmap = pDraw->pScreen->GetWindowPixmap(pWin);
++
++        /*
++         * Find the top-most window using this pixmap
++         */
++        while (pWin->parent &&
++               pDraw->pScreen->GetWindowPixmap(pWin->parent) == pPixmap)
++            pWin = pWin->parent;
++
++        /*
++         * Walk the sub-tree to invalidate all of the
++         * windows using the same pixmap
++         */
++        TraverseTree(pWin, DRI2InvalidateWalk, pPixmap);
++        DRI2InvalidateDrawable(&pPixmap->drawable);
++    }
++    else
++        DRI2InvalidateDrawable(pDraw);
++}
++
+ DrawablePtr DRI2UpdatePrime(DrawablePtr pDraw, DRI2BufferPtr pDest)
+ {
+     DRI2DrawablePtr pPriv = DRI2GetDrawable(pDraw);
+@@ -831,6 +869,8 @@ DrawablePtr DRI2UpdatePrime(DrawablePtr pDraw, DRI2BufferPtr pDest)
+     spix->screen_x = mpix->screen_x;
+     spix->screen_y = mpix->screen_y;
+ #endif
++
++    DRI2InvalidateDrawableAll(pDraw);
+     return &spix->drawable;
+ }
+ 
+@@ -1048,18 +1088,7 @@ DRI2WaitSwap(ClientPtr client, DrawablePtr pDrawable)
+     return FALSE;
+ }
+ 
+-/*
+- * A TraverseTree callback to invalidate all windows using the same
+- * pixmap
+- */
+-static int
+-DRI2InvalidateWalk(WindowPtr pWin, pointer data)
+-{
+-    if (pWin->drawable.pScreen->GetWindowPixmap(pWin) != data)
+-        return WT_DONTWALKCHILDREN;
+-    DRI2InvalidateDrawable(&pWin->drawable);
+-    return WT_WALKCHILDREN;
+-}
++
+ 
+ int
+ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
+@@ -1162,26 +1191,7 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
+      */
+     *swap_target = pPriv->swap_count + pPriv->swapsPending;
+ 
+-    if (pDraw->type == DRAWABLE_WINDOW) {
+-        WindowPtr pWin = (WindowPtr) pDraw;
+-        PixmapPtr pPixmap = pScreen->GetWindowPixmap(pWin);
+-
+-        /*
+-         * Find the top-most window using this pixmap
+-         */
+-        while (pWin->parent &&
+-               pScreen->GetWindowPixmap(pWin->parent) == pPixmap)
+-            pWin = pWin->parent;
+-
+-        /*
+-         * Walk the sub-tree to invalidate all of the
+-         * windows using the same pixmap
+-         */
+-        TraverseTree(pWin, DRI2InvalidateWalk, pPixmap);
+-        DRI2InvalidateDrawable(&pPixmap->drawable);
+-    }
+-    else
+-        DRI2InvalidateDrawable(pDraw);
++    DRI2InvalidateDrawableAll(pDraw);
+ 
+     return Success;
+ }
+-- 
+1.7.12
+
diff --git a/xorg-x11-server.spec b/xorg-x11-server.spec
index 994ada3..ab2835e 100644
--- a/xorg-x11-server.spec
+++ b/xorg-x11-server.spec
@@ -43,7 +43,7 @@
 Summary:   X.Org X11 X server
 Name:      xorg-x11-server
 Version:   1.12.99.905
-Release:   4%{?gitdate:.%{gitdate}}%{dist}
+Release:   5%{?gitdate:.%{gitdate}}%{dist}
 URL:       http://www.x.org
 License:   MIT
 Group:     User Interface/X
@@ -115,6 +115,9 @@ Patch7042: 0003-xf86-fix-multi-seat-video-device-support.patch
 # backport vt switch fix from list
 Patch7050: 0001-xf86-call-enter-leave-VT-for-gpu-screens-as-well.patch
 
+# backport dri2 drawable fix
+Patch7051: 0001-dri2-invalidate-drawable-after-sharing-pixmap.patch
+
 %global moduledir	%{_libdir}/xorg/modules
 %global drimoduledir	%{_libdir}/dri
 %global sdkdir		%{_includedir}/xorg
@@ -587,6 +590,9 @@ rm -rf $RPM_BUILD_ROOT
 %{xserver_source_dir}
 
 %changelog
+* Fri Sep 07 2012 Dave Airlie <airlied at redhat.com> 1.12.99.905-5
+- fix prime offload with DRI2 compositors
+
 * Mon Sep 03 2012 Dave Airlie <airlied at redhat.com> 1.12.99.905-4
 - fix multi-gpu after VT switch
 


More information about the scm-commits mailing list