e_hwc_window: Fix flickering when window state is changed in HYBRID mode 54/317154/2
authorChangyeon Lee <cyeon.lee@samsung.com>
Thu, 26 Dec 2024 03:24:00 +0000 (12:24 +0900)
committerChangyeon Lee <cyeon.lee@samsung.com>
Thu, 26 Dec 2024 05:58:02 +0000 (14:58 +0900)
Skip current buffer if the present sync is needed

Change-Id: Ic488e77f87e88b034bc3e41de2b77f4f0422ecb1

src/bin/displaymgr/e_hwc_windows.c

index 31e59b59479d135d8a8fb53cefa69afcfa73fd5f..a2890da5c198b8c96c3be9999b53061f9659b9b2 100644 (file)
@@ -4004,6 +4004,50 @@ e_hwc_windows_mirror_unset(E_Hwc *hwc)
    EHWSINF("e_hwc_windows_mirror_unset", NULL, hwc);
 }
 
+static Eina_Bool
+_e_hwc_windows_target_window_buffer_skip(E_Hwc *hwc)
+{
+   E_Hwc_Window_Target *target_hwc_window;
+   E_Hwc_Window *hwc_window;
+   tdm_hwc *thwc;
+   tdm_region fb_damage;
+
+   target_hwc_window = hwc->target_hwc_window;
+   EINA_SAFETY_ON_NULL_RETURN_VAL(target_hwc_window, EINA_FALSE);
+
+   hwc_window = (E_Hwc_Window *)target_hwc_window;
+
+   thwc = hwc->thwc;
+   EINA_SAFETY_ON_NULL_RETURN_VAL(thwc, EINA_FALSE);
+
+   CLEAR(fb_damage);
+
+   if ((hwc_window->current.buffer.tsurface) &&
+       (hwc_window->current.buffer.tsurface != hwc_window->commit.buffer.tsurface))
+     {
+        e_hwc_window_queue_buffer_reference(&hwc_window->current.queue_buffer_ref, hwc_window->commit.queue_buffer_ref.buffer);
+        e_hwc_window_buffer_set(&hwc_window->current.buffer, hwc_window->commit.buffer.tsurface,
+                                hwc_window->commit.buffer.queue, hwc_window->commit.buffer.transform);
+        tdm_hwc_set_client_target_buffer(thwc, hwc_window->commit.buffer.tsurface, fb_damage);
+
+        e_hwc_windows_target_window_force_render(target_hwc_window);
+     }
+
+   if (hwc->root_target_hwc_window)
+     {
+        hwc_window = (E_Hwc_Window *)hwc->root_target_hwc_window;
+
+        if (hwc_window->current.buffer.tsurface)
+          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->commit.queue_buffer_ref.buffer);
+        e_hwc_window_buffer_set(&hwc_window->current.buffer, hwc_window->commit.buffer.tsurface,
+                                hwc_window->commit.buffer.queue, hwc_window->commit.buffer.transform);
+     }
+
+   return EINA_TRUE;
+}
+
 EINTERN Eina_Bool
 e_hwc_windows_present_sync(E_Hwc *hwc)
 {
@@ -4028,6 +4072,7 @@ e_hwc_windows_present_sync(E_Hwc *hwc)
      }
 
    _e_hwc_windows_target_window_queue_clear(root_target_hwc_window);
+   _e_hwc_windows_target_window_buffer_skip(hwc);
    e_hwc_windows_target_window_force_render(hwc->target_hwc_window);
 
    EHWSINF("Present sync", NULL, hwc);