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 <otaylor@fishsoup.net>
Cc: Robert Bragg <robert@linux.intel.com>
Reviewed-by: Robert Bragg <robert@sixbynine.org>
This commit is contained in:
Chris Wilson 2015-01-30 00:16:16 +00:00 committed by Robert Bragg
parent b9640c091f
commit 5ccd2825c7

View File

@ -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,