summaryrefslogtreecommitdiffstats
path: root/src/glx/dri2_glx.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2011-02-14 19:03:37 -0800
committerEric Anholt <[email protected]>2011-02-26 12:43:15 -0800
commit74cde6505c233f388e902d1daa0e9f186dd012a9 (patch)
tree6f2ddce1285570ca17492a5b21bde8733a41b15e /src/glx/dri2_glx.c
parent4d01bea808592aec74be2d2a4bbb6488b9299cda (diff)
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.
Diffstat (limited to 'src/glx/dri2_glx.c')
-rw-r--r--src/glx/dri2_glx.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index a275ba5b9fe..2c28bc27150 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 */