[Mesa-dev,13/15] egl: add new platform functions

Submitted by Marek Olšák on May 28, 2015, 12:28 p.m.

Details

Message ID CAAxE2A4R2ZdJKAJuRqTQu_tddk3KEe0PngtmZL=4UgYeuGWE7g@mail.gmail.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Marek Olšák May 28, 2015, 12:28 p.m.
A new patch is attached. Please review.

Marek

On Wed, May 13, 2015 at 12:54 AM, Marek Olšák <maraeo@gmail.com> wrote:
> From: Marek Olšák <marek.olsak@amd.com>
>
> These are just wrappers around the existing extension functions.
> ---
>  src/egl/main/eglapi.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 45 insertions(+)
>
> diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
> index 34a113b..e3b8ec2 100644
> --- a/src/egl/main/eglapi.c
> +++ b/src/egl/main/eglapi.c
> @@ -325,6 +325,18 @@ eglGetPlatformDisplayEXT(EGLenum platform, void *native_display,
>     return _eglGetDisplayHandle(dpy);
>  }
>
> +EGLDisplay EGLAPIENTRY
> +eglGetPlatformDisplay(EGLenum platform, void *native_display,
> +                      const EGLAttrib *attrib_list)
> +{
> +   EGLDisplay display;
> +   EGLint *int_attribs = _eglConvertAttribsToInt(attrib_list);
> +
> +   display = eglGetPlatformDisplayEXT(platform, native_display, int_attribs);
> +   free(int_attribs);
> +   return display;
> +}
> +
>  /**
>   * Copy the extension into the string and update the string pointer.
>   */
> @@ -752,6 +764,21 @@ eglCreatePlatformWindowSurfaceEXT(EGLDisplay dpy, EGLConfig config,
>  }
>
>
> +EGLSurface EGLAPIENTRY
> +eglCreatePlatformWindowSurface(EGLDisplay dpy, EGLConfig config,
> +                               void *native_window,
> +                               const EGLAttrib *attrib_list)
> +{
> +   EGLSurface surface;
> +   EGLint *int_attribs = _eglConvertAttribsToInt(attrib_list);
> +
> +   surface = eglCreatePlatformWindowSurfaceEXT(dpy, config, native_window,
> +                                               int_attribs);
> +   free(int_attribs);
> +   return surface;
> +}
> +
> +
>  static EGLSurface
>  _eglCreatePixmapSurfaceCommon(_EGLDisplay *disp, EGLConfig config,
>                                void *native_pixmap, const EGLint *attrib_list)
> @@ -806,6 +833,21 @@ eglCreatePlatformPixmapSurfaceEXT(EGLDisplay dpy, EGLConfig config,
>
>
>  EGLSurface EGLAPIENTRY
> +eglCreatePlatformPixmapSurface(EGLDisplay dpy, EGLConfig config,
> +                               void *native_pixmap,
> +                               const EGLAttrib *attrib_list)
> +{
> +   EGLSurface surface;
> +   EGLint *int_attribs = _eglConvertAttribsToInt(attrib_list);
> +
> +   surface = eglCreatePlatformPixmapSurfaceEXT(dpy, config, native_pixmap,
> +                                               int_attribs);
> +   free(int_attribs);
> +   return surface;
> +}
> +
> +
> +EGLSurface EGLAPIENTRY
>  eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config,
>                          const EGLint *attrib_list)
>  {
> @@ -1188,6 +1230,9 @@ eglGetProcAddress(const char *procname)
>        { "eglGetSyncAttrib", (_EGLProc) eglGetSyncAttrib },
>        { "eglCreateImage", (_EGLProc) eglCreateImage },
>        { "eglDestroyImage", (_EGLProc) eglDestroyImage },
> +      { "eglGetPlatformDisplay", (_EGLProc) eglGetPlatformDisplay },
> +      { "eglCreatePlatformWindowSurface", (_EGLProc) eglCreatePlatformWindowSurface },
> +      { "eglCreatePlatformPixmapSurface", (_EGLProc) eglCreatePlatformPixmapSurface },
>        { "eglWaitSync", (_EGLProc) eglWaitSync },
>  #endif /* _EGL_GET_CORE_ADDRESSES */
>  #ifdef EGL_MESA_drm_display
> --
> 2.1.0
>

Patch hide | download patch | download mbox

From e97b020d22500f6876563e62076a9ee80622f395 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= <marek.olsak@amd.com>
Date: Tue, 12 May 2015 21:06:41 +0200
Subject: [PATCH 2/2] egl: add new platform functions (v2)

These are just wrappers around the existing extension functions.

v2: return BAD_ALLOC if _eglConvertAttribsToInt fails
---
 src/egl/main/eglapi.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index e4fd44e..b9e37c4 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -326,6 +326,21 @@  eglGetPlatformDisplayEXT(EGLenum platform, void *native_display,
    return _eglGetDisplayHandle(dpy);
 }
 
+EGLDisplay EGLAPIENTRY
+eglGetPlatformDisplay(EGLenum platform, void *native_display,
+                      const EGLAttrib *attrib_list)
+{
+   EGLDisplay display;
+   EGLint *int_attribs = _eglConvertAttribsToInt(attrib_list);
+
+   if (attrib_list && !int_attribs)
+      RETURN_EGL_ERROR(NULL, EGL_BAD_ALLOC, NULL);
+
+   display = eglGetPlatformDisplayEXT(platform, native_display, int_attribs);
+   free(int_attribs);
+   return display;
+}
+
 /**
  * Copy the extension into the string and update the string pointer.
  */
@@ -752,6 +767,24 @@  eglCreatePlatformWindowSurfaceEXT(EGLDisplay dpy, EGLConfig config,
 }
 
 
+EGLSurface EGLAPIENTRY
+eglCreatePlatformWindowSurface(EGLDisplay dpy, EGLConfig config,
+                               void *native_window,
+                               const EGLAttrib *attrib_list)
+{
+   EGLSurface surface;
+   EGLint *int_attribs = _eglConvertAttribsToInt(attrib_list);
+
+   if (attrib_list && !int_attribs)
+      RETURN_EGL_ERROR(NULL, EGL_BAD_ALLOC, EGL_NO_SURFACE);
+
+   surface = eglCreatePlatformWindowSurfaceEXT(dpy, config, native_window,
+                                               int_attribs);
+   free(int_attribs);
+   return surface;
+}
+
+
 static EGLSurface
 _eglCreatePixmapSurfaceCommon(_EGLDisplay *disp, EGLConfig config,
                               void *native_pixmap, const EGLint *attrib_list)
@@ -806,6 +839,24 @@  eglCreatePlatformPixmapSurfaceEXT(EGLDisplay dpy, EGLConfig config,
 
 
 EGLSurface EGLAPIENTRY
+eglCreatePlatformPixmapSurface(EGLDisplay dpy, EGLConfig config,
+                               void *native_pixmap,
+                               const EGLAttrib *attrib_list)
+{
+   EGLSurface surface;
+   EGLint *int_attribs = _eglConvertAttribsToInt(attrib_list);
+
+   if (attrib_list && !int_attribs)
+      RETURN_EGL_ERROR(NULL, EGL_BAD_ALLOC, EGL_NO_SURFACE);
+
+   surface = eglCreatePlatformPixmapSurfaceEXT(dpy, config, native_pixmap,
+                                               int_attribs);
+   free(int_attribs);
+   return surface;
+}
+
+
+EGLSurface EGLAPIENTRY
 eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config,
                         const EGLint *attrib_list)
 {
@@ -1794,6 +1845,9 @@  eglGetProcAddress(const char *procname)
       { "eglWaitSync", (_EGLProc) eglWaitSync },
       { "eglCreateImage", (_EGLProc) eglCreateImage },
       { "eglDestroyImage", (_EGLProc) eglDestroyImage },
+      { "eglGetPlatformDisplay", (_EGLProc) eglGetPlatformDisplay },
+      { "eglCreatePlatformWindowSurface", (_EGLProc) eglCreatePlatformWindowSurface },
+      { "eglCreatePlatformPixmapSurface", (_EGLProc) eglCreatePlatformPixmapSurface },
 #ifdef EGL_MESA_drm_display
       { "eglGetDRMDisplayMESA", (_EGLProc) eglGetDRMDisplayMESA },
 #endif
-- 
2.1.0


Comments

On Thu 28 May 2015, Marek Olšák wrote:
> A new patch is attached. Please review.
> 

Looks good to me.
Reviewed-by: Chad Versace <chad.versace@intel.com>

Later, if and when some platform extension defines a pointer-sized
attribute, then we will need to invert the function order. That is,
eglGetPlatformDisplayEXT will then need to be a wrapper around
eglGetPlatformDisplay. But this patch's approach is fine for now.