summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-10-14 09:30:17 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-10-14 09:30:17 -0400
commitdc5c17a104c9be1939881852ee76668d7bf693ac (patch)
treec4402cfe2f01846cc429a88759e0c0d4dd69d15b
parent7ad8acc290f078aa9d2bfd32ec15a4e5677ab01f (diff)
evas/render: selectively inhibit render callbacks
Summary: only call these if they are subscribed to now ref T8321 Reviewers: cedric Reviewed By: cedric Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8321 Differential Revision: https://phab.enlightenment.org/D10361
-rw-r--r--src/lib/evas/canvas/evas_main.c36
-rw-r--r--src/lib/evas/canvas/evas_render.c32
-rw-r--r--src/lib/evas/include/evas_private.h5
3 files changed, 65 insertions, 8 deletions
diff --git a/src/lib/evas/canvas/evas_main.c b/src/lib/evas/canvas/evas_main.c
index d246bdc60b..92c9ed2334 100644
--- a/src/lib/evas/canvas/evas_main.c
+++ b/src/lib/evas/canvas/evas_main.c
@@ -2014,5 +2014,41 @@ EWAPI const Efl_Event_Description _EVAS_CANVAS_EVENT_AXIS_UPDATE =
2014EWAPI const Efl_Event_Description _EVAS_CANVAS_EVENT_VIEWPORT_RESIZE = 2014EWAPI const Efl_Event_Description _EVAS_CANVAS_EVENT_VIEWPORT_RESIZE =
2015 EFL_EVENT_DESCRIPTION("viewport,resize"); 2015 EFL_EVENT_DESCRIPTION("viewport,resize");
2016 2016
2017#define CHECK_ADD(var, ev, member) \
2018 if ((var) == (ev)) \
2019 { \
2020 e->member = EINA_TRUE; \
2021 }
2022
2023
2024EOLIAN static Eina_Bool
2025_evas_canvas_efl_object_event_callback_priority_add(Eo *obj, Evas_Public_Data *e, const Efl_Event_Description *desc, Efl_Callback_Priority priority, Efl_Event_Cb func, const void *user_data)
2026{
2027 CHECK_ADD(desc, EVAS_CANVAS_EVENT_RENDER_FLUSH_PRE, cb_render_flush_pre)
2028 else CHECK_ADD(desc, EVAS_CANVAS_EVENT_RENDER_FLUSH_POST, cb_render_flush_post)
2029 else CHECK_ADD(desc, EFL_CANVAS_SCENE_EVENT_RENDER_PRE, cb_render_pre)
2030 else CHECK_ADD(desc, EFL_CANVAS_SCENE_EVENT_RENDER_POST, cb_render_post)
2031
2032 return efl_event_callback_priority_add(efl_super(obj, MY_CLASS), desc, priority, func, user_data);
2033}
2034
2035EOLIAN static Eina_Bool
2036_evas_canvas_efl_object_event_callback_array_priority_add(Eo *obj, Evas_Public_Data *e, const Efl_Callback_Array_Item *array, Efl_Callback_Priority priority, const void *user_data)
2037{
2038 for (int i = 0; array[i].desc; ++i)
2039 {
2040 CHECK_ADD(array[i].desc, EVAS_CANVAS_EVENT_RENDER_FLUSH_PRE, cb_render_flush_pre)
2041 else CHECK_ADD(array[i].desc, EVAS_CANVAS_EVENT_RENDER_FLUSH_POST, cb_render_flush_post)
2042 else CHECK_ADD(array[i].desc, EFL_CANVAS_SCENE_EVENT_RENDER_PRE, cb_render_pre)
2043 else CHECK_ADD(array[i].desc, EFL_CANVAS_SCENE_EVENT_RENDER_POST, cb_render_post)
2044 }
2045 return efl_event_callback_array_priority_add(efl_super(obj, MY_CLASS), array, priority, user_data);
2046}
2047#undef CHECK_ADD
2048#define EVAS_CANVAS_EXTRA_OPS \
2049 EFL_OBJECT_OP_FUNC(efl_event_callback_priority_add, _evas_canvas_efl_object_event_callback_priority_add), \
2050 EFL_OBJECT_OP_FUNC(efl_event_callback_array_priority_add, _evas_canvas_efl_object_event_callback_array_priority_add)
2051
2052
2017#include "evas_stack.x" 2053#include "evas_stack.x"
2018#include "canvas/evas_canvas_eo.c" 2054#include "canvas/evas_canvas_eo.c"
diff --git a/src/lib/evas/canvas/evas_render.c b/src/lib/evas/canvas/evas_render.c
index 4895517c1a..70ed55a953 100644
--- a/src/lib/evas/canvas/evas_render.c
+++ b/src/lib/evas/canvas/evas_render.c
@@ -2762,10 +2762,26 @@ _drop_image_cache_ref(const void *container EINA_UNUSED, void *data, void *fdata
2762} 2762}
2763 2763
2764static void 2764static void
2765_cb_always_call(Evas *eo_e, Evas_Callback_Type type, void *event_info) 2765_cb_always_call(Evas *eo_e, Evas_Public_Data *e, Evas_Callback_Type type, void *event_info)
2766{ 2766{
2767 int freeze_num = 0, i; 2767 int freeze_num = 0, i;
2768 2768
2769 switch (type)
2770 {
2771 case EVAS_CALLBACK_RENDER_PRE:
2772 if (!e->cb_render_pre) return;
2773 break;
2774 case EVAS_CALLBACK_RENDER_POST:
2775 if (!e->cb_render_post) return;
2776 break;
2777 case EVAS_CALLBACK_RENDER_FLUSH_PRE:
2778 if (!e->cb_render_flush_pre) return;
2779 break;
2780 case EVAS_CALLBACK_RENDER_FLUSH_POST:
2781 if (!e->cb_render_flush_post) return;
2782 break;
2783 default: break;
2784 }
2769 freeze_num = efl_event_freeze_count_get(eo_e); 2785 freeze_num = efl_event_freeze_count_get(eo_e);
2770 for (i = 0; i < freeze_num; i++) efl_event_thaw(eo_e); 2786 for (i = 0; i < freeze_num; i++) efl_event_thaw(eo_e);
2771 evas_event_callback_call(eo_e, type, event_info); 2787 evas_event_callback_call(eo_e, type, event_info);
@@ -3277,7 +3293,7 @@ evas_render_updates_internal(Evas *eo_e,
3277 3293
3278 RD(0, "[--- RENDER EVAS (size: %ix%i): %p (eo %p)\n", e->viewport.w, e->viewport.h, e, eo_e); 3294 RD(0, "[--- RENDER EVAS (size: %ix%i): %p (eo %p)\n", e->viewport.w, e->viewport.h, e, eo_e);
3279 3295
3280 _cb_always_call(eo_e, EVAS_CALLBACK_RENDER_PRE, NULL); 3296 _cb_always_call(eo_e, e, EVAS_CALLBACK_RENDER_PRE, NULL);
3281 3297
3282 /* Check if the modified object mean recalculating every thing */ 3298 /* Check if the modified object mean recalculating every thing */
3283 if (!e->invalidate) 3299 if (!e->invalidate)
@@ -3596,7 +3612,7 @@ evas_render_updates_internal(Evas *eo_e,
3596 efl_ref(eo_e); 3612 efl_ref(eo_e);
3597 _rendering_evases = eina_list_prepend(_rendering_evases, e); 3613 _rendering_evases = eina_list_prepend(_rendering_evases, e);
3598 e->rendering = _rendering_evases; 3614 e->rendering = _rendering_evases;
3599 _cb_always_call(eo_e, EVAS_CALLBACK_RENDER_FLUSH_PRE, NULL); 3615 _cb_always_call(eo_e, e, EVAS_CALLBACK_RENDER_FLUSH_PRE, NULL);
3600 evas_thread_queue_flush((Evas_Thread_Command_Cb)evas_render_pipe_wakeup, e); 3616 evas_thread_queue_flush((Evas_Thread_Command_Cb)evas_render_pipe_wakeup, e);
3601 eina_evlog("-render_output_async_flush", eo_e, 0.0, NULL); 3617 eina_evlog("-render_output_async_flush", eo_e, 0.0, NULL);
3602 } 3618 }
@@ -3607,11 +3623,11 @@ evas_render_updates_internal(Evas *eo_e,
3607 { 3623 {
3608 _evas_object_image_video_overlay_do(eo_obj); 3624 _evas_object_image_video_overlay_do(eo_obj);
3609 } 3625 }
3610 _cb_always_call(eo_e, EVAS_CALLBACK_RENDER_FLUSH_PRE, NULL); 3626 _cb_always_call(eo_e, e, EVAS_CALLBACK_RENDER_FLUSH_PRE, NULL);
3611 EINA_LIST_FOREACH(e->outputs, l, out) 3627 EINA_LIST_FOREACH(e->outputs, l, out)
3612 if (out->output) 3628 if (out->output)
3613 ENFN->output_flush(ENC, out->output, EVAS_RENDER_MODE_SYNC); 3629 ENFN->output_flush(ENC, out->output, EVAS_RENDER_MODE_SYNC);
3614 _cb_always_call(eo_e, EVAS_CALLBACK_RENDER_FLUSH_POST, NULL); 3630 _cb_always_call(eo_e, e, EVAS_CALLBACK_RENDER_FLUSH_POST, NULL);
3615 _deferred_callbacks_process(eo_e, evas); 3631 _deferred_callbacks_process(eo_e, evas);
3616 eina_evlog("-render_output_flush", eo_e, 0.0, NULL); 3632 eina_evlog("-render_output_flush", eo_e, 0.0, NULL);
3617 } 3633 }
@@ -3766,7 +3782,7 @@ evas_render_updates_internal(Evas *eo_e,
3766 } 3782 }
3767 eina_spinlock_take(&(e->render.lock)); 3783 eina_spinlock_take(&(e->render.lock));
3768 e->inside_post_render = EINA_TRUE; 3784 e->inside_post_render = EINA_TRUE;
3769 _cb_always_call(eo_e, EVAS_CALLBACK_RENDER_POST, &post); 3785 _cb_always_call(eo_e, e, EVAS_CALLBACK_RENDER_POST, &post);
3770 e->inside_post_render = EINA_FALSE; 3786 e->inside_post_render = EINA_FALSE;
3771 eina_spinlock_release(&(e->render.lock)); 3787 eina_spinlock_release(&(e->render.lock));
3772 if (post.updated_area) eina_list_free(post.updated_area); 3788 if (post.updated_area) eina_list_free(post.updated_area);
@@ -3835,7 +3851,7 @@ evas_render_wakeup(Evas *eo_e)
3835 { 3851 {
3836 _evas_object_image_video_overlay_do(eo_obj); 3852 _evas_object_image_video_overlay_do(eo_obj);
3837 } 3853 }
3838 _cb_always_call(eo_e, EVAS_CALLBACK_RENDER_FLUSH_POST, NULL); 3854 _cb_always_call(eo_e, evas, EVAS_CALLBACK_RENDER_FLUSH_POST, NULL);
3839 } 3855 }
3840 3856
3841 /* clear redraws */ 3857 /* clear redraws */
@@ -3878,7 +3894,7 @@ evas_render_wakeup(Evas *eo_e)
3878 evas->rendering = NULL; 3894 evas->rendering = NULL;
3879 3895
3880 post.updated_area = ret_updates; 3896 post.updated_area = ret_updates;
3881 _cb_always_call(eo_e, EVAS_CALLBACK_RENDER_POST, &post); 3897 _cb_always_call(eo_e, evas, EVAS_CALLBACK_RENDER_POST, &post);
3882 evas->inside_post_render = EINA_FALSE; 3898 evas->inside_post_render = EINA_FALSE;
3883 _deferred_callbacks_process(eo_e, evas); 3899 _deferred_callbacks_process(eo_e, evas);
3884 3900
diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h
index 86bb885ce3..39bb3acd0d 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -912,6 +912,11 @@ struct _Evas_Public_Data
912 Eina_Bool is_frozen : 1; 912 Eina_Bool is_frozen : 1;
913 Eina_Bool inside_post_render : 1; 913 Eina_Bool inside_post_render : 1;
914 Eina_Bool devices_modified : 1; 914 Eina_Bool devices_modified : 1;
915 Eina_Bool cb_render_pre : 1;
916
917 Eina_Bool cb_render_post : 1;
918 Eina_Bool cb_render_flush_pre : 1;
919 Eina_Bool cb_render_flush_post : 1;
915}; 920};
916 921
917struct _Evas_Layer 922struct _Evas_Layer