e_hwc_window: reset constraints when device type window transit to composite 13/198613/2
authorChangyeon Lee <cyeon.lee@samsung.com>
Mon, 28 Jan 2019 04:58:18 +0000 (13:58 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Mon, 28 Jan 2019 07:42:27 +0000 (07:42 +0000)
Change-Id: I58d3eff9db56a51579945bcf7f157ccd19673431

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

index 33e2d6e..91be81e 100644 (file)
@@ -251,8 +251,35 @@ _e_hwc_window_cb_queue_destroy(struct wl_listener *listener, void *data)
    hwc_window->queue = NULL;
 }
 
+static Eina_Bool
+_e_hwc_window_buffer_queue_set(E_Hwc_Window *hwc_window)
+{
+   E_Hwc_Window_Queue *queue = NULL;
+   struct wayland_tbm_client_queue *cqueue = NULL;
+
+   cqueue = _get_wayland_tbm_client_queue(hwc_window->ec);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(cqueue, EINA_FALSE);
+
+   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;
+
+   EHWTRACE("Set constranints BUFFER_QUEUE -- {%s}",
+             hwc_window->ec, hwc_window, e_client_util_name_get(hwc_window->ec));
+
+   return EINA_TRUE;
+}
+
 static void
-_e_hwc_window_constraints_reset(E_Hwc_Window *hwc_window)
+_e_hwc_window_buffer_queue_unset(E_Hwc_Window *hwc_window)
 {
    /* reset the TDM_HWC_WIN_CONSTRAINT_BUFFER_QUEUE */
    if (hwc_window->queue)
@@ -261,6 +288,20 @@ _e_hwc_window_constraints_reset(E_Hwc_Window *hwc_window)
         wl_list_remove(&hwc_window->queue_destroy_listener.link);
         hwc_window->queue = NULL;
      }
+
+    EHWTRACE("Unset constranints BUFFER_QUEUE -- {%s}",
+              hwc_window->ec, hwc_window, e_client_util_name_get(hwc_window->ec));
+}
+
+static void
+_e_hwc_window_constraints_reset(E_Hwc_Window *hwc_window)
+{
+   _e_hwc_window_buffer_queue_unset(hwc_window);
+
+   hwc_window->constraints = TDM_HWC_WIN_CONSTRAINT_NONE;
+
+   EHWTRACE("Reset constranints -- {%s}",
+            hwc_window->ec, hwc_window, e_client_util_name_get(hwc_window->ec));
 }
 
 static void
@@ -1413,6 +1454,10 @@ e_hwc_window_transition_set(E_Hwc_Window *hwc_window, E_Hwc_Window_Transition tr
 
    hwc_window->transition = transition;
 
+   if ((transition == E_HWC_WINDOW_TRANSITION_DEVICE_TO_CLIENT) ||
+       (transition == E_HWC_WINDOW_TRANSITION_DEVICE_TO_NONE))
+     _e_hwc_window_constraints_reset(hwc_window);
+
    return EINA_TRUE;
 }
 
@@ -1427,8 +1472,6 @@ e_hwc_window_transition_get(E_Hwc_Window *hwc_window)
 EINTERN Eina_Bool
 e_hwc_window_constraints_update(E_Hwc_Window *hwc_window)
 {
-   E_Hwc_Window_Queue *queue = NULL;
-   struct wayland_tbm_client_queue *cqueue = NULL;
    tdm_error terror;
    int constraints;
 
@@ -1441,32 +1484,26 @@ e_hwc_window_constraints_update(E_Hwc_Window *hwc_window)
 
    if (hwc_window->constraints == constraints) return EINA_TRUE;
 
-   if (constraints & TDM_HWC_WIN_CONSTRAINT_BUFFER_QUEUE)
+   if (constraints)
      {
-         if (!hwc_window->queue)
-           {
-              cqueue = _get_wayland_tbm_client_queue(hwc_window->ec);
-              EINA_SAFETY_ON_NULL_RETURN_VAL(cqueue, EINA_FALSE);
-
-              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;
-           }
+        if (constraints & TDM_HWC_WIN_CONSTRAINT_BUFFER_QUEUE)
+          {
+             if (!_e_hwc_window_buffer_queue_set(hwc_window))
+               {
+                  ERR("fail to _e_hwc_window_buffer_queue_set");
+                  return EINA_FALSE;
+               }
+          }
+        else
+          _e_hwc_window_buffer_queue_unset(hwc_window);
+
+        EHWTRACE("Set constranints:%x -- {%s}",
+                  hwc_window->ec, hwc_window, constraints, e_client_util_name_get(hwc_window->ec));
+
+        hwc_window->constraints = constraints;
      }
    else
-     {
-         _e_hwc_window_constraints_reset(hwc_window);
-     }
-
-   hwc_window->constraints = constraints;
+     _e_hwc_window_constraints_reset(hwc_window);
 
    return EINA_TRUE;
 }
index 2c3b8af..dba72d9 100644 (file)
@@ -1488,6 +1488,7 @@ _e_hwc_windows_accept(E_Hwc *hwc)
         /* update the accepted_state */
         state = e_hwc_window_state_get(hwc_window);
         e_hwc_window_accepted_state_set(hwc_window, state);
+        e_hwc_window_transition_set(hwc_window, E_HWC_WINDOW_TRANSITION_NONE_TO_NONE);
 
         /* notify the hwc_window that it will be displayed on hw layer */
         if (!hwc_window->queue &&