hwc_windows: set hwc_window to queue if preparation type is buffer queue 34/186434/3
authorChangyeon Lee <cyeon.lee@samsung.com>
Thu, 9 Aug 2018 03:00:47 +0000 (12:00 +0900)
committerChangyeon Lee <cyeon.lee@samsung.com>
Fri, 10 Aug 2018 05:27:23 +0000 (14:27 +0900)
Change-Id: Ic756a029adf687d8fa55bbe04fbe003e6482025b

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

index 4f0a7e67a3c12b957342a73c52427f6a5cf4ed99..a6fd09a4d7d796002fd834882e4932ad0a2b5d03 100644 (file)
@@ -516,6 +516,8 @@ _e_hwc_window_client_cb_del(void *data EINA_UNUSED, E_Client *ec)
    if (e_hwc_policy_get(output->hwc) == E_HWC_POLICY_PLANES)
      return;
 
+   e_hwc_window_preparation_set(ec->hwc_window, TDM_PREPARATION_NONE);
+
    if (!ec->hwc_window) return;
 
    e_hwc_window_free(ec->hwc_window);
@@ -1754,6 +1756,47 @@ e_hwc_window_is_on_target_window(E_Hwc_Window *hwc_window)
    return EINA_FALSE;
 }
 
+EINTERN Eina_Bool
+e_hwc_window_preparation_set(E_Hwc_Window *hwc_window, int preparation_types)
+{
+   E_Hwc_Window_Queue *queue = NULL;
+
+   EINA_SAFETY_ON_FALSE_RETURN_VAL(hwc_window, EINA_FALSE);
+
+   if (hwc_window->preparation_types == preparation_types) return EINA_TRUE;
+
+   if (preparation_types & TDM_PREPARATION_BUFFER_QUEUE)
+     {
+         if (!hwc_window->queue)
+           {
+              queue = e_hwc_window_queue_user_set(hwc_window);
+              if (!queue)
+                {
+                   ERR("fail to e_hwc_window_queue_user_set ehw:%p", hwc_window);
+                   hwc_window->queue = NULL;
+                   return EINA_FALSE;
+                }
+
+              wl_signal_add(&queue->destroy_signal, &hwc_window->queue_destroy_listener);
+              hwc_window->queue_destroy_listener.notify = _e_hwc_window_cb_queue_destroy;
+              hwc_window->queue = queue;
+           }
+     }
+   else
+     {
+         if (hwc_window->queue)
+           {
+              e_hwc_window_queue_user_unset(hwc_window->queue, hwc_window);
+              wl_list_remove(&hwc_window->queue_destroy_listener.link);
+              hwc_window->queue = NULL;
+           }
+     }
+
+   hwc_window->preparation_types = preparation_types;
+
+   return EINA_TRUE;
+}
+
 static void
 _e_hwc_window_client_recover(E_Hwc_Window *hwc_window)
 {
index df6dc9d0c6aa1a6f2038e95bda7e7351c9377db0..e3fefc157750a1bb143ff3d7be4f959d07da6330 100644 (file)
@@ -105,6 +105,8 @@ struct _E_Hwc_Window
       tbm_surface_h               tsurface;
    } cursor;
 
+   int                            preparation_types;
+
    E_Hwc_Window_Queue            *queue;
    struct wl_listener             queue_destroy_listener;
 
@@ -170,6 +172,8 @@ EINTERN E_Hwc_Window_State e_hwc_window_state_get(E_Hwc_Window *hwc_window);
 EINTERN Eina_Bool          e_hwc_window_accepted_state_set(E_Hwc_Window *hwc_window, E_Hwc_Window_State state);
 EINTERN E_Hwc_Window_State e_hwc_window_accepted_state_get(E_Hwc_Window *hwc_window);
 
+EINTERN Eina_Bool          e_hwc_window_preparation_set(E_Hwc_Window *hwc_window, int preparation_types);
+
 EINTERN void               e_hwc_window_render_list_add(E_Hwc_Window *hwc_window);
 EINTERN Eina_Bool          e_hwc_window_is_on_target_window(E_Hwc_Window *hwc_window);
 EINTERN Eina_Bool          e_hwc_window_render_target_window_set(E_Hwc_Window *hwc_window, Eina_Bool set);
index ac28c9d04f59944df1596f6336b2f6c66817024f..c1d1ff90bc6c96ee342a7b1973021ea23460bea1 100644 (file)
@@ -504,6 +504,13 @@ _e_hwc_window_queue_unset(E_Hwc_Window_Queue *queue)
 
    queue->state = E_HWC_WINDOW_QUEUE_STATE_UNSET;
 
+   if (queue->state == E_HWC_WINDOW_QUEUE_STATE_PENDING_UNSET)
+     hwc_window = queue->pending_unset_user;
+   else
+     hwc_window = queue->user;
+
+   tdm_hwc_window_release_buffer_queue(hwc_window, queue->tqueue);
+
    if (queue->user)
      {
         e_object_unref(E_OBJECT(queue->user));
@@ -1099,7 +1106,7 @@ _e_hwc_window_tqueue_get(E_Hwc_Window *hwc_window)
    if (hwc_window->is_target)
      tqueue = _get_tbm_surface_queue();
    else
-     tqueue = tdm_hwc_window_get_buffer_queue(hwc_window->thwc_window, &error);
+     tqueue = tdm_hwc_window_acquire_buffer_queue(hwc_window->thwc_window, &error);
 
    if (!tqueue)
      {
index b2584a98778449291d980b08f66bc7c78ee63247..b69e04237d70f71c4d831292736586499f9a2ed9 100644 (file)
@@ -1520,6 +1520,29 @@ _e_hwc_windows_target_state_set(E_Hwc_Window_Target *target_hwc_window, E_Hwc_Wi
      e_hwc_window_accepted_state_set(target_window, state);
 }
 
+static void
+_e_hwc_windows_preparation_update(E_Hwc *hwc)
+{
+   tdm_error terror;
+   E_Hwc_Window *hwc_window;
+   const Eina_List *l;
+   int preparation_types;
+
+   EINA_LIST_FOREACH(hwc->hwc_windows, l, hwc_window)
+     {
+        if (hwc_window->is_target) continue;
+        if (!hwc_window->thwc_window) continue;
+
+        terror = tdm_hwc_window_get_preparation_types(hwc_window->thwc_window,
+                                                      &preparation_types);
+        if (terror != TDM_ERROR_NONE) continue;
+
+        e_hwc_window_preparation_set(hwc_window, preparation_types);
+     }
+
+   return;
+}
+
 /* evaluate the hwc_windows */
 static Eina_Bool
 _e_hwc_windows_evaluate(E_Hwc *hwc)
@@ -1539,6 +1562,8 @@ _e_hwc_windows_evaluate(E_Hwc *hwc)
    else
      EHWSTRACE(" Need the comopsition re-evaulation.", NULL);
 
+   _e_hwc_windows_preparation_update(hwc);
+
    /* decide the E_HWC_MODE */
    hwc_mode = _e_hwc_windows_hwc_mode_get(hwc);
    if (hwc->hwc_mode != hwc_mode)