summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMinkyoung Kim <mer.kim@samsung.com>2016-03-17 18:20:49 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-03-18 13:28:45 +0900
commitbc2b32cba7bb562e2a558ac971fc3b95a1150511 (patch)
treea4eb8a9df8120e7b20ce0c27cb96fe5ac4c1acc0 /src
parent4e0cff107ebaba8cfcac18efca7dbaa8d82ce888 (diff)
evas/gl_x11 : Move engine data to native.
Summary: If 2 evases refer to same pixmap, use same EvasGL_Image. But EvasGL_Image can have only one engine data. When evas related to native is destroyed and another evas use that native, crash occur. So native callbacks need to be independent to engine data. Test Plan: mobile, local test Reviewers: cedric, spacegrapher, wonsik, jpeg Reviewed By: jpeg Differential Revision: https://phab.enlightenment.org/D3800
Diffstat (limited to 'src')
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_common.h2
-rw-r--r--src/modules/evas/engines/gl_x11/evas_engine.c56
2 files changed, 38 insertions, 20 deletions
diff --git a/src/modules/evas/engines/gl_common/evas_gl_common.h b/src/modules/evas/engines/gl_common/evas_gl_common.h
index e4b14f3c5e..80e1eb1a8e 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_common.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_common.h
@@ -440,6 +440,8 @@ struct _Evas_GL_Image
440 int target; 440 int target;
441 int mipmap; 441 int mipmap;
442 unsigned char loose : 1; 442 unsigned char loose : 1;
443 void *disp;
444 Evas_GL_Shared *shared;
443 } native; 445 } native;
444 446
445 struct { 447 struct {
diff --git a/src/modules/evas/engines/gl_x11/evas_engine.c b/src/modules/evas/engines/gl_x11/evas_engine.c
index e48dea03a0..eacd924617 100644
--- a/src/modules/evas/engines/gl_x11/evas_engine.c
+++ b/src/modules/evas/engines/gl_x11/evas_engine.c
@@ -2031,11 +2031,10 @@ _native_bind_cb(void *data EINA_UNUSED, void *image)
2031 } 2031 }
2032#else 2032#else
2033# ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT 2033# ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT
2034 Render_Engine *re = data;
2035 2034
2036 if (glsym_glXBindTexImage) 2035 if (glsym_glXBindTexImage)
2037 { 2036 {
2038 glsym_glXBindTexImage(eng_get_ob(re)->disp, (XID)n->ns_data.x11.surface, 2037 glsym_glXBindTexImage(im->native.disp, (XID)n->ns_data.x11.surface,
2039 GLX_FRONT_LEFT_EXT, NULL); 2038 GLX_FRONT_LEFT_EXT, NULL);
2040 GLERRV("glsym_glXBindTexImage"); 2039 GLERRV("glsym_glXBindTexImage");
2041 } 2040 }
@@ -2121,11 +2120,10 @@ _native_unbind_cb(void *data EINA_UNUSED, void *image)
2121 // nothing 2120 // nothing
2122#else 2121#else
2123# ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT 2122# ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT
2124 Render_Engine *re = data;
2125 2123
2126 if (glsym_glXReleaseTexImage) 2124 if (glsym_glXReleaseTexImage)
2127 { 2125 {
2128 glsym_glXReleaseTexImage(eng_get_ob(re)->disp, (XID)(n->ns_data.x11.surface), 2126 glsym_glXReleaseTexImage(im->native.disp, (XID)(n->ns_data.x11.surface),
2129 GLX_FRONT_LEFT_EXT); 2127 GLX_FRONT_LEFT_EXT);
2130 } 2128 }
2131 else 2129 else
@@ -2152,9 +2150,8 @@ _native_unbind_cb(void *data EINA_UNUSED, void *image)
2152} 2150}
2153 2151
2154static void 2152static void
2155_native_free_cb(void *data, void *image) 2153_native_free_cb(void *data EINA_UNUSED, void *image)
2156{ 2154{
2157 Render_Engine *re = data;
2158 Evas_GL_Image *im = image; 2155 Evas_GL_Image *im = image;
2159 Native *n = im->native.data; 2156 Native *n = im->native.data;
2160 uint32_t pmid, texid; 2157 uint32_t pmid, texid;
@@ -2167,14 +2164,14 @@ _native_free_cb(void *data, void *image)
2167 if (n->ns.type == EVAS_NATIVE_SURFACE_X11) 2164 if (n->ns.type == EVAS_NATIVE_SURFACE_X11)
2168 { 2165 {
2169 pmid = n->ns_data.x11.pixmap; 2166 pmid = n->ns_data.x11.pixmap;
2170 eina_hash_del(eng_get_ob(re)->gl_context->shared->native_pm_hash, &pmid, im); 2167 eina_hash_del(im->native.shared->native_pm_hash, &pmid, im);
2171#ifdef GL_GLES 2168#ifdef GL_GLES
2172 if (n->ns_data.x11.surface) 2169 if (n->ns_data.x11.surface)
2173 { 2170 {
2174 int err; 2171 int err;
2175 if (glsym_eglDestroyImage) 2172 if (glsym_eglDestroyImage)
2176 { 2173 {
2177 glsym_eglDestroyImage(eng_get_ob(re)->egl_disp, 2174 glsym_eglDestroyImage(im->native.disp,
2178 n->ns_data.x11.surface); 2175 n->ns_data.x11.surface);
2179 if ((err = eglGetError()) != EGL_SUCCESS) 2176 if ((err = eglGetError()) != EGL_SUCCESS)
2180 { 2177 {
@@ -2193,7 +2190,7 @@ _native_free_cb(void *data, void *image)
2193 { 2190 {
2194 if (glsym_glXReleaseTexImage) 2191 if (glsym_glXReleaseTexImage)
2195 { 2192 {
2196 glsym_glXReleaseTexImage(eng_get_ob(re)->disp, (XID)n->ns_data.x11.surface, 2193 glsym_glXReleaseTexImage(im->native.disp, (XID)n->ns_data.x11.surface,
2197 GLX_FRONT_LEFT_EXT); 2194 GLX_FRONT_LEFT_EXT);
2198 } 2195 }
2199 else 2196 else
@@ -2201,7 +2198,7 @@ _native_free_cb(void *data, void *image)
2201 } 2198 }
2202 if (glsym_glXDestroyPixmap) 2199 if (glsym_glXDestroyPixmap)
2203 { 2200 {
2204 glsym_glXDestroyPixmap(eng_get_ob(re)->disp, (XID)n->ns_data.x11.surface); 2201 glsym_glXDestroyPixmap(im->native.disp, (XID)n->ns_data.x11.surface);
2205 GLERRV("glsym_glXDestroyPixmap"); 2202 GLERRV("glsym_glXDestroyPixmap");
2206 } 2203 }
2207 else 2204 else
@@ -2214,18 +2211,18 @@ _native_free_cb(void *data, void *image)
2214 else if (n->ns.type == EVAS_NATIVE_SURFACE_OPENGL) 2211 else if (n->ns.type == EVAS_NATIVE_SURFACE_OPENGL)
2215 { 2212 {
2216 texid = n->ns.data.opengl.texture_id; 2213 texid = n->ns.data.opengl.texture_id;
2217 eina_hash_del(eng_get_ob(re)->gl_context->shared->native_tex_hash, &texid, im); 2214 eina_hash_del(im->native.shared->native_tex_hash, &texid, im);
2218 } 2215 }
2219 else if (n->ns.type == EVAS_NATIVE_SURFACE_TBM) 2216 else if (n->ns.type == EVAS_NATIVE_SURFACE_TBM)
2220 { 2217 {
2221 eina_hash_del(eng_get_ob(re)->gl_context->shared->native_tbm_hash, &n->ns_data.tbm.buffer, im); 2218 eina_hash_del(im->native.shared->native_tbm_hash, &n->ns_data.tbm.buffer, im);
2222#ifdef GL_GLES 2219#ifdef GL_GLES
2223 if (n->ns_data.tbm.surface) 2220 if (n->ns_data.tbm.surface)
2224 { 2221 {
2225 int err; 2222 int err;
2226 if (glsym_eglDestroyImage) 2223 if (glsym_eglDestroyImage)
2227 { 2224 {
2228 glsym_eglDestroyImage(eng_get_ob(re)->egl_disp, 2225 glsym_eglDestroyImage(im->native.disp,
2229 n->ns_data.tbm.surface); 2226 n->ns_data.tbm.surface);
2230 if ((err = eglGetError()) != EGL_SUCCESS) 2227 if ((err = eglGetError()) != EGL_SUCCESS)
2231 { 2228 {
@@ -2240,19 +2237,19 @@ _native_free_cb(void *data, void *image)
2240 } 2237 }
2241 else if (n->ns.type == EVAS_NATIVE_SURFACE_EVASGL) 2238 else if (n->ns.type == EVAS_NATIVE_SURFACE_EVASGL)
2242 { 2239 {
2243 eina_hash_del(eng_get_ob(re)->gl_context->shared->native_evasgl_hash, &n->ns.data.evasgl.surface, im); 2240 eina_hash_del(im->native.shared->native_evasgl_hash, &n->ns.data.evasgl.surface, im);
2244 } 2241 }
2245 else if (n->ns.type == EVAS_NATIVE_SURFACE_WL) 2242 else if (n->ns.type == EVAS_NATIVE_SURFACE_WL)
2246 { 2243 {
2247#ifdef GL_GLES 2244#ifdef GL_GLES
2248# ifdef HAVE_WAYLAND 2245# ifdef HAVE_WAYLAND
2249 wlid = (void*)n->ns_data.wl_surface.wl_buf; 2246 wlid = (void*)n->ns_data.wl_surface.wl_buf;
2250 eina_hash_del(eng_get_ob(re)->gl_context->shared->native_wl_hash, &wlid, image); 2247 eina_hash_del(im->native.shared->native_wl_hash, &wlid, image);
2251 if (n->ns_data.wl_surface.surface) 2248 if (n->ns_data.wl_surface.surface)
2252 { 2249 {
2253 if (glsym_eglDestroyImage) 2250 if (glsym_eglDestroyImage)
2254 { 2251 {
2255 glsym_eglDestroyImage(eng_get_ob(re)->egl_disp, n->ns_data.wl_surface.surface); 2252 glsym_eglDestroyImage(im->native.disp, n->ns_data.wl_surface.surface);
2256 if (eglGetError() != EGL_SUCCESS) 2253 if (eglGetError() != EGL_SUCCESS)
2257 ERR("eglDestroyImage() failed."); 2254 ERR("eglDestroyImage() failed.");
2258 } 2255 }
@@ -2271,9 +2268,8 @@ _native_free_cb(void *data, void *image)
2271} 2268}
2272 2269
2273static int 2270static int
2274_native_yinvert_cb(void *data, void *image) 2271_native_yinvert_cb(void *data EINA_UNUSED, void *image)
2275{ 2272{
2276 Render_Engine *re = data;
2277 Evas_GL_Image *im = image; 2273 Evas_GL_Image *im = image;
2278 Native *n = im->native.data; 2274 Native *n = im->native.data;
2279 int yinvert = 0, val; 2275 int yinvert = 0, val;
@@ -2284,11 +2280,11 @@ _native_yinvert_cb(void *data, void *image)
2284 { 2280 {
2285#if GL_GLES 2281#if GL_GLES
2286 if (extn_have_y_inverted && 2282 if (extn_have_y_inverted &&
2287 eglGetConfigAttrib(eng_get_ob(re)->egl_disp, n->ns_data.x11.config, 2283 eglGetConfigAttrib(im->native.disp, n->ns_data.x11.config,
2288 EGL_Y_INVERTED_NOK, &val)) 2284 EGL_Y_INVERTED_NOK, &val))
2289 yinvert = val; 2285 yinvert = val;
2290#else 2286#else
2291 glXGetFBConfigAttrib(eng_get_ob(re)->disp, n->ns_data.x11.config, 2287 glXGetFBConfigAttrib(im->native.disp, n->ns_data.x11.config,
2292 GLX_Y_INVERTED_EXT, &val); 2288 GLX_Y_INVERTED_EXT, &val);
2293 if (val) yinvert = 1; 2289 if (val) yinvert = 1;
2294#endif 2290#endif
@@ -2622,6 +2618,8 @@ eng_image_native_set(void *data, void *image, void *native)
2622 2618
2623 im->native.yinvert = yinvert; 2619 im->native.yinvert = yinvert;
2624 im->native.loose = 0; 2620 im->native.loose = 0;
2621 im->native.disp = eng_get_ob(re)->egl_disp;
2622 im->native.shared = eng_get_ob(re)->gl_context->shared;
2625 im->native.data = n; 2623 im->native.data = n;
2626 im->native.func.data = re; 2624 im->native.func.data = re;
2627 im->native.func.bind = _native_bind_cb; 2625 im->native.func.bind = _native_bind_cb;
@@ -2829,6 +2827,8 @@ eng_image_native_set(void *data, void *image, void *native)
2829 ERR("GLX Pixmap create fail"); 2827 ERR("GLX Pixmap create fail");
2830 im->native.yinvert = yinvert; 2828 im->native.yinvert = yinvert;
2831 im->native.loose = eng_get_ob(re)->detected.loose_binding; 2829 im->native.loose = eng_get_ob(re)->detected.loose_binding;
2830 im->native.disp = eng_get_ob(re)->disp;
2831 im->native.shared = eng_get_ob(re)->gl_context->shared;
2832 im->native.data = n; 2832 im->native.data = n;
2833 im->native.func.data = re; 2833 im->native.func.data = re;
2834 im->native.func.bind = _native_bind_cb; 2834 im->native.func.bind = _native_bind_cb;
@@ -2857,6 +2857,12 @@ eng_image_native_set(void *data, void *image, void *native)
2857 2857
2858 im->native.yinvert = 0; 2858 im->native.yinvert = 0;
2859 im->native.loose = 0; 2859 im->native.loose = 0;
2860#ifdef GL_GLES
2861 im->native.disp = eng_get_ob(re)->egl_disp;
2862#else
2863 im->native.disp = eng_get_ob(re)->disp;
2864#endif
2865 im->native.shared = eng_get_ob(re)->gl_context->shared;
2860 im->native.data = n; 2866 im->native.data = n;
2861 im->native.func.data = re; 2867 im->native.func.data = re;
2862 im->native.func.bind = _native_bind_cb; 2868 im->native.func.bind = _native_bind_cb;
@@ -2896,6 +2902,8 @@ eng_image_native_set(void *data, void *image, void *native)
2896 ERR("eglCreateImage() for %p failed", buffer); 2902 ERR("eglCreateImage() for %p failed", buffer);
2897 im->native.yinvert = 1; 2903 im->native.yinvert = 1;
2898 im->native.loose = 0; 2904 im->native.loose = 0;
2905 im->native.disp = eng_get_ob(re)->egl_disp;
2906 im->native.shared = eng_get_ob(re)->gl_context->shared;
2899 im->native.data = n; 2907 im->native.data = n;
2900 im->native.func.data = re; 2908 im->native.func.data = re;
2901 im->native.func.bind = _native_bind_cb; 2909 im->native.func.bind = _native_bind_cb;
@@ -2923,6 +2931,12 @@ eng_image_native_set(void *data, void *image, void *native)
2923 2931
2924 im->native.yinvert = 0; 2932 im->native.yinvert = 0;
2925 im->native.loose = 0; 2933 im->native.loose = 0;
2934#ifdef GL_GLES
2935 im->native.disp = eng_get_ob(re)->egl_disp;
2936#else
2937 im->native.disp = eng_get_ob(re)->disp;
2938#endif
2939 im->native.shared = eng_get_ob(re)->gl_context->shared;
2926 im->native.data = n; 2940 im->native.data = n;
2927 im->native.func.data = re; 2941 im->native.func.data = re;
2928 im->native.func.bind = _native_bind_cb; 2942 im->native.func.bind = _native_bind_cb;
@@ -3004,6 +3018,8 @@ eng_image_native_set(void *data, void *image, void *native)
3004 //im->native.yinvert = yinvert; 3018 //im->native.yinvert = yinvert;
3005 im->native.yinvert = 1; 3019 im->native.yinvert = 1;
3006 im->native.loose = 0; 3020 im->native.loose = 0;
3021 im->native.disp = eng_get_ob(re)->egl_disp;
3022 im->native.shared = eng_get_ob(re)->gl_context->shared;
3007 im->native.data = n; 3023 im->native.data = n;
3008 im->native.func.data = re; 3024 im->native.func.data = re;
3009 im->native.func.bind = _native_bind_cb; 3025 im->native.func.bind = _native_bind_cb;