[03/16] egl: Add EGL_EXT_image_implicit_sync_control

Submitted by Jason Ekstrand on Feb. 9, 2018, 11:43 p.m.

Details

Message ID 1518219812-31776-4-git-send-email-jason.ekstrand@intel.com
State New
Headers show
Series "Modifiers for EGL, GLX, and Vulkan WSI on Intel" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Jason Ekstrand Feb. 9, 2018, 11:43 p.m.
From: Daniel Stone <daniels@collabora.com>

Signed-off-by: Daniel Stone <daniels@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(+)

Patch hide | download patch | download mbox

diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index c110349..4645221 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(IMG_context_priority);
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index d7e5199..f38ed06 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -104,6 +104,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_pixel_format_float;
    EGLBoolean EXT_swap_buffers_with_damage;
 
diff --git a/src/egl/main/eglimage.c b/src/egl/main/eglimage.c
index 46bf0c5..cc55acc 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 8751792..0c3c861 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;
 };
 
 /**

Comments

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>

On Fri, Feb 9, 2018 at 3:43 PM, Jason Ekstrand <jason@jlekstrand.net> wrote:

> From: Daniel Stone <daniels@collabora.com>
>
> Signed-off-by: Daniel Stone <daniels@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 c110349..4645221 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(IMG_context_priority);
> diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
> index d7e5199..f38ed06 100644
> --- a/src/egl/main/egldisplay.h
> +++ b/src/egl/main/egldisplay.h
> @@ -104,6 +104,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_pixel_format_float;
>     EGLBoolean EXT_swap_buffers_with_damage;
>
> diff --git a/src/egl/main/eglimage.c b/src/egl/main/eglimage.c
> index 46bf0c5..cc55acc 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 8751792..0c3c861 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.5.0.400.gff86faf
>
>