forked from enlightenment/efl
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
This commit is contained in:
parent
7ad8acc290
commit
dc5c17a104
|
@ -2014,5 +2014,41 @@ EWAPI const Efl_Event_Description _EVAS_CANVAS_EVENT_AXIS_UPDATE =
|
||||||
EWAPI const Efl_Event_Description _EVAS_CANVAS_EVENT_VIEWPORT_RESIZE =
|
EWAPI const Efl_Event_Description _EVAS_CANVAS_EVENT_VIEWPORT_RESIZE =
|
||||||
EFL_EVENT_DESCRIPTION("viewport,resize");
|
EFL_EVENT_DESCRIPTION("viewport,resize");
|
||||||
|
|
||||||
|
#define CHECK_ADD(var, ev, member) \
|
||||||
|
if ((var) == (ev)) \
|
||||||
|
{ \
|
||||||
|
e->member = EINA_TRUE; \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
EOLIAN static Eina_Bool
|
||||||
|
_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)
|
||||||
|
{
|
||||||
|
CHECK_ADD(desc, EVAS_CANVAS_EVENT_RENDER_FLUSH_PRE, cb_render_flush_pre)
|
||||||
|
else CHECK_ADD(desc, EVAS_CANVAS_EVENT_RENDER_FLUSH_POST, cb_render_flush_post)
|
||||||
|
else CHECK_ADD(desc, EFL_CANVAS_SCENE_EVENT_RENDER_PRE, cb_render_pre)
|
||||||
|
else CHECK_ADD(desc, EFL_CANVAS_SCENE_EVENT_RENDER_POST, cb_render_post)
|
||||||
|
|
||||||
|
return efl_event_callback_priority_add(efl_super(obj, MY_CLASS), desc, priority, func, user_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static Eina_Bool
|
||||||
|
_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)
|
||||||
|
{
|
||||||
|
for (int i = 0; array[i].desc; ++i)
|
||||||
|
{
|
||||||
|
CHECK_ADD(array[i].desc, EVAS_CANVAS_EVENT_RENDER_FLUSH_PRE, cb_render_flush_pre)
|
||||||
|
else CHECK_ADD(array[i].desc, EVAS_CANVAS_EVENT_RENDER_FLUSH_POST, cb_render_flush_post)
|
||||||
|
else CHECK_ADD(array[i].desc, EFL_CANVAS_SCENE_EVENT_RENDER_PRE, cb_render_pre)
|
||||||
|
else CHECK_ADD(array[i].desc, EFL_CANVAS_SCENE_EVENT_RENDER_POST, cb_render_post)
|
||||||
|
}
|
||||||
|
return efl_event_callback_array_priority_add(efl_super(obj, MY_CLASS), array, priority, user_data);
|
||||||
|
}
|
||||||
|
#undef CHECK_ADD
|
||||||
|
#define EVAS_CANVAS_EXTRA_OPS \
|
||||||
|
EFL_OBJECT_OP_FUNC(efl_event_callback_priority_add, _evas_canvas_efl_object_event_callback_priority_add), \
|
||||||
|
EFL_OBJECT_OP_FUNC(efl_event_callback_array_priority_add, _evas_canvas_efl_object_event_callback_array_priority_add)
|
||||||
|
|
||||||
|
|
||||||
#include "evas_stack.x"
|
#include "evas_stack.x"
|
||||||
#include "canvas/evas_canvas_eo.c"
|
#include "canvas/evas_canvas_eo.c"
|
||||||
|
|
|
@ -2762,10 +2762,26 @@ _drop_image_cache_ref(const void *container EINA_UNUSED, void *data, void *fdata
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cb_always_call(Evas *eo_e, Evas_Callback_Type type, void *event_info)
|
_cb_always_call(Evas *eo_e, Evas_Public_Data *e, Evas_Callback_Type type, void *event_info)
|
||||||
{
|
{
|
||||||
int freeze_num = 0, i;
|
int freeze_num = 0, i;
|
||||||
|
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case EVAS_CALLBACK_RENDER_PRE:
|
||||||
|
if (!e->cb_render_pre) return;
|
||||||
|
break;
|
||||||
|
case EVAS_CALLBACK_RENDER_POST:
|
||||||
|
if (!e->cb_render_post) return;
|
||||||
|
break;
|
||||||
|
case EVAS_CALLBACK_RENDER_FLUSH_PRE:
|
||||||
|
if (!e->cb_render_flush_pre) return;
|
||||||
|
break;
|
||||||
|
case EVAS_CALLBACK_RENDER_FLUSH_POST:
|
||||||
|
if (!e->cb_render_flush_post) return;
|
||||||
|
break;
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
freeze_num = efl_event_freeze_count_get(eo_e);
|
freeze_num = efl_event_freeze_count_get(eo_e);
|
||||||
for (i = 0; i < freeze_num; i++) efl_event_thaw(eo_e);
|
for (i = 0; i < freeze_num; i++) efl_event_thaw(eo_e);
|
||||||
evas_event_callback_call(eo_e, type, event_info);
|
evas_event_callback_call(eo_e, type, event_info);
|
||||||
|
@ -3277,7 +3293,7 @@ evas_render_updates_internal(Evas *eo_e,
|
||||||
|
|
||||||
RD(0, "[--- RENDER EVAS (size: %ix%i): %p (eo %p)\n", e->viewport.w, e->viewport.h, e, eo_e);
|
RD(0, "[--- RENDER EVAS (size: %ix%i): %p (eo %p)\n", e->viewport.w, e->viewport.h, e, eo_e);
|
||||||
|
|
||||||
_cb_always_call(eo_e, EVAS_CALLBACK_RENDER_PRE, NULL);
|
_cb_always_call(eo_e, e, EVAS_CALLBACK_RENDER_PRE, NULL);
|
||||||
|
|
||||||
/* Check if the modified object mean recalculating every thing */
|
/* Check if the modified object mean recalculating every thing */
|
||||||
if (!e->invalidate)
|
if (!e->invalidate)
|
||||||
|
@ -3596,7 +3612,7 @@ evas_render_updates_internal(Evas *eo_e,
|
||||||
efl_ref(eo_e);
|
efl_ref(eo_e);
|
||||||
_rendering_evases = eina_list_prepend(_rendering_evases, e);
|
_rendering_evases = eina_list_prepend(_rendering_evases, e);
|
||||||
e->rendering = _rendering_evases;
|
e->rendering = _rendering_evases;
|
||||||
_cb_always_call(eo_e, EVAS_CALLBACK_RENDER_FLUSH_PRE, NULL);
|
_cb_always_call(eo_e, e, EVAS_CALLBACK_RENDER_FLUSH_PRE, NULL);
|
||||||
evas_thread_queue_flush((Evas_Thread_Command_Cb)evas_render_pipe_wakeup, e);
|
evas_thread_queue_flush((Evas_Thread_Command_Cb)evas_render_pipe_wakeup, e);
|
||||||
eina_evlog("-render_output_async_flush", eo_e, 0.0, NULL);
|
eina_evlog("-render_output_async_flush", eo_e, 0.0, NULL);
|
||||||
}
|
}
|
||||||
|
@ -3607,11 +3623,11 @@ evas_render_updates_internal(Evas *eo_e,
|
||||||
{
|
{
|
||||||
_evas_object_image_video_overlay_do(eo_obj);
|
_evas_object_image_video_overlay_do(eo_obj);
|
||||||
}
|
}
|
||||||
_cb_always_call(eo_e, EVAS_CALLBACK_RENDER_FLUSH_PRE, NULL);
|
_cb_always_call(eo_e, e, EVAS_CALLBACK_RENDER_FLUSH_PRE, NULL);
|
||||||
EINA_LIST_FOREACH(e->outputs, l, out)
|
EINA_LIST_FOREACH(e->outputs, l, out)
|
||||||
if (out->output)
|
if (out->output)
|
||||||
ENFN->output_flush(ENC, out->output, EVAS_RENDER_MODE_SYNC);
|
ENFN->output_flush(ENC, out->output, EVAS_RENDER_MODE_SYNC);
|
||||||
_cb_always_call(eo_e, EVAS_CALLBACK_RENDER_FLUSH_POST, NULL);
|
_cb_always_call(eo_e, e, EVAS_CALLBACK_RENDER_FLUSH_POST, NULL);
|
||||||
_deferred_callbacks_process(eo_e, evas);
|
_deferred_callbacks_process(eo_e, evas);
|
||||||
eina_evlog("-render_output_flush", eo_e, 0.0, NULL);
|
eina_evlog("-render_output_flush", eo_e, 0.0, NULL);
|
||||||
}
|
}
|
||||||
|
@ -3766,7 +3782,7 @@ evas_render_updates_internal(Evas *eo_e,
|
||||||
}
|
}
|
||||||
eina_spinlock_take(&(e->render.lock));
|
eina_spinlock_take(&(e->render.lock));
|
||||||
e->inside_post_render = EINA_TRUE;
|
e->inside_post_render = EINA_TRUE;
|
||||||
_cb_always_call(eo_e, EVAS_CALLBACK_RENDER_POST, &post);
|
_cb_always_call(eo_e, e, EVAS_CALLBACK_RENDER_POST, &post);
|
||||||
e->inside_post_render = EINA_FALSE;
|
e->inside_post_render = EINA_FALSE;
|
||||||
eina_spinlock_release(&(e->render.lock));
|
eina_spinlock_release(&(e->render.lock));
|
||||||
if (post.updated_area) eina_list_free(post.updated_area);
|
if (post.updated_area) eina_list_free(post.updated_area);
|
||||||
|
@ -3835,7 +3851,7 @@ evas_render_wakeup(Evas *eo_e)
|
||||||
{
|
{
|
||||||
_evas_object_image_video_overlay_do(eo_obj);
|
_evas_object_image_video_overlay_do(eo_obj);
|
||||||
}
|
}
|
||||||
_cb_always_call(eo_e, EVAS_CALLBACK_RENDER_FLUSH_POST, NULL);
|
_cb_always_call(eo_e, evas, EVAS_CALLBACK_RENDER_FLUSH_POST, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* clear redraws */
|
/* clear redraws */
|
||||||
|
@ -3878,7 +3894,7 @@ evas_render_wakeup(Evas *eo_e)
|
||||||
evas->rendering = NULL;
|
evas->rendering = NULL;
|
||||||
|
|
||||||
post.updated_area = ret_updates;
|
post.updated_area = ret_updates;
|
||||||
_cb_always_call(eo_e, EVAS_CALLBACK_RENDER_POST, &post);
|
_cb_always_call(eo_e, evas, EVAS_CALLBACK_RENDER_POST, &post);
|
||||||
evas->inside_post_render = EINA_FALSE;
|
evas->inside_post_render = EINA_FALSE;
|
||||||
_deferred_callbacks_process(eo_e, evas);
|
_deferred_callbacks_process(eo_e, evas);
|
||||||
|
|
||||||
|
|
|
@ -912,6 +912,11 @@ struct _Evas_Public_Data
|
||||||
Eina_Bool is_frozen : 1;
|
Eina_Bool is_frozen : 1;
|
||||||
Eina_Bool inside_post_render : 1;
|
Eina_Bool inside_post_render : 1;
|
||||||
Eina_Bool devices_modified : 1;
|
Eina_Bool devices_modified : 1;
|
||||||
|
Eina_Bool cb_render_pre : 1;
|
||||||
|
|
||||||
|
Eina_Bool cb_render_post : 1;
|
||||||
|
Eina_Bool cb_render_flush_pre : 1;
|
||||||
|
Eina_Bool cb_render_flush_post : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _Evas_Layer
|
struct _Evas_Layer
|
||||||
|
|
Loading…
Reference in New Issue