e_hwc_window: add transition_failrues to hwc_window 23/211623/4
authorChangyeon Lee <cyeon.lee@samsung.com>
Tue, 6 Aug 2019 05:39:21 +0000 (14:39 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Wed, 14 Aug 2019 02:29:05 +0000 (02:29 +0000)
1. increase transition_failures when buffer of target_window is changed
   and transition of hwc_window is set.
2. max_transition_failures is set by queue size of target window
3. if transition_failures of hwc_widow larger than max_transition_failrues,
   force accept trainsition of hwc_window.
4. if transition window is exist and buffer and display buffer of target are same,
   transition is set true

Change-Id: I1a7abb639bb1eb47ee415c85fe42272943d43e70

src/bin/e_hwc.h
src/bin/e_hwc_window.c
src/bin/e_hwc_window.h
src/bin/e_hwc_window_queue.c
src/bin/e_hwc_window_queue.h
src/bin/e_hwc_windows.c

index 37fe385464b2edf8fbc346fa1da1840041ce3b41..a23b6d18b9275e24877e82d6db38c0afdde58edd 100644 (file)
@@ -93,6 +93,7 @@ struct _E_Hwc
    Eina_List           *visible_windows;
    int                  num_visible_windows;
    Eina_Bool            device_state_available;
+   Eina_Bool            transition;
 
    /* capabilities */
    Eina_Bool     tdm_hwc_video_stream;
index 7c7b8838a4aa5f295024145b17f02e4671a2b8cf..5da4fbd0ad3dc16a891d9fa358d42fae7ba93a37 100644 (file)
@@ -1568,10 +1568,19 @@ e_hwc_window_transition_set(E_Hwc_Window *hwc_window, E_Hwc_Window_Transition tr
 
    hwc_window->transition = transition;
 
+   if (transition == E_HWC_WINDOW_TRANSITION_NONE_TO_NONE)
+     hwc_window->transition_failures = 0;
+
    if ((transition == E_HWC_WINDOW_TRANSITION_DEVICE_TO_CLIENT) ||
        (transition == E_HWC_WINDOW_TRANSITION_DEVICE_TO_NONE))
      _e_hwc_window_constraints_reset(hwc_window);
 
+   if (transition)
+     EHWTRACE(" [%25s] is on TRANSITION [%s -> %s].",
+              hwc_window->ec, hwc_window->hwc, hwc_window, e_hwc_window_name_get(hwc_window),
+              e_hwc_window_state_string_get(hwc_window->accepted_state),
+              e_hwc_window_state_string_get(hwc_window->state));
+
    return EINA_TRUE;
 }
 
index f6c24cb523306476ce9709329e30791f36e89375..e9ecdcba1e5bfdeaa0ab8e9539b68a3359edf72d 100644 (file)
@@ -93,6 +93,7 @@ struct _E_Hwc_Window
    E_Hwc_Window_State             state;
    E_Hwc_Window_State             accepted_state;
    E_Hwc_Window_Transition        transition;
+   int                            transition_failures;
 
    E_Hwc_Window_Buffer            buffer;
 
@@ -154,6 +155,7 @@ struct _E_Hwc_Window_Target
    Eina_List          *target_buffer_list;
    Eina_List          *rendered_windows;
    Eina_Bool           is_rendering;
+   int                 max_transition_failures;
 
    Eina_Bool skip_surface_set;
 };
index 2ea662761fbd0d20b849884d4b5cc5a40e475d39..35ae7fc9b8889470d5d8bd3054b52a36c8d59d32 100644 (file)
@@ -1489,6 +1489,18 @@ e_hwc_window_queue_acquirable_buffers_get(E_Hwc_Window_Queue *queue)
    return acquirable_buffers;
 }
 
+EINTERN int
+e_hwc_window_queue_size_get(E_Hwc_Window_Queue *queue)
+{
+   int queue_size;
+
+   EINA_SAFETY_ON_NULL_RETURN_VAL(queue, 0);
+
+   queue_size = tbm_surface_queue_get_size(queue->tqueue);
+
+   return queue_size;
+}
+
 EINTERN void
 e_hwc_window_queue_trace_debug(Eina_Bool onoff)
 {
index b5511ca0727320a22c2591ee4bfb8c5ddffac6b0..70242f71b7e857a09cc33bd79c3a4f7907178c84 100644 (file)
@@ -74,6 +74,7 @@ EINTERN Eina_Bool                   e_hwc_window_queue_buffer_release(E_Hwc_Wind
 EINTERN Eina_Bool                   e_hwc_window_queue_clear(E_Hwc_Window_Queue *queue);
 
 EINTERN Eina_List *                 e_hwc_window_queue_acquirable_buffers_get(E_Hwc_Window_Queue *queue);
+EINTERN int                         e_hwc_window_queue_size_get(E_Hwc_Window_Queue *queue);
 
 EINTERN void                        e_hwc_window_queue_trace_debug(Eina_Bool onoff);
 EINTERN void                        e_hwc_window_queue_debug_info_get(Eldbus_Message_Iter *iter);
index d05b97829c67880ab5195a51e460eea559a36a6c..43228486aba59dec30766bd29f0324f80328cd94 100644 (file)
@@ -7,6 +7,7 @@
 # include <pixman.h>
 
 #define DBG_EVALUATE 1
+#define DEFAULT_MAX_TRANSITION_FAILURES 3;
 
 #ifndef CLEAR
 #define CLEAR(x) memset(&(x), 0, sizeof (x))
@@ -766,6 +767,7 @@ static Eina_Bool
 _e_hwc_windows_target_window_queue_set(E_Hwc_Window_Target *target_hwc_window)
 {
    E_Hwc_Window_Queue *queue = NULL;
+   int queue_size = 0;
 
    queue = e_hwc_window_queue_user_set((E_Hwc_Window *)target_hwc_window);
    if (!queue) return EINA_FALSE;
@@ -776,6 +778,17 @@ _e_hwc_windows_target_window_queue_set(E_Hwc_Window_Target *target_hwc_window)
    ((E_Hwc_Window *)target_hwc_window)->queue_destroy_listener.notify = _e_hwc_windows_target_cb_queue_destroy;
    ((E_Hwc_Window *)target_hwc_window)->queue = queue;
 
+   queue_size = e_hwc_window_queue_size_get(queue);
+   if (queue_size)
+     {
+        target_hwc_window->max_transition_failures =
+           e_hwc_window_queue_size_get(((E_Hwc_Window *)target_hwc_window)->queue);
+     }
+   else
+     {
+        target_hwc_window->max_transition_failures = DEFAULT_MAX_TRANSITION_FAILURES;
+     }
+
    /* as evas_renderer has finished its work (to provide a composited buffer) it enqueues
     * the result buffer into this queue and acquirable cb gets called; this cb does nothing
     * except the writing into the event_fd object, this writing causes the new ecore_main loop
@@ -1652,17 +1665,29 @@ static Eina_Bool
 _e_hwc_windows_transition_check(E_Hwc *hwc)
 {
    E_Hwc_Window *hwc_window = NULL;
-
+   E_Hwc_Window_Target *target_hwc_window = NULL;
    Eina_Bool transition = EINA_FALSE;
    const Eina_List *l;
 
+   target_hwc_window = hwc->target_hwc_window;
+   EINA_SAFETY_ON_NULL_RETURN_VAL(target_hwc_window, EINA_FALSE);
+
    EINA_LIST_FOREACH(hwc->hwc_windows, l, hwc_window)
      {
+        E_Hwc_Window_Transition window_transition = E_HWC_WINDOW_TRANSITION_NONE_TO_NONE;
+
         if (e_hwc_window_is_target(hwc_window)) continue;
         if (e_hwc_window_is_video(hwc_window)) continue;
 
         if (hwc_window->state == hwc_window->accepted_state) continue;
 
+        if (hwc_window->transition_failures > target_hwc_window->max_transition_failures)
+          continue;
+
+        if ((((E_Hwc_Window *)target_hwc_window)->display.buffer.tsurface) ==
+            (((E_Hwc_Window *)target_hwc_window)->buffer.tsurface))
+          return EINA_TRUE;
+
         /* DEVICE -> CLIENT */
         if (hwc_window->state == E_HWC_WINDOW_STATE_CLIENT &&
             hwc_window->accepted_state == E_HWC_WINDOW_STATE_DEVICE)
@@ -1671,20 +1696,14 @@ _e_hwc_windows_transition_check(E_Hwc *hwc)
                continue;
 
              if (!_e_hwc_windows_target_window_rendered_window_has(hwc, hwc_window))
-               {
-                  e_hwc_window_transition_set(hwc_window, E_HWC_WINDOW_TRANSITION_DEVICE_TO_CLIENT);
-                  transition = EINA_TRUE;
-               }
+               window_transition = E_HWC_WINDOW_TRANSITION_DEVICE_TO_CLIENT;
           }
         /* DEVICE -> NONE */
         else if (hwc_window->state == E_HWC_WINDOW_STATE_NONE &&
                  hwc_window->accepted_state == E_HWC_WINDOW_STATE_DEVICE)
           {
              if (_e_hwc_windows_target_window_rendered_window_has(hwc, hwc_window))
-               {
-                  e_hwc_window_transition_set(hwc_window, E_HWC_WINDOW_TRANSITION_DEVICE_TO_CLIENT);
-                  transition = EINA_TRUE;
-               }
+               window_transition = E_HWC_WINDOW_TRANSITION_DEVICE_TO_NONE;
           }
         /* CURSOR -> CLIENT */
         else if (hwc_window->state == E_HWC_WINDOW_STATE_CLIENT &&
@@ -1694,69 +1713,53 @@ _e_hwc_windows_transition_check(E_Hwc *hwc)
                continue;
 
              if (!_e_hwc_windows_target_window_rendered_window_has(hwc, hwc_window))
-               {
-                  e_hwc_window_transition_set(hwc_window, E_HWC_WINDOW_TRANSITION_CURSOR_TO_CLIENT);
-                  transition = EINA_TRUE;
-               }
+               window_transition = E_HWC_WINDOW_TRANSITION_CURSOR_TO_CLIENT;
           }
         /* CURSOR -> NONE */
         else if (hwc_window->state == E_HWC_WINDOW_STATE_NONE &&
                  hwc_window->accepted_state == E_HWC_WINDOW_STATE_CURSOR)
           {
              if (_e_hwc_windows_target_window_rendered_window_has(hwc, hwc_window))
-               {
-                  e_hwc_window_transition_set(hwc_window, E_HWC_WINDOW_TRANSITION_CURSOR_TO_CLIENT);
-                  transition = EINA_TRUE;
-               }
+               window_transition = E_HWC_WINDOW_TRANSITION_CURSOR_TO_NONE;
           }
         /* NONE -> DEVICE */
         else if (hwc_window->state == E_HWC_WINDOW_STATE_DEVICE &&
                  hwc_window->accepted_state == E_HWC_WINDOW_STATE_NONE)
           {
              if (_e_hwc_windows_target_window_rendered_window_has(hwc, hwc_window))
-               {
-                  e_hwc_window_transition_set(hwc_window, E_HWC_WINDOW_TRANSITION_NONE_TO_DEVICE);
-                  transition = EINA_TRUE;
-               }
+               window_transition = E_HWC_WINDOW_TRANSITION_NONE_TO_DEVICE;
           }
         /* NONE -> CURSOR */
         else if (hwc_window->state == E_HWC_WINDOW_STATE_CURSOR &&
                  hwc_window->accepted_state == E_HWC_WINDOW_STATE_NONE)
           {
              if (_e_hwc_windows_target_window_rendered_window_has(hwc, hwc_window))
-               {
-                  e_hwc_window_transition_set(hwc_window, E_HWC_WINDOW_TRANSITION_NONE_TO_CURSOR);
-                  transition = EINA_TRUE;
-               }
+               window_transition = E_HWC_WINDOW_TRANSITION_NONE_TO_CURSOR;
           }
         /* CLIENT -> DEVICE */
         else if (hwc_window->state == E_HWC_WINDOW_STATE_DEVICE &&
                  hwc_window->accepted_state == E_HWC_WINDOW_STATE_CLIENT)
           {
              if (_e_hwc_windows_target_window_rendered_window_has(hwc, hwc_window))
-               {
-                  e_hwc_window_transition_set(hwc_window, E_HWC_WINDOW_TRANSITION_CLIENT_TO_DEVICE);
-                  transition = EINA_TRUE;
-               }
+               window_transition = E_HWC_WINDOW_TRANSITION_CLIENT_TO_DEVICE;
           }
         /* CLIENT -> CURSOR */
         else if (hwc_window->state == E_HWC_WINDOW_STATE_CURSOR &&
                  hwc_window->accepted_state == E_HWC_WINDOW_STATE_CLIENT)
           {
              if (_e_hwc_windows_target_window_rendered_window_has(hwc, hwc_window))
-               {
-                  e_hwc_window_transition_set(hwc_window, E_HWC_WINDOW_TRANSITION_CLIENT_TO_CURSOR);
-                  transition = EINA_TRUE;
-               }
+               window_transition = E_HWC_WINDOW_TRANSITION_CLIENT_TO_CURSOR;
+          }
+
+        if (window_transition)
+          {
+             hwc_window->transition_failures++;
+
+             e_hwc_window_transition_set(hwc_window, window_transition);
+             transition = EINA_TRUE;
           }
      }
-#if 0
-    if (transition)
-      EHWSTRACE(" [%25s(ehw:%p)] is on TRANSITION [%s -> %s].",
-                hwc_window->ec, hwc, e_hwc_window_name_get(hwc_window), hwc_window,
-                e_hwc_window_state_string_get(hwc_window->accepted_state),
-                e_hwc_window_state_string_get(hwc_window->state));
-#endif
+
     return transition;
 }
 
@@ -2290,6 +2293,13 @@ _e_hwc_windows_evaluate(E_Hwc *hwc)
           _e_hwc_windows_target_window_buffer_skip(hwc, EINA_FALSE);
         else
           _e_hwc_windows_target_window_buffer_skip(hwc, EINA_TRUE);
+
+        if (!hwc->transition)
+          {
+             _e_hwc_windows_target_window_force_render(hwc->target_hwc_window);
+             hwc->transition = EINA_TRUE;
+          }
+
         goto re_evaluate;
      }
 
@@ -2310,6 +2320,8 @@ _e_hwc_windows_evaluate(E_Hwc *hwc)
           _e_hwc_windows_target_buffer_fetch(hwc, !hwc->pp_set);
      }
 
+   hwc->transition = EINA_FALSE;
+
    return EINA_TRUE;
 
 re_evaluate: