use smooth transition if the layer is really grabbed 36/164336/1
authorKonstantin Drabeniuk <k.drabeniuk@samsung.com>
Mon, 18 Dec 2017 16:01:27 +0000 (18:01 +0200)
committerKonstantin Drabeniuk <k.drabeniuk@samsung.com>
Mon, 18 Dec 2017 16:16:16 +0000 (18:16 +0200)
Change-Id: Iaa324722102308d31c94f01631cc62fa9445560f
Signed-off-by: Konstantin Drabeniuk <k.drabeniuk@samsung.com>
src/tdm_exynos_output.c
src/tdm_exynos_types.h

index f083662913c632440bae2da7f40e5430a48731fa..c0094cb629bbf57a48248ed400ccf9f3b7a8ee15 100644 (file)
@@ -954,6 +954,28 @@ work:
        return 1;
 }
 
+static void
+_reset_hwc_windows_grabbed_layer_zpos(struct list_head *hwc_window_list)
+{
+       tdm_exynos_hwc_window_data *hw = NULL;
+
+       LIST_FOR_EACH_ENTRY(hw, hwc_window_list, link) {
+               hw->grabbed_layer_zpos = -1;
+       }
+}
+
+static int
+_is_device_to_client_transition(struct list_head *hwc_window_list)
+{
+       tdm_exynos_hwc_window_data *hw = NULL;
+
+       LIST_FOR_EACH_ENTRY(hw, hwc_window_list, link)
+               if (hw->is_device_to_client_transition)
+                       return 1;
+
+       return 0;
+}
+
 static tdm_error
 _tdm_exynos_display_prepare_commit(tdm_exynos_output_data *output_data) {
 
@@ -1001,8 +1023,8 @@ _tdm_exynos_display_prepare_commit(tdm_exynos_output_data *output_data) {
 
                        /* preempt the hwc_wnd which was mapped to the primary layer */
                        hw = _find_maped_hwc_window_to_layer(&output_data->hwc_window_list, primary_layer_zpos);
-                       hw->assigned_layer_zpos = -1;
-                       hw->prev_assigned_layer_zpos = -1;
+                       if (hw)
+                               hw->assigned_layer_zpos = -1;
 
                        _update_layers_info(output_data);
                }
@@ -1011,8 +1033,18 @@ _tdm_exynos_display_prepare_commit(tdm_exynos_output_data *output_data) {
                 * within 'device to client transition' state, so after such transition
                 * has finished, we trigger a revalidate event to reevaluate the overlay policy */
                tdm_backend_trigger_need_validate_event(output_data);
+
+               hw = NULL;
+
+               LIST_FOR_EACH_ENTRY(hw, &output_data->hwc_window_list, link)
+                       hw->is_device_to_client_transition = 0;
        }
 
+       if (_is_device_to_client_transition(&output_data->hwc_window_list))
+               return TDM_ERROR_NONE;
+
+       _reset_hwc_windows_grabbed_layer_zpos(&output_data->hwc_window_list);
+
        LIST_FOR_EACH_ENTRY(layer, &output_data->layer_list, link) {
                if (output_data->need_target_window && layer->zpos == primary_layer_zpos)
                        continue;
@@ -1020,16 +1052,11 @@ _tdm_exynos_display_prepare_commit(tdm_exynos_output_data *output_data) {
                        continue;
 
                hw = _find_maped_hwc_window_to_layer(&output_data->hwc_window_list, layer->zpos);
+               if (hw)
+                       hw->grabbed_layer_zpos = layer->zpos;
                _set_hwc_window_buffer_to_layer(layer, hw);
        }
 
-       if (device_to_client_transition_finished) {
-               hw = NULL;
-
-               LIST_FOR_EACH_ENTRY(hw, &output_data->hwc_window_list, link)
-                       hw->is_device_to_client_transition = 0;
-       }
-
        return TDM_ERROR_NONE;
 }
 
@@ -1433,21 +1460,6 @@ _update_windows_previous_type(struct list_head *hwc_wnds)
                hw->prev_validated_type = hw->validated_type;
 }
 
-static void
-_update_windows_previous_assigned_layer_zpos(struct list_head *hwc_wnds)
-{
-       tdm_exynos_hwc_window_data *hw = NULL;
-
-       LIST_FOR_EACH_ENTRY(hw, hwc_wnds, link) {
-               if (hw->client_type == TDM_COMPOSITION_NONE) {
-                       hw->prev_assigned_layer_zpos = -1;
-                       continue;
-               }
-
-               hw->prev_assigned_layer_zpos = hw->assigned_layer_zpos;
-       }
-}
-
 static void
 _reset_composition_types(struct list_head *hwc_window_list)
 {
@@ -1680,9 +1692,13 @@ _reset_buffers_for_unvis_hwc_windows(tdm_exynos_output_data *output_data)
        if (!output_data->need_target_window)
                output_data->target_hwc_window->surface = NULL;
 
-       LIST_FOR_EACH_ENTRY(hw, &output_data->hwc_window_list, link)
+       LIST_FOR_EACH_ENTRY(hw, &output_data->hwc_window_list, link) {
+               if (!output_data->need_target_window)
+                       hw->present_on_target_wnd = 0;
+
                if (hw->client_type == TDM_COMPOSITION_NONE)
                        hw->surface = NULL;
+       }
 }
 
 static void
@@ -1696,7 +1712,7 @@ _restore_windows_assigned_layer_zpos(struct list_head *hwc_wnds)
                        continue;
                }
 
-               hw->assigned_layer_zpos = hw->prev_assigned_layer_zpos;
+               hw->assigned_layer_zpos = hw->grabbed_layer_zpos;
        }
 }
 
@@ -1709,24 +1725,12 @@ _reset_windows_to_client(struct list_head *hwc_wnds)
                if (hw->client_type == TDM_COMPOSITION_NONE)
                        continue;
 
-               if (hw->prev_validated_type == TDM_COMPOSITION_DEVICE &&
+               if (hw->grabbed_layer_zpos >= 0 &&
                                hw->validated_type == TDM_COMPOSITION_CLIENT)
                        hw->is_device_to_client_transition = 1;
 
                hw->validated_type = TDM_COMPOSITION_CLIENT;
        }
-
-       /* move to 'device to client transition' state hwc_wnds
-        * which were mapped to overlays, but which weren't reset to
-        * CLIENT by e20 or _map_hwc_windows_to_layers() func */
-       LIST_FOR_EACH_ENTRY(hw, hwc_wnds, link) {
-               if (hw->client_type == TDM_COMPOSITION_NONE)
-                       continue;
-
-               if (hw->prev_validated_type == TDM_COMPOSITION_DEVICE &&
-                               hw->validated_type == TDM_COMPOSITION_CLIENT)
-                       hw->is_device_to_client_transition = 1;
-       }
 }
 
 /* if we got at least one device -> client transition or we have
@@ -1739,14 +1743,16 @@ _is_reset_to_client_needed(struct list_head *hwc_wnds)
        tdm_exynos_hwc_window_data *hw = NULL;
 
        LIST_FOR_EACH_ENTRY(hw, hwc_wnds, link) {
-               if (hw->client_type == TDM_COMPOSITION_NONE)
+               if (hw->client_type == TDM_COMPOSITION_NONE) {
+                       if (hw->is_device_to_client_transition)
+                               return 1;
+
                        continue;
+               }
 
-               if (hw->prev_validated_type == TDM_COMPOSITION_DEVICE &&
-                               hw->validated_type == TDM_COMPOSITION_CLIENT)
-                       return 1;
 
-               if (hw->is_device_to_client_transition)
+               if (hw->grabbed_layer_zpos >= 0 &&
+                               hw->validated_type == TDM_COMPOSITION_CLIENT)
                        return 1;
        }
 
@@ -1793,7 +1799,6 @@ exynos_output_hwc_validate(tdm_output *output, uint32_t *num_types)
                }
 
                _update_windows_previous_type(&exynos_output->hwc_window_list);
-               _update_windows_previous_assigned_layer_zpos(&exynos_output->hwc_window_list);
        }
 
        _reset_buffers_for_unvis_hwc_windows(exynos_output);
index 566ff93328c34cb819e42aa426d6327435e47e0e..fb30aeb08ab1f44b23ac4866508361c1b43d2d56 100644 (file)
@@ -202,7 +202,7 @@ struct _tdm_exynos_hwc_window_data {
        tdm_hwc_window_composition prev_validated_type;
 
        int assigned_layer_zpos;
-       int prev_assigned_layer_zpos;
+       int grabbed_layer_zpos;
 
        tdm_hwc_window_flag flags;