dri2: Don't call the dri2 flush hook for swapbuffers unless we have a context.
authorEric Anholt <eric@anholt.net>
Tue, 15 Feb 2011 03:03:37 +0000 (19:03 -0800)
committerEric Anholt <eric@anholt.net>
Sat, 26 Feb 2011 20:43:15 +0000 (12:43 -0800)
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

index a275ba5b9fe534f9df23c5b636911af1585204cd..2c28bc271500a47e13a945159b2fca76d16d2f34 100644 (file)
@@ -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 */