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#ifndef __DC_MPCC_H__
26#define __DC_MPCC_H__
27
28#include "dc_hw_types.h"
29#include "hw_shared.h"
30#include "transform.h"
31
32#define MAX_MPCC 6
33#define MAX_OPP 6
34
35#define MAX_DWB 2
36
37enum mpc_output_csc_mode {
38 MPC_OUTPUT_CSC_DISABLE = 0,
39 MPC_OUTPUT_CSC_COEF_A,
40 MPC_OUTPUT_CSC_COEF_B
41};
42
43
44enum mpcc_blend_mode {
45 MPCC_BLEND_MODE_BYPASS,
46 MPCC_BLEND_MODE_TOP_LAYER_PASSTHROUGH,
47 MPCC_BLEND_MODE_TOP_LAYER_ONLY,
48 MPCC_BLEND_MODE_TOP_BOT_BLENDING
49};
50
51enum mpcc_alpha_blend_mode {
52 MPCC_ALPHA_BLEND_MODE_PER_PIXEL_ALPHA,
53 MPCC_ALPHA_BLEND_MODE_PER_PIXEL_ALPHA_COMBINED_GLOBAL_GAIN,
54 MPCC_ALPHA_BLEND_MODE_GLOBAL_ALPHA
55};
56
57
58
59
60struct mpcc_blnd_cfg {
61 struct tg_color black_color;
62 enum mpcc_alpha_blend_mode alpha_mode;
63 bool pre_multiplied_alpha;
64 int global_gain;
65 int global_alpha;
66 bool overlap_only;
67
68
69 int bottom_gain_mode;
70 int background_color_bpc;
71 int top_gain;
72 int bottom_inside_gain;
73 int bottom_outside_gain;
74};
75
76struct mpc_grph_gamut_adjustment {
77 struct fixed31_32 temperature_matrix[CSC_TEMPERATURE_MATRIX_SIZE];
78 enum graphics_gamut_adjust_type gamut_adjust_type;
79};
80
81struct mpcc_sm_cfg {
82 bool enable;
83
84 int sm_mode;
85
86 bool frame_alt;
87
88 bool field_alt;
89
90 int force_next_frame_porlarity;
91
92 int force_next_field_polarity;
93};
94
95struct mpc_denorm_clamp {
96 int clamp_max_r_cr;
97 int clamp_min_r_cr;
98 int clamp_max_g_y;
99 int clamp_min_g_y;
100 int clamp_max_b_cb;
101 int clamp_min_b_cb;
102};
103
104struct mpc_dwb_flow_control {
105 int flow_ctrl_mode;
106 int flow_ctrl_cnt0;
107 int flow_ctrl_cnt1;
108};
109
110
111
112
113
114struct mpcc {
115 int mpcc_id;
116 int dpp_id;
117 struct mpcc *mpcc_bot;
118 struct mpcc_blnd_cfg blnd_cfg;
119 struct mpcc_sm_cfg sm_cfg;
120 bool shared_bottom;
121};
122
123
124
125
126struct mpc_tree {
127 int opp_id;
128 struct mpcc *opp_list;
129};
130
131struct mpc {
132 const struct mpc_funcs *funcs;
133 struct dc_context *ctx;
134
135 struct mpcc mpcc_array[MAX_MPCC];
136 struct pwl_params blender_params;
137 bool cm_bypass_mode;
138};
139
140struct mpcc_state {
141 uint32_t opp_id;
142 uint32_t dpp_id;
143 uint32_t bot_mpcc_id;
144 uint32_t mode;
145 uint32_t alpha_mode;
146 uint32_t pre_multiplied_alpha;
147 uint32_t overlap_only;
148 uint32_t idle;
149 uint32_t busy;
150};
151
152struct mpc_funcs {
153 void (*read_mpcc_state)(
154 struct mpc *mpc,
155 int mpcc_inst,
156 struct mpcc_state *s);
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174 struct mpcc* (*insert_plane)(
175 struct mpc *mpc,
176 struct mpc_tree *tree,
177 struct mpcc_blnd_cfg *blnd_cfg,
178 struct mpcc_sm_cfg *sm_cfg,
179 struct mpcc *insert_above_mpcc,
180 int dpp_id,
181 int mpcc_id);
182
183
184
185
186
187
188
189
190
191
192
193 void (*remove_mpcc)(
194 struct mpc *mpc,
195 struct mpc_tree *tree,
196 struct mpcc *mpcc);
197
198
199
200
201
202
203
204
205
206 void (*mpc_init)(struct mpc *mpc);
207 void (*mpc_init_single_inst)(
208 struct mpc *mpc,
209 unsigned int mpcc_id);
210
211
212
213
214
215
216
217
218
219
220
221 void (*update_blending)(
222 struct mpc *mpc,
223 struct mpcc_blnd_cfg *blnd_cfg,
224 int mpcc_id);
225
226
227
228
229
230
231
232
233
234
235
236
237 void (*cursor_lock)(
238 struct mpc *mpc,
239 int opp_id,
240 bool lock);
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258 struct mpcc* (*insert_plane_to_secondary)(
259 struct mpc *mpc,
260 struct mpc_tree *tree,
261 struct mpcc_blnd_cfg *blnd_cfg,
262 struct mpcc_sm_cfg *sm_cfg,
263 struct mpcc *insert_above_mpcc,
264 int dpp_id,
265 int mpcc_id);
266
267
268
269
270
271
272
273
274
275
276 void (*remove_mpcc_from_secondary)(
277 struct mpc *mpc,
278 struct mpc_tree *tree,
279 struct mpcc *mpcc);
280
281 struct mpcc* (*get_mpcc_for_dpp_from_secondary)(
282 struct mpc_tree *tree,
283 int dpp_id);
284 struct mpcc* (*get_mpcc_for_dpp)(
285 struct mpc_tree *tree,
286 int dpp_id);
287
288 void (*wait_for_idle)(struct mpc *mpc, int id);
289
290 void (*assert_mpcc_idle_before_connect)(struct mpc *mpc, int mpcc_id);
291
292 void (*init_mpcc_list_from_hw)(
293 struct mpc *mpc,
294 struct mpc_tree *tree);
295
296 void (*set_denorm)(struct mpc *mpc,
297 int opp_id,
298 enum dc_color_depth output_depth);
299
300 void (*set_denorm_clamp)(
301 struct mpc *mpc,
302 int opp_id,
303 struct mpc_denorm_clamp denorm_clamp);
304
305 void (*set_output_csc)(struct mpc *mpc,
306 int opp_id,
307 const uint16_t *regval,
308 enum mpc_output_csc_mode ocsc_mode);
309
310 void (*set_ocsc_default)(struct mpc *mpc,
311 int opp_id,
312 enum dc_color_space color_space,
313 enum mpc_output_csc_mode ocsc_mode);
314
315 void (*set_output_gamma)(
316 struct mpc *mpc,
317 int mpcc_id,
318 const struct pwl_params *params);
319 void (*power_on_mpc_mem_pwr)(
320 struct mpc *mpc,
321 int mpcc_id,
322 bool power_on);
323 void (*set_dwb_mux)(
324 struct mpc *mpc,
325 int dwb_id,
326 int mpcc_id);
327
328 void (*disable_dwb_mux)(
329 struct mpc *mpc,
330 int dwb_id);
331
332 bool (*is_dwb_idle)(
333 struct mpc *mpc,
334 int dwb_id);
335
336 void (*set_out_rate_control)(
337 struct mpc *mpc,
338 int opp_id,
339 bool enable,
340 bool rate_2x_mode,
341 struct mpc_dwb_flow_control *flow_control);
342
343 void (*set_gamut_remap)(
344 struct mpc *mpc,
345 int mpcc_id,
346 const struct mpc_grph_gamut_adjustment *adjust);
347
348 bool (*program_shaper)(
349 struct mpc *mpc,
350 const struct pwl_params *params,
351 uint32_t rmu_idx);
352
353 uint32_t (*acquire_rmu)(struct mpc *mpc, int mpcc_id, int rmu_idx);
354
355 bool (*program_3dlut)(
356 struct mpc *mpc,
357 const struct tetrahedral_params *params,
358 int rmu_idx);
359
360 int (*release_rmu)(struct mpc *mpc, int mpcc_id);
361
362 unsigned int (*get_mpc_out_mux)(
363 struct mpc *mpc,
364 int opp_id);
365
366 void (*set_bg_color)(struct mpc *mpc,
367 struct tg_color *bg_color,
368 int mpcc_id);
369};
370
371#endif
372