diff options
author | Rob Clark <[email protected]> | 2016-11-18 08:39:33 -0500 |
---|---|---|
committer | Chad Versace <[email protected]> | 2016-12-01 10:57:35 -0800 |
commit | 0201f01dc4e903d9b60cbbf87fde3ffa7c76f248 (patch) | |
tree | a271c9cec3a1b31c72df49ffc50c8164ed25a374 /src/egl/main/eglsync.c | |
parent | 21b1acfcfe4e3dd5c1de225771ba1f284026fe72 (diff) |
egl: add EGL_ANDROID_native_fence_sync
With fixes from Chad squashed in, plus fixes for issues that Rafael
found while writing piglit tests.
Signed-off-by: Rob Clark <[email protected]>
Tested-by: Rafael Antognolli <[email protected]>
Reviewed-by: Chad Versace <[email protected]>
Tested-by: Chad Versace <[email protected]>
Diffstat (limited to 'src/egl/main/eglsync.c')
-rw-r--r-- | src/egl/main/eglsync.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/egl/main/eglsync.c b/src/egl/main/eglsync.c index 7b2c882d813..cb931b81682 100644 --- a/src/egl/main/eglsync.c +++ b/src/egl/main/eglsync.c @@ -59,6 +59,14 @@ _eglParseSyncAttribList(_EGLSync *sync, const EGLAttrib *attrib_list) err = EGL_BAD_ATTRIBUTE; } break; + case EGL_SYNC_NATIVE_FENCE_FD_ANDROID: + if (sync->Type == EGL_SYNC_NATIVE_FENCE_ANDROID) { + /* we take ownership of the native fd, so no dup(): */ + sync->SyncFd = val; + } else { + err = EGL_BAD_ATTRIBUTE; + } + break; default: err = EGL_BAD_ATTRIBUTE; break; @@ -83,6 +91,7 @@ _eglInitSync(_EGLSync *sync, _EGLDisplay *dpy, EGLenum type, _eglInitResource(&sync->Resource, sizeof(*sync), dpy); sync->Type = type; sync->SyncStatus = EGL_UNSIGNALED_KHR; + sync->SyncFd = EGL_NO_NATIVE_FENCE_FD_ANDROID; err = _eglParseSyncAttribList(sync, attrib_list); @@ -90,6 +99,12 @@ _eglInitSync(_EGLSync *sync, _EGLDisplay *dpy, EGLenum type, case EGL_SYNC_CL_EVENT_KHR: sync->SyncCondition = EGL_SYNC_CL_EVENT_COMPLETE_KHR; break; + case EGL_SYNC_NATIVE_FENCE_ANDROID: + if (sync->SyncFd == EGL_NO_NATIVE_FENCE_FD_ANDROID) + sync->SyncCondition = EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR; + else + sync->SyncCondition = EGL_SYNC_NATIVE_FENCE_SIGNALED_ANDROID; + break; default: sync->SyncCondition = EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR; } @@ -117,17 +132,20 @@ _eglGetSyncAttrib(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync, if (sync->SyncStatus != EGL_SIGNALED_KHR && (sync->Type == EGL_SYNC_FENCE_KHR || sync->Type == EGL_SYNC_CL_EVENT_KHR || - sync->Type == EGL_SYNC_REUSABLE_KHR)) + sync->Type == EGL_SYNC_REUSABLE_KHR || + sync->Type == EGL_SYNC_NATIVE_FENCE_ANDROID)) drv->API.ClientWaitSyncKHR(drv, dpy, sync, 0, 0); *value = sync->SyncStatus; break; case EGL_SYNC_CONDITION_KHR: if (sync->Type != EGL_SYNC_FENCE_KHR && - sync->Type != EGL_SYNC_CL_EVENT_KHR) + sync->Type != EGL_SYNC_CL_EVENT_KHR && + sync->Type != EGL_SYNC_NATIVE_FENCE_ANDROID) return _eglError(EGL_BAD_ATTRIBUTE, "eglGetSyncAttribKHR"); *value = sync->SyncCondition; break; + default: return _eglError(EGL_BAD_ATTRIBUTE, "eglGetSyncAttribKHR"); break; |