HAS_RGB565 = 4,
};
-static EGLBoolean
-dri2_wl_swap_interval(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf,
- EGLint interval);
-
static int
roundtrip(struct dri2_egl_display *dri2_dpy)
{
goto cleanup_surf;
}
- dri2_wl_swap_interval(drv, disp, &dri2_surf->base,
- dri2_dpy->default_swap_interval);
+ dri2_surf->base.SwapInterval = dri2_dpy->default_swap_interval;
return &dri2_surf->base;
_EGLSurface *surf,
EGLint interval)
{
- if (interval > surf->Config->MaxSwapInterval)
- interval = surf->Config->MaxSwapInterval;
- else if (interval < surf->Config->MinSwapInterval)
- interval = surf->Config->MinSwapInterval;
-
- surf->SwapInterval = interval;
-
return EGL_TRUE;
}
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;
}
if (_eglGetSurfaceHandle(surf) == EGL_NO_SURFACE)
RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE);
- ret = drv->API.SwapInterval(drv, disp, surf, interval);
+ interval = CLAMP(interval,
+ surf->Config->MinSwapInterval,
+ surf->Config->MaxSwapInterval);
+
+ if (surf->SwapInterval != interval)
+ ret = drv->API.SwapInterval(drv, disp, surf, interval);
+ else
+ ret = EGL_TRUE;
+
+ if (ret)
+ surf->SwapInterval = interval;
RETURN_EGL_EVAL(disp, ret);
}
#include "eglsurface.h"
-static void
-_eglClampSwapInterval(_EGLSurface *surf, EGLint interval)
-{
- EGLint bound = surf->Config->MaxSwapInterval;
- if (interval >= bound) {
- interval = bound;
- }
- else {
- bound = surf->Config->MinSwapInterval;
- if (interval < bound)
- interval = bound;
- }
- surf->SwapInterval = interval;
-}
-
-
/**
* Parse the list of surface attributes and return the proper error code.
*/
surf->BufferAgeRead = EGL_FALSE;
/* the default swap interval is 1 */
- _eglClampSwapInterval(surf, 1);
+ surf->SwapInterval = 1;
err = _eglParseSurfaceAttribList(surf, attrib_list);
if (err != EGL_SUCCESS)
_eglSwapInterval(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
EGLint interval)
{
- _eglClampSwapInterval(surf, interval);
return EGL_TRUE;
}