From 9eefb3ea8958bf58b6c4a0212a34a194bbc2ce4c Mon Sep 17 00:00:00 2001 From: Gwanglim Lee Date: Tue, 2 Dec 2014 22:45:36 +0900 Subject: [PATCH] Evas GL: Add support for bind_wayland_display extension This provides EGL_WL_bind_wayland_display EGL extension to bind and unbind the wl_display of a wayland server to an EGLDisplay. @feature --- src/lib/evas/Evas_GL.h | 21 +++++++++++++++ .../evas/engines/gl_common/evas_gl_api_ext.c | 27 +++++++++++++++++++ .../engines/gl_common/evas_gl_api_ext_def.h | 26 ++++++++++++++++++ 3 files changed, 74 insertions(+) diff --git a/src/lib/evas/Evas_GL.h b/src/lib/evas/Evas_GL.h index eb55d081e2..d9ee6225c2 100644 --- a/src/lib/evas/Evas_GL.h +++ b/src/lib/evas/Evas_GL.h @@ -4123,6 +4123,27 @@ EvasGLImage *img = glapi->evasglCreateImageForContext int (*evasglWaitSync) (Evas_GL *evas_gl, EvasGLSync sync, int flags); /** @} */ + /** + * @name Evas GL Wayland functions + * @since 1.13 + * @{ */ + /** + * @anchor evasglBindWaylandDisplay + * @brief Requires the extension @c EGL_WL_bind_wayland_display, similar to eglBindWaylandDisplayWL. + */ + Eina_Bool (*evasglBindWaylandDisplay) (Evas_GL *evas_gl, void *wl_display); + /** + * @anchor evasglUnbindWaylandDisplay + * @brief Requires the extension @c EGL_WL_bind_wayland_display, similar to eglUnbindWaylandDisplayWL. + */ + Eina_Bool (*evasglUnbindWaylandDisplay) (Evas_GL *evas_gl, void *wl_display); + /** + * @anchor evasglQueryWaylandBuffer + * @brief Requires the extension @c EGL_WL_bind_wayland_display, similar to eglQueryWaylandBufferWL. + */ + Eina_Bool (*evasglQueryWaylandBuffer) (Evas_GL *evas_gl, void *buffer, int attribute, int *value); + /** @} */ + /* future calls will be added down here for expansion */ }; diff --git a/src/modules/evas/engines/gl_common/evas_gl_api_ext.c b/src/modules/evas/engines/gl_common/evas_gl_api_ext.c index 576718f7f1..206bd71353 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_api_ext.c +++ b/src/modules/evas/engines/gl_common/evas_gl_api_ext.c @@ -243,6 +243,33 @@ evgl_evasglWaitSync(Evas_GL *evas_gl EINA_UNUSED, return EXT_FUNC(eglWaitSyncKHR)(dpy, sync, flags); } +static Eina_Bool +evgl_evasglBindWaylandDisplay(Evas_GL *evas_gl EINA_UNUSED, + void *wl_display) +{ + EGLDisplay dpy = EGLDISPLAY_GET(); + if (!dpy) return EINA_FALSE; + return EXT_FUNC(eglBindWaylandDisplayWL)(dpy, wl_display); +} + +static Eina_Bool +evgl_evasglUnbindWaylandDisplay(Evas_GL *evas_gl EINA_UNUSED, + void *wl_display) +{ + EGLDisplay dpy = EGLDISPLAY_GET(); + if (!dpy) return EINA_FALSE; + return EXT_FUNC(eglUnbindWaylandDisplayWL)(dpy, wl_display); +} + +static Eina_Bool +evgl_evasglQueryWaylandBuffer(Evas_GL *evas_gl EINA_UNUSED, + void *buffer, int attribute, int *value) +{ + EGLDisplay dpy = EGLDISPLAY_GET(); + if (!dpy) return EINA_FALSE; + return EXT_FUNC(eglQueryWaylandBufferWL)(dpy, buffer, attribute, value); +} + #else #endif diff --git a/src/modules/evas/engines/gl_common/evas_gl_api_ext_def.h b/src/modules/evas/engines/gl_common/evas_gl_api_ext_def.h index 7c71ad25ca..879b367e8d 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_api_ext_def.h +++ b/src/modules/evas/engines/gl_common/evas_gl_api_ext_def.h @@ -1600,6 +1600,32 @@ _EVASGL_EXT_BEGIN(EGL_KHR_wait_sync) _EVASGL_EXT_END() +_EVASGL_EXT_BEGIN(EGL_WL_bind_wayland_display) + + _EVASGL_EXT_DRVNAME(EGL_WL_bind_wayland_display) + + _EVASGL_EXT_FUNCTION_PRIVATE_BEGIN(EGLBoolean, eglBindWaylandDisplayWL, (EGLDisplay dpy, struct wl_display *display)) + _EVASGL_EXT_FUNCTION_DRVFUNC_PROCADDR("eglBindWaylandDisplayWL") + _EVASGL_EXT_FUNCTION_PRIVATE_END() + _EVASGL_EXT_FUNCTION_PRIVATE_BEGIN(EGLBoolean, eglUnbindWaylandDisplayWL, (EGLDisplay dpy, struct wl_display *display)) + _EVASGL_EXT_FUNCTION_DRVFUNC_PROCADDR("eglUnbindWaylandDisplayWL") + _EVASGL_EXT_FUNCTION_PRIVATE_END() + _EVASGL_EXT_FUNCTION_PRIVATE_BEGIN(EGLBoolean, eglQueryWaylandBufferWL, (EGLDisplay dpy, struct wl_resource *buffer, EGLint attribute, EGLint *value)) + _EVASGL_EXT_FUNCTION_DRVFUNC_PROCADDR("eglQueryWaylandBufferWL") + _EVASGL_EXT_FUNCTION_PRIVATE_END() + + _EVASGL_EXT_FUNCTION_BEGIN(Eina_Bool, evasglBindWaylandDisplay, (Evas_GL *evas_gl, void *wl_display)) + _EVASGL_EXT_FUNCTION_DRVFUNC(evgl_evasglBindWaylandDisplay) + _EVASGL_EXT_FUNCTION_END() + _EVASGL_EXT_FUNCTION_BEGIN(Eina_Bool, evasglUnbindWaylandDisplay, (Evas_GL *evas_gl, void *wl_display)) + _EVASGL_EXT_FUNCTION_DRVFUNC(evgl_evasglUnbindWaylandDisplay) + _EVASGL_EXT_FUNCTION_END() + _EVASGL_EXT_FUNCTION_BEGIN(Eina_Bool, evasglQueryWaylandBuffer, (Evas_GL *evas_gl, void *buffer, int attribute, int *value)) + _EVASGL_EXT_FUNCTION_DRVFUNC(evgl_evasglQueryWaylandBuffer) + _EVASGL_EXT_FUNCTION_END() + +_EVASGL_EXT_END() + #if 0 _EVASGL_EXT_BEGIN(EGL_SEC_map_image)