[Mesa-dev] [PATCH] glx: Specify swap on the next vblank for glXSwapBuffers()

Chris Wilson chris at chris-wilson.co.uk
Tue Nov 1 11:10:27 UTC 2016


glXSwapBuffers() is translated internally into glXSwapBuffersMsc() with
a target and divisor of 0.

https://www.opengl.org/registry/specs/OML/glx_sync_control.txt

    "If <divisor> = 0, the swap will occur when MSC becomes greater than
    or equal to <target_msc>."

It does not require waiting until the next MSC, which is the commonly
expected behaviour of apps using glXSwapBuffers() when not overriding the
vblank_mode / swap_interval. To force the frame to be displayed on the
next vblank, we want to pass divisor 1 to the backend.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Adam Jackson <ajax at redhat.com>
---
 src/glx/glxcmds.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
index 6abe0b9..4e3f3f5 100644
--- a/src/glx/glxcmds.c
+++ b/src/glx/glxcmds.c
@@ -840,7 +840,7 @@ glXSwapBuffers(Display * dpy, GLXDrawable drawable)
       if (pdraw != NULL) {
          Bool flush = gc != &dummyContext && drawable == gc->currentDrawable;
 
-         (*pdraw->psc->driScreen->swapBuffers)(pdraw, 0, 0, 0, flush);
+         (*pdraw->psc->driScreen->swapBuffers)(pdraw, 0, 1, 0, flush);
          return;
       }
    }
-- 
2.10.2



More information about the mesa-dev mailing list