egl: Add support for EGL_KHR_fence_sync.
authorChia-I Wu <olv@lunarg.com>
Sun, 15 Aug 2010 09:09:48 +0000 (17:09 +0800)
committerChia-I Wu <olv@lunarg.com>
Mon, 16 Aug 2010 16:06:19 +0000 (00:06 +0800)
Individual drivers still need to support and enable the extension.

src/egl/main/egldisplay.h
src/egl/main/eglmisc.c
src/egl/main/eglsync.c
src/egl/main/eglsync.h

index a5c14530676d5a5dc86b07b5ed51b1a84b57cddb..97c9d196ec4ad8a139185b1c34e9f50b9c73cf7b 100644 (file)
@@ -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;
index 2ef6ba59e3473209cd1feeb2c1f3bcd8284cd4cb..b10783bcb967b980d6807283e3dd2e5c4d6297e3 100644 (file)
@@ -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);
index 3f51e89acd609ef268236f7c581ebe640dbb7a31..b6c62d0087dac2001f45deea5b8851d85545bdaf 100644 (file)
@@ -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;
index a0134784aa29aefb8a1d675ccc5179832bcdb389..25c467175e97bcd7020ec1b609648f6e78bb2e8c 100644 (file)
@@ -19,6 +19,7 @@ struct _egl_sync
 
    EGLenum Type;
    EGLenum SyncStatus;
+   EGLenum SyncCondition;
 };