summaryrefslogtreecommitdiffstats
path: root/src/egl/main/eglsync.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/egl/main/eglsync.c')
-rw-r--r--src/egl/main/eglsync.c22
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;