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

Chris Wilson chris at chris-wilson.co.uk
Wed Nov 2 07:06:21 UTC 2016


On Wed, Nov 02, 2016 at 12:14:32PM +0900, Michel Dänzer wrote:
> 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?

Hmm, I was thinking that it was overridden by the backend. It's not, so
yes we need to take some_draw->vtable->swap_interval() into account.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the mesa-dev mailing list