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
0027 #ifndef __DAL_DPP_H__
0028 #define __DAL_DPP_H__
0029
0030 #include "transform.h"
0031
0032 union defer_reg_writes {
0033 struct {
0034 bool disable_blnd_lut:1;
0035 bool disable_3dlut:1;
0036 bool disable_shaper:1;
0037 bool disable_gamcor:1;
0038 bool disable_dscl:1;
0039 } bits;
0040 uint32_t raw;
0041 };
0042
0043 struct dpp {
0044 const struct dpp_funcs *funcs;
0045 struct dc_context *ctx;
0046
0047
0048
0049
0050
0051
0052 int inst;
0053 struct dpp_caps *caps;
0054 struct pwl_params regamma_params;
0055 struct pwl_params degamma_params;
0056 struct dpp_cursor_attributes cur_attr;
0057 union defer_reg_writes deferred_reg_writes;
0058
0059 struct pwl_params shaper_params;
0060 bool cm_bypass_mode;
0061 };
0062
0063 struct dpp_input_csc_matrix {
0064 enum dc_color_space color_space;
0065 uint16_t regval[12];
0066 };
0067
0068 static const struct dpp_input_csc_matrix __maybe_unused dpp_input_csc_matrix[] = {
0069 {COLOR_SPACE_SRGB,
0070 {0x2000, 0, 0, 0, 0, 0x2000, 0, 0, 0, 0, 0x2000, 0} },
0071 {COLOR_SPACE_SRGB_LIMITED,
0072 {0x2000, 0, 0, 0, 0, 0x2000, 0, 0, 0, 0, 0x2000, 0} },
0073 {COLOR_SPACE_YCBCR601,
0074 {0x2cdd, 0x2000, 0, 0xe991, 0xe926, 0x2000, 0xf4fd, 0x10ef,
0075 0, 0x2000, 0x38b4, 0xe3a6} },
0076 {COLOR_SPACE_YCBCR601_LIMITED,
0077 {0x3353, 0x2568, 0, 0xe400, 0xe5dc, 0x2568, 0xf367, 0x1108,
0078 0, 0x2568, 0x40de, 0xdd3a} },
0079 {COLOR_SPACE_YCBCR709,
0080 {0x3265, 0x2000, 0, 0xe6ce, 0xf105, 0x2000, 0xfa01, 0xa7d, 0,
0081 0x2000, 0x3b61, 0xe24f} },
0082
0083 {COLOR_SPACE_YCBCR709_LIMITED,
0084 {0x39a6, 0x2568, 0, 0xe0d6, 0xeedd, 0x2568, 0xf925, 0x9a8, 0,
0085 0x2568, 0x43ee, 0xdbb2} }
0086 };
0087
0088 struct dpp_grph_csc_adjustment {
0089 struct fixed31_32 temperature_matrix[CSC_TEMPERATURE_MATRIX_SIZE];
0090 enum graphics_gamut_adjust_type gamut_adjust_type;
0091 };
0092
0093 struct cnv_color_keyer_params {
0094 int color_keyer_en;
0095 int color_keyer_mode;
0096 int color_keyer_alpha_low;
0097 int color_keyer_alpha_high;
0098 int color_keyer_red_low;
0099 int color_keyer_red_high;
0100 int color_keyer_green_low;
0101 int color_keyer_green_high;
0102 int color_keyer_blue_low;
0103 int color_keyer_blue_high;
0104 };
0105
0106
0107
0108
0109
0110
0111
0112 struct cnv_alpha_2bit_lut {
0113 int lut0;
0114 int lut1;
0115 int lut2;
0116 int lut3;
0117 };
0118
0119 struct dcn_dpp_state {
0120 uint32_t is_enabled;
0121 uint32_t igam_lut_mode;
0122 uint32_t igam_input_format;
0123 uint32_t dgam_lut_mode;
0124 uint32_t rgam_lut_mode;
0125 uint32_t gamut_remap_mode;
0126 uint32_t gamut_remap_c11_c12;
0127 uint32_t gamut_remap_c13_c14;
0128 uint32_t gamut_remap_c21_c22;
0129 uint32_t gamut_remap_c23_c24;
0130 uint32_t gamut_remap_c31_c32;
0131 uint32_t gamut_remap_c33_c34;
0132 };
0133
0134 struct CM_bias_params {
0135 uint32_t cm_bias_cr_r;
0136 uint32_t cm_bias_y_g;
0137 uint32_t cm_bias_cb_b;
0138 uint32_t cm_bias_format;
0139 };
0140
0141 struct dpp_funcs {
0142 bool (*dpp_program_gamcor_lut)(
0143 struct dpp *dpp_base, const struct pwl_params *params);
0144
0145 void (*dpp_set_pre_degam)(struct dpp *dpp_base,
0146 enum dc_transfer_func_predefined tr);
0147
0148 void (*dpp_program_cm_dealpha)(struct dpp *dpp_base,
0149 uint32_t enable, uint32_t additive_blending);
0150
0151 void (*dpp_program_cm_bias)(
0152 struct dpp *dpp_base,
0153 struct CM_bias_params *bias_params);
0154
0155 void (*dpp_read_state)(struct dpp *dpp, struct dcn_dpp_state *s);
0156
0157 void (*dpp_reset)(struct dpp *dpp);
0158
0159 void (*dpp_set_scaler)(struct dpp *dpp,
0160 const struct scaler_data *scl_data);
0161
0162 void (*dpp_set_pixel_storage_depth)(
0163 struct dpp *dpp,
0164 enum lb_pixel_depth depth,
0165 const struct bit_depth_reduction_params *bit_depth_params);
0166
0167 bool (*dpp_get_optimal_number_of_taps)(
0168 struct dpp *dpp,
0169 struct scaler_data *scl_data,
0170 const struct scaling_taps *in_taps);
0171
0172 void (*dpp_set_gamut_remap)(
0173 struct dpp *dpp,
0174 const struct dpp_grph_csc_adjustment *adjust);
0175
0176 void (*dpp_set_csc_default)(
0177 struct dpp *dpp,
0178 enum dc_color_space colorspace);
0179
0180 void (*dpp_set_csc_adjustment)(
0181 struct dpp *dpp,
0182 const uint16_t *regval);
0183
0184 void (*dpp_power_on_regamma_lut)(
0185 struct dpp *dpp,
0186 bool power_on);
0187
0188 void (*dpp_program_regamma_lut)(
0189 struct dpp *dpp,
0190 const struct pwl_result_data *rgb,
0191 uint32_t num);
0192
0193 void (*dpp_configure_regamma_lut)(
0194 struct dpp *dpp,
0195 bool is_ram_a);
0196
0197 void (*dpp_program_regamma_lutb_settings)(
0198 struct dpp *dpp,
0199 const struct pwl_params *params);
0200
0201 void (*dpp_program_regamma_luta_settings)(
0202 struct dpp *dpp,
0203 const struct pwl_params *params);
0204
0205 void (*dpp_program_regamma_pwl)(
0206 struct dpp *dpp,
0207 const struct pwl_params *params,
0208 enum opp_regamma mode);
0209
0210 void (*dpp_program_bias_and_scale)(
0211 struct dpp *dpp,
0212 struct dc_bias_and_scale *params);
0213
0214 void (*dpp_set_degamma)(
0215 struct dpp *dpp_base,
0216 enum ipp_degamma_mode mode);
0217
0218 void (*dpp_program_input_lut)(
0219 struct dpp *dpp_base,
0220 const struct dc_gamma *gamma);
0221
0222 void (*dpp_program_degamma_pwl)(struct dpp *dpp_base,
0223 const struct pwl_params *params);
0224
0225 void (*dpp_setup)(
0226 struct dpp *dpp_base,
0227 enum surface_pixel_format format,
0228 enum expansion_mode mode,
0229 struct dc_csc_transform input_csc_color_matrix,
0230 enum dc_color_space input_color_space,
0231 struct cnv_alpha_2bit_lut *alpha_2bit_lut);
0232
0233 void (*dpp_full_bypass)(struct dpp *dpp_base);
0234
0235 void (*set_cursor_attributes)(
0236 struct dpp *dpp_base,
0237 struct dc_cursor_attributes *cursor_attributes);
0238
0239 void (*set_cursor_position)(
0240 struct dpp *dpp_base,
0241 const struct dc_cursor_position *pos,
0242 const struct dc_cursor_mi_param *param,
0243 uint32_t width,
0244 uint32_t height
0245 );
0246
0247 void (*dpp_set_hdr_multiplier)(
0248 struct dpp *dpp_base,
0249 uint32_t multiplier);
0250
0251 void (*set_optional_cursor_attributes)(
0252 struct dpp *dpp_base,
0253 struct dpp_cursor_attributes *attr);
0254
0255 void (*dpp_dppclk_control)(
0256 struct dpp *dpp_base,
0257 bool dppclk_div,
0258 bool enable);
0259
0260 void (*dpp_deferred_update)(
0261 struct dpp *dpp);
0262 bool (*dpp_program_blnd_lut)(
0263 struct dpp *dpp,
0264 const struct pwl_params *params);
0265 bool (*dpp_program_shaper_lut)(
0266 struct dpp *dpp,
0267 const struct pwl_params *params);
0268 bool (*dpp_program_3dlut)(
0269 struct dpp *dpp,
0270 struct tetrahedral_params *params);
0271 void (*dpp_cnv_set_alpha_keyer)(
0272 struct dpp *dpp_base,
0273 struct cnv_color_keyer_params *color_keyer);
0274 };
0275
0276
0277
0278 #endif