aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChad Versace <[email protected]>2016-09-27 13:27:12 -0700
committerChad Versace <[email protected]>2016-10-04 14:11:28 -0700
commitf2c2f43d4ea2948e8fd9be1ab192664df262c0f4 (patch)
tree85d5c11af1a5768fca28f70447bb7f1b1fc73fb9
parent69adb9a778470b1717e619e38aebb47a28031756 (diff)
egl: Fix an error path in eglCreateSync*
When the user called eglCreateSync64KHR on a display without EGL_KHR_cl_event2 (the only extension that exposes it), we returned EGL_NO_SYNC but did not update the error code. We also did the same for eglCreateSync on a display without EGL 1.5. Reviewed-by: Emil Velikov <[email protected]>
-rw-r--r--src/egl/main/eglapi.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 44fc0b83fad..07f6794799a 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -1395,8 +1395,18 @@ _eglCreateSync(_EGLDisplay *disp, EGLenum type, const EGLint *attrib_list,
_EGL_CHECK_DISPLAY(disp, EGL_NO_SYNC_KHR, drv);
- if (!disp->Extensions.KHR_cl_event2 && is64)
- RETURN_EGL_EVAL(disp, EGL_NO_SYNC_KHR);
+ if (!disp->Extensions.KHR_cl_event2 && is64) {
+ /* There exist two EGLAttrib variants of eglCreateSync*:
+ * eglCreateSync64KHR which requires EGL_KHR_cl_event2, and eglCreateSync
+ * which requires EGL 1.5. Here we use the presence of EGL_KHR_cl_event2
+ * support as a proxy for EGL 1.5 support, even though that's not
+ * entirely correct (though _eglComputeVersion does the same).
+ *
+ * The EGL spec provides no guidance on how to handle unsupported
+ * functions. EGL_BAD_MATCH seems reasonable.
+ */
+ RETURN_EGL_ERROR(disp, EGL_BAD_MATCH, EGL_NO_SYNC_KHR);
+ }
/* return an error if the client API doesn't support GL_OES_EGL_sync */
if (!ctx || ctx->Resource.Display != disp ||