video: Move video update job to E_MAIN_HOOK_POST_CLIENT_IDLER_BEFORE 56/285656/1 accepted/tizen/7.0/unified/20221219.021144
authorSeunghun Lee <shiin.lee@samsung.com>
Thu, 15 Dec 2022 08:16:10 +0000 (17:16 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Fri, 16 Dec 2022 05:01:36 +0000 (14:01 +0900)
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
src/bin/e_main.h
src/bin/video/iface/e_video_hwc.c
src/bin/video/iface/e_video_hwc.h

index 6c4ab3d658799e7889ec4761741185dd49c84897..97933d5292e256a8b6e38b2d79b051f18c717b7e 100644 (file)
@@ -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;
 }
 
index fa4fe7ac7ed6a0ce362607c141a44e25e9783102..9591b4c44e43949d9f4a41995c7600289bd7b2b1 100644 (file)
@@ -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;
 
index 80a1963e6aa9565045fc6e43fb962a1ba7f48526..ab48990736551344c5003aae56fe3cb827257b9a 100644 (file)
@@ -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)
      {
index 0e6e9a21874ada7d3fe920a1ec8c9eea00d6cf8d..22072eed1fb7a33bc9f443a28907b2a722f7dc96 100644 (file)
@@ -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;