summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWonsik Jung <sidein@samsung.com>2016-01-05 16:41:14 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-01-05 17:01:45 +0900
commit7db9613e8c95268acfa6d51ea6aa45418ee8e697 (patch)
tree90c8b334eaef11377194911c3bfeac5a1ce02c7c
parentc1b4728487715c66120ed4c4d75065012bd42682 (diff)
Evas_Engine: add TBM surface and clean up Native Struct
Summary: Add TBM surface in wayland and clean up Native struct on Evas Engine. Previous TBM surface for evas_object_image's native_surface_set is only in Evas X11 backend. This patch has the code for wayland backend. In addition, evas_native_tbm.c is moved to software_generic. Becuase this file is common. And, Native in Evas_Engine is clean-up. @feature Test Plan: TBM surface is tested with spacegrapher's test app(tbm.c) in Tizen Device. Pixmap surface is tested in ubuntu with same test app. EvasGL is tested with elementary_test. Reviewers: jpeg, spacegrapher, raster, cedric Subscribers: dkdk, scholb.kim, JoogabYun Differential Revision: https://phab.enlightenment.org/D3501
-rw-r--r--src/Makefile_Evas.am21
-rw-r--r--src/modules/evas/engines/gl_drm/evas_engine.c28
-rw-r--r--src/modules/evas/engines/gl_x11/evas_engine.c157
-rw-r--r--src/modules/evas/engines/software_generic/evas_native_common.h82
-rw-r--r--src/modules/evas/engines/software_generic/evas_native_tbm.c (renamed from src/modules/evas/engines/software_x11/evas_native_tbm.c)89
-rw-r--r--src/modules/evas/engines/software_x11/evas_engine.c27
-rw-r--r--src/modules/evas/engines/software_x11/evas_engine.h1
-rw-r--r--src/modules/evas/engines/software_x11/evas_xcb_image.c22
-rw-r--r--src/modules/evas/engines/software_x11/evas_xcb_image.h12
-rw-r--r--src/modules/evas/engines/software_x11/evas_xlib_dri_image.c33
-rw-r--r--src/modules/evas/engines/software_x11/evas_xlib_image.c22
-rw-r--r--src/modules/evas/engines/software_x11/evas_xlib_image.h12
-rw-r--r--src/modules/evas/engines/wayland_shm/evas_engine.c91
13 files changed, 379 insertions, 218 deletions
diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am
index d5b3167d09..43f11d7e68 100644
--- a/src/Makefile_Evas.am
+++ b/src/Makefile_Evas.am
@@ -577,13 +577,12 @@ modules/evas/engines/software_generic/evas_ector_software_buffer.eo
577### Engines 577### Engines
578 578
579if EVAS_STATIC_BUILD_SOFTWARE_GENERIC 579if EVAS_STATIC_BUILD_SOFTWARE_GENERIC
580BUILT_SOURCES += \
581 modules/evas/engines/software_generic/evas_ector_software_buffer.eo.c \
582 modules/evas/engines/software_generic/evas_ector_software_buffer.eo.h
583lib_evas_libevas_la_SOURCES += \ 580lib_evas_libevas_la_SOURCES += \
584 modules/evas/engines/software_generic/evas_engine.c \ 581modules/evas/engines/software_generic/evas_engine.c \
585 modules/evas/engines/software_generic/Evas_Engine_Software_Generic.h \ 582modules/evas/engines/software_generic/Evas_Engine_Software_Generic.h \
586 modules/evas/engines/software_generic/evas_ector_software_buffer.c 583modules/evas/engines/software_generic/evas_native_tbm.c \
584modules/evas/engines/software_generic/evas_ector_software_buffer.c \
585modules/evas/engines/software_generic/evas_native_common.h
587lib_evas_libevas_la_LIBADD += 586lib_evas_libevas_la_LIBADD +=
588lib_evas_libevas_la_CPPFLAGS += -I$(top_srcdir)/src/lib/ector 587lib_evas_libevas_la_CPPFLAGS += -I$(top_srcdir)/src/lib/ector
589else 588else
@@ -595,7 +594,12 @@ enginesoftwaregenericpkg_LTLIBRARIES = modules/evas/engines/software_generic/mod
595install_enginesoftwaregenericpkgLTLIBRARIES = install-enginesoftwaregenericpkgLTLIBRARIES 594install_enginesoftwaregenericpkgLTLIBRARIES = install-enginesoftwaregenericpkgLTLIBRARIES
596$(install_enginesoftwaregenericpkgLTLIBRARIES): install-libLTLIBRARIES 595$(install_enginesoftwaregenericpkgLTLIBRARIES): install-libLTLIBRARIES
597 596
598modules_evas_engines_software_generic_module_la_SOURCES = modules/evas/engines/software_generic/evas_engine.c modules/evas/engines/software_generic/Evas_Engine_Software_Generic.h 597modules_evas_engines_software_generic_module_la_SOURCES = \
598modules/evas/engines/software_generic/evas_engine.c \
599modules/evas/engines/software_generic/Evas_Engine_Software_Generic.h \
600modules/evas/engines/software_generic/evas_native_tbm.c \
601modules/evas/engines/software_generic/evas_ector_software_buffer.c \
602modules/evas/engines/software_generic/evas_native_common.h
599modules_evas_engines_software_generic_module_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \ 603modules_evas_engines_software_generic_module_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
600-I$(top_srcdir)/src/lib/evas/include \ 604-I$(top_srcdir)/src/lib/evas/include \
601-I$(top_srcdir)/src/lib/evas/cserve2 \ 605-I$(top_srcdir)/src/lib/evas/cserve2 \
@@ -1075,8 +1079,7 @@ SOFTWARE_X11_SOURCES = \
1075modules/evas/engines/software_x11/evas_engine.c \ 1079modules/evas/engines/software_x11/evas_engine.c \
1076modules/evas/engines/software_x11/evas_engine.h \ 1080modules/evas/engines/software_x11/evas_engine.h \
1077modules/evas/engines/software_x11/evas_x_egl.c \ 1081modules/evas/engines/software_x11/evas_x_egl.c \
1078modules/evas/engines/software_x11/evas_x_egl.h \ 1082modules/evas/engines/software_x11/evas_x_egl.h
1079modules/evas/engines/software_x11/evas_native_tbm.c
1080SOFTWARE_X11_CPPFLAGS = -I$(top_builddir)/src/lib/efl \ 1083SOFTWARE_X11_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
1081-I$(top_srcdir)/src/lib/evas/include \ 1084-I$(top_srcdir)/src/lib/evas/include \
1082-I$(top_srcdir)/src/lib/evas/cserve2 \ 1085-I$(top_srcdir)/src/lib/evas/cserve2 \
diff --git a/src/modules/evas/engines/gl_drm/evas_engine.c b/src/modules/evas/engines/gl_drm/evas_engine.c
index 908dd2312c..bddaa7b0f9 100644
--- a/src/modules/evas/engines/gl_drm/evas_engine.c
+++ b/src/modules/evas/engines/gl_drm/evas_engine.c
@@ -1,6 +1,7 @@
1#include "config.h" 1#include "config.h"
2#include "evas_engine.h" 2#include "evas_engine.h"
3#include "../gl_common/evas_gl_define.h" 3#include "../gl_common/evas_gl_define.h"
4#include "../software_generic/evas_native_common.h"
4 5
5#include <wayland-client.h> 6#include <wayland-client.h>
6 7
@@ -27,15 +28,6 @@ int _extn_have_buffer_age = 1;
27static Eina_Bool initted = EINA_FALSE; 28static Eina_Bool initted = EINA_FALSE;
28static int gl_wins = 0; 29static int gl_wins = 0;
29 30
30/* local structures */
31typedef struct _Native Native;
32struct _Native
33{
34 Evas_Native_Surface ns;
35 struct wl_buffer *wl_buf;
36 void *egl_surface;
37};
38
39/* local function prototype types */ 31/* local function prototype types */
40typedef void (*_eng_fn)(void); 32typedef void (*_eng_fn)(void);
41typedef _eng_fn (*glsym_func_eng_fn)(); 33typedef _eng_fn (*glsym_func_eng_fn)();
@@ -627,11 +619,11 @@ _native_cb_bind(void *data EINA_UNUSED, void *image)
627 619
628 if (n->ns.type == EVAS_NATIVE_SURFACE_WL) 620 if (n->ns.type == EVAS_NATIVE_SURFACE_WL)
629 { 621 {
630 if (n->egl_surface) 622 if (n->ns_data.wl_surface.surface)
631 { 623 {
632 if (glsym_glEGLImageTargetTexture2DOES) 624 if (glsym_glEGLImageTargetTexture2DOES)
633 { 625 {
634 glsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, n->egl_surface); 626 glsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, n->ns_data.wl_surface.surface);
635 GLERRV("glsym_glEGLImageTargetTexture2DOES"); 627 GLERRV("glsym_glEGLImageTargetTexture2DOES");
636 } 628 }
637 else 629 else
@@ -680,13 +672,13 @@ _native_cb_free(void *data, void *image)
680 672
681 if (n->ns.type == EVAS_NATIVE_SURFACE_WL) 673 if (n->ns.type == EVAS_NATIVE_SURFACE_WL)
682 { 674 {
683 wlid = (void*)n->wl_buf; 675 wlid = (void*)n->ns_data.wl_surface.wl_buf;
684 eina_hash_del(ob->gl_context->shared->native_wl_hash, &wlid, img); 676 eina_hash_del(ob->gl_context->shared->native_wl_hash, &wlid, img);
685 if (n->egl_surface) 677 if (n->ns_data.wl_surface.surface)
686 { 678 {
687 if (glsym_eglDestroyImage) 679 if (glsym_eglDestroyImage)
688 { 680 {
689 glsym_eglDestroyImage(ob->egl.disp, n->egl_surface); 681 glsym_eglDestroyImage(ob->egl.disp, n->ns_data.wl_surface.surface);
690 if (eglGetError() != EGL_SUCCESS) 682 if (eglGetError() != EGL_SUCCESS)
691 ERR("eglDestroyImage() failed."); 683 ERR("eglDestroyImage() failed.");
692 } 684 }
@@ -1168,9 +1160,9 @@ eng_image_native_set(void *data, void *image, void *native)
1168 eina_hash_add(ob->gl_context->shared->native_wl_hash, 1160 eina_hash_add(ob->gl_context->shared->native_wl_hash,
1169 &wlid, img); 1161 &wlid, img);
1170 1162
1171 n->wl_buf = wl_buf; 1163 n->ns_data.wl_surface.wl_buf = wl_buf;
1172 if (glsym_eglCreateImage) 1164 if (glsym_eglCreateImage)
1173 n->egl_surface = glsym_eglCreateImage(ob->egl.disp, 1165 n->ns_data.wl_surface.surface = glsym_eglCreateImage(ob->egl.disp,
1174 NULL, 1166 NULL,
1175 EGL_WAYLAND_BUFFER_WL, 1167 EGL_WAYLAND_BUFFER_WL,
1176 wl_buf, attribs); 1168 wl_buf, attribs);
@@ -1184,7 +1176,7 @@ eng_image_native_set(void *data, void *image, void *native)
1184 return NULL; 1176 return NULL;
1185 } 1177 }
1186 1178
1187 if (!n->egl_surface) 1179 if (!n->ns_data.wl_surface.surface)
1188 { 1180 {
1189 ERR("eglCreatePixmapSurface() for %p failed", wl_buf); 1181 ERR("eglCreatePixmapSurface() for %p failed", wl_buf);
1190 eina_hash_del(ob->gl_context->shared->native_wl_hash, 1182 eina_hash_del(ob->gl_context->shared->native_wl_hash,
@@ -1221,7 +1213,7 @@ eng_image_native_set(void *data, void *image, void *native)
1221 eina_hash_add(ob->gl_context->shared->native_tex_hash, 1213 eina_hash_add(ob->gl_context->shared->native_tex_hash,
1222 &texid, img); 1214 &texid, img);
1223 1215
1224 n->egl_surface = 0; 1216 n->ns_data.opengl.surface = 0;
1225 1217
1226 img->native.yinvert = 0; 1218 img->native.yinvert = 0;
1227 img->native.loose = 0; 1219 img->native.loose = 0;
diff --git a/src/modules/evas/engines/gl_x11/evas_engine.c b/src/modules/evas/engines/gl_x11/evas_engine.c
index 84db094fc8..c94ab17756 100644
--- a/src/modules/evas/engines/gl_x11/evas_engine.c
+++ b/src/modules/evas/engines/gl_x11/evas_engine.c
@@ -1,6 +1,7 @@
1#include "evas_common_private.h" /* Also includes international specific stuff */ 1#include "evas_common_private.h" /* Also includes international specific stuff */
2#include "evas_engine.h" 2#include "evas_engine.h"
3#include "../gl_common/evas_gl_define.h" 3#include "../gl_common/evas_gl_define.h"
4#include "../software_generic/evas_native_common.h"
4 5
5#ifdef HAVE_DLSYM 6#ifdef HAVE_DLSYM
6# include <dlfcn.h> /* dlopen,dlclose,etc */ 7# include <dlfcn.h> /* dlopen,dlclose,etc */
@@ -2000,31 +2001,6 @@ end:
2000///////////////////////////////////////////////////////////////////////// 2001/////////////////////////////////////////////////////////////////////////
2001// 2002//
2002// 2003//
2003typedef struct _Native Native;
2004
2005struct _Native
2006{
2007 Evas_Native_Surface ns;
2008 Pixmap pixmap;
2009 Visual *visual;
2010 void *buffer;
2011
2012 void *config;
2013 void *surface;
2014#ifdef GL_GLES
2015# ifdef HAVE_WAYLAND
2016 void *wl_buf;
2017 void *egl_surface;
2018# endif
2019#endif
2020/*
2021#ifndef GL_GLES
2022 void *fbc;
2023 XID glx_pixmap;
2024#endif
2025*/
2026};
2027
2028// FIXME: this is enabled so updates happen - but its SLOOOOOOOOOOOOOOOW 2004// FIXME: this is enabled so updates happen - but its SLOOOOOOOOOOOOOOOW
2029// (i am sure this is the reason) not to mention seemingly superfluous. but 2005// (i am sure this is the reason) not to mention seemingly superfluous. but
2030// i need to enable it for it to work on fglrx at least. havent tried nvidia. 2006// i need to enable it for it to work on fglrx at least. havent tried nvidia.
@@ -2043,11 +2019,11 @@ _native_bind_cb(void *data EINA_UNUSED, void *image)
2043 if (n->ns.type == EVAS_NATIVE_SURFACE_X11) 2019 if (n->ns.type == EVAS_NATIVE_SURFACE_X11)
2044 { 2020 {
2045#ifdef GL_GLES 2021#ifdef GL_GLES
2046 if (n->surface) 2022 if (n->ns_data.x11.surface)
2047 { 2023 {
2048 if (glsym_glEGLImageTargetTexture2DOES) 2024 if (glsym_glEGLImageTargetTexture2DOES)
2049 { 2025 {
2050 glsym_glEGLImageTargetTexture2DOES(im->native.target, n->surface); 2026 glsym_glEGLImageTargetTexture2DOES(im->native.target, n->ns_data.x11.surface);
2051 GLERRV("glsym_glEGLImageTargetTexture2DOES"); 2027 GLERRV("glsym_glEGLImageTargetTexture2DOES");
2052 } 2028 }
2053 else 2029 else
@@ -2059,7 +2035,7 @@ _native_bind_cb(void *data EINA_UNUSED, void *image)
2059 2035
2060 if (glsym_glXBindTexImage) 2036 if (glsym_glXBindTexImage)
2061 { 2037 {
2062 glsym_glXBindTexImage(eng_get_ob(re)->disp, (XID)n->surface, 2038 glsym_glXBindTexImage(eng_get_ob(re)->disp, (XID)n->ns_data.x11.surface,
2063 GLX_FRONT_LEFT_EXT, NULL); 2039 GLX_FRONT_LEFT_EXT, NULL);
2064 GLERRV("glsym_glXBindTexImage"); 2040 GLERRV("glsym_glXBindTexImage");
2065 } 2041 }
@@ -2075,11 +2051,11 @@ _native_bind_cb(void *data EINA_UNUSED, void *image)
2075 else if (n->ns.type == EVAS_NATIVE_SURFACE_TBM) 2051 else if (n->ns.type == EVAS_NATIVE_SURFACE_TBM)
2076 { 2052 {
2077#ifdef GL_GLES 2053#ifdef GL_GLES
2078 if (n->surface) 2054 if (n->ns_data.tbm.surface)
2079 { 2055 {
2080 if (glsym_glEGLImageTargetTexture2DOES) 2056 if (glsym_glEGLImageTargetTexture2DOES)
2081 { 2057 {
2082 glsym_glEGLImageTargetTexture2DOES(im->native.target, n->surface); 2058 glsym_glEGLImageTargetTexture2DOES(im->native.target, n->ns_data.tbm.surface);
2083 GLERRV("glsym_glEGLImageTargetTexture2DOES"); 2059 GLERRV("glsym_glEGLImageTargetTexture2DOES");
2084 } 2060 }
2085 else 2061 else
@@ -2089,16 +2065,19 @@ _native_bind_cb(void *data EINA_UNUSED, void *image)
2089 } 2065 }
2090 else if (n->ns.type == EVAS_NATIVE_SURFACE_EVASGL) 2066 else if (n->ns.type == EVAS_NATIVE_SURFACE_EVASGL)
2091 { 2067 {
2092 if (n->surface) 2068 if (n->ns_data.evasgl.surface)
2093 { 2069 {
2094 Eina_Bool is_egl_image; 2070 Eina_Bool is_egl_image = EINA_FALSE;
2095 void *buffer = glsym_evgl_native_surface_buffer_get(n->surface, &is_egl_image); 2071 void *surface;
2072
2073 if (glsym_evgl_native_surface_buffer_get)
2074 surface = glsym_evgl_native_surface_buffer_get(n->ns_data.evasgl.surface, &is_egl_image);
2096 if (is_egl_image) 2075 if (is_egl_image)
2097 { 2076 {
2098#ifdef GL_GLES 2077#ifdef GL_GLES
2099 if (glsym_glEGLImageTargetTexture2DOES) 2078 if (glsym_glEGLImageTargetTexture2DOES)
2100 { 2079 {
2101 glsym_glEGLImageTargetTexture2DOES(im->native.target, buffer); 2080 glsym_glEGLImageTargetTexture2DOES(im->native.target, surface);
2102 GLERRV("glsym_glEGLImageTargetTexture2DOES"); 2081 GLERRV("glsym_glEGLImageTargetTexture2DOES");
2103 } 2082 }
2104 else 2083 else
@@ -2107,7 +2086,7 @@ _native_bind_cb(void *data EINA_UNUSED, void *image)
2107 } 2086 }
2108 else 2087 else
2109 { 2088 {
2110 glBindTexture(GL_TEXTURE_2D, (GLuint)(uintptr_t)buffer); 2089 glBindTexture(GL_TEXTURE_2D, (GLuint)(uintptr_t)surface);
2111 } 2090 }
2112 } 2091 }
2113 } 2092 }
@@ -2115,11 +2094,11 @@ _native_bind_cb(void *data EINA_UNUSED, void *image)
2115 { 2094 {
2116#ifdef GL_GLES 2095#ifdef GL_GLES
2117# ifdef HAVE_WAYLAND 2096# ifdef HAVE_WAYLAND
2118 if (n->egl_surface) 2097 if (n->ns_data.wl_surface.surface)
2119 { 2098 {
2120 if (glsym_glEGLImageTargetTexture2DOES) 2099 if (glsym_glEGLImageTargetTexture2DOES)
2121 { 2100 {
2122 glsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, n->egl_surface); 2101 glsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, n->ns_data.wl_surface.surface);
2123 GLERRV("glsym_glEGLImageTargetTexture2DOES"); 2102 GLERRV("glsym_glEGLImageTargetTexture2DOES");
2124 } 2103 }
2125 else 2104 else
@@ -2146,7 +2125,7 @@ _native_unbind_cb(void *data EINA_UNUSED, void *image)
2146 2125
2147 if (glsym_glXReleaseTexImage) 2126 if (glsym_glXReleaseTexImage)
2148 { 2127 {
2149 glsym_glXReleaseTexImage(eng_get_ob(re)->disp, (XID)n->surface, 2128 glsym_glXReleaseTexImage(eng_get_ob(re)->disp, (XID)(n->ns_data.x11.surface),
2150 GLX_FRONT_LEFT_EXT); 2129 GLX_FRONT_LEFT_EXT);
2151 } 2130 }
2152 else 2131 else
@@ -2187,16 +2166,16 @@ _native_free_cb(void *data, void *image)
2187 2166
2188 if (n->ns.type == EVAS_NATIVE_SURFACE_X11) 2167 if (n->ns.type == EVAS_NATIVE_SURFACE_X11)
2189 { 2168 {
2190 pmid = n->pixmap; 2169 pmid = n->ns_data.x11.pixmap;
2191 eina_hash_del(eng_get_ob(re)->gl_context->shared->native_pm_hash, &pmid, im); 2170 eina_hash_del(eng_get_ob(re)->gl_context->shared->native_pm_hash, &pmid, im);
2192#ifdef GL_GLES 2171#ifdef GL_GLES
2193 if (n->surface) 2172 if (n->ns_data.x11.surface)
2194 { 2173 {
2195 int err; 2174 int err;
2196 if (glsym_eglDestroyImage) 2175 if (glsym_eglDestroyImage)
2197 { 2176 {
2198 glsym_eglDestroyImage(eng_get_ob(re)->egl_disp, 2177 glsym_eglDestroyImage(eng_get_ob(re)->egl_disp,
2199 n->surface); 2178 n->ns_data.x11.surface);
2200 if ((err = eglGetError()) != EGL_SUCCESS) 2179 if ((err = eglGetError()) != EGL_SUCCESS)
2201 { 2180 {
2202 ERR("eglDestroyImage() failed."); 2181 ERR("eglDestroyImage() failed.");
@@ -2208,13 +2187,13 @@ _native_free_cb(void *data, void *image)
2208 } 2187 }
2209#else 2188#else
2210# ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT 2189# ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT
2211 if (n->surface) 2190 if (n->ns_data.x11.surface)
2212 { 2191 {
2213 if (im->native.loose) 2192 if (im->native.loose)
2214 { 2193 {
2215 if (glsym_glXReleaseTexImage) 2194 if (glsym_glXReleaseTexImage)
2216 { 2195 {
2217 glsym_glXReleaseTexImage(eng_get_ob(re)->disp, (XID)n->surface, 2196 glsym_glXReleaseTexImage(eng_get_ob(re)->disp, (XID)n->ns_data.x11.surface,
2218 GLX_FRONT_LEFT_EXT); 2197 GLX_FRONT_LEFT_EXT);
2219 } 2198 }
2220 else 2199 else
@@ -2222,12 +2201,12 @@ _native_free_cb(void *data, void *image)
2222 } 2201 }
2223 if (glsym_glXDestroyPixmap) 2202 if (glsym_glXDestroyPixmap)
2224 { 2203 {
2225 glsym_glXDestroyPixmap(eng_get_ob(re)->disp, (XID)n->surface); 2204 glsym_glXDestroyPixmap(eng_get_ob(re)->disp, (XID)n->ns_data.x11.surface);
2226 GLERRV("glsym_glXDestroyPixmap"); 2205 GLERRV("glsym_glXDestroyPixmap");
2227 } 2206 }
2228 else 2207 else
2229 ERR("Try glXDestroyPixmap on GLX with no support"); 2208 ERR("Try glXDestroyPixmap on GLX with no support");
2230 n->surface = 0; 2209 n->ns_data.x11->surface = 0;
2231 } 2210 }
2232# endif 2211# endif
2233#endif 2212#endif
@@ -2239,15 +2218,15 @@ _native_free_cb(void *data, void *image)
2239 } 2218 }
2240 else if (n->ns.type == EVAS_NATIVE_SURFACE_TBM) 2219 else if (n->ns.type == EVAS_NATIVE_SURFACE_TBM)
2241 { 2220 {
2242 eina_hash_del(eng_get_ob(re)->gl_context->shared->native_tbm_hash, &n->buffer, im); 2221 eina_hash_del(eng_get_ob(re)->gl_context->shared->native_tbm_hash, &n->ns_data.tbm.buffer, im);
2243#ifdef GL_GLES 2222#ifdef GL_GLES
2244 if (n->surface) 2223 if (n->ns_data.tbm.surface)
2245 { 2224 {
2246 int err; 2225 int err;
2247 if (glsym_eglDestroyImage) 2226 if (glsym_eglDestroyImage)
2248 { 2227 {
2249 glsym_eglDestroyImage(eng_get_ob(re)->egl_disp, 2228 glsym_eglDestroyImage(eng_get_ob(re)->egl_disp,
2250 n->surface); 2229 n->ns_data.tbm.surface);
2251 if ((err = eglGetError()) != EGL_SUCCESS) 2230 if ((err = eglGetError()) != EGL_SUCCESS)
2252 { 2231 {
2253 ERR("eglDestroyImage() failed."); 2232 ERR("eglDestroyImage() failed.");
@@ -2267,13 +2246,13 @@ _native_free_cb(void *data, void *image)
2267 { 2246 {
2268#ifdef GL_GLES 2247#ifdef GL_GLES
2269# ifdef HAVE_WAYLAND 2248# ifdef HAVE_WAYLAND
2270 wlid = (void*)n->wl_buf; 2249 wlid = (void*)n->ns_data.wl_surface.wl_buf;
2271 eina_hash_del(eng_get_ob(re)->gl_context->shared->native_wl_hash, &wlid, image); 2250 eina_hash_del(eng_get_ob(re)->gl_context->shared->native_wl_hash, &wlid, image);
2272 if (n->egl_surface) 2251 if (n->ns_data.wl_surface.surface)
2273 { 2252 {
2274 if (glsym_eglDestroyImage) 2253 if (glsym_eglDestroyImage)
2275 { 2254 {
2276 glsym_eglDestroyImage(eng_get_ob(re)->egl_disp, n->egl_surface); 2255 glsym_eglDestroyImage(eng_get_ob(re)->egl_disp, n->ns_data.wl_surface.surface);
2277 if (eglGetError() != EGL_SUCCESS) 2256 if (eglGetError() != EGL_SUCCESS)
2278 ERR("eglDestroyImage() failed."); 2257 ERR("eglDestroyImage() failed.");
2279 } 2258 }
@@ -2305,11 +2284,11 @@ _native_yinvert_cb(void *data, void *image)
2305 { 2284 {
2306#if GL_GLES 2285#if GL_GLES
2307 if (extn_have_y_inverted && 2286 if (extn_have_y_inverted &&
2308 eglGetConfigAttrib(eng_get_ob(re)->egl_disp, n->config, 2287 eglGetConfigAttrib(eng_get_ob(re)->egl_disp, n->ns_data.x11.config,
2309 EGL_Y_INVERTED_NOK, &val)) 2288 EGL_Y_INVERTED_NOK, &val))
2310 yinvert = val; 2289 yinvert = val;
2311#else 2290#else
2312 glXGetFBConfigAttrib(eng_get_ob(re)->disp, n->config, 2291 glXGetFBConfigAttrib(eng_get_ob(re)->disp, n->ns_data.x11.config,
2313 GLX_Y_INVERTED_EXT, &val); 2292 GLX_Y_INVERTED_EXT, &val);
2314 if (val) yinvert = 1; 2293 if (val) yinvert = 1;
2315#endif 2294#endif
@@ -2324,7 +2303,7 @@ _native_yinvert_cb(void *data, void *image)
2324 } 2303 }
2325 else if (n->ns.type == EVAS_NATIVE_SURFACE_EVASGL) 2304 else if (n->ns.type == EVAS_NATIVE_SURFACE_EVASGL)
2326 { 2305 {
2327 yinvert = glsym_evgl_native_surface_yinvert_get(n->surface); 2306 yinvert = glsym_evgl_native_surface_yinvert_get(n->ns_data.evasgl.surface);
2328 } 2307 }
2329 2308
2330 return yinvert; 2309 return yinvert;
@@ -2581,19 +2560,19 @@ eng_image_native_set(void *data, void *image, void *native)
2581 } 2560 }
2582 2561
2583 memcpy(&(n->ns), ns, sizeof(Evas_Native_Surface)); 2562 memcpy(&(n->ns), ns, sizeof(Evas_Native_Surface));
2584 n->pixmap = pm; 2563 n->ns_data.x11.pixmap = pm;
2585 n->visual = vis; 2564 n->ns_data.x11.visual = vis;
2586 if (glsym_eglCreateImage) 2565 if (glsym_eglCreateImage)
2587 n->surface = glsym_eglCreateImage(eng_get_ob(re)->egl_disp, 2566 n->ns_data.x11.surface = glsym_eglCreateImage(eng_get_ob(re)->egl_disp,
2588 EGL_NO_CONTEXT, 2567 EGL_NO_CONTEXT,
2589 EGL_NATIVE_PIXMAP_KHR, 2568 EGL_NATIVE_PIXMAP_KHR,
2590 (void *)pm, 2569 (void *)pm,
2591 NULL); 2570 NULL);
2592 else 2571 else
2593 ERR("Try eglCreateImage on EGL with no support"); 2572 ERR("Try eglCreateImage on EGL with no support");
2594 if (!n->surface) 2573 if (!n->ns_data.x11.surface)
2595 ERR("eglCreatePixmapSurface() for 0x%x failed", (unsigned int)pm); 2574 ERR("eglCreatePixmapSurface() for 0x%x failed", (unsigned int)pm);
2596 n->config = (void *)egl_config; 2575 n->ns_data.x11.config = (void *)egl_config;
2597 2576
2598 im->native.yinvert = yinvert; 2577 im->native.yinvert = yinvert;
2599 im->native.loose = 0; 2578 im->native.loose = 0;
@@ -2717,7 +2696,7 @@ eng_image_native_set(void *data, void *image, void *native)
2717 glXGetFBConfigAttrib(eng_get_ob(re)->disp, configs[j], 2696 glXGetFBConfigAttrib(eng_get_ob(re)->disp, configs[j],
2718 GLX_BIND_TO_MIPMAP_TEXTURE_EXT, &val); 2697 GLX_BIND_TO_MIPMAP_TEXTURE_EXT, &val);
2719 mipmap = val; 2698 mipmap = val;
2720 n->config = configs[j]; 2699 n->ns_data.x11.config = configs[j];
2721 found = 1; 2700 found = 1;
2722 break; 2701 break;
2723 } 2702 }
@@ -2759,16 +2738,16 @@ eng_image_native_set(void *data, void *image, void *native)
2759 pixmap_att[i++] = 0; 2738 pixmap_att[i++] = 0;
2760 2739
2761 memcpy(&(n->ns), ns, sizeof(Evas_Native_Surface)); 2740 memcpy(&(n->ns), ns, sizeof(Evas_Native_Surface));
2762 n->pixmap = pm; 2741 n->ns_data.x11->pixmap = pm;
2763 n->visual = vis; 2742 n->ns_data.x11->visual = vis;
2764 if (glsym_glXCreatePixmap) 2743 if (glsym_glXCreatePixmap)
2765 n->surface = (void *)glsym_glXCreatePixmap(eng_get_ob(re)->disp, 2744 n->ns_data.x11.surface = (void *)glsym_glXCreatePixmap(eng_get_ob(re)->disp,
2766 n->config, 2745 n->ns_data.x11->config,
2767 n->pixmap, 2746 n->ns_data.x11->pixmap,
2768 pixmap_att); 2747 pixmap_att);
2769 else 2748 else
2770 ERR("Try glXCreatePixmap on GLX with no support"); 2749 ERR("Try glXCreatePixmap on GLX with no support");
2771 if (n->surface) 2750 if (n->ns_data.x11.surface)
2772 { 2751 {
2773// printf("%p: new native texture for %x | %4i x %4i @ %2i = %p\n", 2752// printf("%p: new native texture for %x | %4i x %4i @ %2i = %p\n",
2774// n, pm, w, h, depth, n->surface); 2753// n, pm, w, h, depth, n->surface);
@@ -2777,7 +2756,7 @@ eng_image_native_set(void *data, void *image, void *native)
2777 ERR("no target :("); 2756 ERR("no target :(");
2778 if (glsym_glXQueryDrawable) 2757 if (glsym_glXQueryDrawable)
2779 glsym_glXQueryDrawable(eng_get_ob(re)->disp, 2758 glsym_glXQueryDrawable(eng_get_ob(re)->disp,
2780 n->pixmap, 2759 n->ns_data.x11->pixmap,
2781 GLX_TEXTURE_TARGET_EXT, 2760 GLX_TEXTURE_TARGET_EXT,
2782 &target); 2761 &target);
2783 } 2762 }
@@ -2828,10 +2807,7 @@ eng_image_native_set(void *data, void *image, void *native)
2828 2807
2829 eina_hash_add(eng_get_ob(re)->gl_context->shared->native_tex_hash, &texid, im); 2808 eina_hash_add(eng_get_ob(re)->gl_context->shared->native_tex_hash, &texid, im);
2830 2809
2831 n->pixmap = 0; 2810 n->ns_data.opengl.surface = 0;
2832 n->visual = 0;
2833 n->config = 0;
2834 n->surface = 0;
2835 2811
2836 im->native.yinvert = 0; 2812 im->native.yinvert = 0;
2837 im->native.loose = 0; 2813 im->native.loose = 0;
@@ -2861,16 +2837,16 @@ eng_image_native_set(void *data, void *image, void *native)
2861 eina_hash_add(eng_get_ob(re)->gl_context->shared->native_tbm_hash, &buffer, im); 2837 eina_hash_add(eng_get_ob(re)->gl_context->shared->native_tbm_hash, &buffer, im);
2862 2838
2863 memcpy(&(n->ns), ns, sizeof(Evas_Native_Surface)); 2839 memcpy(&(n->ns), ns, sizeof(Evas_Native_Surface));
2864 n->buffer = buffer; 2840 n->ns_data.tbm.buffer = buffer;
2865 if (glsym_eglCreateImage) 2841 if (glsym_eglCreateImage)
2866 n->surface = glsym_eglCreateImage(eng_get_ob(re)->egl_disp, 2842 n->ns_data.tbm.surface = glsym_eglCreateImage(eng_get_ob(re)->egl_disp,
2867 EGL_NO_CONTEXT, 2843 EGL_NO_CONTEXT,
2868 EGL_NATIVE_SURFACE_TIZEN, 2844 EGL_NATIVE_SURFACE_TIZEN,
2869 (void *)buffer, 2845 (void *)buffer,
2870 NULL); 2846 NULL);
2871 else 2847 else
2872 ERR("Try eglCreateImage on EGL with no support"); 2848 ERR("Try eglCreateImage on EGL with no support");
2873 if (!n->surface) 2849 if (!n->ns_data.tbm.surface)
2874 ERR("eglCreateImage() for %p failed", buffer); 2850 ERR("eglCreateImage() for %p failed", buffer);
2875 im->native.yinvert = 1; 2851 im->native.yinvert = 1;
2876 im->native.loose = 0; 2852 im->native.loose = 0;
@@ -2897,10 +2873,7 @@ eng_image_native_set(void *data, void *image, void *native)
2897 2873
2898 eina_hash_add(eng_get_ob(re)->gl_context->shared->native_evasgl_hash, &buffer, im); 2874 eina_hash_add(eng_get_ob(re)->gl_context->shared->native_evasgl_hash, &buffer, im);
2899 2875
2900 n->pixmap = 0; 2876 n->ns_data.evasgl.surface = ns->data.evasgl.surface;
2901 n->visual = 0;
2902
2903 n->surface = ns->data.evasgl.surface;
2904 2877
2905 im->native.yinvert = 0; 2878 im->native.yinvert = 0;
2906 im->native.loose = 0; 2879 im->native.loose = 0;
@@ -2954,12 +2927,12 @@ eng_image_native_set(void *data, void *image, void *native)
2954 eina_hash_add(eng_get_ob(re)->gl_context->shared->native_wl_hash, 2927 eina_hash_add(eng_get_ob(re)->gl_context->shared->native_wl_hash,
2955 &wlid, im); 2928 &wlid, im);
2956 2929
2957 n->wl_buf = wl_buf; 2930 n->ns_data.wl_surface.wl_buf = wl_buf;
2958 if (glsym_eglCreateImage) 2931 if (glsym_eglCreateImage)
2959 n->egl_surface = glsym_eglCreateImage(eng_get_ob(re)->egl_disp, 2932 n->ns_data.wl_surface.surface = glsym_eglCreateImage(eng_get_ob(re)->egl_disp,
2960 NULL, 2933 NULL,
2961 EGL_WAYLAND_BUFFER_WL, 2934 EGL_WAYLAND_BUFFER_WL,
2962 wl_buf, attribs); 2935 wl_buf, attribs);
2963 else 2936 else
2964 { 2937 {
2965 ERR("Try eglCreateImage on EGL with no support"); 2938 ERR("Try eglCreateImage on EGL with no support");
@@ -2970,7 +2943,7 @@ eng_image_native_set(void *data, void *image, void *native)
2970 return NULL; 2943 return NULL;
2971 } 2944 }
2972 2945
2973 if (!n->egl_surface) 2946 if (!n->ns_data.wl_surface.surface)
2974 { 2947 {
2975 ERR("eglCreatePixmapSurface() for %p failed", wl_buf); 2948 ERR("eglCreatePixmapSurface() for %p failed", wl_buf);
2976 eina_hash_del(eng_get_ob(re)->gl_context->shared->native_wl_hash, 2949 eina_hash_del(eng_get_ob(re)->gl_context->shared->native_wl_hash,
diff --git a/src/modules/evas/engines/software_generic/evas_native_common.h b/src/modules/evas/engines/software_generic/evas_native_common.h
new file mode 100644
index 0000000000..0ff0b7437d
--- /dev/null
+++ b/src/modules/evas/engines/software_generic/evas_native_common.h
@@ -0,0 +1,82 @@
1#ifndef _EVAS_NATIVE_COMMON_H
2#define _EVAS_NATIVE_COMMON_H
3
4#ifdef EAPI
5# undef EAPI
6#endif
7
8#ifdef _WIN32
9# ifdef EFL_EVAS_BUILD
10# ifdef DLL_EXPORT
11# define EAPI __declspec(dllexport)
12# else
13# define EAPI
14# endif /* ! DLL_EXPORT */
15# else
16# define EAPI __declspec(dllimport)
17# endif /* ! EFL_EVAS_BUILD */
18#else
19# ifdef __GNUC__
20# if __GNUC__ >= 4
21# define EAPI __attribute__ ((visibility("default")))
22# else
23# define EAPI
24# endif
25# else
26# define EAPI
27# endif
28#endif /* ! _WIN32 */
29
30//#include <Evas_Common.h>
31
32typedef struct _Native Native;
33struct _Native
34{
35 Evas_Native_Surface ns;
36 union {
37 /* EVAS_NATIVE_SURFACE_X11 */
38 struct
39 {
40 unsigned long pixmap; /* Pixmap */
41 void *visual; /* Visual */
42 void *display; /* Display */
43 void *exim; /* Ecore_X_Image or Evas_DRI_Image */
44
45 void *buffer;
46 void *config; /* egl configuration or glx configuration */
47 void *surface; /* egl surface or glx surface */
48 } x11; /**< Set this struct fields if surface data is SW X11 based. */
49
50 /* EVAS_NATIVE_SURFACE_WL */
51 struct
52 {
53 void *wl_buf; /* struct wl_buffer */
54 void *surface; /*egl surface*/
55 } wl_surface; /**< Set this struct fields if surface data is Wayland based. */
56
57 /* EVAS_NATIVE_SURFACE_OPENGL */
58 struct
59 {
60 void *surface; /*egl surface*/
61 } opengl;
62
63 /* EVAS_NATIVE_SURFACE_EVASGL */
64 struct
65 {
66 void *surface; /*evas gl surface*/
67 } evasgl;
68
69 /* EVAS_NATIVE_SURFACE_TBM */
70 struct
71 {
72 void *buffer; /*tbm surface*/
73 void *surface; /*egl surface*/
74 } tbm;
75 } ns_data; /**< Choose one union data according to your surface in Evas Engine. */
76};
77
78EAPI void * evas_native_tbm_surface_image_set(void *data, void *image, void *native);
79
80typedef void *(*Evas_Native_Tbm_Surface_Image_Set_Call)(void *data, void *image, void *native);
81
82#endif //_EVAS_NATIVE_COMMON_H
diff --git a/src/modules/evas/engines/software_x11/evas_native_tbm.c b/src/modules/evas/engines/software_generic/evas_native_tbm.c
index aeedc70748..bcc81c6d69 100644
--- a/src/modules/evas/engines/software_x11/evas_native_tbm.c
+++ b/src/modules/evas/engines/software_generic/evas_native_tbm.c
@@ -1,14 +1,6 @@
1#include "evas_common_private.h" 1#include "evas_common_private.h"
2#ifdef BUILD_ENGINE_SOFTWARE_XLIB
3# include "evas_xlib_image.h"
4#endif
5#ifdef BUILD_ENGINE_SOFTWARE_XCB
6# include "evas_xcb_image.h"
7#endif
8#include "evas_private.h" 2#include "evas_private.h"
9 3#include "evas_native_common.h"
10#include "Evas_Engine_Software_X11.h"
11#include "evas_engine.h"
12 4
13#ifdef HAVE_DLSYM 5#ifdef HAVE_DLSYM
14# include <dlfcn.h> /* dlopen,dlclose,etc */ 6# include <dlfcn.h> /* dlopen,dlclose,etc */
@@ -28,6 +20,8 @@
28#define __tbm_fourcc_code(a,b,c,d) ((uint32_t)(a) | ((uint32_t)(b) << 8) | \ 20#define __tbm_fourcc_code(a,b,c,d) ((uint32_t)(a) | ((uint32_t)(b) << 8) | \
29 ((uint32_t)(c) << 16) | ((uint32_t)(d) << 24)) 21 ((uint32_t)(c) << 16) | ((uint32_t)(d) << 24))
30 22
23#define TBM_FORMAT_ARGB8888 __tbm_fourcc_code('A', 'R', '2', '4')
24#define TBM_FORMAT_ABGR8888 __tbm_fourcc_code('A', 'B', '2', '4')
31#define TBM_FORMAT_RGBX8888 __tbm_fourcc_code('R', 'X', '2', '4') /* [31:0] R:G:B:x 8:8:8:8 little endian */ 25#define TBM_FORMAT_RGBX8888 __tbm_fourcc_code('R', 'X', '2', '4') /* [31:0] R:G:B:x 8:8:8:8 little endian */
32#define TBM_FORMAT_RGBA8888 __tbm_fourcc_code('R', 'A', '2', '4') /* [31:0] R:G:B:A 8:8:8:8 little endian */ 26#define TBM_FORMAT_RGBA8888 __tbm_fourcc_code('R', 'A', '2', '4') /* [31:0] R:G:B:A 8:8:8:8 little endian */
33#define TBM_FORMAT_BGRA8888 __tbm_fourcc_code('B', 'A', '2', '4') /* [31:0] B:G:R:A 8:8:8:8 little endian */ 27#define TBM_FORMAT_BGRA8888 __tbm_fourcc_code('B', 'A', '2', '4') /* [31:0] B:G:R:A 8:8:8:8 little endian */
@@ -69,7 +63,6 @@ typedef struct _tbm_surface_info
69 void *reserved6; /**< Reserved pointer6 */ 63 void *reserved6; /**< Reserved pointer6 */
70} tbm_surface_info_s; 64} tbm_surface_info_s;
71 65
72
73/* returns 0 on success */ 66/* returns 0 on success */
74static int (*sym_tbm_surface_map) (tbm_surface_h surface, int opt, tbm_surface_info_s *info) = NULL; 67static int (*sym_tbm_surface_map) (tbm_surface_h surface, int opt, tbm_surface_info_s *info) = NULL;
75static int (*sym_tbm_surface_unmap) (tbm_surface_h surface) = NULL; 68static int (*sym_tbm_surface_unmap) (tbm_surface_h surface) = NULL;
@@ -214,17 +207,24 @@ _evas_video_nv12(unsigned char *evas_data, const unsigned char *source_data, uns
214static void 207static void
215_native_bind_cb(void *data EINA_UNUSED, void *image, int x EINA_UNUSED, int y EINA_UNUSED, int w EINA_UNUSED, int h EINA_UNUSED) 208_native_bind_cb(void *data EINA_UNUSED, void *image, int x EINA_UNUSED, int y EINA_UNUSED, int w EINA_UNUSED, int h EINA_UNUSED)
216{ 209{
217 RGBA_Image *im; 210 RGBA_Image *im = image;
218 Native *n; 211 Native *n = im->native.data;
219 212 tbm_surface_info_s info;
220 if (!(im = image)) return; 213 tbm_surface_h *tbm_surf;
221 214
222 n = im->native.data; 215 if (!im) return;
223 if ((n) && (n->ns.type == EVAS_NATIVE_SURFACE_TBM)) 216 if (n)
224 { 217 {
225 tbm_surface_info_s info; 218 if (n->ns.type == EVAS_NATIVE_SURFACE_TBM)
219 {
220 tbm_surf = n->ns.data.tbm.buffer;
221 }
222 else tbm_surf = NULL;
226 223
227 if (sym_tbm_surface_map(n->ns.data.tbm.buffer, TBM_SURF_OPTION_READ|TBM_SURF_OPTION_WRITE, &info)) return; 224 if (!tbm_surf)
225 return;
226 if (sym_tbm_surface_map(tbm_surf, TBM_SURF_OPTION_READ|TBM_SURF_OPTION_WRITE, &info))
227 return;
228 228
229 im->image.data = (DATA32 *)info.planes[0].ptr; 229 im->image.data = (DATA32 *)info.planes[0].ptr;
230 } 230 }
@@ -233,28 +233,32 @@ _native_bind_cb(void *data EINA_UNUSED, void *image, int x EINA_UNUSED, int y EI
233static void 233static void
234_native_unbind_cb(void *data EINA_UNUSED, void *image) 234_native_unbind_cb(void *data EINA_UNUSED, void *image)
235{ 235{
236 RGBA_Image *im; 236 RGBA_Image *im = image;
237 Native *n; 237 Native *n = im->native.data;
238 238 tbm_surface_h *tbm_surf;
239 if (!(im = image)) return;
240 239
241 n = im->native.data; 240 if (!im) return;
242 if ((n) && (n->ns.type == EVAS_NATIVE_SURFACE_TBM)) 241 if (n)
243 { 242 {
244 sym_tbm_surface_unmap(n->ns.data.tbm.buffer); 243 if (n->ns.type == EVAS_NATIVE_SURFACE_TBM)
244 {
245 tbm_surf = n->ns.data.tbm.buffer;
246 }
247 else tbm_surf = NULL;
248
249 if (!tbm_surf)
250 return;
251 sym_tbm_surface_unmap(tbm_surf);
245 } 252 }
246} 253}
247 254
248static void 255static void
249_native_free_cb(void *data EINA_UNUSED, void *image) 256_native_free_cb(void *data EINA_UNUSED, void *image)
250{ 257{
251 RGBA_Image *im; 258 RGBA_Image *im = image;
252 Native *n; 259 Native *n = im->native.data;
253
254 if (!(im = image)) return;
255
256 n = im->native.data;
257 260
261 if (!im) return;
258 im->native.data = NULL; 262 im->native.data = NULL;
259 im->native.func.bind = NULL; 263 im->native.func.bind = NULL;
260 im->native.func.unbind = NULL; 264 im->native.func.unbind = NULL;
@@ -267,14 +271,16 @@ _native_free_cb(void *data EINA_UNUSED, void *image)
267 tbm_shutdown(); 271 tbm_shutdown();
268} 272}
269 273
270void * 274EAPI void *
271evas_native_tbm_image_set(void *data EINA_UNUSED, void *image, void *native) 275evas_native_tbm_surface_image_set(void *data EINA_UNUSED, void *image, void *native)
272{ 276{
273 Evas_Native_Surface *ns = native; 277 Evas_Native_Surface *ns = native;
274 RGBA_Image *im = image; 278 RGBA_Image *im = image;
279 tbm_surface_h *tbm_surf;
275 280
276 if (!im) return NULL; 281 if (!im) return NULL;
277 if ((ns) && (ns->type == EVAS_NATIVE_SURFACE_TBM)) 282
283 if (ns)
278 { 284 {
279 void *pixels_data; 285 void *pixels_data;
280 int w, h, stride; 286 int w, h, stride;
@@ -282,6 +288,14 @@ evas_native_tbm_image_set(void *data EINA_UNUSED, void *image, void *native)
282 tbm_surface_info_s info; 288 tbm_surface_info_s info;
283 Native *n; 289 Native *n;
284 290
291 if (ns->type == EVAS_NATIVE_SURFACE_TBM)
292 {
293 tbm_surf = ns->data.tbm.buffer;
294 }
295 else tbm_surf = NULL;
296
297 if (!tbm_surf) return NULL;
298
285 if (!tbm_init()) 299 if (!tbm_init())
286 { 300 {
287 ERR("Could not initialize TBM!"); 301 ERR("Could not initialize TBM!");
@@ -291,7 +305,7 @@ evas_native_tbm_image_set(void *data EINA_UNUSED, void *image, void *native)
291 n = calloc(1, sizeof(Native)); 305 n = calloc(1, sizeof(Native));
292 if (!n) return NULL; 306 if (!n) return NULL;
293 307
294 if (sym_tbm_surface_map(ns->data.tbm.buffer, TBM_SURF_OPTION_READ|TBM_SURF_OPTION_WRITE, &info)) 308 if (sym_tbm_surface_map(tbm_surf, TBM_SURF_OPTION_READ|TBM_SURF_OPTION_WRITE, &info))
295 { 309 {
296 free(n); 310 free(n);
297 return im; 311 return im;
@@ -311,6 +325,8 @@ evas_native_tbm_image_set(void *data EINA_UNUSED, void *image, void *native)
311 case TBM_FORMAT_RGBA8888: 325 case TBM_FORMAT_RGBA8888:
312 case TBM_FORMAT_RGBX8888: 326 case TBM_FORMAT_RGBX8888:
313 case TBM_FORMAT_BGRA8888: 327 case TBM_FORMAT_BGRA8888:
328 case TBM_FORMAT_ARGB8888:
329 case TBM_FORMAT_ABGR8888:
314 im->cache_entry.w = stride / 4; 330 im->cache_entry.w = stride / 4;
315 evas_cache_image_colorspace(&im->cache_entry, EVAS_COLORSPACE_ARGB8888); 331 evas_cache_image_colorspace(&im->cache_entry, EVAS_COLORSPACE_ARGB8888);
316 im->cache_entry.flags.alpha = (format == TBM_FORMAT_RGBX8888 ? 0 : 1); 332 im->cache_entry.flags.alpha = (format == TBM_FORMAT_RGBX8888 ? 0 : 1);
@@ -346,8 +362,7 @@ evas_native_tbm_image_set(void *data EINA_UNUSED, void *image, void *native)
346 im->native.func.unbind = _native_unbind_cb; 362 im->native.func.unbind = _native_unbind_cb;
347 im->native.func.free = _native_free_cb; 363 im->native.func.free = _native_free_cb;
348 364
349 sym_tbm_surface_unmap(ns->data.tbm.buffer); 365 sym_tbm_surface_unmap(tbm_surf);
350 } 366 }
351 return im; 367 return im;
352} 368}
353
diff --git a/src/modules/evas/engines/software_x11/evas_engine.c b/src/modules/evas/engines/software_x11/evas_engine.c
index 5ed5fd14be..b6dc615f48 100644
--- a/src/modules/evas/engines/software_x11/evas_engine.c
+++ b/src/modules/evas/engines/software_x11/evas_engine.c
@@ -26,6 +26,13 @@
26#include "evas_x_egl.h" 26#include "evas_x_egl.h"
27#endif 27#endif
28 28
29#include "../software_generic/evas_native_common.h"
30
31#ifdef HAVE_DLSYM
32# include <dlfcn.h>
33#endif
34
35Evas_Native_Tbm_Surface_Image_Set_Call glsym_evas_native_tbm_surface_image_set = NULL;
29int _evas_engine_soft_x11_log_dom = -1; 36int _evas_engine_soft_x11_log_dom = -1;
30 37
31/* function tables - filled in later (func and parent func) */ 38/* function tables - filled in later (func and parent func) */
@@ -414,6 +421,22 @@ _best_depth_get(int backend, void *connection, int screen)
414 return 0; 421 return 0;
415} 422}
416 423
424static void
425_symbols(void)
426{
427 static int done = 0;
428
429 if (done) return;
430
431#define LINK2GENERIC(sym) \
432 glsym_##sym = dlsym(RTLD_DEFAULT, #sym);
433
434 // Get function pointer to native_common that is now provided through the link of SW_Generic.
435 LINK2GENERIC(evas_native_tbm_surface_image_set);
436
437 done = 1;
438}
439
417/* engine api this module provides */ 440/* engine api this module provides */
418static void * 441static void *
419eng_info(Evas *eo_e EINA_UNUSED) 442eng_info(Evas *eo_e EINA_UNUSED)
@@ -730,7 +753,7 @@ eng_image_native_set(void *data EINA_UNUSED, void *image, void *native)
730 } 753 }
731 else if (ns->type == EVAS_NATIVE_SURFACE_TBM) 754 else if (ns->type == EVAS_NATIVE_SURFACE_TBM)
732 { 755 {
733 return evas_native_tbm_image_set(re->generic.ob, ie, ns); 756 return glsym_evas_native_tbm_surface_image_set(re->generic.ob, ie, ns);
734 } 757 }
735 else if (ns->type == EVAS_NATIVE_SURFACE_EVASGL) 758 else if (ns->type == EVAS_NATIVE_SURFACE_EVASGL)
736 { 759 {
@@ -738,6 +761,7 @@ eng_image_native_set(void *data EINA_UNUSED, void *image, void *native)
738 Native *n = calloc(1, sizeof(Native)); 761 Native *n = calloc(1, sizeof(Native));
739 if (n) 762 if (n)
740 { 763 {
764 n->ns_data.evasgl.surface = ns->data.evasgl.surface;
741 im = (RGBA_Image *) ie; 765 im = (RGBA_Image *) ie;
742 n->ns.type = EVAS_NATIVE_SURFACE_EVASGL; 766 n->ns.type = EVAS_NATIVE_SURFACE_EVASGL;
743 n->ns.version = EVAS_NATIVE_SURFACE_VERSION; 767 n->ns.version = EVAS_NATIVE_SURFACE_VERSION;
@@ -796,6 +820,7 @@ module_open(Evas_Module *em)
796 ORD(image_native_set); 820 ORD(image_native_set);
797 ORD(image_native_get); 821 ORD(image_native_get);
798 822
823 _symbols();
799 /* now advertise out own api */ 824 /* now advertise out own api */
800 em->functions = (void *)(&func); 825 em->functions = (void *)(&func);
801 return 1; 826 return 1;
diff --git a/src/modules/evas/engines/software_x11/evas_engine.h b/src/modules/evas/engines/software_x11/evas_engine.h
index b561e2f83b..c29f62deea 100644
--- a/src/modules/evas/engines/software_x11/evas_engine.h
+++ b/src/modules/evas/engines/software_x11/evas_engine.h
@@ -116,6 +116,5 @@ struct _Outbuf
116 116
117void evas_software_xlib_x_init(void); 117void evas_software_xlib_x_init(void);
118void evas_software_xcb_init(void); 118void evas_software_xcb_init(void);
119void *evas_native_tbm_image_set(void *data, void *image, void *native);
120 119
121#endif 120#endif
diff --git a/src/modules/evas/engines/software_x11/evas_xcb_image.c b/src/modules/evas/engines/software_x11/evas_xcb_image.c
index 597a8c6bd4..dc892456c4 100644
--- a/src/modules/evas/engines/software_x11/evas_xcb_image.c
+++ b/src/modules/evas/engines/software_x11/evas_xcb_image.c
@@ -14,20 +14,20 @@ _evas_xcb_image_update(void *data EINA_UNUSED, void *image, int x, int y, int w,
14 im = image; 14 im = image;
15 n = im->native.data; 15 n = im->native.data;
16 16
17 if (ecore_x_image_get(n->exim, n->pixmap, 0, 0, x, y, w, h)) 17 if (ecore_x_image_get(n->ns_data.x11->exim, n->ns_data.x11->pixmap, 0, 0, x, y, w, h))
18 { 18 {
19 char *pix; 19 char *pix;
20 int bpl, rows, bpp; 20 int bpl, rows, bpp;
21 21
22 pix = ecore_x_image_data_get(n->exim, &bpl, &rows, &bpp); 22 pix = ecore_x_image_data_get(n->ns_data.x11->exim, &bpl, &rows, &bpp);
23 if (!ecore_x_image_is_argb32_get(n->exim)) 23 if (!ecore_x_image_is_argb32_get(n->ns_data.x11->exim))
24 { 24 {
25 Ecore_X_Colormap colormap; 25 Ecore_X_Colormap colormap;
26 26
27 if (!im->image.data) 27 if (!im->image.data)
28 im->image.data = (DATA32 *)malloc(im->cache_entry.w * im->cache_entry.h * sizeof(DATA32)); 28 im->image.data = (DATA32 *)malloc(im->cache_entry.w * im->cache_entry.h * sizeof(DATA32));
29 colormap = ecore_x_default_colormap_get(ecore_x_display_get(), ecore_x_default_screen_get()); 29 colormap = ecore_x_default_colormap_get(ecore_x_display_get(), ecore_x_default_screen_get());
30 ecore_x_image_to_argb_convert(pix, bpp, bpl, colormap, n->visual, 30 ecore_x_image_to_argb_convert(pix, bpp, bpl, colormap, n->ns_data.x11->visual,
31 x, y, w, h, im->image.data, 31 x, y, w, h, im->image.data,
32 (w * sizeof(int)), 0, 0); 32 (w * sizeof(int)), 0, 0);
33 } 33 }
@@ -58,12 +58,12 @@ _native_cb_free(void *data EINA_UNUSED, void *image)
58 im = image; 58 im = image;
59 n = im->native.data; 59 n = im->native.data;
60 60
61 if (n->exim) 61 if (n->ns_data.x11->exim)
62 { 62 {
63 ecore_x_image_free(n->exim); 63 ecore_x_image_free(n->ns_data.x11->exim);
64 n->exim = NULL; 64 n->ns_data.x11->exim = NULL;
65 } 65 }
66 n->visual = NULL; 66 n->ns_data.x11->visual = NULL;
67 67
68 im->native.data = NULL; 68 im->native.data = NULL;
69 im->native.func.data = NULL; 69 im->native.func.data = NULL;
@@ -110,9 +110,9 @@ evas_xcb_image_native_set(void *data, void *image, void *native)
110 } 110 }
111 111
112 memcpy(&(n->ns), ns, sizeof(Evas_Native_Surface)); 112 memcpy(&(n->ns), ns, sizeof(Evas_Native_Surface));
113 n->pixmap = pm; 113 n->ns_data.x11->pixmap = pm;
114 n->visual = vis; 114 n->ns_data.x11->visual = vis;
115 n->exim = exim; 115 n->ns_data.x11->exim = exim;
116 116
117 im->native.data = n; 117 im->native.data = n;
118 im->native.func.data = NULL; 118 im->native.func.data = NULL;
diff --git a/src/modules/evas/engines/software_x11/evas_xcb_image.h b/src/modules/evas/engines/software_x11/evas_xcb_image.h
index ffd9e6254b..cfe6c6302d 100644
--- a/src/modules/evas/engines/software_x11/evas_xcb_image.h
+++ b/src/modules/evas/engines/software_x11/evas_xcb_image.h
@@ -1,15 +1,5 @@
1#include "evas_engine.h" 1#include "evas_engine.h"
2#include <Ecore_X.h> 2#include <Ecore_X.h>
3 3#include "../software_generic/evas_native_common.h"
4typedef struct _Native Native;
5
6struct _Native
7{
8 Evas_Native_Surface ns;
9 Ecore_X_Pixmap pixmap;
10 Ecore_X_Visual *visual;
11
12 Ecore_X_Image *exim;
13};
14 4
15void *evas_xcb_image_native_set(void *data, void *image, void *native); 5void *evas_xcb_image_native_set(void *data, void *image, void *native);
diff --git a/src/modules/evas/engines/software_x11/evas_xlib_dri_image.c b/src/modules/evas/engines/software_x11/evas_xlib_dri_image.c
index 0c0a0ab025..fa33391c35 100644
--- a/src/modules/evas/engines/software_x11/evas_xlib_dri_image.c
+++ b/src/modules/evas/engines/software_x11/evas_xlib_dri_image.c
@@ -4,6 +4,7 @@
4 4
5#include "evas_common_private.h" 5#include "evas_common_private.h"
6#include "evas_xlib_dri_image.h" 6#include "evas_xlib_dri_image.h"
7#include "../software_generic/evas_native_common.h"
7 8
8# include <dlfcn.h> /* dlopen,dlclose,etc */ 9# include <dlfcn.h> /* dlopen,dlclose,etc */
9# include <sys/types.h> 10# include <sys/types.h>
@@ -408,7 +409,7 @@ _evas_xlib_image_x_free(Display *d)
408Eina_Bool 409Eina_Bool
409evas_xlib_image_get_buffers(RGBA_Image *im) 410evas_xlib_image_get_buffers(RGBA_Image *im)
410{ 411{
411 DRI_Native *n = NULL; 412 Native *n = NULL;
412 Display *d; 413 Display *d;
413 Evas_DRI_Image *exim; 414 Evas_DRI_Image *exim;
414 415
@@ -416,8 +417,8 @@ evas_xlib_image_get_buffers(RGBA_Image *im)
416 n = im->native.data; 417 n = im->native.data;
417 if (!n) return EINA_FALSE; 418 if (!n) return EINA_FALSE;
418 419
419 exim = n->exim; 420 exim = n->ns_data.x11.exim;
420 d = n->d; 421 d = n->ns_data.x11.display;
421 422
422 if(!exim) return EINA_FALSE; 423 if(!exim) return EINA_FALSE;
423 424
@@ -513,7 +514,7 @@ static void
513_native_bind_cb(void *data EINA_UNUSED, void *image, int x EINA_UNUSED, int y EINA_UNUSED, int w EINA_UNUSED, int h EINA_UNUSED) 514_native_bind_cb(void *data EINA_UNUSED, void *image, int x EINA_UNUSED, int y EINA_UNUSED, int w EINA_UNUSED, int h EINA_UNUSED)
514{ 515{
515 RGBA_Image *im = image; 516 RGBA_Image *im = image;
516 DRI_Native *n = im->native.data; 517 Native *n = im->native.data;
517 518
518 if ((n) && (n->ns.type == EVAS_NATIVE_SURFACE_X11)) 519 if ((n) && (n->ns.type == EVAS_NATIVE_SURFACE_X11))
519 { 520 {
@@ -528,15 +529,15 @@ static void
528_native_free_cb(void *data EINA_UNUSED, void *image) 529_native_free_cb(void *data EINA_UNUSED, void *image)
529{ 530{
530 RGBA_Image *im = image; 531 RGBA_Image *im = image;
531 DRI_Native *n = im->native.data; 532 Native *n = im->native.data;
532 if (!n) return; 533 if (!n) return;
533 if (n->exim) 534 if (n->ns_data.x11.exim)
534 { 535 {
535 evas_xlib_image_dri_free(n->exim); 536 evas_xlib_image_dri_free(n->ns_data.x11.exim);
536 n->exim = NULL; 537 n->ns_data.x11.exim = NULL;
537 } 538 }
538 n->visual = NULL; 539 n->ns_data.x11.visual = NULL;
539 n->d = NULL; 540 n->ns_data.x11.display = NULL;
540 541
541 im->native.data = NULL; 542 im->native.data = NULL;
542 im->native.func.data = NULL; 543 im->native.func.data = NULL;
@@ -552,7 +553,7 @@ evas_xlib_image_dri_native_set(void *data, void *image, void *native)
552 Display *d = NULL; 553 Display *d = NULL;
553 Visual *vis = NULL; 554 Visual *vis = NULL;
554 Pixmap pm = 0; 555 Pixmap pm = 0;
555 DRI_Native *n = NULL; 556 Native *n = NULL;
556 RGBA_Image *im = image; 557 RGBA_Image *im = image;
557 int w, h; 558 int w, h;
558 Evas_DRI_Image *exim; 559 Evas_DRI_Image *exim;
@@ -586,7 +587,7 @@ evas_xlib_image_dri_native_set(void *data, void *image, void *native)
586 587
587 exim->draw = (Drawable)ns->data.x11.pixmap; 588 exim->draw = (Drawable)ns->data.x11.pixmap;
588 589
589 n = calloc(1, sizeof(DRI_Native)); 590 n = calloc(1, sizeof(Native));
590 if (!n) 591 if (!n)
591 { 592 {
592 evas_xlib_image_dri_free(exim); 593 evas_xlib_image_dri_free(exim);
@@ -594,10 +595,10 @@ evas_xlib_image_dri_native_set(void *data, void *image, void *native)
594 } 595 }
595 596
596 memcpy(&(n->ns), ns, sizeof(Evas_Native_Surface)); 597 memcpy(&(n->ns), ns, sizeof(Evas_Native_Surface));
597 n->pixmap = pm; 598 n->ns_data.x11.pixmap = pm;
598 n->visual = vis; 599 n->ns_data.x11.visual = vis;
599 n->d = d; 600 n->ns_data.x11.display = d;
600 n->exim = exim; 601 n->ns_data.x11.exim = exim;
601 im->native.data = n; 602 im->native.data = n;
602 im->native.func.data = NULL; 603 im->native.func.data = NULL;
603 im->native.func.bind = _native_bind_cb; 604 im->native.func.bind = _native_bind_cb;
diff --git a/src/modules/evas/engines/software_x11/evas_xlib_image.c b/src/modules/evas/engines/software_x11/evas_xlib_image.c
index 947297785a..75731485e5 100644
--- a/src/modules/evas/engines/software_x11/evas_xlib_image.c
+++ b/src/modules/evas/engines/software_x11/evas_xlib_image.c
@@ -13,15 +13,15 @@ evas_xlib_image_update(void *data EINA_UNUSED, void *image, int x, int y, int w,
13 char *pix; 13 char *pix;
14 int bpl, rows, bpp; 14 int bpl, rows, bpp;
15 15
16 if (ecore_x_image_get(n->exim, n->pixmap, 0, 0, x, y, w, h)) 16 if (ecore_x_image_get(n->ns_data.x11.exim, n->ns_data.x11.pixmap, 0, 0, x, y, w, h))
17 { 17 {
18 pix = ecore_x_image_data_get(n->exim, &bpl, &rows, &bpp); 18 pix = ecore_x_image_data_get(n->ns_data.x11.exim, &bpl, &rows, &bpp);
19 if (!ecore_x_image_is_argb32_get(n->exim)) 19 if (!ecore_x_image_is_argb32_get(n->ns_data.x11.exim))
20 { 20 {
21 if (!im->image.data) 21 if (!im->image.data)
22 im->image.data = (DATA32 *)malloc(im->cache_entry.w * im->cache_entry.h * sizeof(DATA32)); 22 im->image.data = (DATA32 *)malloc(im->cache_entry.w * im->cache_entry.h * sizeof(DATA32));
23 Ecore_X_Colormap colormap = ecore_x_default_colormap_get(ecore_x_display_get(), ecore_x_default_screen_get()); 23 Ecore_X_Colormap colormap = ecore_x_default_colormap_get(ecore_x_display_get(), ecore_x_default_screen_get());
24 ecore_x_image_to_argb_convert(pix, bpp, bpl, colormap, n->visual, 24 ecore_x_image_to_argb_convert(pix, bpp, bpl, colormap, n->ns_data.x11.visual,
25 x, y, w, h, 25 x, y, w, h,
26 im->image.data, (w * sizeof(int)), 0, 0); 26 im->image.data, (w * sizeof(int)), 0, 0);
27 } 27 }
@@ -50,12 +50,12 @@ _native_free_cb(void *data EINA_UNUSED, void *image)
50 RGBA_Image *im = image; 50 RGBA_Image *im = image;
51 Native *n = im->native.data; 51 Native *n = im->native.data;
52 52
53 if (n->exim) 53 if (n->ns_data.x11.exim)
54 { 54 {
55 ecore_x_image_free(n->exim); 55 ecore_x_image_free(n->ns_data.x11.exim);
56 n->exim = NULL; 56 n->ns_data.x11.exim = NULL;
57 } 57 }
58 n->visual = NULL; 58 n->ns_data.x11.visual = NULL;
59 59
60 im->native.data = NULL; 60 im->native.data = NULL;
61 im->native.func.data = NULL; 61 im->native.func.data = NULL;
@@ -99,9 +99,9 @@ evas_xlib_image_native_set(void *data, void *image, void *native)
99 } 99 }
100 100
101 memcpy(&(n->ns), ns, sizeof(Evas_Native_Surface)); 101 memcpy(&(n->ns), ns, sizeof(Evas_Native_Surface));
102 n->pixmap = pm; 102 n->ns_data.x11.pixmap = pm;
103 n->visual = vis; 103 n->ns_data.x11.visual = vis;
104 n->exim = exim; 104 n->ns_data.x11.exim = exim;
105 im->native.data = n; 105 im->native.data = n;
106 im->native.func.data = NULL; 106 im->native.func.data = NULL;
107 im->native.func.bind = _native_bind_cb; 107 im->native.func.bind = _native_bind_cb;
diff --git a/src/modules/evas/engines/software_x11/evas_xlib_image.h b/src/modules/evas/engines/software_x11/evas_xlib_image.h
index 36a62258c4..7d7347583f 100644
--- a/src/modules/evas/engines/software_x11/evas_xlib_image.h
+++ b/src/modules/evas/engines/software_x11/evas_xlib_image.h
@@ -1,15 +1,5 @@
1#include "evas_engine.h" 1#include "evas_engine.h"
2#include <Ecore_X.h> 2#include <Ecore_X.h>
3 3#include "../software_generic/evas_native_common.h"
4typedef struct _Native Native;
5
6struct _Native
7{
8 Evas_Native_Surface ns;
9 Pixmap pixmap;
10 Visual *visual;
11
12 Ecore_X_Image *exim;
13};
14 4
15void *evas_xlib_image_native_set(void *data, void *image, void *native); 5void *evas_xlib_image_native_set(void *data, void *image, void *native);
diff --git a/src/modules/evas/engines/wayland_shm/evas_engine.c b/src/modules/evas/engines/wayland_shm/evas_engine.c
index 82500908b3..e6a810c130 100644
--- a/src/modules/evas/engines/wayland_shm/evas_engine.c
+++ b/src/modules/evas/engines/wayland_shm/evas_engine.c
@@ -5,6 +5,11 @@
5#endif 5#endif
6 6
7#include "evas_engine.h" 7#include "evas_engine.h"
8#include "../software_generic/evas_native_common.h"
9
10#ifdef HAVE_DLSYM
11# include <dlfcn.h>
12#endif
8 13
9/* logging domain variable */ 14/* logging domain variable */
10int _evas_engine_way_shm_log_dom = -1; 15int _evas_engine_way_shm_log_dom = -1;
@@ -12,6 +17,8 @@ int _evas_engine_way_shm_log_dom = -1;
12/* evas function tables - filled in later (func and parent func) */ 17/* evas function tables - filled in later (func and parent func) */
13static Evas_Func func, pfunc; 18static Evas_Func func, pfunc;
14 19
20Evas_Native_Tbm_Surface_Image_Set_Call glsym_evas_native_tbm_surface_image_set = NULL;
21
15/* engine structure data */ 22/* engine structure data */
16typedef struct _Render_Engine Render_Engine; 23typedef struct _Render_Engine Render_Engine;
17struct _Render_Engine 24struct _Render_Engine
@@ -77,6 +84,22 @@ err:
77 return NULL; 84 return NULL;
78} 85}
79 86
87static void
88_symbols(void)
89{
90 static int done = 0;
91
92 if (done) return;
93
94#define LINK2GENERIC(sym) \
95 glsym_##sym = dlsym(RTLD_DEFAULT, #sym);
96
97 // Get function pointer to native_common that is now provided through the link of SW_Generic.
98 LINK2GENERIC(evas_native_tbm_surface_image_set);
99
100 done = 1;
101}
102
80/* ENGINE API FUNCTIONS WE PROVIDE */ 103/* ENGINE API FUNCTIONS WE PROVIDE */
81static void * 104static void *
82eng_info(Evas *eo_evas EINA_UNUSED) 105eng_info(Evas *eo_evas EINA_UNUSED)
@@ -242,6 +265,71 @@ eng_output_resize(void *data, int w, int h)
242 re->generic.h = h; 265 re->generic.h = h;
243} 266}
244 267
268static void *
269eng_image_native_set(void *data EINA_UNUSED, void *image, void *native)
270{
271 Evas_Native_Surface *ns = native;
272 Image_Entry *ie = image;
273 RGBA_Image *im = image, *im2;
274
275 if (!im || !ns) return im;
276
277 if (ns->type == EVAS_NATIVE_SURFACE_TBM)
278 {
279 if (im->native.data)
280 {
281 //image have native surface already
282 Evas_Native_Surface *ens = im->native.data;
283
284 if ((ens->type == ns->type) &&
285 (ens->data.tbm.buffer == ns->data.tbm.buffer))
286 return im;
287 }
288 }
289
290 if ((ns->type == EVAS_NATIVE_SURFACE_OPENGL) &&
291 (ns->version == EVAS_NATIVE_SURFACE_VERSION))
292 im2 = evas_cache_image_data(evas_common_image_cache_get(),
293 ie->w, ie->h,
294 ns->data.x11.visual, 1,
295 EVAS_COLORSPACE_ARGB8888);
296 else
297 im2 = evas_cache_image_data(evas_common_image_cache_get(),
298 ie->w, ie->h,
299 NULL, 1,
300 EVAS_COLORSPACE_ARGB8888);
301
302 if (im->native.data)
303 {
304 if (im->native.func.free)
305 im->native.func.free(im->native.func.data, im);
306 }
307
308#ifdef EVAS_CSERVE2
309 if (evas_cserve2_use_get() && evas_cache2_image_cached(ie))
310 evas_cache2_image_close(ie);
311 else
312#endif
313 evas_cache_image_drop(ie);
314 im = im2;
315
316 if (ns->type == EVAS_NATIVE_SURFACE_TBM)
317 return glsym_evas_native_tbm_surface_image_set(NULL, im, ns);
318
319 return im;
320}
321
322static void *
323eng_image_native_get(void *data EINA_UNUSED, void *image)
324{
325 RGBA_Image *im = image;
326 Native *n;
327 if (!im) return NULL;
328 n = im->native.data;
329 if (!n) return NULL;
330 return &(n->ns);
331}
332
245/* EVAS MODULE FUNCTIONS */ 333/* EVAS MODULE FUNCTIONS */
246static int 334static int
247module_open(Evas_Module *em) 335module_open(Evas_Module *em)
@@ -273,7 +361,10 @@ module_open(Evas_Module *em)
273 ORD(setup); 361 ORD(setup);
274 ORD(output_free); 362 ORD(output_free);
275 ORD(output_resize); 363 ORD(output_resize);
364 ORD(image_native_set);
365 ORD(image_native_get);
276 366
367 _symbols();
277 /* advertise our own engine functions */ 368 /* advertise our own engine functions */
278 em->functions = (void *)(&func); 369 em->functions = (void *)(&func);
279 370