hwc: check the reserved memory at the validation 27/193227/1
authorSooChan Lim <sc1.lim@samsung.com>
Fri, 16 Nov 2018 08:40:01 +0000 (17:40 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Fri, 16 Nov 2018 09:01:17 +0000 (18:01 +0900)
Change-Id: I194cf824ea889c6d24edeef919417526021cdac0

src/tdm_sprd_hwc.c

index 68e32e8..75d7141 100644 (file)
@@ -82,9 +82,6 @@ _sprd_hwc_window_has_reserved_buffer(tdm_sprd_hwc_window_data *hwc_window_data)
 static int
 _sprd_hwc_window_can_set_on_hw_layer(tdm_sprd_hwc_window_data *hwc_window_data)
 {
-       if (!_sprd_hwc_window_has_reserved_buffer(hwc_window_data))
-               return 0;
-
        if (hwc_window_data->info.transform != TDM_TRANSFORM_NORMAL)
                return 0;
 
@@ -255,7 +252,7 @@ _sprd_hwc_apply_policy(tdm_sprd_hwc_data *hwc_data , tdm_hwc_window **composited
                goto set_clients_below;
 
        /* NUM_UI_LAYSERS is 1, so device_count always 1 at this point */
-       for (i = 0; i < device_count; i++) {
+       while (device_count > 0) {
                        /* for video */
                        if (composited_list[next_idx]->client_type == TDM_COMPOSITION_VIDEO) {
                                composited_list[next_idx]->validated_type = TDM_COMPOSITION_VIDEO;
@@ -264,9 +261,15 @@ _sprd_hwc_apply_policy(tdm_sprd_hwc_data *hwc_data , tdm_hwc_window **composited
                                continue;
                        }
 
+                       /* set clients below when sprd can not set the window to the hw layer */
+                       if (!_sprd_hwc_window_can_set_on_hw_layer(composited_list[next_idx]))
+                               break;
+
                        /* set the buffer_queue constraint */
                        composited_list[next_idx]->constraints = TDM_CONSTRAINT_BUFFER_QUEUE;
-                       if (!_sprd_hwc_window_can_set_on_hw_layer(composited_list[next_idx])) {
+
+                       /* set clients below when the hwc_window does not have the reserved buffer */
+                       if (!_sprd_hwc_window_has_reserved_buffer(composited_list[next_idx])) {
                                composited_list[next_idx]->validated_type = TDM_COMPOSITION_CLIENT;
                                composited_list[next_idx]->lzpos = -1;
                                next_idx++;