summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2015-03-03 20:08:16 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-03-03 20:08:16 +0900
commitbea9567d0e6c7a1a02915993ecfc04c6d690f0fc (patch)
treeae7ec5fa9d052e6b8421812edbfa55f7d9569b98
parenta14492ef73c9267042c5bf505080d0e90af394de (diff)
Evas GL: Kill runtime warnings caused by auto fallback
The previous commit modifies the concept of direct rendering vs. indirect rendering, so some runtime checks (in debug mode only) will fail. This commit introduces two new engine functions: - gl_get_pixels_pre - gl_get_pixels_post The latter will be used in a later patch for optimization.
-rw-r--r--src/lib/evas/canvas/evas_object_image.c14
-rw-r--r--src/lib/evas/include/evas_private.h2
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_core.c61
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_core.h6
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_core_private.h1
-rw-r--r--src/modules/evas/engines/gl_generic/evas_engine.c16
-rw-r--r--src/modules/evas/engines/software_generic/evas_engine.c2
7 files changed, 65 insertions, 37 deletions
diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c
index e4aa44863d..90b3c49aa2 100644
--- a/src/lib/evas/canvas/evas_object_image.c
+++ b/src/lib/evas/canvas/evas_object_image.c
@@ -2900,7 +2900,13 @@ evas_process_dirty_pixels(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj,
2900 h = obj->cur->geometry.h; 2900 h = obj->cur->geometry.h;
2901 2901
2902 if (!o->direct_render) 2902 if (!o->direct_render)
2903 o->pixels->func.get_pixels(o->pixels->func.get_pixels_data, eo_obj); 2903 {
2904 if (ENFN->gl_get_pixels_pre)
2905 ENFN->gl_get_pixels_pre(output);
2906 o->pixels->func.get_pixels(o->pixels->func.get_pixels_data, eo_obj);
2907 if (ENFN->gl_get_pixels_post)
2908 ENFN->gl_get_pixels_post(output);
2909 }
2904 2910
2905 if (!(obj->cur->geometry.x == x && 2911 if (!(obj->cur->geometry.x == x &&
2906 obj->cur->geometry.y == y && 2912 obj->cur->geometry.y == y &&
@@ -2936,9 +2942,11 @@ evas_process_dirty_pixels(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj,
2936 else 2942 else
2937 { 2943 {
2938 // Auto-fallback to FBO rendering (for perf & power consumption) 2944 // Auto-fallback to FBO rendering (for perf & power consumption)
2945 if (ENFN->gl_get_pixels_pre)
2946 ENFN->gl_get_pixels_pre(output);
2939 o->pixels->func.get_pixels(o->pixels->func.get_pixels_data, obj->object); 2947 o->pixels->func.get_pixels(o->pixels->func.get_pixels_data, obj->object);
2940 //if (ENFN->get_pixels_render_post) 2948 if (ENFN->gl_get_pixels_post)
2941 //ENFN->get_pixels_render_post(output); 2949 ENFN->gl_get_pixels_post(output);
2942 o->direct_render = EINA_FALSE; 2950 o->direct_render = EINA_FALSE;
2943 } 2951 }
2944 } 2952 }
diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h
index fe241d29e7..d1dd272c37 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -1311,6 +1311,8 @@ struct _Evas_Func
1311 Eina_Bool (*gl_surface_direct_renderable_get) (void *data, Evas_Native_Surface *ns, Eina_Bool *override); 1311 Eina_Bool (*gl_surface_direct_renderable_get) (void *data, Evas_Native_Surface *ns, Eina_Bool *override);
1312 void (*gl_image_direct_set) (void *data, void *image, Eina_Bool direct); 1312 void (*gl_image_direct_set) (void *data, void *image, Eina_Bool direct);
1313 int (*gl_image_direct_get) (void *data, void *image); 1313 int (*gl_image_direct_get) (void *data, void *image);
1314 void (*gl_get_pixels_pre) (void *data);
1315 void (*gl_get_pixels_post) (void *data);
1314 1316
1315 int (*image_load_error_get) (void *data, void *image); 1317 int (*image_load_error_get) (void *data, void *image);
1316 int (*font_run_end_get) (void *data, Evas_Font_Set *font, Evas_Font_Instance **script_fi, Evas_Font_Instance **cur_fi, Evas_Script_Type script, const Eina_Unicode *text, int run_len); 1318 int (*font_run_end_get) (void *data, Evas_Font_Set *font, Evas_Font_Instance **script_fi, Evas_Font_Instance **cur_fi, Evas_Script_Type script, const Eina_Unicode *text, int run_len);
diff --git a/src/modules/evas/engines/gl_common/evas_gl_core.c b/src/modules/evas/engines/gl_common/evas_gl_core.c
index 1155e901cc..e3bdccf1f5 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_core.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_core.c
@@ -1284,42 +1284,19 @@ int
1284_evgl_not_in_pixel_get(void) 1284_evgl_not_in_pixel_get(void)
1285{ 1285{
1286 EVGL_Resource *rsc; 1286 EVGL_Resource *rsc;
1287 EVGL_Context *ctx;
1287 1288
1288 if (!(rsc=_evgl_tls_resource_get())) return 1; 1289 if (!(rsc=_evgl_tls_resource_get()))
1289 1290 return 1;
1290 EVGL_Context *ctx = rsc->current_ctx;
1291
1292 if (evgl_engine->direct_force_off)
1293 return 0;
1294 1291
1295 if (rsc->id != evgl_engine->main_tid) 1292 if (rsc->id != evgl_engine->main_tid)
1296 return 0; 1293 return 0;
1297 1294
1295 ctx = rsc->current_ctx;
1298 if (!ctx || !ctx->current_sfc) 1296 if (!ctx || !ctx->current_sfc)
1299 return 0; 1297 return 0;
1300 1298
1301 if (!ctx->current_sfc->direct_fb_opt) 1299 return !rsc->direct.in_get_pixels;
1302 return 0;
1303
1304 if (rsc->direct.rot == 0)
1305 return !rsc->direct.enabled;
1306
1307 if (!ctx->current_sfc->client_side_rotation)
1308 return 0;
1309
1310 return !rsc->direct.enabled;
1311
1312 /* was:
1313 if ((!evgl_engine->direct_force_off) &&
1314 (rsc->id == evgl_engine->main_tid) &&
1315 (ctx) &&
1316 (ctx->current_sfc) &&
1317 (ctx->current_sfc->direct_fb_opt) &&
1318 (!rsc->direct.enabled))
1319 return 1;
1320 else
1321 return 0;
1322 */
1323} 1300}
1324 1301
1325int 1302int
@@ -1698,7 +1675,7 @@ evgl_surface_create(void *eng_data, Evas_GL_Config *cfg, int w, int h)
1698 else 1675 else
1699 { 1676 {
1700 eina_hash_add(evgl_engine->direct_surfaces, &sfc->gles1_sfc_native, sfc); 1677 eina_hash_add(evgl_engine->direct_surfaces, &sfc->gles1_sfc_native, sfc);
1701 DBG("Added tex %d as direct surface: %p", sfc->gles1_sfc_native, sfc); 1678 DBG("Added native %p as direct surface: %p", sfc->gles1_sfc_native, sfc);
1702 } 1679 }
1703 } 1680 }
1704 1681
@@ -2500,7 +2477,7 @@ evgl_native_surface_get(EVGL_Surface *sfc, Evas_Native_Surface *ns)
2500} 2477}
2501 2478
2502int 2479int
2503evgl_direct_rendered() 2480evgl_direct_rendered(void)
2504{ 2481{
2505 EVGL_Resource *rsc; 2482 EVGL_Resource *rsc;
2506 2483
@@ -2546,7 +2523,7 @@ evgl_native_surface_direct_opts_get(Evas_Native_Surface *ns,
2546 sfc = eina_hash_find(evgl_engine->direct_surfaces, &ns->data.x11.pixmap); 2523 sfc = eina_hash_find(evgl_engine->direct_surfaces, &ns->data.x11.pixmap);
2547 if (!sfc) 2524 if (!sfc)
2548 { 2525 {
2549 DBG("Native surface %p (pixmap %x) was not found.", 2526 DBG("Native surface %p (pixmap %lx) was not found.",
2550 ns, ns->data.x11.pixmap); 2527 ns, ns->data.x11.pixmap);
2551 return EINA_FALSE; 2528 return EINA_FALSE;
2552 } 2529 }
@@ -2626,7 +2603,7 @@ evgl_direct_info_set(int win_w, int win_h, int rot,
2626} 2603}
2627 2604
2628void 2605void
2629evgl_direct_info_clear() 2606evgl_direct_info_clear(void)
2630{ 2607{
2631 EVGL_Resource *rsc; 2608 EVGL_Resource *rsc;
2632 2609
@@ -2635,6 +2612,26 @@ evgl_direct_info_clear()
2635 rsc->direct.enabled = EINA_FALSE; 2612 rsc->direct.enabled = EINA_FALSE;
2636} 2613}
2637 2614
2615void
2616evgl_get_pixels_pre(void)
2617{
2618 EVGL_Resource *rsc;
2619
2620 if (!(rsc=_evgl_tls_resource_get())) return;
2621
2622 rsc->direct.in_get_pixels = EINA_TRUE;
2623}
2624
2625void
2626evgl_get_pixels_post(void)
2627{
2628 EVGL_Resource *rsc;
2629
2630 if (!(rsc=_evgl_tls_resource_get())) return;
2631
2632 rsc->direct.in_get_pixels = EINA_FALSE;
2633}
2634
2638Evas_GL_API * 2635Evas_GL_API *
2639evgl_api_get(Evas_GL_Context_Version version) 2636evgl_api_get(Evas_GL_Context_Version version)
2640{ 2637{
diff --git a/src/modules/evas/engines/gl_common/evas_gl_core.h b/src/modules/evas/engines/gl_common/evas_gl_core.h
index 7eeca5d6a5..2d06d3e2d5 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_core.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_core.h
@@ -36,13 +36,15 @@ Evas_GL_API *evgl_api_get(Evas_GL_Context_Version version);
36void evgl_safe_extension_add(const char *name, void *funcptr); 36void evgl_safe_extension_add(const char *name, void *funcptr);
37Eina_Bool evgl_safe_extension_get(const char *name, void **pfuncptr); 37Eina_Bool evgl_safe_extension_get(const char *name, void **pfuncptr);
38 38
39int evgl_direct_rendered(); 39int evgl_direct_rendered(void);
40void evgl_direct_override_get(Eina_Bool *override, Eina_Bool *force_off); 40void evgl_direct_override_get(Eina_Bool *override, Eina_Bool *force_off);
41void evgl_direct_info_set(int win_w, int win_h, int rot, 41void evgl_direct_info_set(int win_w, int win_h, int rot,
42 int img_x, int img_y, int img_w, int img_h, 42 int img_x, int img_y, int img_w, int img_h,
43 int clip_x, int clip_y, int clip_w, int clip_h, 43 int clip_x, int clip_y, int clip_w, int clip_h,
44 unsigned int texid); 44 unsigned int texid);
45void evgl_direct_info_clear(); 45void evgl_direct_info_clear(void);
46void evgl_get_pixels_pre(void);
47void evgl_get_pixels_post(void);
46 48
47Eina_Bool evgl_native_surface_direct_opts_get(Evas_Native_Surface *ns, 49Eina_Bool evgl_native_surface_direct_opts_get(Evas_Native_Surface *ns,
48 Eina_Bool *direct_render, 50 Eina_Bool *direct_render,
diff --git a/src/modules/evas/engines/gl_common/evas_gl_core_private.h b/src/modules/evas/engines/gl_common/evas_gl_core_private.h
index 9cdefc4ad2..454534a9ba 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_core_private.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_core_private.h
@@ -279,6 +279,7 @@ struct _EVGL_Resource
279 } partial; 279 } partial;
280 280
281 Eina_Bool enabled : 1; 281 Eina_Bool enabled : 1;
282 Eina_Bool in_get_pixels : 1;
282 } direct; 283 } direct;
283 struct { 284 struct {
284 GLclampf r, g, b, a; 285 GLclampf r, g, b, a;
diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c b/src/modules/evas/engines/gl_generic/evas_engine.c
index 3f199ed59a..e6007276d0 100644
--- a/src/modules/evas/engines/gl_generic/evas_engine.c
+++ b/src/modules/evas/engines/gl_generic/evas_engine.c
@@ -854,7 +854,9 @@ eng_image_draw(void *data, void *context, void *surface, void *image, int src_x,
854 texid); 854 texid);
855 855
856 // Call pixel get function 856 // Call pixel get function
857 evgl_get_pixels_pre();
857 re->func.get_pixels(re->func.get_pixels_data, re->func.obj); 858 re->func.get_pixels(re->func.get_pixels_data, re->func.obj);
859 evgl_get_pixels_post();
858 860
859 // Call end tile if it's being used 861 // Call end tile if it's being used
860 if ((gl_context->master_clip.enabled) && 862 if ((gl_context->master_clip.enabled) &&
@@ -1349,6 +1351,18 @@ eng_gl_get_pixels_set(void *data, void *get_pixels, void *get_pixels_data, void
1349 re->func.obj = (Evas_Object*)obj; 1351 re->func.obj = (Evas_Object*)obj;
1350} 1352}
1351 1353
1354static void
1355eng_gl_get_pixels_pre(void *data EINA_UNUSED)
1356{
1357 evgl_get_pixels_pre();
1358}
1359
1360static void
1361eng_gl_get_pixels_post(void *data EINA_UNUSED)
1362{
1363 evgl_get_pixels_post();
1364}
1365
1352static Eina_Bool 1366static Eina_Bool
1353eng_gl_surface_lock(void *data, void *surface) 1367eng_gl_surface_lock(void *data, void *surface)
1354{ 1368{
@@ -2139,6 +2153,8 @@ module_open(Evas_Module *em)
2139 ORD(gl_direct_override_get); 2153 ORD(gl_direct_override_get);
2140 ORD(gl_surface_direct_renderable_get); 2154 ORD(gl_surface_direct_renderable_get);
2141 ORD(gl_get_pixels_set); 2155 ORD(gl_get_pixels_set);
2156 ORD(gl_get_pixels_pre);
2157 ORD(gl_get_pixels_post);
2142 ORD(gl_surface_lock); 2158 ORD(gl_surface_lock);
2143 ORD(gl_surface_read_pixels); 2159 ORD(gl_surface_read_pixels);
2144 ORD(gl_surface_unlock); 2160 ORD(gl_surface_unlock);
diff --git a/src/modules/evas/engines/software_generic/evas_engine.c b/src/modules/evas/engines/software_generic/evas_engine.c
index 205baad172..958a054ad4 100644
--- a/src/modules/evas/engines/software_generic/evas_engine.c
+++ b/src/modules/evas/engines/software_generic/evas_engine.c
@@ -3574,6 +3574,8 @@ static Evas_Func func =
3574 NULL, // need software mesa for gl rendering <- gl_surface_direct_renderable_get 3574 NULL, // need software mesa for gl rendering <- gl_surface_direct_renderable_get
3575 NULL, // need software mesa for gl rendering <- gl_image_direct_set 3575 NULL, // need software mesa for gl rendering <- gl_image_direct_set
3576 NULL, // need software mesa for gl rendering <- gl_image_direct_get 3576 NULL, // need software mesa for gl rendering <- gl_image_direct_get
3577 NULL, // need software mesa for gl rendering <- gl_get_pixels_pre
3578 NULL, // need software mesa for gl rendering <- gl_get_pixels_post
3577 eng_image_load_error_get, 3579 eng_image_load_error_get,
3578 eng_font_run_font_end_get, 3580 eng_font_run_font_end_get,
3579 eng_image_animated_get, 3581 eng_image_animated_get,