It adds TIZEN_image_native_surface extension string to _EGLExtensions.
And it adds a routine of creating an EGLImage from a tbm_surface.

  - section overview
    from 
https://www.khronos.org/registry/EGL/extensions/TIZEN/EGL_TIZEN_image_native_surface.txt

    "Tizen Buffer Manager (TBM) is a user space, generic memory management
     framework to create and share memory buffers between different system
     components. This extension enables using a Tizen Buffer Manager (TBM)
     surface object (struct tbm_surface_h) as an EGLImage source."

Signed-off-by: Mun Gwan-gyeong <elong...@gmail.com>
---
 src/egl/drivers/dri2/platform_tizen.c | 18 ++++++++++++++++++
 src/egl/main/eglapi.c                 |  2 ++
 src/egl/main/egldisplay.h             |  2 ++
 3 files changed, 22 insertions(+)

diff --git a/src/egl/drivers/dri2/platform_tizen.c 
b/src/egl/drivers/dri2/platform_tizen.c
index 3fe6cb504b..1efcb0e4fa 100644
--- a/src/egl/drivers/dri2/platform_tizen.c
+++ b/src/egl/drivers/dri2/platform_tizen.c
@@ -708,6 +708,20 @@ tizen_query_surface(_EGLDriver *drv, _EGLDisplay *dpy, 
_EGLSurface *surf,
    return _eglQuerySurface(drv, dpy, surf, attribute, value);
 }
 
+static _EGLImage *
+dri2_create_image_tizen_native_buffer(_EGLDisplay *disp,
+                                      _EGLContext *ctx,
+                                      tbm_surface_h tbm_surface)
+{
+   int fd;
+
+   fd = get_native_buffer_fd(tbm_surface);
+   if (fd >= 0)
+      return tizen_create_image_from_prime_fd(disp, ctx, tbm_surface, fd);
+
+   return tizen_create_image_from_name(disp, ctx, tbm_surface);
+}
+
 static _EGLImage *
 dri2_create_image_tizen_wl_buffer(_EGLDisplay *disp,
                                   _EGLContext *ctx,
@@ -735,6 +749,9 @@ tizen_create_image_khr(_EGLDriver *drv, _EGLDisplay *disp,
                        EGLClientBuffer buffer, const EGLint *attr_list)
 {
    switch (target) {
+   case EGL_NATIVE_SURFACE_TIZEN:
+      return dri2_create_image_tizen_native_buffer(disp, ctx,
+                                                   (tbm_surface_h)buffer);
    case EGL_WAYLAND_BUFFER_WL:
       return dri2_create_image_tizen_wl_buffer(disp, ctx, 
(tpl_handle_t)buffer);
    default:
@@ -1269,6 +1286,7 @@ dri2_initialize_tizen(_EGLDriver *drv, _EGLDisplay *dpy)
 
    dpy->Extensions.EXT_buffer_age = EGL_TRUE;
    dpy->Extensions.EXT_swap_buffers_with_damage = EGL_TRUE;
+   dpy->Extensions.TIZEN_image_native_surface = EGL_TRUE;
    dpy->Extensions.WL_bind_wayland_display = EGL_TRUE;
 
    drv->API.BindWaylandDisplayWL = tizen_bind_wayland_display_wl;
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 12e867ca72..1bcff72ae4 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -536,6 +536,8 @@ _eglCreateExtensionsString(_EGLDisplay *dpy)
 
    _EGL_CHECK_EXTENSION(NV_post_sub_buffer);
 
+   _EGL_CHECK_EXTENSION(TIZEN_image_native_surface);
+
    _EGL_CHECK_EXTENSION(WL_bind_wayland_display);
    _EGL_CHECK_EXTENSION(WL_create_wayland_buffer_from_image);
 
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index c009462b82..1ff7b5a2d5 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -133,6 +133,8 @@ struct _egl_extensions
 
    EGLBoolean NV_post_sub_buffer;
 
+   EGLBoolean TIZEN_image_native_surface;
+
    EGLBoolean WL_bind_wayland_display;
    EGLBoolean WL_create_wayland_buffer_from_image;
 };
-- 
2.14.1

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to