[Mesa-dev] [RFC v3 03/23] egl: Add EGL_EXT_image_implicit_sync_control

Louis-Francis Ratté-Boulianne lfrb at collabora.com
Thu Sep 28 07:54:43 UTC 2017


From: Daniel Stone <daniels at collabora.com>

Signed-off-by: Daniel Stone <daniels at collabora.com>
---
 src/egl/main/eglapi.c     |  1 +
 src/egl/main/egldisplay.h |  1 +
 src/egl/main/eglimage.c   | 26 ++++++++++++++++++++++++++
 src/egl/main/eglimage.h   |  3 +++
 4 files changed, 31 insertions(+)

diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 4a9b3fe392..41a2a1a9d8 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -488,6 +488,7 @@ _eglCreateExtensionsString(_EGLDisplay *dpy)
    _EGL_CHECK_EXTENSION(EXT_create_context_robustness);
    _EGL_CHECK_EXTENSION(EXT_image_dma_buf_import);
    _EGL_CHECK_EXTENSION(EXT_image_dma_buf_import_modifiers);
+   _EGL_CHECK_EXTENSION(EXT_image_implicit_sync_control);
    _EGL_CHECK_EXTENSION(EXT_swap_buffers_with_damage);
 
    _EGL_CHECK_EXTENSION(KHR_cl_event2);
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index 9a0b9b672a..93ef8739c6 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -103,6 +103,7 @@ struct _egl_extensions
    EGLBoolean EXT_create_context_robustness;
    EGLBoolean EXT_image_dma_buf_import;
    EGLBoolean EXT_image_dma_buf_import_modifiers;
+   EGLBoolean EXT_image_implicit_sync_control;
    EGLBoolean EXT_swap_buffers_with_damage;
 
    EGLBoolean KHR_cl_event2;
diff --git a/src/egl/main/eglimage.c b/src/egl/main/eglimage.c
index 46bf0c50f0..cc55accdae 100644
--- a/src/egl/main/eglimage.c
+++ b/src/egl/main/eglimage.c
@@ -265,6 +265,28 @@ _eglParseEXTImageDmaBufImportModifiersAttribs(_EGLImageAttribs *attrs,
    return EGL_SUCCESS;
 }
 
+static EGLint
+_eglParseEXTImageImplicitSyncControlAttribs(_EGLImageAttribs *attrs,
+                                            _EGLDisplay *dpy,
+                                            EGLint attr, EGLint val)
+{
+   if (!dpy->Extensions.EXT_image_implicit_sync_control)
+      return EGL_BAD_PARAMETER;
+
+   switch (attr) {
+   case EGL_IMPORT_SYNC_TYPE_EXT:
+      if (val != EGL_IMPORT_IMPLICIT_SYNC_EXT &&
+          val != EGL_IMPORT_EXPLICIT_SYNC_EXT)
+         return EGL_BAD_ATTRIBUTE;
+      attrs->ExplicitSync = (val == EGL_IMPORT_EXPLICIT_SYNC_EXT);
+      break;
+   default:
+      return EGL_BAD_PARAMETER;
+   }
+
+   return EGL_SUCCESS;
+}
+
 /**
  * Parse the list of image attributes.
  *
@@ -313,6 +335,10 @@ _eglParseImageAttribList(_EGLImageAttribs *attrs, _EGLDisplay *dpy,
       if (err == EGL_SUCCESS)
          continue;
 
+      err = _eglParseEXTImageImplicitSyncControlAttribs(attrs, dpy, attr, val);
+      if (err == EGL_SUCCESS)
+         continue;
+
       return _eglError(err, __func__);
    }
 
diff --git a/src/egl/main/eglimage.h b/src/egl/main/eglimage.h
index 8751792132..0c3c861c0c 100644
--- a/src/egl/main/eglimage.h
+++ b/src/egl/main/eglimage.h
@@ -79,6 +79,9 @@ struct _egl_image_attribs
    struct _egl_image_attrib_int DMABufSampleRangeHint;
    struct _egl_image_attrib_int DMABufChromaHorizontalSiting;
    struct _egl_image_attrib_int DMABufChromaVerticalSiting;
+
+   /* EGL_EXT_image_implicit_sync_control */
+   EGLBoolean ExplicitSync;
 };
 
 /**
-- 
2.13.0



More information about the mesa-dev mailing list