Mesa (master): egl: fix error handling in _eglCreateSync

Tapani Pälli tpalli at kemper.freedesktop.org
Thu Oct 27 05:48:42 UTC 2016


Module: Mesa
Branch: master
Commit: 6bf6fcfcd9a916530bfbd47351bd1f0df47c4a3d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6bf6fcfcd9a916530bfbd47351bd1f0df47c4a3d

Author: Tapani Pälli <tapani.palli at intel.com>
Date:   Tue Oct 25 11:29:53 2016 +0300

egl: fix error handling in _eglCreateSync

EGL specification requires context to be current only when sync
type matches EGL_SYNC_FENCE_KHR.

Fixes 25 failing dEQP tests:
   dEQP-EGL.functional.reusable_sync.*

Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98339
Reviewed-by: Eric Engestrom <eric.engestrom at imgtec.com>

---

 src/egl/main/eglapi.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 9db9964..04cac03 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -1605,9 +1605,16 @@ _eglCreateSync(_EGLDisplay *disp, EGLenum type, const EGLAttrib *attrib_list,
       RETURN_EGL_ERROR(disp, EGL_BAD_MATCH, EGL_NO_SYNC_KHR);
    }
 
+   /* If type is EGL_SYNC_FENCE and no context is current for the bound API
+    * (i.e., eglGetCurrentContext returns EGL_NO_CONTEXT ), an EGL_BAD_MATCH
+    * error is generated.
+    */
+   if (!ctx && type == EGL_SYNC_FENCE_KHR)
+      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 ||
-       ctx->ClientAPI != EGL_OPENGL_ES_API)
+   if (ctx && (ctx->Resource.Display != disp ||
+       ctx->ClientAPI != EGL_OPENGL_ES_API))
       RETURN_EGL_ERROR(disp, EGL_BAD_MATCH, EGL_NO_SYNC_KHR);
 
    switch (type) {




More information about the mesa-commit mailing list