0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 #ifndef __DAL_DCN10_CM_COMMON_H__
0027 #define __DAL_DCN10_CM_COMMON_H__
0028
0029 #define TF_HELPER_REG_FIELD_LIST(type) \
0030 type exp_region0_lut_offset; \
0031 type exp_region0_num_segments; \
0032 type exp_region1_lut_offset; \
0033 type exp_region1_num_segments;\
0034 type field_region_end;\
0035 type field_region_end_slope;\
0036 type field_region_end_base;\
0037 type exp_region_start;\
0038 type exp_resion_start_segment;\
0039 type field_region_linear_slope
0040
0041 #define TF_HELPER_REG_LIST \
0042 uint32_t start_cntl_b; \
0043 uint32_t start_cntl_g; \
0044 uint32_t start_cntl_r; \
0045 uint32_t start_slope_cntl_b; \
0046 uint32_t start_slope_cntl_g; \
0047 uint32_t start_slope_cntl_r; \
0048 uint32_t start_end_cntl1_b; \
0049 uint32_t start_end_cntl2_b; \
0050 uint32_t start_end_cntl1_g; \
0051 uint32_t start_end_cntl2_g; \
0052 uint32_t start_end_cntl1_r; \
0053 uint32_t start_end_cntl2_r; \
0054 uint32_t region_start; \
0055 uint32_t region_end
0056
0057 #define TF_CM_REG_FIELD_LIST(type) \
0058 type csc_c11; \
0059 type csc_c12
0060
0061 struct xfer_func_shift {
0062 TF_HELPER_REG_FIELD_LIST(uint8_t);
0063 };
0064
0065 struct xfer_func_mask {
0066 TF_HELPER_REG_FIELD_LIST(uint32_t);
0067 };
0068
0069 struct xfer_func_reg {
0070 struct xfer_func_shift shifts;
0071 struct xfer_func_mask masks;
0072
0073 TF_HELPER_REG_LIST;
0074 };
0075
0076 struct cm_color_matrix_shift {
0077 TF_CM_REG_FIELD_LIST(uint8_t);
0078 };
0079
0080 struct cm_color_matrix_mask {
0081 TF_CM_REG_FIELD_LIST(uint32_t);
0082 };
0083
0084 struct color_matrices_reg{
0085 struct cm_color_matrix_shift shifts;
0086 struct cm_color_matrix_mask masks;
0087
0088 uint32_t csc_c11_c12;
0089 uint32_t csc_c33_c34;
0090 };
0091
0092 void cm_helper_program_color_matrices(
0093 struct dc_context *ctx,
0094 const uint16_t *regval,
0095 const struct color_matrices_reg *reg);
0096
0097 void cm_helper_program_xfer_func(
0098 struct dc_context *ctx,
0099 const struct pwl_params *params,
0100 const struct xfer_func_reg *reg);
0101
0102 bool cm_helper_convert_to_custom_float(
0103 struct pwl_result_data *rgb_resulted,
0104 struct curve_points3 *corner_points,
0105 uint32_t hw_points_num,
0106 bool fixpoint);
0107
0108 bool cm_helper_translate_curve_to_hw_format(
0109 const struct dc_transfer_func *output_tf,
0110 struct pwl_params *lut_params, bool fixpoint);
0111
0112 bool cm_helper_translate_curve_to_degamma_hw_format(
0113 const struct dc_transfer_func *output_tf,
0114 struct pwl_params *lut_params);
0115
0116
0117 #endif