1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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
61 struct xfer_func_shift {
62 TF_HELPER_REG_FIELD_LIST(uint8_t);
63 };
64
65 struct xfer_func_mask {
66 TF_HELPER_REG_FIELD_LIST(uint32_t);
67 };
68
69 struct xfer_func_reg {
70 struct xfer_func_shift shifts;
71 struct xfer_func_mask masks;
72
73 TF_HELPER_REG_LIST;
74 };
75
76 struct cm_color_matrix_shift {
77 TF_CM_REG_FIELD_LIST(uint8_t);
78 };
79
80 struct cm_color_matrix_mask {
81 TF_CM_REG_FIELD_LIST(uint32_t);
82 };
83
84 struct 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
92 void cm_helper_program_color_matrices(
93 struct dc_context *ctx,
94 const uint16_t *regval,
95 const struct color_matrices_reg *reg);
96
97 void cm_helper_program_xfer_func(
98 struct dc_context *ctx,
99 const struct pwl_params *params,
100 const struct xfer_func_reg *reg);
101
102 bool 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
108 bool cm_helper_translate_curve_to_hw_format(
109 const struct dc_transfer_func *output_tf,
110 struct pwl_params *lut_params, bool fixpoint);
111
112 bool cm_helper_translate_curve_to_degamma_hw_format(
113 const struct dc_transfer_func *output_tf,
114 struct pwl_params *lut_params);
115
116
117 #endif