From 5ccd2825c724267d066c4e93190a4bec1ae0ced0 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 30 Jan 2015 00:16:16 +0000 Subject: [PATCH] glx: Precisely wait for the next vblank Currently the code queries the current msc then tries to approximate the value of the next msc satisfing the modulus 2 for when to wait. This introduces some instability as the msc may tick over during the roundtrip leading to a 32ms wait instead of a 16ms wait. This happens often enough to cause jerky animations, and affect gnome-shell-perf-tool. A simpler solution is just use a single roundtrip by using WaitForMsc to ask the driver to compute the next vblank itself. Cc: Owen W. Taylor Cc: Robert Bragg Reviewed-by: Robert Bragg --- cogl/winsys/cogl-winsys-glx.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cogl/winsys/cogl-winsys-glx.c b/cogl/winsys/cogl-winsys-glx.c index 0487b79fb..34fb0711f 100644 --- a/cogl/winsys/cogl-winsys-glx.c +++ b/cogl/winsys/cogl-winsys-glx.c @@ -1626,10 +1626,8 @@ _cogl_winsys_wait_for_vblank (CoglOnscreen *onscreen) int64_t msc; int64_t sbc; - glx_renderer->glXGetSyncValues (xlib_renderer->xdpy, drawable, - &ust, &msc, &sbc); glx_renderer->glXWaitForMsc (xlib_renderer->xdpy, drawable, - 0, 2, (msc + 1) % 2, + 0, 1, 0, &ust, &msc, &sbc); info->presentation_time = ust_to_nanoseconds (ctx->display->renderer, drawable,