e_hwc_windows: add e_hwc_windows_present_sync 56/227956/7 submit/tizen/20200323.101502
authorChangyeon Lee <cyeon.lee@samsung.com>
Tue, 17 Mar 2020 10:04:19 +0000 (19:04 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Mon, 23 Mar 2020 10:01:17 +0000 (10:01 +0000)
if e_hwc_windows_present_sync is called,
previous frame will be discard.

Change-Id: I29d0bccdf29f32e7470be7f89e8d832d36aa8c4e

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

index a7b6383b36591573106ce84386625aa617919ab1..1cac472e6a2392d5dd7f2d88ccb35b6aa4ec8224 100644 (file)
@@ -138,6 +138,8 @@ struct _E_Hwc
    double               lapse;
    int                  cframes;
    int                  flapse;
+
+   Eina_Bool            present_sync;
 };
 
 E_API extern int E_EVENT_HWC_ACTIVE;
index 704c303c2a6956a653eedd1c2e83c4b4bd294bd9..cd096e81fe54714adb3fa725b4a7b2516e7f4d8a 100644 (file)
@@ -70,6 +70,7 @@ struct _E_Hwc_Windows_Pp_Data
 struct _E_Hwc_Windows_Buffer_Comp_Info
 {
    E_Presentation_Time_Container presentation_container;
+   Eina_Bool skip;
 };
 
 static Eina_Bool ehws_trace = EINA_FALSE;
@@ -521,6 +522,7 @@ _e_hwc_windows_target_buffer_fetch(E_Hwc *hwc, Eina_Bool tdm_set)
    tdm_region fb_damage;
    Eina_List *rendered_windows = NULL;
    E_Hwc_Window_Queue_Buffer *queue_buffer = NULL;
+   E_Hwc_Windows_Buffer_Comp_Info *buffer_comp_info;
    uint32_t n_thw = 0;
    const Eina_List *l;
    int i;
@@ -554,6 +556,15 @@ _e_hwc_windows_target_buffer_fetch(E_Hwc *hwc, Eina_Bool tdm_set)
         tsurface = queue_buffer->tsurface;
         EINA_SAFETY_ON_NULL_RETURN_VAL(tsurface, EINA_FALSE);
 
+        buffer_comp_info = _e_hwc_windows_buffer_comp_info_get(tsurface);
+        if ((buffer_comp_info) && (buffer_comp_info->skip))
+          {
+             e_hwc_window_presentation_time_feedback_take(hwc_window,
+                                                          &buffer_comp_info->presentation_container);
+             e_hwc_window_queue_buffer_release(hwc_window->queue, queue_buffer);
+             return EINA_FALSE;
+          }
+
         if (hwc_window->buffer.tsurface &&
             hwc_window->buffer.tsurface != hwc_window->display.buffer.tsurface)
           {
@@ -872,6 +883,7 @@ _e_hwc_windows_target_window_surface_queue_trace_cb(tbm_surface_queue_h surface_
         tbm_surface_h tsurface, tbm_surface_queue_trace trace, void *data)
 {
    E_Hwc_Window_Target *target_hwc_window = (E_Hwc_Window_Target *)data;
+   E_Hwc_Windows_Buffer_Comp_Info *buffer_comp_info;
 
    /* gets called as evas_renderer dequeues a new buffer from the queue */
    if (trace == TBM_SURFACE_QUEUE_TRACE_DEQUEUE)
@@ -915,6 +927,10 @@ _e_hwc_windows_target_window_surface_queue_trace_cb(tbm_surface_queue_h surface_
 
         target_hwc_window->rendering_tsurfaces =
           eina_list_remove(target_hwc_window->rendering_tsurfaces, tsurface);
+
+        buffer_comp_info = _e_hwc_windows_buffer_comp_info_get(tsurface);
+        if (buffer_comp_info)
+          buffer_comp_info->skip = EINA_FALSE;
      }
 }
 
@@ -1949,6 +1965,28 @@ _e_hwc_windows_transition_check(E_Hwc *hwc)
     return transition;
 }
 
+static Eina_Bool
+_e_hwc_windows_present_sync_check(E_Hwc *hwc)
+{
+   E_Hwc_Window_Target *target_hwc_window;
+
+   if (!hwc->present_sync) return EINA_FALSE;
+
+   target_hwc_window = hwc->target_hwc_window;
+   EINA_SAFETY_ON_NULL_RETURN_VAL(target_hwc_window, EINA_FALSE);
+
+   if (hwc->hwc_mode != E_HWC_MODE_FULL)
+     {
+        if ((((E_Hwc_Window *)target_hwc_window)->display.buffer.tsurface) ==
+            (((E_Hwc_Window *)target_hwc_window)->buffer.tsurface))
+          return EINA_TRUE;
+     }
+
+    hwc->present_sync = EINA_FALSE;
+
+    return EINA_FALSE;
+}
+
 static Eina_Bool
 _e_hwc_windows_validated_changes_update(E_Hwc *hwc, uint32_t num_changes)
 {
@@ -2492,6 +2530,12 @@ _e_hwc_windows_evaluate(E_Hwc *hwc)
         goto re_evaluate;
      }
 
+   if (_e_hwc_windows_present_sync_check(hwc))
+     {
+        EHWSTRACE(" Not accpet display sync.", NULL, hwc);
+        goto re_evaluate;
+     }
+
    if (e_hwc_norender_get(hwc) > 0)
      {
         EHWSTRACE(" Not accpet validation NoRender get.", NULL, hwc);
@@ -3884,3 +3928,34 @@ e_hwc_windows_presentation_update(E_Hwc *hwc, E_Client *ec)
 
    return EINA_TRUE;
 }
+
+EINTERN Eina_Bool
+e_hwc_windows_present_sync(E_Hwc *hwc)
+{
+   E_Hwc_Window_Target *target_hwc_window;
+   E_Hwc_Windows_Buffer_Comp_Info *buffer_comp_info;
+   tbm_surface_h tsurface;
+   Eina_List *l;
+
+   EINA_SAFETY_ON_NULL_RETURN_VAL(hwc, EINA_FALSE);
+   EINA_SAFETY_ON_FALSE_RETURN_VAL(hwc->hwc_policy == E_HWC_POLICY_WINDOWS, EINA_FALSE);
+
+   target_hwc_window = hwc->target_hwc_window;
+   EINA_SAFETY_ON_NULL_RETURN_VAL(target_hwc_window, EINA_FALSE);
+
+   hwc->present_sync = EINA_TRUE;
+
+   EINA_LIST_FOREACH(target_hwc_window->rendering_tsurfaces, l, tsurface)
+     {
+        buffer_comp_info = _e_hwc_windows_buffer_comp_info_get(tsurface);
+        if (!buffer_comp_info) continue;
+
+        buffer_comp_info->skip = EINA_TRUE;
+     }
+
+   e_hwc_window_queue_clear(((E_Hwc_Window *)target_hwc_window)->queue);
+
+   EHWSINF("Present sync", NULL, hwc);
+
+   return EINA_TRUE;
+}
index e42df447a7900df3aa3e5bfcd7dd79faa6b9dfc9..6e14fa73df4f542090c7db20d5793d63cc0ee9fc 100644 (file)
@@ -42,5 +42,7 @@ EINTERN Eina_Bool            e_hwc_windows_mirror_set(E_Hwc *hwc, E_Hwc *src_hwc
 EINTERN void                 e_hwc_windows_mirror_unset(E_Hwc *hwc);
 EINTERN Eina_Bool            e_hwc_windows_presentation_update(E_Hwc *hwc, E_Client *ec);
 
+EINTERN Eina_Bool            e_hwc_windows_present_sync(E_Hwc *hwc);
+
 #endif
 #endif