hwc: add exynos_hwc_window_get_layer 09/169909/3
authorSooChan Lim <sc1.lim@samsung.com>
Mon, 12 Feb 2018 05:03:42 +0000 (14:03 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Tue, 20 Feb 2018 00:54:01 +0000 (00:54 +0000)
Change-Id: I49660e27f3f7ba28b58cbad414c7df7798792956

src/tdm_exynos.c
src/tdm_exynos.h
src/tdm_exynos_output.c
src/tdm_exynos_window.c

index beb51e8467547435845b730e0b428e66345cf12e..7213e50d5a45601e2b07e8366d47b7c62edf45e9 100644 (file)
@@ -328,6 +328,7 @@ tdm_exynos_init(tdm_display *dpy, tdm_error *error)
                exynos_func_hwc_window.hwc_window_set_buffer = exynos_hwc_window_set_buffer;
                exynos_func_hwc_window.hwc_window_unset_buffer = exynos_hwc_window_unset_buffer;
                exynos_func_hwc_window.hwc_window_get_buffer = exynos_hwc_window_get_buffer;
+               exynos_func_hwc_window.hwc_window_get_layer = exynos_hwc_window_get_layer;
                exynos_func_hwc_window.hwc_window_set_composition_type = exynos_hwc_window_set_composition_type;
                exynos_func_hwc_window.hwc_window_set_info = exynos_hwc_window_set_info;
                exynos_func_hwc_window.hwc_window_get_info = exynos_hwc_window_get_info;
index 32ed15aea47cd43c6770ea98a3e0fbcca682fc12..75ca1b27f17b92ed5173b144441ed11b5c5cd881 100644 (file)
@@ -88,6 +88,7 @@ tdm_error    exynos_hwc_window_get_info(tdm_hwc_window *hwc_window, tdm_hwc_wind
 tdm_error    exynos_hwc_window_set_buffer(tdm_hwc_window *hwc_window, tbm_surface_h surface);
 tdm_error    exynos_hwc_window_unset_buffer(tdm_hwc_window *hwc_window);
 tbm_surface_h exynos_hwc_window_get_buffer(tdm_hwc_window *hwc_window, tdm_error *error);
+tdm_layer    *exynos_hwc_window_get_layer(tdm_hwc_window *hwc_window, tdm_error *error);
 tdm_error    exynos_hwc_window_set_flags(tdm_hwc_window *hwc_window, tdm_hwc_window_flag flags);
 tdm_error    exynos_hwc_window_unset_flags(tdm_hwc_window *hwc_window, tdm_hwc_window_flag flags);
 tdm_error    exynos_hwc_window_video_get_capability(tdm_hwc_window *hwc_window,
index 245817a74f2ccbe42cece2a685abd0921e6970e0..b2ed70cd31c9f1bf1ab280533e0d899534692bb4 100644 (file)
@@ -18,7 +18,7 @@ tdm_hwc_window *
 _exynos_output_hwc_window_create(tdm_output *output, tdm_hwc_window_info *info,
                                                                 tdm_error *error);
 
-static const char *
+const char *
 _comp_to_str(tdm_hwc_window_composition composition_type)
 {
        if (composition_type == TDM_COMPOSITION_CLIENT)
index 53c47e22990532bf21ec5c80f0ba2ff3dc2bf98b..a3c9f94dd663105b323bdf79c7ff48a0244798b6 100644 (file)
@@ -7,6 +7,9 @@
 tdm_exynos_layer_data *
 _exynos_output_get_layer(tdm_exynos_output_data *output_data, int index);
 
+const char *
+_comp_to_str(tdm_hwc_window_composition composition_type);
+
 tbm_surface_queue_h
 exynos_hwc_window_get_tbm_buffer_queue(tdm_hwc_window *hwc_window, tdm_error *error)
 {
@@ -194,6 +197,54 @@ fail_operation:
        return NULL;
 }
 
+tdm_layer *
+exynos_hwc_window_get_layer(tdm_hwc_window *hwc_window, tdm_error *error)
+{
+       tdm_exynos_hwc_window_data *hwc_window_data = hwc_window;
+       tdm_exynos_output_data *output_data;
+       tdm_exynos_data *exynos_data;
+       tdm_exynos_layer_data *layer_data = NULL;
+
+       if (!hwc_window_data)
+               goto fail_paremeter;
+
+       output_data = hwc_window_data->output_data;
+       exynos_data = hwc_window_data->exynos_data;
+
+       if (!output_data)
+               goto fail_operation;
+       if (!exynos_data)
+               goto fail_operation;
+       if (hwc_window_data->assigned_layer_zpos == -1) {
+               TDM_ERR("Fail: No assigend_layer_zpos.");
+               goto fail_operation;
+       }
+
+       if (hwc_window_data->validated_type == TDM_COMPOSITION_NONE ||
+               hwc_window_data->validated_type == TDM_COMPOSITION_CLIENT ||
+               hwc_window_data->validated_type == TDM_COMPOSITION_DEVICE_CANDIDATE) {
+               TDM_ERR("Fail: validate_type is %s.", _comp_to_str(hwc_window_data->validated_type));
+               goto fail_operation;
+       }
+
+       layer_data = _exynos_output_get_layer(output_data, hwc_window_data->assigned_layer_zpos);
+       if (!layer_data) {
+               TDM_ERR("Fail: No layer_data.");
+               goto fail_operation;
+       }
+
+       *error = TDM_ERROR_NONE;
+
+       return (tdm_layer *)layer_data;
+
+fail_paremeter:
+       *error = TDM_ERROR_INVALID_PARAMETER;
+       return NULL;
+fail_operation:
+       *error = TDM_ERROR_OPERATION_FAILED;
+       return NULL;
+}
+
 tdm_error
 exynos_hwc_window_set_flags(tdm_hwc_window *hwc_window, tdm_hwc_window_flag flags)
 {