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

Michel Dänzer michel at daenzer.net
Wed Nov 2 03:14:32 UTC 2016


On 01/11/16 08:10 PM, Chris Wilson wrote:
> 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);

Shouldn't this depend on the drawable's current swap interval?


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer


More information about the mesa-dev mailing list