xserver: Branch 'master' - 4 commits

Keith Packard keithp at kemper.freedesktop.org
Mon Dec 19 22:33:12 PST 2011


 glx/glxdri2.c             |    2 +-
 hw/xfree86/dri2/dri2.c    |   36 ++++++++++++++++++++++++++++++++++--
 hw/xfree86/dri2/dri2.h    |    3 ++-
 hw/xfree86/dri2/dri2ext.c |    4 ++--
 4 files changed, 39 insertions(+), 6 deletions(-)

New commits:
commit 4df65d247b56c6b1b06e17a61236d6637312cdbb
Author: Ville Syrjälä <syrjala at sci.fi>
Date:   Sun Dec 18 18:29:41 2011 +0200

    dri2: Invalidate window pixmaps
    
    While a redirected window is flipped, its pixmap may still be used as
    and EGL image and should also get invalidated. When sending invalidate
    events for a window, also send the events for its pixmap.
    
    Signed-off-by: Ville Syrjälä <syrjala at sci.fi>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index 8187a3e..5e524db 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -423,7 +423,7 @@ __glXDRIscreenCreateContext(__GLXscreen *baseScreen,
 }
 
 static void
-__glXDRIinvalidateBuffers(DrawablePtr pDraw, void *priv)
+__glXDRIinvalidateBuffers(DrawablePtr pDraw, void *priv, XID id)
 {
 #if __DRI2_FLUSH_VERSION >= 3
     __GLXDRIdrawable *private = priv;
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 86e98a5..d6441a2 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -587,7 +587,7 @@ DRI2InvalidateDrawable(DrawablePtr pDraw)
     pPriv->needInvalidate = FALSE;
 
     list_for_each_entry(ref, &pPriv->reference_list, link)
-	ref->invalidate(pDraw, ref->priv);
+	ref->invalidate(pDraw, ref->priv, ref->id);
 }
 
 /*
@@ -958,6 +958,7 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
 	 * windows using the same pixmap
 	 */
 	TraverseTree(pWin, DRI2InvalidateWalk, pPixmap);
+	DRI2InvalidateDrawable(&pPixmap->drawable);
     } else
 	DRI2InvalidateDrawable(pDraw);
 
diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h
index 9c93209..a67e35f 100644
--- a/hw/xfree86/dri2/dri2.h
+++ b/hw/xfree86/dri2/dri2.h
@@ -166,7 +166,8 @@ typedef int		(*DRI2ScheduleWaitMSCProcPtr)(ClientPtr client,
 						      CARD64 remainder);
 
 typedef void		(*DRI2InvalidateProcPtr)(DrawablePtr pDraw,
-						 void *data);
+						 void *data,
+						 XID id);
 
 /**
  * DRI2 calls this hook when ever swap_limit is going to be changed. Default
diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c
index e612cf0..73ef7f2 100644
--- a/hw/xfree86/dri2/dri2ext.c
+++ b/hw/xfree86/dri2/dri2ext.c
@@ -156,13 +156,13 @@ ProcDRI2Authenticate(ClientPtr client)
 }
 
 static void
-DRI2InvalidateBuffersEvent(DrawablePtr pDraw, void *priv)
+DRI2InvalidateBuffersEvent(DrawablePtr pDraw, void *priv, XID id)
 {
     xDRI2InvalidateBuffers event;
     ClientPtr client = priv;
 
     event.type = DRI2EventBase + DRI2_InvalidateBuffers;
-    event.drawable = pDraw->id;
+    event.drawable = id;
 
     WriteEventsToClient(client, 1, (xEvent *)&event);
 }
commit e8fd23fad046877ca0ee08c1e147557756debc8e
Author: Keith Packard <keithp at keithp.com>
Date:   Sun Dec 18 18:29:40 2011 +0200

    dri2: Invalidate DRI2 buffers for all windows with the same pixmap on swap
    
    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 .
    
    [Original patch by Michel Dänzer <michel at daenzer.net>]
    [Tree walk optimized version by Keith Packard <keithp at keithp.com>]
    
    Signed-off-by: Ville Syrjälä <syrjala at sci.fi>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index eb84aa5..86e98a5 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -830,6 +830,19 @@ 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,
 		CARD64 divisor, CARD64 remainder, CARD64 *swap_target,
@@ -930,7 +943,23 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
      */
     *swap_target = pPriv->swap_count + pPriv->swapsPending;
 
-    DRI2InvalidateDrawable(pDraw);
+    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);
+    } else
+	DRI2InvalidateDrawable(pDraw);
 
     return Success;
 }
commit 6f916ffec7767eeab62132eb6575043969104c81
Author: Michel Dänzer <daenzer at vmware.com>
Date:   Sun Dec 18 18:29:39 2011 +0200

    dri2: Always re-generate front buffer information when asked for it.
    
    Otherwise we might keep stale cached information, e.g. after the driver
    performed page flipping.
    
    This is part of the fix for
    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>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index d2035a4..eb84aa5 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -377,6 +377,7 @@ allocate_or_reuse_buffer(DrawablePtr pDraw, DRI2ScreenPtr ds,
     int old_buf = find_attachment(pPriv, attachment);
 
     if ((old_buf < 0)
+	|| attachment == DRI2BufferFrontLeft
 	|| !dimensions_match
 	|| (pPriv->buffers[old_buf]->format != format)) {
 	*buffer = (*ds->CreateBuffer)(pDraw, attachment, format);
commit 603fcb3abf155e91fd3250f4a7aa16f289506e8e
Author: Rami Ylimäki <rami.ylimaki at vincit.fi>
Date:   Sun Dec 18 18:29:38 2011 +0200

    dri2: Initialize needInvalidate member of DRI2Drawable.
    
    If the client is not behaving correctly and swaps buffers before
    getting them, Valgrind will complain about uninitialized memory being
    used in DRI2InvalidateDrawable.
    
    Signed-off-by: Rami Ylimäki <rami.ylimaki at vincit.fi>
    Reviewed-by: Ville Syrjälä <syrjala at sci.fi>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 0d613be..d2035a4 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -181,6 +181,7 @@ DRI2AllocateDrawable(DrawablePtr pDraw)
     pPriv->last_swap_ust = 0;
     list_init(&pPriv->reference_list);
     pPriv->serialNumber = DRI2DrawableSerial(pDraw);
+    pPriv->needInvalidate = FALSE;
 
     if (pDraw->type == DRAWABLE_WINDOW) {
 	pWin = (WindowPtr) pDraw;


More information about the xorg-commit mailing list