From 2b2c5c4f5cb4620044eeaa7cc308e696209c7046 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sun, 15 Aug 2010 17:09:48 +0800 Subject: egl: Add support for EGL_KHR_fence_sync. Individual drivers still need to support and enable the extension. --- src/egl/main/egldisplay.h | 1 + src/egl/main/eglmisc.c | 1 + src/egl/main/eglsync.c | 9 ++++++++- src/egl/main/eglsync.h | 1 + 4 files changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h index a5c14530676..97c9d196ec4 100644 --- a/src/egl/main/egldisplay.h +++ b/src/egl/main/egldisplay.h @@ -64,6 +64,7 @@ struct _egl_extensions EGLBoolean KHR_gl_renderbuffer_image; EGLBoolean KHR_reusable_sync; + EGLBoolean KHR_fence_sync; EGLBoolean KHR_surfaceless_gles1; EGLBoolean KHR_surfaceless_gles2; diff --git a/src/egl/main/eglmisc.c b/src/egl/main/eglmisc.c index 2ef6ba59e34..b10783bcb96 100644 --- a/src/egl/main/eglmisc.c +++ b/src/egl/main/eglmisc.c @@ -98,6 +98,7 @@ _eglUpdateExtensionsString(_EGLDisplay *dpy) _EGL_CHECK_EXTENSION(KHR_gl_renderbuffer_image); _EGL_CHECK_EXTENSION(KHR_reusable_sync); + _EGL_CHECK_EXTENSION(KHR_fence_sync); _EGL_CHECK_EXTENSION(KHR_surfaceless_gles1); _EGL_CHECK_EXTENSION(KHR_surfaceless_gles2); diff --git a/src/egl/main/eglsync.c b/src/egl/main/eglsync.c index 3f51e89acd6..b6c62d0087d 100644 --- a/src/egl/main/eglsync.c +++ b/src/egl/main/eglsync.c @@ -46,7 +46,8 @@ _eglInitSync(_EGLSync *sync, _EGLDisplay *dpy, EGLenum type, { EGLint err; - if (!(type == EGL_SYNC_REUSABLE_KHR && dpy->Extensions.KHR_reusable_sync)) + if (!(type == EGL_SYNC_REUSABLE_KHR && dpy->Extensions.KHR_reusable_sync) && + !(type == EGL_SYNC_FENCE_KHR && dpy->Extensions.KHR_fence_sync)) return _eglError(EGL_BAD_ATTRIBUTE, "eglCreateSyncKHR"); memset(sync, 0, sizeof(*sync)); @@ -55,6 +56,7 @@ _eglInitSync(_EGLSync *sync, _EGLDisplay *dpy, EGLenum type, sync->Type = type; sync->SyncStatus = EGL_UNSIGNALED_KHR; + sync->SyncCondition = EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR; err = _eglParseSyncAttribList(sync, attrib_list); if (err != EGL_SUCCESS) @@ -109,6 +111,11 @@ _eglGetSyncAttribKHR(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync, case EGL_SYNC_STATUS_KHR: *value = sync->SyncStatus; break; + case EGL_SYNC_CONDITION_KHR: + if (sync->Type != EGL_SYNC_FENCE_KHR) + return _eglError(EGL_BAD_ATTRIBUTE, "eglGetSyncAttribKHR"); + *value = sync->SyncCondition; + break; default: return _eglError(EGL_BAD_ATTRIBUTE, "eglGetSyncAttribKHR"); break; diff --git a/src/egl/main/eglsync.h b/src/egl/main/eglsync.h index a0134784aa2..25c467175e9 100644 --- a/src/egl/main/eglsync.h +++ b/src/egl/main/eglsync.h @@ -19,6 +19,7 @@ struct _egl_sync EGLenum Type; EGLenum SyncStatus; + EGLenum SyncCondition; }; -- cgit v1.2.3