e_hwc_windows: fix missing present feedback callback when queue is cleared 61/303561/1
authorChangyeon Lee <cyeon.lee@samsung.com>
Tue, 2 Jan 2024 03:22:27 +0000 (12:22 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Tue, 2 Jan 2024 07:01:32 +0000 (16:01 +0900)
if queue is cleared when state of target window is none, present feedback
callback of queue buffer is missed until queue buffer is resued.
this patch move present feedback callback to target window when
queue is cleared.

Change-Id: Idfcddad5b01478a3439ad790a1c8dc8af4f93c90

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

index a76150f..61d7d91 100644 (file)
@@ -2299,19 +2299,6 @@ e_hwc_window_queue_buffer_release(E_Hwc_Window_Queue *queue, E_Hwc_Window_Queue_
    return EINA_TRUE;
 }
 
-EINTERN Eina_Bool
-e_hwc_window_queue_clear(E_Hwc_Window_Queue *queue)
-{
-   E_Hwc_Window_Queue_Buffer *queue_buffer;
-
-   EINA_SAFETY_ON_NULL_RETURN_VAL(queue, EINA_FALSE);
-
-   while ((queue_buffer = e_hwc_window_queue_buffer_acquire(queue)))
-     e_hwc_window_queue_buffer_release(queue, queue_buffer);
-
-   return EINA_TRUE;
-}
-
 EINTERN Eina_List *
 e_hwc_window_queue_acquirable_buffers_get(E_Hwc_Window_Queue *queue)
 {
index de3a519..b3ec776 100644 (file)
@@ -101,7 +101,6 @@ EINTERN E_Hwc_Window_Queue_Buffer * e_hwc_window_queue_buffer_dequeue(E_Hwc_Wind
 EINTERN Eina_Bool                   e_hwc_window_queue_buffer_enqueue(E_Hwc_Window_Queue *queue, E_Hwc_Window_Queue_Buffer *queue_buffer);
 EINTERN E_Hwc_Window_Queue_Buffer * e_hwc_window_queue_buffer_acquire(E_Hwc_Window_Queue *queue);
 EINTERN Eina_Bool                   e_hwc_window_queue_buffer_release(E_Hwc_Window_Queue *queue, E_Hwc_Window_Queue_Buffer *queue_buffer);
-EINTERN Eina_Bool                   e_hwc_window_queue_clear(E_Hwc_Window_Queue *queue);
 EINTERN void                        e_hwc_window_queue_buffer_reference(E_Hwc_Window_Queue_Buffer_Ref *ref, E_Hwc_Window_Queue_Buffer *buffer);
 
 EINTERN Eina_List *                 e_hwc_window_queue_acquirable_buffers_get(E_Hwc_Window_Queue *queue);
index 6592f10..7d053c9 100644 (file)
@@ -661,7 +661,6 @@ _e_hwc_windows_target_window_buffer_skip(E_Hwc *hwc)
 {
    E_Hwc_Window_Target *target_hwc_window;
    E_Hwc_Window *hwc_window;
-   E_Hwc_Windows_Comp_Info *comp_info;
    tdm_hwc *thwc;
    tdm_region fb_damage;
 
@@ -691,16 +690,7 @@ _e_hwc_windows_target_window_buffer_skip(E_Hwc *hwc)
         hwc_window = (E_Hwc_Window *)hwc->root_target_hwc_window;
 
         if (hwc_window->current.buffer.tsurface)
-          {
-             comp_info = _e_hwc_windows_comp_info_get(hwc_window->current.buffer.tsurface);
-             if (comp_info)
-               {
-                  e_hwc_window_presentation_time_feedback_take((E_Hwc_Window *)target_hwc_window,
-                                                               &comp_info->presentation_container);
-                  e_hwc_window_presentation_callback_take((E_Hwc_Window *)target_hwc_window,
-                                                          &comp_info->presentation_callbacks);
-               }
-          }
+          e_hwc_windows_presentation_time_feedback_and_callback_take(hwc, hwc_window->current.buffer.tsurface);
 
         e_hwc_window_queue_buffer_reference(&hwc_window->current.queue_buffer_ref, hwc_window->display.queue_buffer_ref.buffer);
         e_hwc_window_buffer_set(&hwc_window->current.buffer, hwc_window->display.buffer.tsurface,
@@ -710,6 +700,21 @@ _e_hwc_windows_target_window_buffer_skip(E_Hwc *hwc)
    return EINA_TRUE;
 }
 
+static void
+_e_hwc_windows_target_window_queue_clear(E_Hwc_Window_Target *target_hwc_window)
+{
+   E_Hwc_Window *hwc_window;
+   E_Hwc_Window_Queue_Buffer *queue_buffer;
+
+   hwc_window = (E_Hwc_Window *)target_hwc_window;
+
+   while ((queue_buffer = e_hwc_window_queue_buffer_acquire(hwc_window->queue)))
+     {
+        e_hwc_windows_presentation_time_feedback_and_callback_take(target_hwc_window->hwc, queue_buffer->tsurface);
+        e_hwc_window_queue_buffer_release(hwc_window->queue, queue_buffer);
+     }
+}
+
 static Eina_Bool
 _e_hwc_windows_root_target_buffer_fetch(E_Hwc *hwc)
 {
@@ -755,10 +760,7 @@ _e_hwc_windows_root_target_buffer_fetch(E_Hwc *hwc)
         comp_info = _e_hwc_windows_comp_info_get(tsurface);
         if ((comp_info) && (comp_info->skip))
           {
-             e_hwc_window_presentation_time_feedback_take((E_Hwc_Window *)hwc->target_hwc_window,
-                                                          &comp_info->presentation_container);
-             e_hwc_window_presentation_callback_take((E_Hwc_Window *)hwc->target_hwc_window,
-                                                     &comp_info->presentation_callbacks);
+             e_hwc_windows_presentation_time_feedback_and_callback_take(hwc, tsurface);
              e_hwc_window_queue_buffer_release(queue, queue_buffer);
              return EINA_FALSE;
           }
@@ -794,7 +796,7 @@ _e_hwc_windows_root_target_buffer_fetch(E_Hwc *hwc)
      }
    else
      {
-        e_hwc_window_queue_clear(queue);
+        _e_hwc_windows_target_window_queue_clear(target_hwc_window);
 
         if (!hwc_window->current.buffer.tsurface) return EINA_FALSE;
 
@@ -802,18 +804,7 @@ _e_hwc_windows_root_target_buffer_fetch(E_Hwc *hwc)
           {
              queue_buffer = e_hwc_window_queue_buffer_find(hwc_window->current.buffer.queue, hwc_window->current.buffer.tsurface);
              if (queue_buffer)
-               {
-                  E_Hwc_Windows_Comp_Info *comp_info;
-
-                  comp_info = _e_hwc_windows_comp_info_get(hwc_window->current.buffer.tsurface);
-                  if (comp_info)
-                    {
-                       e_hwc_window_presentation_time_feedback_take((E_Hwc_Window *)hwc->target_hwc_window,
-                                                                   &comp_info->presentation_container);
-                       e_hwc_window_presentation_callback_take((E_Hwc_Window *)hwc->target_hwc_window,
-                                                               &comp_info->presentation_callbacks);
-                    }
-               }
+               e_hwc_windows_presentation_time_feedback_and_callback_take(hwc, hwc_window->current.buffer.tsurface);
           }
 
         e_hwc_window_queue_buffer_reference(&hwc_window->current.queue_buffer_ref, NULL);
@@ -4506,7 +4497,7 @@ e_hwc_windows_present_sync(E_Hwc *hwc)
         comp_info->skip = EINA_TRUE;
      }
 
-   e_hwc_window_queue_clear(((E_Hwc_Window *)root_target_hwc_window)->queue);
+   _e_hwc_windows_target_window_queue_clear(root_target_hwc_window);
 
    _e_hwc_windows_target_window_buffer_skip(hwc);
 
@@ -4544,3 +4535,25 @@ e_hwc_windows_fence_enabled_get(E_Hwc *hwc)
 
    return EINA_TRUE;
 }
+
+EINTERN void
+e_hwc_windows_presentation_time_feedback_and_callback_take(E_Hwc *hwc, tbm_surface_h tsurface)
+{
+   E_Hwc_Windows_Comp_Info *comp_info;
+   E_Hwc_Window_Target *target_hwc_window;
+
+   EINA_SAFETY_ON_NULL_RETURN(hwc);
+   EINA_SAFETY_ON_NULL_RETURN(tsurface);
+
+   target_hwc_window = hwc->target_hwc_window;
+   EINA_SAFETY_ON_NULL_RETURN(target_hwc_window);
+
+   comp_info = _e_hwc_windows_comp_info_get(tsurface);
+   if (comp_info)
+     {
+        e_hwc_window_presentation_time_feedback_take((E_Hwc_Window *)target_hwc_window,
+                                                     &comp_info->presentation_container);
+        e_hwc_window_presentation_callback_take((E_Hwc_Window *)target_hwc_window,
+                                                &comp_info->presentation_callbacks);
+     }
+}
index 4e474b4..e036223 100644 (file)
@@ -67,5 +67,7 @@ EINTERN void                 e_hwc_windows_target_window_force_render(E_Hwc_Wind
 EINTERN Eina_Bool            e_hwc_windows_pp_set(E_Hwc *hwc, Eina_Rectangle *src_rect, Eina_Rectangle *dst_rect);
 EINTERN void                 e_hwc_windows_pp_unset(E_Hwc *hwc);
 
+EINTERN void                 e_hwc_windows_presentation_time_feedback_and_callback_take(E_Hwc *hwc, tbm_surface_h tsurface);
+
 #endif
 #endif