[PATCH xserver 2/2] dri2: Invalidate DRI2 buffers for all windows with the same pixmap on swap.

Michel Dänzer michel at daenzer.net
Fri Mar 25 10:26:56 PDT 2011


From: Michel Dänzer <daenzer at vmware.com>

Without this, when a compositing manager unredirects a fullscreen window which
uses DRI2 and page flipping, the DRI2 buffer information for the compositing
manager's output window (typically the Composite Overlay Window or root window)
may become stale, resulting in all kinds of hilarity.

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=35452 .

Signed-off-by: Michel Dänzer <daenzer at vmware.com>
Reviewed-by: Ville Syrjälä <ville.syrjala at nokia.com>
Reviewed-by: Mario Kleiner <mario.kleiner at tuebingen.mpg.de>
---
 hw/xfree86/dri2/dri2.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index c9d8eac..c229959 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -815,6 +815,15 @@ DRI2WaitSwap(ClientPtr client, DrawablePtr pDrawable)
     return FALSE;
 }
 
+static int
+DRI2SwapWalk(WindowPtr pWin, pointer data)
+{
+    if (pWin->drawable.pScreen->GetWindowPixmap(pWin) == data)
+	DRI2InvalidateDrawable(&pWin->drawable);
+
+    return WT_WALKCHILDREN;
+}
+
 int
 DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
 		CARD64 divisor, CARD64 remainder, CARD64 *swap_target,
@@ -915,7 +924,14 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
      */
     *swap_target = pPriv->swap_count + pPriv->swapsPending;
 
-    DRI2InvalidateDrawable(pDraw);
+    if (pDraw->type == DRAWABLE_WINDOW) {
+	/* Invalidate DRI2 buffers for all windows with the same window pixmap
+	 * as this one.
+	 */
+	WalkTree(pScreen, DRI2SwapWalk,
+		 pScreen->GetWindowPixmap((WindowPtr)pDraw));
+    } else
+	DRI2InvalidateDrawable(pDraw);
 
     return Success;
 }
-- 
1.7.4.1



More information about the xorg-devel mailing list