Mesa (7.9): glx: Invalidate buffers after binding a drawable

Kristian Høgsberg krh at kemper.freedesktop.org
Tue Sep 28 12:36:48 UTC 2010


Module: Mesa
Branch: 7.9
Commit: 7d154de04883c7b83dbc1a4619a1d6d8758dc07e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7d154de04883c7b83dbc1a4619a1d6d8758dc07e

Author: Kristian Høgsberg <krh at bitplanet.net>
Date:   Wed Sep 22 17:34:00 2010 -0400

glx: Invalidate buffers after binding a drawable

If the server doesn't send invalidate events, we may miss a
resize before the rendering starts.  Invalidate the buffers now
so the driver will recheck before rendering starts.

https://bugs.freedesktop.org/show_bug.cgi?id=29984
https://bugs.freedesktop.org/show_bug.cgi?id=30155

---

 src/glx/dri2_glx.c |   21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index 911298b..f6b3763 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -138,6 +138,7 @@ dri2_bind_context(struct glx_context *context, struct glx_context *old,
    struct dri2_context *pcp = (struct dri2_context *) context;
    struct dri2_screen *psc = (struct dri2_screen *) pcp->base.psc;
    struct dri2_drawable *pdraw, *pread;
+   struct dri2_display *pdp;
 
    pdraw = (struct dri2_drawable *) driFetchDrawable(context, draw);
    pread = (struct dri2_drawable *) driFetchDrawable(context, read);
@@ -145,11 +146,21 @@ dri2_bind_context(struct glx_context *context, struct glx_context *old,
    if (pdraw == NULL || pread == NULL)
       return GLXBadDrawable;
 
-   if ((*psc->core->bindContext) (pcp->driContext,
-				  pdraw->driDrawable, pread->driDrawable))
-      return Success;
+   if (!(*psc->core->bindContext) (pcp->driContext,
+				   pdraw->driDrawable, pread->driDrawable))
+      return GLXBadContext;
+
+   /* If the server doesn't send invalidate events, we may miss a
+    * resize before the rendering starts.  Invalidate the buffers now
+    * so the driver will recheck before rendering starts. */
+   pdp = (struct dri2_display *) psc->base.display;
+   if (!pdp->invalidateAvailable) {
+      dri2InvalidateBuffers(psc->base.dpy, pdraw->base.xDrawable);
+      if (pread != pdraw)
+	 dri2InvalidateBuffers(psc->base.dpy, pread->base.xDrawable);
+   }
 
-   return GLXBadContext;
+   return Success;
 }
 
 static void




More information about the mesa-commit mailing list