e_hwc_windows: add pp_queue to E_Hwc_Window_Target 79/241179/2
authorChangyeon Lee <cyeon.lee@samsung.com>
Thu, 13 Aug 2020 10:26:35 +0000 (19:26 +0900)
committerChangyeon Lee <cyeon.lee@samsung.com>
Tue, 25 Aug 2020 04:20:01 +0000 (13:20 +0900)
if queue of pp is set to E_Hwc_Widnow_Target,
E_Hwc_Window_Target set buffer of pp_queue to tdm

Change-Id: I4c46bd1ee9e5bebb29ba5157a5223cdcfd8b9556

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

index 30448d5..ceacee1 100644 (file)
@@ -166,6 +166,9 @@ struct _E_Hwc_Window_Target
 
    Eina_Bool           skip_surface_set;
 
+   E_Hwc_Window_Queue *pp_queue;
+   struct wl_listener  pp_queue_destroy_listener;
+
    E_Egl_Sync         *end_render_sync;
 };
 
index ec7ccbd..c57b31e 100644 (file)
@@ -525,6 +525,7 @@ _e_hwc_windows_target_buffer_fetch(E_Hwc *hwc, Eina_Bool tdm_set)
    Eina_List *rendered_windows = NULL;
    E_Hwc_Window_Queue_Buffer *queue_buffer = NULL;
    E_Hwc_Windows_Buffer_Comp_Info *buffer_comp_info;
+   E_Hwc_Window_Queue *queue;
    uint32_t n_thw = 0;
    const Eina_List *l;
    int i;
@@ -548,11 +549,15 @@ _e_hwc_windows_target_buffer_fetch(E_Hwc *hwc, Eina_Bool tdm_set)
 
    EINA_SAFETY_ON_NULL_RETURN_VAL(hwc_window->queue , EINA_FALSE);
 
-   if ((hwc_window->state == E_HWC_WINDOW_STATE_DEVICE) ||
-       (hwc->pp_set && hwc->pp_hwc_window))
+   if ((hwc->pp_set) && (target_hwc_window->pp_queue))
+     queue = target_hwc_window->pp_queue;
+   else
+     queue = hwc_window->queue;
+
+   if (hwc_window->state == E_HWC_WINDOW_STATE_DEVICE)
      {
         /* acquire the surface */
-        queue_buffer = e_hwc_window_queue_buffer_acquire(hwc_window->queue);
+        queue_buffer = e_hwc_window_queue_buffer_acquire(queue);
         if (!queue_buffer) return EINA_FALSE;
 
         tsurface = queue_buffer->tsurface;
@@ -563,7 +568,7 @@ _e_hwc_windows_target_buffer_fetch(E_Hwc *hwc, Eina_Bool tdm_set)
           {
              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);
+             e_hwc_window_queue_buffer_release(queue, queue_buffer);
              return EINA_FALSE;
           }
 
@@ -575,7 +580,7 @@ _e_hwc_windows_target_buffer_fetch(E_Hwc *hwc, Eina_Bool tdm_set)
                e_hwc_window_queue_buffer_release(hwc_window->buffer.queue, queue_buffer);
           }
 
-        e_hwc_window_buffer_set(&hwc_window->buffer, tsurface, hwc_window->queue);
+        e_hwc_window_buffer_set(&hwc_window->buffer, tsurface, queue);
         e_hwc_window_info_update(hwc_window);
 
         /* the damage isn't supported by hwc extension yet */
@@ -622,7 +627,7 @@ _e_hwc_windows_target_buffer_fetch(E_Hwc *hwc, Eina_Bool tdm_set)
      }
    else
      {
-        e_hwc_window_queue_clear(hwc_window->queue);
+        e_hwc_window_queue_clear(queue);
 
         if (!hwc_window->buffer.tsurface) return EINA_FALSE;
 
@@ -1028,6 +1033,47 @@ _e_hwc_windows_target_window_render_finished_cb(void *data, Ecore_Fd_Handler *fd
 }
 
 static void
+_e_hwc_windows_target_cb_pp_queue_destroy(struct wl_listener *listener, void *data)
+{
+   E_Hwc_Window_Target *target_hwc_window = NULL;
+
+   target_hwc_window = container_of(listener, E_Hwc_Window_Target, pp_queue_destroy_listener);
+   EINA_SAFETY_ON_NULL_RETURN(target_hwc_window);
+
+   if ((E_Hwc_Window_Queue *)data != target_hwc_window->pp_queue) return;
+
+   if (target_hwc_window->pp_queue_destroy_listener.notify)
+     {
+        wl_list_remove(&target_hwc_window->pp_queue_destroy_listener.link);
+        target_hwc_window->pp_queue_destroy_listener.notify = NULL;
+     }
+
+   target_hwc_window->pp_queue = NULL;
+}
+
+static Eina_Bool
+_e_hwc_windows_target_window_pp_queue_set(E_Hwc_Window_Target *target_hwc_window, E_Hwc_Window_Queue *queue)
+{
+   if (target_hwc_window->pp_queue == queue)
+     return EINA_TRUE;
+
+   if (target_hwc_window->pp_queue)
+     {
+        wl_list_remove(&target_hwc_window->pp_queue_destroy_listener.link);
+        target_hwc_window->pp_queue_destroy_listener.notify = NULL;
+     }
+
+   if (queue)
+     {
+        wl_signal_add(&queue->destroy_signal, &target_hwc_window->pp_queue_destroy_listener);
+        target_hwc_window->pp_queue_destroy_listener.notify = _e_hwc_windows_target_cb_pp_queue_destroy;
+        target_hwc_window->pp_queue = queue;
+     }
+
+   return EINA_TRUE;
+}
+
+static void
 _e_hwc_windows_target_cb_queue_destroy(struct wl_listener *listener, void *data)
 {
    E_Hwc_Window *hwc_window = NULL;