From 7cafd567362e08075a741db549cc4c7f64d9fd2d Mon Sep 17 00:00:00 2001 From: Seunghun Lee Date: Thu, 15 Dec 2022 17:16:10 +0900 Subject: [PATCH] video: Move video update job to E_MAIN_HOOK_POST_CLIENT_IDLER_BEFORE This patch is to change the order of jobs like this: Old: video update job -> e_client_idler_before() -> hwc commit job New: e_client_idler_before() -> video update job -> hwc commit job The problem with the old way is that if the E_Client for video gets updated for some reason in the process of e_client_idler_before(), then video update job couldn't get a chance to be up to date with it and hwc commit job would end up getting done without the update. It would be obviously better if we could commit all changes to onscreen at once as far as possible. And this patch is made to achieve it. It is necessaty to add a new hook point called E_MAIN_HOOK_POST_CLIENT_IDLER_BEFORE in e_main, because there is no way to insert a video update job handler between e_client_idler_before() and hwc commt job, The callbacks associated with the hook point will be called right after the call e_client_idler_before(). This way, video update job will be able to get a chance to be up to date with changes which might be made in the process of e_client_idler_before(). Change-Id: I857e0efcb12e7a06c18921bdfc6e6077fd5f521d --- src/bin/e_main.c | 5 ++++- src/bin/e_main.h | 1 + src/bin/video/iface/e_video_hwc.c | 23 +++++++++-------------- src/bin/video/iface/e_video_hwc.h | 2 +- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/bin/e_main.c b/src/bin/e_main.c index 6c4ab3d..97933d5 100644 --- a/src/bin/e_main.c +++ b/src/bin/e_main.c @@ -122,7 +122,8 @@ static int _e_main_hooks_walking = 0; static Eina_Inlist *_e_main_hooks[] = { [E_MAIN_HOOK_MODULE_LOAD_DONE] = NULL, - [E_MAIN_HOOK_E_INFO_READY] = NULL + [E_MAIN_HOOK_E_INFO_READY] = NULL, + [E_MAIN_HOOK_POST_CLIENT_IDLER_BEFORE] = NULL }; /* external variables */ @@ -1168,7 +1169,9 @@ static Eina_Bool _e_main_cb_idle_before(void *data EINA_UNUSED) { e_client_idler_before(); + _e_main_hook_call(E_MAIN_HOOK_POST_CLIENT_IDLER_BEFORE, NULL); edje_thaw(); + return ECORE_CALLBACK_RENEW; } diff --git a/src/bin/e_main.h b/src/bin/e_main.h index fa4fe7a..9591b4c 100644 --- a/src/bin/e_main.h +++ b/src/bin/e_main.h @@ -9,6 +9,7 @@ typedef enum _E_Main_Hook_Point { E_MAIN_HOOK_MODULE_LOAD_DONE, E_MAIN_HOOK_E_INFO_READY, + E_MAIN_HOOK_POST_CLIENT_IDLER_BEFORE, E_MAIN_HOOK_LAST } E_Main_Hook_Point; diff --git a/src/bin/video/iface/e_video_hwc.c b/src/bin/video/iface/e_video_hwc.c index 80a1963..ab48990 100644 --- a/src/bin/video/iface/e_video_hwc.c +++ b/src/bin/video/iface/e_video_hwc.c @@ -1194,8 +1194,8 @@ _e_video_hwc_geometry_map_apply(E_Client *ec, E_Video_Hwc_Geometry *out) return EINA_TRUE; } -static Eina_Bool -_e_video_hwc_idle_enterer(void *data) +static void +_e_video_hwc_cb_post_client_idler_before(void *data) { E_Video_Hwc *evh; E_Client *topmost; @@ -1238,24 +1238,19 @@ _e_video_hwc_idle_enterer(void *data) } } - /* The idle enterer will get deleted as a result of returning - * ECORE_CALLBACK_CANCEL. */ - evh->render.idle_enterer = NULL; - - return ECORE_CALLBACK_CANCEL; + E_FREE_FUNC(evh->render.post_client_idler_before_hook, e_main_hook_del); } static void _e_video_hwc_render_queue(E_Video_Hwc *evh) { - if (evh->render.idle_enterer) + if (evh->render.post_client_idler_before_hook) return; - /* The reason that ecore_idle_enterer_*before*_add is used here is to give - * a chance to deal with its jobs prior to the hwc output dealing with its - * job with idle entererer as well. */ - evh->render.idle_enterer = - ecore_idle_enterer_before_add(_e_video_hwc_idle_enterer, evh); + evh->render.post_client_idler_before_hook = + e_main_hook_add(E_MAIN_HOOK_POST_CLIENT_IDLER_BEFORE, + _e_video_hwc_cb_post_client_idler_before, + evh); } static void @@ -1841,7 +1836,7 @@ _e_video_hwc_iface_destroy(E_Video_Comp_Iface *iface) _e_video_hwc_client_event_deinit(evh); - E_FREE_FUNC(evh->render.idle_enterer, ecore_idle_enterer_del); + E_FREE_FUNC(evh->render.post_client_idler_before_hook, e_main_hook_del); if (evh->render_fail.walking) { diff --git a/src/bin/video/iface/e_video_hwc.h b/src/bin/video/iface/e_video_hwc.h index 0e6e9a2..22072ee 100644 --- a/src/bin/video/iface/e_video_hwc.h +++ b/src/bin/video/iface/e_video_hwc.h @@ -96,7 +96,7 @@ struct _E_Video_Hwc struct { - Ecore_Idle_Enterer *idle_enterer; + E_Main_Hook *post_client_idler_before_hook; Eina_Bool map; Eina_Bool redraw; Eina_Bool topmost_viewport; -- 2.7.4