some fix
authorSooChan Lim <sc1.lim@samsung.com>
Mon, 29 Jan 2018 11:43:01 +0000 (20:43 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Mon, 29 Jan 2018 11:43:01 +0000 (20:43 +0900)
Change-Id: Ifca0e7c76034e3e6f3ae05d3920e0c95d83dfca0

src/bin/e_hwc_window.c
src/bin/e_output_hwc.c
src/bin/e_output_hwc.h
src/bin/e_output_hwc_windows.c

index 3e34f93a0d64774bdabef03d616b5e5f24c953a0..0285c4155f8d828aa894ea6216daed11b1fafbe3 100644 (file)
@@ -1292,7 +1292,7 @@ e_hwc_window_buffer_fetch(E_Hwc_Window *hwc_window)
    tbm_surface_h tsurface = NULL;
 
    EINA_SAFETY_ON_NULL_RETURN_VAL(hwc_window, EINA_FALSE);
-#if 1
+#if 0
    if (hwc_window->uncompleted_transition != E_HWC_WINDOW_TRANSITION_NONE_TO_NONE)
      {
         ELOGF("HWC-WINS", " !!! ehw:%p ts:%10p is under TRANSITION. ------- {%25s}, state:%s, zpos:%d, deleted:%s.",
@@ -1345,7 +1345,7 @@ e_hwc_window_buffer_fetch(E_Hwc_Window *hwc_window)
              tsurface = _e_hwc_window_cursor_surface_acquire(hwc_window);
              if (!tsurface)
                {
-                  ELOGF("HWC-WINS", "[soolim] ehw:%p cursor buffer is null.",
+                  ELOGF("HWC-WINS", "[soolim] ehw:%10p cursor buffer is null.",
                         hwc_window->ec ? ec->pixmap : NULL, hwc_window->ec, hwc_window);
                   return EINA_FALSE;
                }
@@ -1397,6 +1397,7 @@ e_hwc_window_commit_data_aquire(E_Hwc_Window *hwc_window)
 {
    E_Hwc_Window_Commit_Data *commit_data = NULL;
 
+
    if (hwc_window->update_exist == EINA_FALSE) return EINA_FALSE;
 
 #if 0
@@ -1559,6 +1560,11 @@ e_hwc_window_target_enabled(E_Hwc_Window_Target *target_hwc_window)
    return EINA_TRUE;
 }
 
+/* set the tsurface to the target_window->tsurface according to the state.
+ *  1. try to set the tsurface to the target_window at E_HWC_WINDOW_STATE_DEVICE.
+ *  2. try to set NULL and release(clear) tsurface_queue of the target_window at E_HWC_WINDOW_STATE_NONE.
+ *  Returing EINA_FALSE means that there is no update for the target_window->tsurface.
+ **/
 EINTERN Eina_Bool
 e_hwc_window_target_buffer_fetch(E_Hwc_Window_Target *target_hwc_window)
 {
@@ -1578,12 +1584,12 @@ e_hwc_window_target_buffer_fetch(E_Hwc_Window_Target *target_hwc_window)
         tsurface = _e_hwc_window_target_window_surface_acquire((E_Hwc_Window_Target *)hwc_window);
         if (!tsurface)
           {
-             ELOGF("HWC-WINS", " the surface of target is null.(E_HWC_WINDOW_STATE_DEVICE)", NULL, NULL);
+             //ELOGF("HWC-WINS", " the surface of target is null.(E_HWC_WINDOW_STATE_DEVICE)", NULL, NULL);
              return EINA_FALSE;
           }
         if (tsurface == hwc_window->tsurface)
           {
-             ELOGF("HWC-WINS", " aquired buffer is same.(ts:%p)(E_HWC_WINDOW_STATE_DEVICE)", NULL, NULL, hwc_window->tsurface);
+             //ELOGF("HWC-WINS", " aquired buffer is same.(ts:%p)(E_HWC_WINDOW_STATE_DEVICE)", NULL, NULL, hwc_window->tsurface);
              return EINA_FALSE;
           }
 
@@ -1600,7 +1606,7 @@ e_hwc_window_target_buffer_fetch(E_Hwc_Window_Target *target_hwc_window)
 
         tdm_output_hwc_set_client_target_buffer(output->toutput, hwc_window->tsurface, fb_damage, NULL, 0);
 
-        ELOGF("HWC-WINS", " ehw:%p sets ts:%p ------- {%25s}, state:%s, zpos:%d no hwc_windows to render.",
+        ELOGF("HWC-WINS", " ehw:%p sets ts:%10p ------- {%25s}, state:%s, zpos:%d no hwc_windows to render.",
               NULL, NULL, hwc_window, hwc_window->tsurface, "@TARGET WINDOW@",
               e_hwc_window_state_string_get(hwc_window->state), hwc_window->zpos);
      }
@@ -1608,7 +1614,7 @@ e_hwc_window_target_buffer_fetch(E_Hwc_Window_Target *target_hwc_window)
      {
         if (hwc_window->tsurface == NULL)
           {
-             ELOGF("HWC-WINS", " the surface of target is null.(E_HWC_WINDOW_STATE_NONE)", NULL, NULL);
+             //ELOGF("HWC-WINS", " the surface of target is null.(E_HWC_WINDOW_STATE_NONE)", NULL, NULL);
              return EINA_FALSE;
           }
 
@@ -1622,8 +1628,8 @@ e_hwc_window_target_buffer_fetch(E_Hwc_Window_Target *target_hwc_window)
 
         //TODO: Do we set the target_buffer to be NULL?
 
-        ELOGF("HWC-WINS", " ehw:%p sets ts:(NULL) ------- {%25s}, state:%s, zpos:%d",
-              NULL, NULL, hwc_window, "@TARGET WINDOW@",
+        ELOGF("HWC-WINS", " ehw:%p sets ts:%10p ------- {%25s}, state:%s, zpos:%d",
+              NULL, NULL, hwc_window, hwc_window->tsurface, "@TARGET WINDOW@",
               e_hwc_window_state_string_get(hwc_window->state), hwc_window->zpos);
      }
 
@@ -1715,10 +1721,11 @@ e_hwc_window_deactivate(E_Hwc_Window *hwc_window)
         if (pointer)
           e_pointer_hwc_set(pointer, EINA_FALSE);
      }
-
+#if 0
    if (hwc_window->activation_state == E_HWC_WINDOW_ACTIVATION_STATE_ACTIVATED &&
        hwc_window->state != E_HWC_WINDOW_STATE_NONE)
      hwc_window->is_device_to_client_transition = EINA_TRUE;
+#endif
 
    hwc_window->activation_state = E_HWC_WINDOW_ACTIVATION_STATE_DEACTIVATED;
 
@@ -1778,6 +1785,9 @@ e_hwc_window_prev_state_update(E_Hwc_Window *hwc_window)
 {
    EINA_SAFETY_ON_NULL_RETURN(hwc_window);
 
+   if (hwc_window->uncompleted_transition != E_HWC_WINDOW_TRANSITION_NONE_TO_NONE)
+     return;
+
    hwc_window->prev_state = hwc_window->state;
 }
 
index a9e109c3ef81acad383ee41ff98c7cfe5a0cbbed..f409c6c28a12d4fde5225421b9f06522fdb7dd4c 100644 (file)
@@ -106,12 +106,14 @@ e_output_hwc_apply(E_Output_Hwc *output_hwc)
         else
           e_output_hwc_planes_changed(output_hwc);
      }
+#if 0
    else
      {
         /* evaluate which e_output_hwc_window will be composited by hwc and wich by GLES */
         if (!e_output_hwc_windows_evaluate(output_hwc))
            ERR("fail to e_output_hwc_windows_evaluate.");
      }
+#endif
 }
 
 EINTERN E_Output_Hwc_Mode
index 5c1574aa0781059941392544caca506f02b993b4..a124099ae9a788ac086ef81b8ca174dfb50c5069 100644 (file)
@@ -36,7 +36,6 @@ struct _E_Output_Hwc
    Eina_List           *hwc_windows;
    E_Hwc_Window_Target *target_hwc_window;
    Eina_Bool            wait_commit;
-   Eina_Bool            need_commit;
    Eina_Bool            update_changes;
    int                  num_visible_windows;
 
index 1344e5cd889669c726ef5300937ff3a10c3f37d9..bd288d4cb06f5b1ebbd342a6b89c2421a8091aae 100644 (file)
@@ -906,7 +906,7 @@ _e_output_hwc_windows_buffers_update(E_Output_Hwc *output_hwc)
 
         if (!e_hwc_window_buffer_fetch(hwc_window))
           {
-             ELOGF("HWC-WINS", "[soolim] ehw:%p e_hwc_window_buffer_fetch failed.",
+             ELOGF("HWC-WINS", " ehw:%p e_hwc_window_buffer_fetch failed.",
                    hwc_window->ec ? ec->pixmap : NULL, hwc_window->ec, hwc_window);
              continue;
           }
@@ -982,6 +982,8 @@ _e_output_hwc_windows_accept(E_Output_Hwc *output_hwc, uint32_t num_changes)
         goto fail;
      }
 
+   ELOGF("HWC-WINS", " Accept Changes NUM : %d", NULL, NULL, num_changes);
+
    for (i = 0; i < num_changes; ++i)
      {
         hwc_window = _e_output_hwc_windows_window_find_by_twin(output_hwc, changed_hwc_window[i]);
@@ -1004,15 +1006,16 @@ _e_output_hwc_windows_accept(E_Output_Hwc *output_hwc, uint32_t num_changes)
 
         /* update the state with the changed compsition */
         state = _e_output_hwc_windows_window_state_get(composition_types[i]);
-        if (!e_hwc_window_state_set(hwc_window, state))
-          {
-             ERR("e_hwc_window_state_set failed.");
-             goto fail;
-          }
+        e_hwc_window_state_set(hwc_window, state);
      }
 
+#if DBG_EVALUATE
+   ELOGF("HWC-WINS", " Modified after HWC Validation:", NULL, NULL);
+   _e_output_hwc_windows_status_print(output_hwc, EINA_FALSE);
+#endif
+
    /* re-validate when there is a DEVICE_TO_CLIENT transition */
-   if (!accept_changes) goto fail;
+   //if (!accept_changes) goto fail;
 
    /* accept changes */
    terror = tdm_output_hwc_accept_changes(toutput);
@@ -1025,11 +1028,6 @@ _e_output_hwc_windows_accept(E_Output_Hwc *output_hwc, uint32_t num_changes)
    free(changed_hwc_window);
    free(composition_types);
 
-#if DBG_EVALUATE
-   ELOGF("HWC-WINS", " Modified after HWC Validation:", NULL, NULL);
-   _e_output_hwc_windows_status_print(output_hwc, EINA_FALSE);
-#endif
-
    return EINA_TRUE;
 
 fail:
@@ -1123,10 +1121,10 @@ _e_output_hwc_windows_visible_windows_list_get(E_Output_Hwc *output_hwc)
    Eina_List *l;
    E_Hwc_Window *hwc_window;
    E_Client  *ec;
-   E_Comp_Wl_Client_Data *cdata = NULL;
    Evas_Object *o;
    int scr_w, scr_h;
    int zpos = 0;
+   E_Comp_Wl_Client_Data *cdata = NULL;
 
    for (o = evas_object_top_get(e_comp->evas); o; o = evas_object_below_get(o))
      {
@@ -1223,7 +1221,7 @@ _e_output_hwc_windows_full_gl_composite_check(E_Output_Hwc *output_hwc, Eina_Lis
    EINA_LIST_FOREACH(visible_windows_list, l, hwc_window)
      {
         ec = hwc_window->ec;
-#if 0  // TODO: check this condition.....
+
         // if there is a ec which is lower than quickpanel and quickpanel is opened.
         if (E_POLICY_QUICKPANEL_LAYER >= evas_object_layer_get(ec->frame))
           {
@@ -1232,10 +1230,10 @@ _e_output_hwc_windows_full_gl_composite_check(E_Output_Hwc *output_hwc, Eina_Lis
                {
                    ELOGF("HWC-WINS", "    HWC_MODE_NONE due to quickpanel is opened.{%25s}.",
                          ec->pixmap, ec, ec->icccm.title);
+                   goto full_gl_composite;
                }
-             goto full_gl_composite;
           }
-#endif
+
         // if ec->frame is not for client buffer (e.g. launchscreen)
         if (e_comp_object_content_type_get(ec->frame) != E_COMP_OBJECT_CONTENT_TYPE_INT_IMAGE)
           {
@@ -1336,12 +1334,12 @@ _e_output_hwc_windows_uncomplete_transition_check(E_Output_Hwc *output_hwc)
            case E_HWC_WINDOW_TRANSITION_DEVICE_TO_NONE:
               if (e_hwc_window_target_enabled(target_hwc_window))
                 {
+                   e_hwc_window_state_set(hwc_window, E_HWC_WINDOW_STATE_NONE);
                    // TODO: to be fixed....
                    if (!e_hwc_window_is_on_target_window(hwc_window))
                      hwc_window->uncompleted_transition = E_HWC_WINDOW_TRANSITION_NONE_TO_NONE;
                    else
                      {
-                        e_hwc_window_state_set(hwc_window, E_HWC_WINDOW_STATE_NONE);
                         ret = EINA_FALSE;
                         ELOGF("HWC-WINS", " E_HWC_WINDOW_TRANSITION_DEVICE_TO_NONE is set.(Transition_Check)",
                               hwc_window->ec ? ec->pixmap : NULL, hwc_window->ec);
@@ -1353,11 +1351,11 @@ _e_output_hwc_windows_uncomplete_transition_check(E_Output_Hwc *output_hwc)
            case E_HWC_WINDOW_TRANSITION_DEVICE_TO_CLIENT:
               if (e_hwc_window_target_enabled(target_hwc_window))
                 {
+                   e_hwc_window_state_set(hwc_window, E_HWC_WINDOW_STATE_CLIENT);
                    if (e_hwc_window_is_on_target_window(hwc_window))
                      hwc_window->uncompleted_transition = E_HWC_WINDOW_TRANSITION_NONE_TO_NONE;
                    else
                      {
-                        e_hwc_window_state_set(hwc_window, E_HWC_WINDOW_STATE_CLIENT);
                         ret = EINA_FALSE;
                         ELOGF("HWC-WINS", " E_HWC_WINDOW_TRANSITION_DEVICE_TO_CLIENT is set.(Transition_Check)",
                               hwc_window->ec ? ec->pixmap : NULL, hwc_window->ec);
@@ -1369,11 +1367,11 @@ _e_output_hwc_windows_uncomplete_transition_check(E_Output_Hwc *output_hwc)
            case E_HWC_WINDOW_TRANSITION_CLIENT_TO_DEVICE:
               if (e_hwc_window_target_enabled(target_hwc_window))
                 {
+                   e_hwc_window_state_set(hwc_window, E_HWC_WINDOW_STATE_DEVICE);
                    if (!e_hwc_window_is_on_target_window(hwc_window))
                      hwc_window->uncompleted_transition = E_HWC_WINDOW_TRANSITION_NONE_TO_NONE;
                    else
                      {
-                        e_hwc_window_state_set(hwc_window, E_HWC_WINDOW_STATE_DEVICE);
                         ret = EINA_FALSE;
                         ELOGF("HWC-WINS", " E_HWC_WINDOW_TRANSITION_CLIENT_TO_DEVICE is set.(Transition_Check)",
                               hwc_window->ec ? ec->pixmap : NULL, hwc_window->ec);
@@ -1546,7 +1544,7 @@ _e_output_hwc_windows_states_evaluate(E_Output_Hwc *output_hwc)
      eina_list_free(visible_windows_list);
 }
 
-/* evaluate the hwc_windows and decide the output_hwc->need_commit */
+/* evaluate the hwc_windows */
 EINTERN Eina_Bool
 e_output_hwc_windows_evaluate(E_Output_Hwc *output_hwc)
 {
@@ -1556,35 +1554,21 @@ e_output_hwc_windows_evaluate(E_Output_Hwc *output_hwc)
 
    ELOGF("HWC-WINS", "====================== Output HWC Apply (evaluate) ======================", NULL, NULL);
 
-   if (output_hwc->wait_commit)
-     {
-        ELOGF("HWC-WINS", "!!!!!!!! Didn't get Output Commit Handler Yet !!!!!!!!", NULL, NULL);
-        return EINA_TRUE;
-     }
-
-   if (e_comp_canvas_norender_get() > 0)
-     {
-        ELOGF("HWC-WINS", " Block Display... NoRender get.", NULL, NULL);
-        return EINA_TRUE;
-     }
-
    /* evaulate the current states */
    _e_output_hwc_windows_states_evaluate(output_hwc);
 
-   /* update transition */
+   /* update the state transition */
    _e_output_hwc_windows_transition_update(output_hwc);
 
-   /* evaulate the need_commit */
+   /* evaulate the compositions with the states*/
    if (_e_output_hwc_windows_commit_evaulate(output_hwc))
      {
-        output_hwc->need_commit = EINA_TRUE;
 #if DBG_EVALUATE
         ELOGF("HWC-WINS", " Succeed the commit_evaulation.", NULL, NULL);
 #endif
      }
    else
      {
-        output_hwc->need_commit = EINA_FALSE;
 #if DBG_EVALUATE
         ELOGF("HWC-WINS", " Need to re-evaulation.", NULL, NULL);
 #endif
@@ -1599,10 +1583,7 @@ e_output_hwc_windows_evaluate(E_Output_Hwc *output_hwc)
    if (hwc_mode == E_OUTPUT_HWC_MODE_HYBRID || hwc_mode == E_OUTPUT_HWC_MODE_NONE)
      e_hwc_window_state_set(target_window, E_HWC_WINDOW_STATE_DEVICE);
    else
-     {
-        e_hwc_window_state_set(target_window, E_HWC_WINDOW_STATE_NONE);
-//        e_hwc_window_target_buffer_fetch(output_hwc->target_hwc_window);
-     }
+     e_hwc_window_state_set(target_window, E_HWC_WINDOW_STATE_NONE);
 
    if (output_hwc->hwc_mode != hwc_mode)
      {
@@ -1620,14 +1601,11 @@ e_output_hwc_windows_evaluate(E_Output_Hwc *output_hwc)
 
 #if DBG_EVALUATE
    if (hwc_mode == E_OUTPUT_HWC_MODE_NONE)
-     ELOGF("HWC-WINS", " HWC_MODE is NONE composition. need_commit is %s.",
-           NULL, NULL, output_hwc->need_commit ? "TRUE" : "FALSE");
+     ELOGF("HWC-WINS", " HWC_MODE is NONE composition.", NULL, NULL);
    else if (hwc_mode == E_OUTPUT_HWC_MODE_HYBRID)
-     ELOGF("HWC-WINS", " HWC_MODE is HYBRID composition. need_commit is %s",
-           NULL, NULL, output_hwc->need_commit ? "TRUE" : "FALSE");
+     ELOGF("HWC-WINS", " HWC_MODE is HYBRID composition.", NULL, NULL);
    else
-     ELOGF("HWC-WINS", " HWC_MODE is FULL HW composition. need_commit is %s",
-           NULL, NULL, output_hwc->need_commit ? "TRUE" : "FALSE");
+     ELOGF("HWC-WINS", " HWC_MODE is FULL HW composition.", NULL, NULL);
 #endif
 
    return ret;
@@ -1689,6 +1667,12 @@ e_output_hwc_windows_commit(E_Output_Hwc *output_hwc)
         return EINA_TRUE;
      }
 
+   if (e_comp_canvas_norender_get() > 0)
+     {
+        ELOGF("HWC-WINS", " Block Display... NoRender get.", NULL, NULL);
+        return EINA_TRUE;
+     }
+
    if (output->dpms == E_OUTPUT_DPMS_OFF)
      {
         EINA_LIST_FOREACH(output_hwc->hwc_windows, l, hwc_window)
@@ -1697,42 +1681,43 @@ e_output_hwc_windows_commit(E_Output_Hwc *output_hwc)
         return EINA_TRUE;
      }
 
+   /* update the target_window */
    target_window = (E_Hwc_Window *)output_hwc->target_hwc_window;
-//   if (e_hwc_window_target_enabled(output_hwc->target_hwc_window))
+   if (!e_hwc_window_target_buffer_fetch(output_hwc->target_hwc_window)) // try aquire
      {
-        if (!e_hwc_window_target_buffer_fetch(output_hwc->target_hwc_window)) // try aquire
-          {
-             output_hwc->need_commit = EINA_FALSE;
-             target_window->update_exist = EINA_FALSE;
-             output_hwc->update_changes = EINA_FALSE;
-#if DBG_EVALUATE
-             ELOGF("HWC-WINS", " No available surface on target_window.", NULL, NULL);
-#endif
-          }
-        else
-          {
-             output_hwc->need_commit = EINA_TRUE;
-             target_window->update_exist = EINA_TRUE;
-             output_hwc->update_changes = EINA_TRUE;
-#if DBG_EVALUATE
-             ELOGF("HWC-WINS", " Available surface on target_window.", NULL, NULL);
-#endif
-          }
+        target_window->update_exist = EINA_FALSE;
+        output_hwc->update_changes = EINA_FALSE;
+        //ELOGF("HWC-WINS", " No available surface on target_window.", NULL, NULL);
+     }
+   else
+     {
+        target_window->update_exist = EINA_TRUE;
+        output_hwc->update_changes = EINA_TRUE;
+        //ELOGF("HWC-WINS", " Available surface on target_window.", NULL, NULL);
      }
 
    /* update the buffers and the infos */
    _e_output_hwc_windows_buffers_update(output_hwc);
 
-   if (output_hwc->update_changes)
-   //if (output_hwc->need_commit || output_hwc->update_changes)
+   if (output_hwc->update_changes || output_hwc->hwc_mode == E_OUTPUT_HWC_MODE_NONE)
      {
         output_hwc->update_changes = EINA_FALSE;
 
-        EINA_LIST_FOREACH(output_hwc->hwc_windows, l, hwc_window)
+        if (!e_output_hwc_windows_evaluate(output_hwc))
+          ERR("failed e_output_hwc_windows_evaluate");
+
+        /* target is on and no surface, then return false */
+        if (e_hwc_window_state_get(target_window) == E_HWC_WINDOW_STATE_DEVICE &&
+            target_window->tsurface == NULL)
           {
-             _e_output_hwc_windows_prepare_commit(output, hwc_window);
+             /* update the previous states. */
+             _e_output_hwc_windows_prev_states_update(output_hwc);
+             return EINA_FALSE;
           }
 
+        EINA_LIST_FOREACH(output_hwc->hwc_windows, l, hwc_window)
+           _e_output_hwc_windows_prepare_commit(output, hwc_window);
+
         if (output->zoom_set)
           {
              e_output_zoom_rotating_check(output);