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 #ifndef __DC_MPCC_H__
0026 #define __DC_MPCC_H__
0027
0028 #include "dc_hw_types.h"
0029 #include "hw_shared.h"
0030 #include "transform.h"
0031
0032 #define MAX_MPCC 6
0033 #define MAX_OPP 6
0034
0035 #define MAX_DWB 2
0036
0037 enum mpc_output_csc_mode {
0038 MPC_OUTPUT_CSC_DISABLE = 0,
0039 MPC_OUTPUT_CSC_COEF_A,
0040 MPC_OUTPUT_CSC_COEF_B
0041 };
0042
0043
0044 enum mpcc_blend_mode {
0045 MPCC_BLEND_MODE_BYPASS,
0046 MPCC_BLEND_MODE_TOP_LAYER_PASSTHROUGH,
0047 MPCC_BLEND_MODE_TOP_LAYER_ONLY,
0048 MPCC_BLEND_MODE_TOP_BOT_BLENDING
0049 };
0050
0051 enum mpcc_alpha_blend_mode {
0052 MPCC_ALPHA_BLEND_MODE_PER_PIXEL_ALPHA,
0053 MPCC_ALPHA_BLEND_MODE_PER_PIXEL_ALPHA_COMBINED_GLOBAL_GAIN,
0054 MPCC_ALPHA_BLEND_MODE_GLOBAL_ALPHA
0055 };
0056
0057
0058
0059
0060 struct mpcc_blnd_cfg {
0061 struct tg_color black_color;
0062 enum mpcc_alpha_blend_mode alpha_mode;
0063 bool pre_multiplied_alpha;
0064 int global_gain;
0065 int global_alpha;
0066 bool overlap_only;
0067
0068
0069 int bottom_gain_mode;
0070 int background_color_bpc;
0071 int top_gain;
0072 int bottom_inside_gain;
0073 int bottom_outside_gain;
0074 };
0075
0076 struct mpc_grph_gamut_adjustment {
0077 struct fixed31_32 temperature_matrix[CSC_TEMPERATURE_MATRIX_SIZE];
0078 enum graphics_gamut_adjust_type gamut_adjust_type;
0079 };
0080
0081 struct mpcc_sm_cfg {
0082 bool enable;
0083
0084 int sm_mode;
0085
0086 bool frame_alt;
0087
0088 bool field_alt;
0089
0090 int force_next_frame_porlarity;
0091
0092 int force_next_field_polarity;
0093 };
0094
0095 struct mpc_denorm_clamp {
0096 int clamp_max_r_cr;
0097 int clamp_min_r_cr;
0098 int clamp_max_g_y;
0099 int clamp_min_g_y;
0100 int clamp_max_b_cb;
0101 int clamp_min_b_cb;
0102 };
0103
0104 struct mpc_dwb_flow_control {
0105 int flow_ctrl_mode;
0106 int flow_ctrl_cnt0;
0107 int flow_ctrl_cnt1;
0108 };
0109
0110
0111
0112
0113
0114 struct mpcc {
0115 int mpcc_id;
0116 int dpp_id;
0117 struct mpcc *mpcc_bot;
0118 struct mpcc_blnd_cfg blnd_cfg;
0119 struct mpcc_sm_cfg sm_cfg;
0120 bool shared_bottom;
0121 };
0122
0123
0124
0125
0126 struct mpc_tree {
0127 int opp_id;
0128 struct mpcc *opp_list;
0129 };
0130
0131 struct mpc {
0132 const struct mpc_funcs *funcs;
0133 struct dc_context *ctx;
0134
0135 struct mpcc mpcc_array[MAX_MPCC];
0136 struct pwl_params blender_params;
0137 bool cm_bypass_mode;
0138 };
0139
0140 struct mpcc_state {
0141 uint32_t opp_id;
0142 uint32_t dpp_id;
0143 uint32_t bot_mpcc_id;
0144 uint32_t mode;
0145 uint32_t alpha_mode;
0146 uint32_t pre_multiplied_alpha;
0147 uint32_t overlap_only;
0148 uint32_t idle;
0149 uint32_t busy;
0150 };
0151
0152 struct mpc_funcs {
0153 void (*read_mpcc_state)(
0154 struct mpc *mpc,
0155 int mpcc_inst,
0156 struct mpcc_state *s);
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168
0169
0170
0171
0172
0173
0174 struct mpcc* (*insert_plane)(
0175 struct mpc *mpc,
0176 struct mpc_tree *tree,
0177 struct mpcc_blnd_cfg *blnd_cfg,
0178 struct mpcc_sm_cfg *sm_cfg,
0179 struct mpcc *insert_above_mpcc,
0180 int dpp_id,
0181 int mpcc_id);
0182
0183
0184
0185
0186
0187
0188
0189
0190
0191
0192
0193 void (*remove_mpcc)(
0194 struct mpc *mpc,
0195 struct mpc_tree *tree,
0196 struct mpcc *mpcc);
0197
0198
0199
0200
0201
0202
0203
0204
0205
0206 void (*mpc_init)(struct mpc *mpc);
0207 void (*mpc_init_single_inst)(
0208 struct mpc *mpc,
0209 unsigned int mpcc_id);
0210
0211
0212
0213
0214
0215
0216
0217
0218
0219
0220
0221 void (*update_blending)(
0222 struct mpc *mpc,
0223 struct mpcc_blnd_cfg *blnd_cfg,
0224 int mpcc_id);
0225
0226
0227
0228
0229
0230
0231
0232
0233
0234
0235
0236
0237 void (*cursor_lock)(
0238 struct mpc *mpc,
0239 int opp_id,
0240 bool lock);
0241
0242
0243
0244
0245
0246
0247
0248
0249
0250
0251
0252
0253
0254
0255
0256
0257
0258 struct mpcc* (*insert_plane_to_secondary)(
0259 struct mpc *mpc,
0260 struct mpc_tree *tree,
0261 struct mpcc_blnd_cfg *blnd_cfg,
0262 struct mpcc_sm_cfg *sm_cfg,
0263 struct mpcc *insert_above_mpcc,
0264 int dpp_id,
0265 int mpcc_id);
0266
0267
0268
0269
0270
0271
0272
0273
0274
0275
0276 void (*remove_mpcc_from_secondary)(
0277 struct mpc *mpc,
0278 struct mpc_tree *tree,
0279 struct mpcc *mpcc);
0280
0281 struct mpcc* (*get_mpcc_for_dpp_from_secondary)(
0282 struct mpc_tree *tree,
0283 int dpp_id);
0284
0285 struct mpcc* (*get_mpcc_for_dpp)(
0286 struct mpc_tree *tree,
0287 int dpp_id);
0288
0289 void (*wait_for_idle)(struct mpc *mpc, int id);
0290
0291 void (*assert_mpcc_idle_before_connect)(struct mpc *mpc, int mpcc_id);
0292
0293 void (*init_mpcc_list_from_hw)(
0294 struct mpc *mpc,
0295 struct mpc_tree *tree);
0296
0297 void (*set_denorm)(struct mpc *mpc,
0298 int opp_id,
0299 enum dc_color_depth output_depth);
0300
0301 void (*set_denorm_clamp)(
0302 struct mpc *mpc,
0303 int opp_id,
0304 struct mpc_denorm_clamp denorm_clamp);
0305
0306 void (*set_output_csc)(struct mpc *mpc,
0307 int opp_id,
0308 const uint16_t *regval,
0309 enum mpc_output_csc_mode ocsc_mode);
0310
0311 void (*set_ocsc_default)(struct mpc *mpc,
0312 int opp_id,
0313 enum dc_color_space color_space,
0314 enum mpc_output_csc_mode ocsc_mode);
0315
0316 void (*set_output_gamma)(
0317 struct mpc *mpc,
0318 int mpcc_id,
0319 const struct pwl_params *params);
0320 void (*power_on_mpc_mem_pwr)(
0321 struct mpc *mpc,
0322 int mpcc_id,
0323 bool power_on);
0324 void (*set_dwb_mux)(
0325 struct mpc *mpc,
0326 int dwb_id,
0327 int mpcc_id);
0328
0329 void (*disable_dwb_mux)(
0330 struct mpc *mpc,
0331 int dwb_id);
0332
0333 bool (*is_dwb_idle)(
0334 struct mpc *mpc,
0335 int dwb_id);
0336
0337 void (*set_out_rate_control)(
0338 struct mpc *mpc,
0339 int opp_id,
0340 bool enable,
0341 bool rate_2x_mode,
0342 struct mpc_dwb_flow_control *flow_control);
0343
0344 void (*set_gamut_remap)(
0345 struct mpc *mpc,
0346 int mpcc_id,
0347 const struct mpc_grph_gamut_adjustment *adjust);
0348
0349 bool (*program_1dlut)(
0350 struct mpc *mpc,
0351 const struct pwl_params *params,
0352 uint32_t rmu_idx);
0353
0354 bool (*program_shaper)(
0355 struct mpc *mpc,
0356 const struct pwl_params *params,
0357 uint32_t rmu_idx);
0358
0359 uint32_t (*acquire_rmu)(struct mpc *mpc, int mpcc_id, int rmu_idx);
0360
0361 bool (*program_3dlut)(
0362 struct mpc *mpc,
0363 const struct tetrahedral_params *params,
0364 int rmu_idx);
0365
0366 int (*release_rmu)(struct mpc *mpc, int mpcc_id);
0367
0368 unsigned int (*get_mpc_out_mux)(
0369 struct mpc *mpc,
0370 int opp_id);
0371
0372 void (*set_bg_color)(struct mpc *mpc,
0373 struct tg_color *bg_color,
0374 int mpcc_id);
0375 void (*set_mpc_mem_lp_mode)(struct mpc *mpc);
0376 };
0377
0378 #endif