e_hwc_window_queue: reset constraints if norender is pushed 78/251878/2 accepted/tizen/unified/20210121.134601 submit/tizen/20210121.033805
authorChangyeon Lee <cyeon.lee@samsung.com>
Wed, 20 Jan 2021 05:08:53 +0000 (14:08 +0900)
committerChangyeon Lee <cyeon.lee@samsung.com>
Wed, 20 Jan 2021 08:07:13 +0000 (17:07 +0900)
if norender is pushed, hwc doesn't change accpeted state of window.
so hwc_window can be block render because hwc_window_queue doesn't
send usable event.

Change-Id: I6cddbd80866a294561a70eb9729ef0e14ea3b2fa

src/bin/e_hwc_window_queue.c

index 76d5ac1..1763ba2 100644 (file)
     } \
   while (0)
 
+#define E_HWC_HOOK_APPEND(list, type, callback, data) \
+  do \
+    { \
+       E_Hwc_Hook *_ch; \
+       _ch = e_hwc_hook_add(type, callback, data); \
+       assert(_ch); \
+       list = eina_list_append(list, _ch); \
+    } \
+  while (0)
+
 #define EHWQERR(f, ec, hwc, ehwq, x...)                                    \
    do                                                                      \
      {                                                                     \
@@ -100,6 +110,7 @@ struct _E_Hwc_Window_Queue_Event
    E_Hwc_Window_Queue *queue;
 };
 
+static Eina_List *hwc_window_queue_hwc_hooks = NULL;
 static Eina_List *hwc_window_queue_window_hooks = NULL;
 static Eina_List *hwc_window_queue_comp_wl_hooks = NULL;
 static E_Hwc_Window_Queue_Manager *_hwc_winq_mgr = NULL;
@@ -1144,46 +1155,6 @@ _e_hwc_window_queue_cb_buffer_change(void *data, E_Client *ec)
      _e_hwc_window_unkown_queue_release(tsurface);
 }
 
-static void
-_e_hwc_window_queue_norender_queue_state_set(E_Hwc *hwc)
-{
-   Eina_Iterator *it;
-   E_Hwc_Window_Queue *queue;
-   E_Hwc_Window_State target_accepted_state;
-   E_Hwc_Window *tmp_hwc_window;
-   Eina_List *l, *ll;
-
-   it = eina_hash_iterator_data_new(_hwc_winq_mgr->hwc_winq_hash);
-   if (!it) return;
-
-   target_accepted_state = e_hwc_window_accepted_state_get((E_Hwc_Window *)hwc->target_hwc_window);
-
-   EINA_ITERATOR_FOREACH(it, queue)
-     {
-        if (!queue->user) continue;
-        if (!queue->user->buffer.tsurface) continue;
-        if (queue->state != E_HWC_WINDOW_QUEUE_STATE_SET_WAITING_BUFFER) continue;
-
-        if ((queue->is_target) && (target_accepted_state == E_HWC_WINDOW_STATE_DEVICE))
-          {
-             if (e_hwc_window_queue_buffer_find(queue, queue->user->buffer.tsurface))
-               {
-                  EINA_LIST_FOREACH_SAFE(queue->user_pending_set, l, ll, tmp_hwc_window)
-                    e_hwc_window_constraints_reset(tmp_hwc_window);
-
-                  e_hwc_window_constraints_reset(queue->user);
-               }
-          }
-        else
-          {
-             if (e_hwc_window_queue_buffer_find(queue, queue->user->buffer.tsurface))
-               _e_hwc_window_queue_set(queue);
-          }
-     }
-
-   eina_iterator_free(it);
-}
-
 void
 _e_hwc_window_queue_cb_accepted_state_set(void *data, E_Hwc_Window *hwc_window)
 {
@@ -1197,9 +1168,6 @@ _e_hwc_window_queue_cb_accepted_state_set(void *data, E_Hwc_Window *hwc_window)
    queue = hwc_window->queue;
    state = e_hwc_window_accepted_state_get(hwc_window);
 
-   if (e_hwc_window_is_target(hwc_window) && e_hwc_norender_get(hwc_window->hwc))
-     _e_hwc_window_queue_norender_queue_state_set(hwc_window->hwc);
-
    if ((state == E_HWC_WINDOW_STATE_DEVICE))
      {
         if (e_hwc_window_is_target(hwc_window))
@@ -1345,6 +1313,31 @@ _e_hwc_window_queue_get(tbm_surface_queue_h tqueue)
    return queue;
 }
 
+static void
+_e_hwc_window_queue_cb_norender_set(void *data, E_Hwc *hwc)
+{
+   Eina_Iterator *it;
+   E_Hwc_Window_Queue *queue;
+   E_Hwc_Window *tmp_hwc_window;
+   Eina_List *l, *ll;
+
+   it = eina_hash_iterator_data_new(_hwc_winq_mgr->hwc_winq_hash);
+   if (!it) return;
+
+   EINA_ITERATOR_FOREACH(it, queue)
+     {
+        if (!queue->user) continue;
+        if (queue->state == E_HWC_WINDOW_QUEUE_STATE_SET) continue;
+
+        EINA_LIST_FOREACH_SAFE(queue->user_pending_set, l, ll, tmp_hwc_window)
+          e_hwc_window_constraints_reset(tmp_hwc_window);
+
+        e_hwc_window_constraints_reset(queue->user);
+     }
+
+   eina_iterator_free(it);
+}
+
 EINTERN Eina_Bool
 e_hwc_window_queue_init(void)
 {
@@ -1357,6 +1350,8 @@ e_hwc_window_queue_init(void)
 
    E_LIST_HANDLER_APPEND(_hwc_winq_mgr->event_handlers, E_EVENT_HWC_WINDOW_QUEUE_UNSET,
                          _e_hwc_window_queue_cb_unset, NULL);
+   E_HWC_HOOK_APPEND(hwc_window_queue_hwc_hooks, E_HWC_HOOK_NORENDER_SET,
+                     _e_hwc_window_queue_cb_norender_set, NULL);
    E_HWC_WINDOW_HOOK_APPEND(hwc_window_queue_window_hooks, E_HWC_WINDOW_HOOK_ACCEPTED_STATE_SET,
                             _e_hwc_window_queue_cb_accepted_state_set, NULL);
    E_COMP_WL_HOOK_APPEND(hwc_window_queue_comp_wl_hooks, E_COMP_WL_HOOK_BUFFER_CHANGE,
@@ -1371,6 +1366,7 @@ e_hwc_window_queue_deinit(void)
    if (!_hwc_winq_mgr) return;
 
    E_FREE_LIST(_hwc_winq_mgr->event_handlers, ecore_event_handler_del);
+   E_FREE_LIST(hwc_window_queue_hwc_hooks, e_hwc_hook_del);
    E_FREE_LIST(hwc_window_queue_window_hooks, e_hwc_window_hook_del);
    E_FREE_LIST(hwc_window_queue_comp_wl_hooks, e_comp_wl_hook_del);