[Mesa-dev] [PATCH 07/10] egl/dri2: return the latest sync status in eglGetSyncAttribKHR

Marek Olšák maraeo at gmail.com
Tue Apr 14 15:19:52 PDT 2015


From: Marek Olšák <marek.olsak at amd.com>

---
 src/egl/main/eglsync.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/egl/main/eglsync.c b/src/egl/main/eglsync.c
index ae3af4f..413d24e 100644
--- a/src/egl/main/eglsync.c
+++ b/src/egl/main/eglsync.c
@@ -30,6 +30,7 @@
 
 #include "eglsync.h"
 #include "eglcurrent.h"
+#include "egldriver.h"
 #include "egllog.h"
 
 
@@ -144,13 +145,19 @@ _eglGetSyncAttribKHR(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync,
                      EGLint attribute, EGLint *value)
 {
    if (!value)
-      return _eglError(EGL_BAD_PARAMETER, "eglGetConfigs");
+      return _eglError(EGL_BAD_PARAMETER, "eglGetSyncAttribKHR");
 
    switch (attribute) {
    case EGL_SYNC_TYPE_KHR:
       *value = sync->Type;
       break;
    case EGL_SYNC_STATUS_KHR:
+      /* update the sync status */
+      if (sync->SyncStatus != EGL_SIGNALED_KHR &&
+          (sync->Type == EGL_SYNC_FENCE_KHR ||
+           sync->Type == EGL_SYNC_CL_EVENT_KHR))
+         drv->API.ClientWaitSyncKHR(drv, dpy, sync, 0, 0);
+
       *value = sync->SyncStatus;
       break;
    case EGL_SYNC_CONDITION_KHR:
-- 
2.1.0



More information about the mesa-dev mailing list