Loading...
1/*
2 * Copyright 2016 Advanced Micro Devices, Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * Authors: AMD
23 *
24 */
25
26#ifndef __DAL_DCN10_CM_COMMON_H__
27#define __DAL_DCN10_CM_COMMON_H__
28
29#define TF_HELPER_REG_FIELD_LIST(type) \
30 type exp_region0_lut_offset; \
31 type exp_region0_num_segments; \
32 type exp_region1_lut_offset; \
33 type exp_region1_num_segments;\
34 type field_region_end;\
35 type field_region_end_slope;\
36 type field_region_end_base;\
37 type exp_region_start;\
38 type exp_resion_start_segment;\
39 type field_region_linear_slope
40
41#define TF_HELPER_REG_LIST \
42 uint32_t start_cntl_b; \
43 uint32_t start_cntl_g; \
44 uint32_t start_cntl_r; \
45 uint32_t start_slope_cntl_b; \
46 uint32_t start_slope_cntl_g; \
47 uint32_t start_slope_cntl_r; \
48 uint32_t start_end_cntl1_b; \
49 uint32_t start_end_cntl2_b; \
50 uint32_t start_end_cntl1_g; \
51 uint32_t start_end_cntl2_g; \
52 uint32_t start_end_cntl1_r; \
53 uint32_t start_end_cntl2_r; \
54 uint32_t region_start; \
55 uint32_t region_end
56
57#define TF_CM_REG_FIELD_LIST(type) \
58 type csc_c11; \
59 type csc_c12
60
61struct xfer_func_shift {
62 TF_HELPER_REG_FIELD_LIST(uint8_t);
63};
64
65struct xfer_func_mask {
66 TF_HELPER_REG_FIELD_LIST(uint32_t);
67};
68
69struct xfer_func_reg {
70 struct xfer_func_shift shifts;
71 struct xfer_func_mask masks;
72
73 TF_HELPER_REG_LIST;
74};
75
76struct cm_color_matrix_shift {
77 TF_CM_REG_FIELD_LIST(uint8_t);
78};
79
80struct cm_color_matrix_mask {
81 TF_CM_REG_FIELD_LIST(uint32_t);
82};
83
84struct color_matrices_reg{
85 struct cm_color_matrix_shift shifts;
86 struct cm_color_matrix_mask masks;
87
88 uint32_t csc_c11_c12;
89 uint32_t csc_c33_c34;
90};
91
92void cm_helper_program_color_matrices(
93 struct dc_context *ctx,
94 const uint16_t *regval,
95 const struct color_matrices_reg *reg);
96
97void cm_helper_program_xfer_func(
98 struct dc_context *ctx,
99 const struct pwl_params *params,
100 const struct xfer_func_reg *reg);
101
102bool cm_helper_convert_to_custom_float(
103 struct pwl_result_data *rgb_resulted,
104 struct curve_points3 *corner_points,
105 uint32_t hw_points_num,
106 bool fixpoint);
107
108bool cm_helper_translate_curve_to_hw_format(
109 struct dc_context *ctx,
110 const struct dc_transfer_func *output_tf,
111 struct pwl_params *lut_params, bool fixpoint);
112
113bool cm_helper_translate_curve_to_degamma_hw_format(
114 const struct dc_transfer_func *output_tf,
115 struct pwl_params *lut_params);
116
117void cm_helper_read_color_matrices(struct dc_context *ctx,
118 uint16_t *regval,
119 const struct color_matrices_reg *reg);
120#endif
1/*
2 * Copyright 2016 Advanced Micro Devices, Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * Authors: AMD
23 *
24 */
25
26#ifndef __DAL_DCN10_CM_COMMON_H__
27#define __DAL_DCN10_CM_COMMON_H__
28
29#define TF_HELPER_REG_FIELD_LIST(type) \
30 type exp_region0_lut_offset; \
31 type exp_region0_num_segments; \
32 type exp_region1_lut_offset; \
33 type exp_region1_num_segments;\
34 type field_region_end;\
35 type field_region_end_slope;\
36 type field_region_end_base;\
37 type exp_region_start;\
38 type exp_resion_start_segment;\
39 type field_region_linear_slope
40
41#define TF_CM_REG_FIELD_LIST(type) \
42 type csc_c11; \
43 type csc_c12
44
45struct xfer_func_shift {
46 TF_HELPER_REG_FIELD_LIST(uint8_t);
47};
48
49struct xfer_func_mask {
50 TF_HELPER_REG_FIELD_LIST(uint32_t);
51};
52
53struct xfer_func_reg {
54 struct xfer_func_shift shifts;
55 struct xfer_func_mask masks;
56
57 uint32_t start_cntl_b;
58 uint32_t start_cntl_g;
59 uint32_t start_cntl_r;
60 uint32_t start_slope_cntl_b;
61 uint32_t start_slope_cntl_g;
62 uint32_t start_slope_cntl_r;
63 uint32_t start_end_cntl1_b;
64 uint32_t start_end_cntl2_b;
65 uint32_t start_end_cntl1_g;
66 uint32_t start_end_cntl2_g;
67 uint32_t start_end_cntl1_r;
68 uint32_t start_end_cntl2_r;
69 uint32_t region_start;
70 uint32_t region_end;
71};
72
73struct cm_color_matrix_shift {
74 TF_CM_REG_FIELD_LIST(uint8_t);
75};
76
77struct cm_color_matrix_mask {
78 TF_CM_REG_FIELD_LIST(uint32_t);
79};
80
81struct color_matrices_reg{
82 struct cm_color_matrix_shift shifts;
83 struct cm_color_matrix_mask masks;
84
85 uint32_t csc_c11_c12;
86 uint32_t csc_c33_c34;
87};
88
89void cm_helper_program_color_matrices(
90 struct dc_context *ctx,
91 const uint16_t *regval,
92 const struct color_matrices_reg *reg);
93
94void cm_helper_program_xfer_func(
95 struct dc_context *ctx,
96 const struct pwl_params *params,
97 const struct xfer_func_reg *reg);
98
99bool cm_helper_convert_to_custom_float(
100 struct pwl_result_data *rgb_resulted,
101 struct curve_points *arr_points,
102 uint32_t hw_points_num,
103 bool fixpoint);
104
105bool cm_helper_translate_curve_to_hw_format(
106 const struct dc_transfer_func *output_tf,
107 struct pwl_params *lut_params, bool fixpoint);
108
109bool cm_helper_translate_curve_to_degamma_hw_format(
110 const struct dc_transfer_func *output_tf,
111 struct pwl_params *lut_params);
112
113
114#endif