e_hwc_window: Synchronize frame in case of subsurface is synchronized committed 21/259721/5 accepted/tizen/unified/20210621.123017 submit/tizen/20210621.042754
authorChangyeon Lee <cyeon.lee@samsung.com>
Thu, 10 Jun 2021 06:26:35 +0000 (15:26 +0900)
committerChangyeon Lee <cyeon.lee@samsung.com>
Mon, 21 Jun 2021 03:13:51 +0000 (12:13 +0900)
if subsurface is synchronized committed, frame should be synchronized
with parent surface.
so call e_hwc_window_present_sync when subsurface is displayed by hwc
but parent is displayed by gl compositing.

Change-Id: Iea291960f18c2bb13e6df1f4de06bbf0a3d9aca5

src/bin/e_hwc_window.c

index 4288fcecc3bd22da3e48e2a4cbb99fcf239d205d..28641041a26e5480b7f5d83c498fc57fbfb988fd 100644 (file)
@@ -95,6 +95,7 @@ typedef enum _E_Hwc_Window_Restriction
 
 static Eina_Bool ehw_trace = EINA_FALSE;
 static Eina_List *hwc_window_client_hooks = NULL;
+static Eina_List *hwc_window_comp_wl_hooks = NULL;
 static Eina_List *hwc_window_event_hdlrs = NULL;
 
 static int _e_hwc_window_hooks_delete = 0;
@@ -943,6 +944,40 @@ end:
    return ECORE_CALLBACK_PASS_ON;
 }
 
+static void
+_e_hwc_window_cb_subsurface_synchronized_commit(void *data, E_Client *ec)
+{
+   E_Client *parent;
+   E_Hwc_Window_State state;
+   Eina_Bool need_sync = EINA_FALSE;
+
+   EINA_SAFETY_ON_NULL_RETURN(ec);
+   if ((!ec->hwc_window) || (!ec->comp_data) || (!ec->comp_data->sub.data)) return;
+
+   state = e_hwc_window_accepted_state_get(ec->hwc_window);
+   if ((state != E_HWC_WINDOW_STATE_DEVICE) && (state != E_HWC_WINDOW_STATE_VIDEO))
+     return;
+
+   parent = ec->comp_data->sub.data->parent;
+   while (parent)
+     {
+        state = e_hwc_window_accepted_state_get(parent->hwc_window);
+        if (state == E_HWC_WINDOW_STATE_CLIENT)
+          {
+             need_sync = EINA_TRUE;
+             break;
+          }
+
+        if ((!parent->comp_data) || (!parent->comp_data->sub.data))
+          break;
+
+        parent = parent->comp_data->sub.data->parent;
+     }
+
+   if (need_sync)
+     e_hwc_window_present_sync(ec->hwc_window);
+}
+
 EINTERN Eina_Bool
 e_hwc_window_init(void)
 {
@@ -952,6 +987,8 @@ e_hwc_window_init(void)
                       _e_hwc_window_client_cb_transform_change, NULL);
    E_LIST_HANDLER_APPEND(hwc_window_event_hdlrs, E_EVENT_CLIENT_ZONE_SET,
                          _e_hwc_window_client_cb_zone_set, NULL);
+   E_COMP_WL_HOOK_APPEND(hwc_window_comp_wl_hooks, E_COMP_WL_HOOK_SUBSURFACE_SYNCHRONIZED_COMMIT,
+                         _e_hwc_window_cb_subsurface_synchronized_commit, NULL);
 
    return EINA_TRUE;
 }
@@ -961,6 +998,7 @@ e_hwc_window_deinit(void)
 {
    E_FREE_LIST(hwc_window_client_hooks, e_client_hook_del);
    E_FREE_LIST(hwc_window_event_hdlrs, ecore_event_handler_del);
+   E_FREE_LIST(hwc_window_comp_wl_hooks, e_comp_wl_hook_del);
 }
 
 EINTERN E_Hwc_Window *