Mesa (master): glx: Don't do the implicit glFlush in SwapBuffers if it' s the wrong drawable.

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


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

Author: Eric Anholt <eric at anholt.net>
Date:   Mon Feb 14 18:38:33 2011 -0800

glx: Don't do the implicit glFlush in SwapBuffers if it's the wrong drawable.

The GLX Spec says you only implicitly glFlush if the drawable being
swapped is the current context's drawable.

---

 src/glx/glxcmds.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
index 80eaf72..22bebab 100644
--- a/src/glx/glxcmds.c
+++ b/src/glx/glxcmds.c
@@ -727,11 +727,16 @@ glXSwapBuffers(Display * dpy, GLXDrawable drawable)
    xGLXSwapBuffersReq *req;
 #endif
 
+   gc = __glXGetCurrentContext();
+
 #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
    __GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable);
 
    if (pdraw != NULL) {
-      glFlush();
+      if (gc && drawable == gc->currentDrawable) {
+	 glFlush();
+      }
+
       (*pdraw->psc->driScreen->swapBuffers)(pdraw, 0, 0, 0);
       return;
    }
@@ -746,7 +751,6 @@ glXSwapBuffers(Display * dpy, GLXDrawable drawable)
     ** The calling thread may or may not have a current context.  If it
     ** does, send the context tag so the server can do a flush.
     */
-   gc = __glXGetCurrentContext();
    if ((gc != NULL) && (dpy == gc->currentDpy) &&
        ((drawable == gc->currentDrawable)
         || (drawable == gc->currentReadable))) {




More information about the mesa-commit mailing list