Mesa (master): dri2: Don' t call the dri2 flush hook for swapbuffers unless we have a context.

Eric Anholt anholt at kemper.freedesktop.org
Sat Feb 26 22:07:31 UTC 2011


Module: Mesa
Branch: master
Commit: 74cde6505c233f388e902d1daa0e9f186dd012a9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=74cde6505c233f388e902d1daa0e9f186dd012a9

Author: Eric Anholt <eric at anholt.net>
Date:   Mon Feb 14 19:03:37 2011 -0800

dri2: Don't call the dri2 flush hook for swapbuffers unless we have a context.

The driver only has one reasonable place to look for its context to
flush anything, which is the current context.  Don't bother it with
having to check.

---

 src/glx/dri2_glx.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index a275ba5..2c28bc2 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -535,8 +535,13 @@ dri2SwapBuffers(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor,
     CARD64 ret = 0;
 
 #ifdef __DRI2_FLUSH
-    if (psc->f)
-    	(*psc->f->flush)(priv->driDrawable);
+    if (psc->f) {
+       struct glx_context *gc = __glXGetCurrentContext();
+
+       if (gc) {
+	  (*psc->f->flush)(priv->driDrawable);
+       }
+    }
 #endif
 
     /* Old servers don't send invalidate events */




More information about the mesa-commit mailing list