[Mesa-dev] [RFC mesa 1/3] egl: deduplicate swap interval clamping logic
Eric Engestrom
eric at engestrom.ch
Tue Aug 1 07:59:17 UTC 2017
On Monday, 2017-07-31 17:07:56 +0000, Daniel Stone wrote:
> Hi Eric,
>
> On 31 July 2017 at 18:04, Eric Engestrom <eric.engestrom at imgtec.com> wrote:
> > @@ -956,16 +956,9 @@ dri2_x11_swap_interval(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf,
> > struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
> > struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf);
> >
> > - if (interval > surf->Config->MaxSwapInterval)
> > - interval = surf->Config->MaxSwapInterval;
> > - else if (interval < surf->Config->MinSwapInterval)
> > - interval = surf->Config->MinSwapInterval;
> > -
> > - if (interval != surf->SwapInterval && dri2_dpy->swap_available)
> > + if (dri2_dpy->swap_available)
> > xcb_dri2_swap_interval(dri2_dpy->conn, dri2_surf->drawable, interval);
> >
> > - surf->SwapInterval = interval;
> > -
> > return EGL_TRUE;
> > }
> >
> > diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
> > index 000368a46a..9ebc3670b4 100644
> > --- a/src/egl/main/eglapi.c
> > +++ b/src/egl/main/eglapi.c
> > @@ -1201,6 +1201,12 @@ eglSwapInterval(EGLDisplay dpy, EGLint interval)
> > if (_eglGetSurfaceHandle(surf) == EGL_NO_SURFACE)
> > RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE);
> >
> > + interval = CLAMP(interval,
> > + surf->Config->MinSwapInterval,
> > + surf->Config->MaxSwapInterval);
> > +
> > + surf->SwapInterval = interval;
> > +
> > ret = drv->API.SwapInterval(drv, disp, surf, interval);
>
> Should probably do what the X11 code did and only call into
> drv->API.SwapInterval() if the interval actually changed.
Yes of course, this is what I intended to do; I finished this in a rush
last night, and sent it just before leaving as an RFC, to be told if
I was doing something wrong.
I'll fix that up, polish&test, and send the "final" patches later today.
> That aside,
> for the series:
> Reviewed-by: Daniel Stone <daniels at collabora.com>
Thanks :)
>
> Cheers,
> Daniel
More information about the mesa-dev
mailing list