diff --git a/src/lib/evas/Evas_Legacy.h b/src/lib/evas/Evas_Legacy.h index 96088916fe..b200c2850f 100644 --- a/src/lib/evas/Evas_Legacy.h +++ b/src/lib/evas/Evas_Legacy.h @@ -3245,7 +3245,7 @@ EAPI void evas_object_image_memfile_set(Evas_Object *ob * Magic version number to know what the native surface struct looks like */ -#define EVAS_NATIVE_SURFACE_VERSION 3 +#define EVAS_NATIVE_SURFACE_VERSION 4 /** * Native surface types that image object supports @@ -3300,6 +3300,7 @@ typedef struct _Evas_Native_Surface { void *visual; /**< visual of the pixmap to use (Visual) */ unsigned long pixmap; /**< pixmap id to use (Pixmap) */ + unsigned int multiple_buffer; /**< From version 4. 1 if pixmap is multiple buffer pixmap such as named pixmap created by enlightenment. driver dependent. @since 1.19 */ } x11; /**< Set this struct fields if surface data is X11 based. */ struct diff --git a/src/modules/evas/engines/gl_x11/evas_engine.c b/src/modules/evas/engines/gl_x11/evas_engine.c index 34e04e5594..093a025170 100644 --- a/src/modules/evas/engines/gl_x11/evas_engine.c +++ b/src/modules/evas/engines/gl_x11/evas_engine.c @@ -2037,6 +2037,31 @@ _native_bind_cb(void *image) #ifdef GL_GLES if (n->ns_data.x11.surface) { + if (n->ns_data.x11.multiple_buffer) + { + EGLint err; + if (!glsym_eglDestroyImage || !glsym_eglCreateImage) + { + ERR("Try eglDestroyImage()/eglCreateImage() on EGL with no support"); + return; + } + + glsym_eglDestroyImage(im->native.disp, n->ns_data.x11.surface); + if ((err = eglGetError()) != EGL_SUCCESS) + { + ERR("eglDestroyImage() failed."); + glsym_evas_gl_common_error_set(err - EGL_SUCCESS); + } + + n->ns_data.x11.surface = glsym_eglCreateImage(im->native.disp, + EGL_NO_CONTEXT, + EGL_NATIVE_PIXMAP_KHR, + (void *)n->ns_data.x11.pixmap, + NULL); + if (!n->ns_data.x11.surface) + ERR("eglCreateImage() for Pixmap 0x%#lx failed: %#x", n->ns_data.x11.pixmap, eglGetError()); + + } if (glsym_glEGLImageTargetTexture2DOES) { glsym_glEGLImageTargetTexture2DOES(im->native.target, n->ns_data.x11.surface); @@ -2628,6 +2653,13 @@ eng_image_native_set(void *data, void *image, void *native) EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, (void *)pm, NULL); + + if ((ns->version < 4) || + ((ns->version == 4) && !(ns->data.x11.multiple_buffer == 1))) + n->ns_data.x11.multiple_buffer = 0; + else + n->ns_data.x11.multiple_buffer = 1; + if (!n->ns_data.x11.surface) { ERR("eglCreateImage() for Pixmap %#lx failed: %#x", pm, eglGetError()); diff --git a/src/modules/evas/engines/software_generic/evas_native_common.h b/src/modules/evas/engines/software_generic/evas_native_common.h index a13b7a0463..a3b721dc39 100644 --- a/src/modules/evas/engines/software_generic/evas_native_common.h +++ b/src/modules/evas/engines/software_generic/evas_native_common.h @@ -64,6 +64,7 @@ struct _Native void *buffer; void *config; /* egl configuration or glx configuration */ void *surface; /* egl surface or glx surface */ + unsigned char multiple_buffer : 1; /* whether pixmap is multiple buffer */ } x11; /**< Set this struct fields if surface data is SW X11 based. */ /* EVAS_NATIVE_SURFACE_WL */