From d85e7c4bafdbc8f29a13dcb9eb5b6634a1e61f14 Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Tue, 17 Mar 2020 19:04:19 +0900 Subject: [PATCH] e_hwc_windows: add e_hwc_windows_present_sync if e_hwc_windows_present_sync is called, previous frame will be discard. Change-Id: I29d0bccdf29f32e7470be7f89e8d832d36aa8c4e --- src/bin/e_hwc.h | 2 ++ src/bin/e_hwc_windows.c | 75 +++++++++++++++++++++++++++++++++++++++++ src/bin/e_hwc_windows.h | 2 ++ 3 files changed, 79 insertions(+) diff --git a/src/bin/e_hwc.h b/src/bin/e_hwc.h index a7b6383b36..1cac472e6a 100644 --- a/src/bin/e_hwc.h +++ b/src/bin/e_hwc.h @@ -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; diff --git a/src/bin/e_hwc_windows.c b/src/bin/e_hwc_windows.c index 704c303c2a..cd096e81fe 100644 --- a/src/bin/e_hwc_windows.c +++ b/src/bin/e_hwc_windows.c @@ -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; +} diff --git a/src/bin/e_hwc_windows.h b/src/bin/e_hwc_windows.h index e42df447a7..6e14fa73df 100644 --- a/src/bin/e_hwc_windows.h +++ b/src/bin/e_hwc_windows.h @@ -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 -- 2.34.1