hwc: change the symbol names and the position of it 21/193121/1
authorSooChan Lim <sc1.lim@samsung.com>
Thu, 15 Nov 2018 02:20:39 +0000 (11:20 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Thu, 15 Nov 2018 02:20:39 +0000 (11:20 +0900)
Change-Id: Iebe32f485d7f4626d0fd68fb47b27daf713bf980

src/tdm_sprd_hwc.c

index 3171c1e..2f6b0e2 100644 (file)
@@ -59,7 +59,7 @@ _print_validate_result(tdm_sprd_hwc_data *hwc_data, tdm_hwc_window **composited_
 }
 
 static int
-_sprd_hwc_window_is_reserved_buffer(tdm_sprd_hwc_window_data *hwc_window_data) {
+_sprd_hwc_window_has_reserved_buffer(tdm_sprd_hwc_window_data *hwc_window_data) {
        tbm_bo bo = NULL;
        int falgs = 0;
 
@@ -75,9 +75,9 @@ _sprd_hwc_window_is_reserved_buffer(tdm_sprd_hwc_window_data *hwc_window_data) {
 }
 
 static int
-_sprd_can_set_hwc_window_on_hw_layer(tdm_sprd_hwc_window_data *hwc_window_data)
+_sprd_hwc_window_can_set_on_hw_layer(tdm_sprd_hwc_window_data *hwc_window_data)
 {
-       if (!_sprd_hwc_window_is_reserved_buffer(hwc_window_data))
+       if (!_sprd_hwc_window_has_reserved_buffer(hwc_window_data))
                return 0;
 
        if (hwc_window_data->info.transform != TDM_TRANSFORM_NORMAL)
@@ -103,7 +103,7 @@ _sprd_can_set_hwc_window_on_hw_layer(tdm_sprd_hwc_window_data *hwc_window_data)
 }
 
 static tbm_surface_queue_h
-_sprd_hwc_window_get_tbm_buffer_queue(tdm_hwc_window *hwc_window, tdm_error *error)
+_sprd_hwc_window_get_tbm_surface_queue(tdm_hwc_window *hwc_window, tdm_error *error)
 {
        tdm_sprd_hwc_window_data *hwc_window_data = NULL;
        tbm_surface_queue_h tqueue = NULL;
@@ -133,8 +133,22 @@ _sprd_hwc_window_get_tbm_buffer_queue(tdm_hwc_window *hwc_window, tdm_error *err
        return tqueue;
 }
 
+tdm_sprd_layer_data *
+_sprd_hwc_get_layer(tdm_sprd_hwc_data *hwc_data, int layer_zpos)
+{
+       tdm_sprd_output_data *output_data = hwc_data->output_data;
+       tdm_sprd_layer_data *l = NULL;
+
+       LIST_FOR_EACH_ENTRY(l, &output_data->layer_list, link) {
+               if (l->zpos == layer_zpos)
+                       return l;
+       }
+
+       return NULL;
+}
+
 static tdm_error
-_sprd_layer_attach_window(tdm_sprd_layer_data *layer_data, tdm_sprd_hwc_window_data *hwc_window_data)
+_sprd_hwc_layer_attach_window(tdm_sprd_layer_data *layer_data, tdm_sprd_hwc_window_data *hwc_window_data)
 {
        tdm_error ret = TDM_ERROR_NONE;
 
@@ -155,19 +169,6 @@ _sprd_layer_attach_window(tdm_sprd_layer_data *layer_data, tdm_sprd_hwc_window_d
        return ret;
 }
 
-tdm_sprd_layer_data *
-_sprd_output_get_layer(tdm_sprd_output_data *output_data, int index)
-{
-       tdm_sprd_layer_data *l = NULL;
-
-       RETURN_VAL_IF_FAIL(output_data, NULL);
-
-       LIST_FOR_EACH_ENTRY(l, &output_data->layer_list, link)
-               if (l->zpos == index)
-                       return l;
-       return NULL;
-}
-
 static int
 _sprd_get_number_of_visible_windows(tdm_sprd_hwc_data *hwc_data)
 {
@@ -189,54 +190,51 @@ _sprd_get_number_of_visible_windows(tdm_sprd_hwc_data *hwc_data)
 static tdm_error
 _sprd_hwc_prepare_commit(tdm_sprd_hwc_data *hwc_data)
 {
-       tdm_sprd_output_data *output_data = NULL;
        tdm_sprd_layer_data * layer = NULL;
        tdm_sprd_hwc_window_data *hwc_window_data = NULL;
        int osd_use = 0, img_use = 0;
 
-       output_data = hwc_data->output_data;
-
        if (!_sprd_get_number_of_visible_windows(hwc_data))
                hwc_data->need_target_window = 1;
 
        /* set target hwc window */
        if (hwc_data->need_target_window) {
-               layer = _sprd_output_get_layer(output_data, 1);
-               _sprd_layer_attach_window(layer, hwc_data->target_hwc_window);
+               layer = _sprd_hwc_get_layer(hwc_data, 1);
+               _sprd_hwc_layer_attach_window(layer, hwc_data->target_hwc_window);
                osd_use = 1;
        }
 
        /* set hwc windows */
        LIST_FOR_EACH_ENTRY_REV(hwc_window_data, &hwc_data->hwc_window_list, link) {
                if (hwc_window_data->validated_type == TDM_HWC_WIN_COMPOSITION_DEVICE) {
-                       layer = _sprd_output_get_layer(output_data, 1);
+                       layer = _sprd_hwc_get_layer(hwc_data, 1);
                        osd_use = 1;
                } else if (hwc_window_data->validated_type == TDM_HWC_WIN_COMPOSITION_VIDEO) {
-                       layer = _sprd_output_get_layer(output_data, 0);
+                       layer = _sprd_hwc_get_layer(hwc_data, 0);
                        img_use = 1;
                } else {
                        continue;
                }
 
-               _sprd_layer_attach_window(layer, hwc_window_data);
+               _sprd_hwc_layer_attach_window(layer, hwc_window_data);
        }
 
        /* disable unused layer */
        if (!osd_use) {
-               layer = _sprd_output_get_layer(output_data, 1);
-               _sprd_layer_attach_window(layer, NULL);
+               layer = _sprd_hwc_get_layer(hwc_data, 1);
+               _sprd_hwc_layer_attach_window(layer, NULL);
        }
 
        if (!img_use) {
-               layer = _sprd_output_get_layer(output_data, 0);
-               _sprd_layer_attach_window(layer, NULL);
+               layer = _sprd_hwc_get_layer(hwc_data, 0);
+               _sprd_hwc_layer_attach_window(layer, NULL);
        }
 
        return TDM_ERROR_NONE;
 }
 
 int
-_sprd_output_get_changed_number(tdm_sprd_hwc_data *hwc_data)
+_sprd_hwc_get_changed_number(tdm_sprd_hwc_data *hwc_data)
 {
        int num = 0;
        tdm_sprd_hwc_window_data *hwc_window_data = NULL;
@@ -354,7 +352,7 @@ sprd_hwc_get_client_target_buffer_queue(tdm_hwc *hwc, tdm_error *error)
                return NULL;
        }
 
-       tqueue = _sprd_hwc_window_get_tbm_buffer_queue(hwc_data->target_hwc_window, error);
+       tqueue = _sprd_hwc_window_get_tbm_surface_queue(hwc_data->target_hwc_window, error);
        RETURN_VAL_IF_FAIL(tqueue, NULL);
 
        if (error)
@@ -411,7 +409,7 @@ sprd_hwc_validate(tdm_hwc *hwc, tdm_hwc_window **composited_wnds, uint32_t num_w
        } else if (num_wnds == 1) {
                composited_list[0]->constraints = TDM_HWC_WIN_CONSTRAINT_NONE;
                if (composited_list[0]->client_type == TDM_HWC_WIN_COMPOSITION_DEVICE) {
-                       if (_sprd_can_set_hwc_window_on_hw_layer(composited_list[0])) {
+                       if (_sprd_hwc_window_can_set_on_hw_layer(composited_list[0])) {
                                hwc_data->need_target_window = 0;
                                composited_list[0]->validated_type = TDM_HWC_WIN_COMPOSITION_DEVICE;
                                composited_list[0]->zpos = zpos;
@@ -444,7 +442,7 @@ sprd_hwc_validate(tdm_hwc *hwc, tdm_hwc_window **composited_wnds, uint32_t num_w
                        composited_list[i]->constraints = TDM_HWC_WIN_CONSTRAINT_NONE;
                    if (num_wnds == 2 && has_video == 1) {
                                if (composited_list[i]->client_type == TDM_HWC_WIN_COMPOSITION_DEVICE) {
-                                       if (_sprd_can_set_hwc_window_on_hw_layer(composited_list[i])) {
+                                       if (_sprd_hwc_window_can_set_on_hw_layer(composited_list[i])) {
                                                hwc_data->need_target_window = 0;
                                                composited_list[i]->validated_type = TDM_HWC_WIN_COMPOSITION_DEVICE;
                                                composited_list[i]->zpos = zpos;
@@ -477,7 +475,7 @@ sprd_hwc_validate(tdm_hwc *hwc, tdm_hwc_window **composited_wnds, uint32_t num_w
                }
        }
 
-       *num_types = _sprd_output_get_changed_number(hwc_data);
+       *num_types = _sprd_hwc_get_changed_number(hwc_data);
 
        /* print the result */
        _print_validate_result(hwc_data, composited_wnds, num_wnds);
@@ -497,7 +495,7 @@ sprd_hwc_get_changed_composition_types(tdm_hwc *hwc, uint32_t *num_elements,
        RETURN_VAL_IF_FAIL(num_elements != NULL, TDM_ERROR_INVALID_PARAMETER);
 
        if ((hwc_window == NULL) || (composition_types == NULL)) {
-               *num_elements = _sprd_output_get_changed_number(hwc_data);
+               *num_elements = _sprd_hwc_get_changed_number(hwc_data);
                return TDM_ERROR_NONE;
        }