summaryrefslogtreecommitdiffstats
path: root/src/egl/main/eglapi.c
diff options
context:
space:
mode:
authorEric Engestrom <[email protected]>2017-07-31 14:49:31 +0100
committerEric Engestrom <[email protected]>2017-08-01 17:36:57 +0100
commit2714a8f3e95139d2c473f99e913562929ae3f5d7 (patch)
tree7dafe8237011053b0d1c795e0d6a8657be9c16d8 /src/egl/main/eglapi.c
parent54826331b31d4cdcb3a7e444caf97b75c3364b54 (diff)
egl: deduplicate swap interval clamping logic
Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Daniel Stone <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
Diffstat (limited to 'src/egl/main/eglapi.c')
-rw-r--r--src/egl/main/eglapi.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 000368a46a1..c5e3955c48c 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -1201,7 +1201,17 @@ eglSwapInterval(EGLDisplay dpy, EGLint interval)
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);
}