summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2013-06-24 10:14:21 +0100
committerChris Michael <cp.michael@samsung.com>2013-06-24 10:14:21 +0100
commit0ae72828693817b507da10d7d199aa6ba250d6d8 (patch)
tree0894eb3c3866fe890f8885d0d1cd3fee6c03852e
parent712a528025dcd6f906d906741ebe105996f1b26e (diff)
Port cedric's async uploading GL texture commit to wayland_egl engine.
Signed-off-by: Chris Michael <cp.michael@samsung.com>
-rw-r--r--src/modules/evas/engines/wayland_egl/evas_engine.c53
-rw-r--r--src/modules/evas/engines/wayland_egl/evas_engine.h1
-rw-r--r--src/modules/evas/engines/wayland_egl/evas_wl_main.c25
3 files changed, 73 insertions, 6 deletions
diff --git a/src/modules/evas/engines/wayland_egl/evas_engine.c b/src/modules/evas/engines/wayland_egl/evas_engine.c
index 7e4d3cdaa6..b9f36d82a9 100644
--- a/src/modules/evas/engines/wayland_egl/evas_engine.c
+++ b/src/modules/evas/engines/wayland_egl/evas_engine.c
@@ -92,6 +92,8 @@ static void _native_free_cb(void *data, void *image);
92static int eng_image_colorspace_get(void *data EINA_UNUSED, void *image); 92static int eng_image_colorspace_get(void *data EINA_UNUSED, void *image);
93static int eng_image_alpha_get(void *data EINA_UNUSED, void *image); 93static int eng_image_alpha_get(void *data EINA_UNUSED, void *image);
94 94
95static Eina_Bool eng_gl_preload_make_current(void *data, void *doit);
96
95#define EVGLINIT(_re, _ret) if (!evgl_init(_re)) return _ret; 97#define EVGLINIT(_re, _ret) if (!evgl_init(_re)) return _ret;
96 98
97/* local variables */ 99/* local variables */
@@ -210,8 +212,8 @@ evgl_extn_veto(Render_Engine *re)
210 if (getenv("EVAS_GL_INFO")) printf("EGL EXTENSION:\n%s\n", str); 212 if (getenv("EVAS_GL_INFO")) printf("EGL EXTENSION:\n%s\n", str);
211 if (!strstr(str, "EGL_EXT_buffer_age")) 213 if (!strstr(str, "EGL_EXT_buffer_age"))
212 extn_have_buffer_age = EINA_FALSE; 214 extn_have_buffer_age = EINA_FALSE;
213 if (!strstr(str, "swap_buffers_with_damage")) 215 /* if (!strstr(str, "swap_buffers_with_damage")) */
214 glsym_eglSwapBuffersWithDamage = NULL; 216 /* glsym_eglSwapBuffersWithDamage = NULL; */
215 } 217 }
216 else 218 else
217 { 219 {
@@ -475,6 +477,7 @@ _re_winfree(Render_Engine *re)
475{ 477{
476 if ((!re) || (!re->win)) return; 478 if ((!re) || (!re->win)) return;
477 if (!re->win->surf) return; 479 if (!re->win->surf) return;
480 evas_gl_preload_render_relax(eng_gl_preload_make_current, re);
478 eng_window_unsurf(re->win); 481 eng_window_unsurf(re->win);
479} 482}
480 483
@@ -674,6 +677,7 @@ eng_setup(Evas *evas, void *info)
674 evas_common_font_init(); 677 evas_common_font_init();
675 evas_common_draw_init(); 678 evas_common_draw_init();
676 evas_common_tilebuf_init(); 679 evas_common_tilebuf_init();
680 evas_gl_preload_init();
677 evgl_extn_veto(re); 681 evgl_extn_veto(re);
678// evgl_engine_init(re, &evgl_funcs); 682// evgl_engine_init(re, &evgl_funcs);
679 initted = EINA_TRUE; 683 initted = EINA_TRUE;
@@ -867,6 +871,8 @@ eng_output_free(void *data)
867 871
868 if ((re = (Render_Engine *)data)) 872 if ((re = (Render_Engine *)data))
869 { 873 {
874 evas_gl_preload_render_relax(eng_gl_preload_make_current, re);
875
870 if (re->win) 876 if (re->win)
871 { 877 {
872 eng_window_free(re->win); 878 eng_window_free(re->win);
@@ -890,6 +896,7 @@ eng_output_free(void *data)
890 896
891 if ((initted) && (!gl_wins)) 897 if ((initted) && (!gl_wins))
892 { 898 {
899 evas_gl_preload_shutdown();
893 evas_common_image_shutdown(); 900 evas_common_image_shutdown();
894 evas_common_font_shutdown(); 901 evas_common_font_shutdown();
895 initted = EINA_FALSE; 902 initted = EINA_FALSE;
@@ -1127,6 +1134,8 @@ eng_output_redraws_next_update_get(void *data, int *x, int *y, int *w, int *h, i
1127 1134
1128 if (first_rect) 1135 if (first_rect)
1129 { 1136 {
1137 evas_gl_preload_render_lock(eng_gl_preload_make_current, re);
1138
1130 eng_window_use(re->win); 1139 eng_window_use(re->win);
1131 if (!_re_wincheck(re)) return NULL; 1140 if (!_re_wincheck(re)) return NULL;
1132 1141
@@ -1182,11 +1191,11 @@ eng_output_flush(void *data, Evas_Render_Mode render_mode)
1182 1191
1183 if (!(re = (Render_Engine *)data)) return; 1192 if (!(re = (Render_Engine *)data)) return;
1184 1193
1185 if (render_mode == EVAS_RENDER_MODE_ASYNC_INIT) return; 1194 if (render_mode == EVAS_RENDER_MODE_ASYNC_INIT) goto end;
1186 1195
1187 if (!_re_wincheck(re)) return; 1196 if (!_re_wincheck(re)) goto end;
1188 1197
1189 if (!re->win->draw.drew) return; 1198 if (!re->win->draw.drew) goto end;
1190 re->win->draw.drew = EINA_FALSE; 1199 re->win->draw.drew = EINA_FALSE;
1191 eng_window_use(re->win); 1200 eng_window_use(re->win);
1192 1201
@@ -1269,6 +1278,8 @@ eng_output_flush(void *data, Evas_Render_Mode render_mode)
1269 evas_common_tilebuf_free_render_rects(re->rects); 1278 evas_common_tilebuf_free_render_rects(re->rects);
1270 re->rects = NULL; 1279 re->rects = NULL;
1271 } 1280 }
1281end:
1282 evas_gl_preload_render_unlock(eng_gl_preload_make_current, re);
1272} 1283}
1273 1284
1274static void 1285static void
@@ -1419,6 +1430,30 @@ eng_gl_get_pixels_set(void *data, void *get_pixels, void *get_pixels_data, void
1419 re->func.obj = (Evas_Object*)obj; 1430 re->func.obj = (Evas_Object*)obj;
1420} 1431}
1421 1432
1433static Eina_Bool
1434eng_gl_preload_make_current(void *data, void *doit)
1435{
1436 Render_Engine *re;
1437
1438 if (!(re = (Render_Engine *)data))
1439 return EINA_FALSE;
1440
1441 if (doit)
1442 {
1443 if (!eglMakeCurrent(re->win->egl_disp, re->win->egl_surface[0],
1444 re->win->egl_surface[0], re->win->egl_context[0]))
1445 return EINA_FALSE;
1446 }
1447 else
1448 {
1449 if (!eglMakeCurrent(re->win->egl_disp, EGL_NO_SURFACE,
1450 EGL_NO_SURFACE, EGL_NO_CONTEXT))
1451 return EINA_FALSE;
1452 }
1453
1454 return EINA_TRUE;
1455}
1456
1422static void 1457static void
1423eng_rectangle_draw(void *data, void *context, void *surface, int x, int y, int w, int h, Eina_Bool do_async EINA_UNUSED) 1458eng_rectangle_draw(void *data, void *context, void *surface, int x, int y, int w, int h, Eina_Bool do_async EINA_UNUSED)
1424{ 1459{
@@ -1817,16 +1852,21 @@ eng_image_data_put(void *data, void *image, DATA32 *image_data)
1817} 1852}
1818 1853
1819static void 1854static void
1820eng_image_data_preload_request(void *data EINA_UNUSED, void *image, const Eo *target) 1855eng_image_data_preload_request(void *data, void *image, const Eo *target)
1821{ 1856{
1822 Evas_GL_Image *gim; 1857 Evas_GL_Image *gim;
1823 RGBA_Image *im; 1858 RGBA_Image *im;
1859 Render_Engine *re;
1824 1860
1825 if (!(gim = image)) return; 1861 if (!(gim = image)) return;
1826 if (gim->native.data) return; 1862 if (gim->native.data) return;
1827 im = (RGBA_Image *)gim->im; 1863 im = (RGBA_Image *)gim->im;
1828 if (!im) return; 1864 if (!im) return;
1829 evas_cache_image_preload_data(&im->cache_entry, target, NULL, NULL, NULL); 1865 evas_cache_image_preload_data(&im->cache_entry, target, NULL, NULL, NULL);
1866 if (!(re = (Render_Engine *)data)) return;
1867 if (!gim->tex)
1868 gim->tex = evas_gl_common_texture_new(re->win->gl_context, gim->im);
1869 evas_gl_preload_target_register(gim->tex, (Eo *)target);
1830} 1870}
1831 1871
1832static void 1872static void
@@ -1840,6 +1880,7 @@ eng_image_data_preload_cancel(void *data EINA_UNUSED, void *image, const Eo *tar
1840 im = (RGBA_Image *)gim->im; 1880 im = (RGBA_Image *)gim->im;
1841 if (!im) return; 1881 if (!im) return;
1842 evas_cache_image_preload_cancel(&im->cache_entry, target); 1882 evas_cache_image_preload_cancel(&im->cache_entry, target);
1883 evas_gl_preload_target_unregister(gim->tex, (Eo *)target);
1843} 1884}
1844 1885
1845static void * 1886static void *
diff --git a/src/modules/evas/engines/wayland_egl/evas_engine.h b/src/modules/evas/engines/wayland_egl/evas_engine.h
index 02e1937956..80765401fd 100644
--- a/src/modules/evas/engines/wayland_egl/evas_engine.h
+++ b/src/modules/evas/engines/wayland_egl/evas_engine.h
@@ -80,5 +80,6 @@ void eng_window_free(Evas_GL_Wl_Window *gw);
80void eng_window_use(Evas_GL_Wl_Window *gw); 80void eng_window_use(Evas_GL_Wl_Window *gw);
81void eng_window_unsurf(Evas_GL_Wl_Window *gw); 81void eng_window_unsurf(Evas_GL_Wl_Window *gw);
82void eng_window_resurf(Evas_GL_Wl_Window *gw); 82void eng_window_resurf(Evas_GL_Wl_Window *gw);
83Eina_Bool eng_window_make_current(void *data, void *doit);
83 84
84#endif 85#endif
diff --git a/src/modules/evas/engines/wayland_egl/evas_wl_main.c b/src/modules/evas/engines/wayland_egl/evas_wl_main.c
index 9ef76705b6..00a84f81f5 100644
--- a/src/modules/evas/engines/wayland_egl/evas_wl_main.c
+++ b/src/modules/evas/engines/wayland_egl/evas_wl_main.c
@@ -223,6 +223,8 @@ eng_window_use(Evas_GL_Wl_Window *gw)
223{ 223{
224 Eina_Bool force = EINA_FALSE; 224 Eina_Bool force = EINA_FALSE;
225 225
226 evas_gl_preload_render_lock(eng_window_make_current, gw);
227
226 if (_evas_gl_wl_window) 228 if (_evas_gl_wl_window)
227 { 229 {
228 if ((eglGetCurrentContext() != 230 if ((eglGetCurrentContext() !=
@@ -305,3 +307,26 @@ eng_window_resurf(Evas_GL_Wl_Window *gw)
305 307
306 gw->surf = EINA_TRUE; 308 gw->surf = EINA_TRUE;
307} 309}
310
311Eina_Bool
312eng_window_make_current(void *data, void *doit)
313{
314 Evas_GL_Wl_Window *gw;
315
316 if (!(gw = data)) return EINA_FALSE;
317
318 if (doit)
319 {
320 if (!eglMakeCurrent(gw->egl_disp, gw->egl_surface[0],
321 gw->egl_surface[0], gw->egl_context[0]))
322 return EINA_FALSE;
323 }
324 else
325 {
326 if (!eglMakeCurrent(gw->egl_disp, EGL_NO_SURFACE,
327 EGL_NO_SURFACE, EGL_NO_CONTEXT))
328 return EINA_FALSE;
329 }
330
331 return EINA_TRUE;
332}