Linux Audio

Check our new training course

Loading...
v6.8
  1/* Copyright 2012-15 Advanced Micro Devices, Inc.
  2 *
  3 * Permission is hereby granted, free of charge, to any person obtaining a
  4 * copy of this software and associated documentation files (the "Software"),
  5 * to deal in the Software without restriction, including without limitation
  6 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  7 * and/or sell copies of the Software, and to permit persons to whom the
  8 * Software is furnished to do so, subject to the following conditions:
  9 *
 10 * The above copyright notice and this permission notice shall be included in
 11 * all copies or substantial portions of the Software.
 12 *
 13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 16 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
 17 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 18 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 19 * OTHER DEALINGS IN THE SOFTWARE.
 20 *
 21 * Authors: AMD
 22 *
 23 */
 24
 25/**
 26 * DOC: mpc-overview
 27 *
 28 * Multiple Pipe/Plane Combined (MPC) is a component in the hardware pipeline
 29 * that performs blending of multiple planes, using global and per-pixel alpha.
 30 * It also performs post-blending color correction operations according to the
 31 * hardware capabilities, such as color transformation matrix and gamma 1D and
 32 * 3D LUT.
 33 */
 34
 35#ifndef __DC_MPCC_H__
 36#define __DC_MPCC_H__
 37
 38#include "dc_hw_types.h"
 39#include "hw_shared.h"
 40#include "transform.h"
 41
 42#define MAX_MPCC 6
 43#define MAX_OPP 6
 44
 45#define MAX_DWB		2
 46
 47enum mpc_output_csc_mode {
 48	MPC_OUTPUT_CSC_DISABLE = 0,
 49	MPC_OUTPUT_CSC_COEF_A,
 50	MPC_OUTPUT_CSC_COEF_B
 51};
 52
 53
 54enum mpcc_blend_mode {
 55	MPCC_BLEND_MODE_BYPASS,
 56	MPCC_BLEND_MODE_TOP_LAYER_PASSTHROUGH,
 57	MPCC_BLEND_MODE_TOP_LAYER_ONLY,
 58	MPCC_BLEND_MODE_TOP_BOT_BLENDING
 59};
 60
 61/**
 62 * enum mpcc_alpha_blend_mode - define the alpha blend mode regarding pixel
 63 * alpha and plane alpha values
 64 */
 65enum mpcc_alpha_blend_mode {
 66	/**
 67	 * @MPCC_ALPHA_BLEND_MODE_PER_PIXEL_ALPHA: per pixel alpha using DPP
 68	 * alpha value
 69	 */
 70	MPCC_ALPHA_BLEND_MODE_PER_PIXEL_ALPHA,
 71	/**
 72	 * @MPCC_ALPHA_BLEND_MODE_PER_PIXEL_ALPHA_COMBINED_GLOBAL_GAIN: per
 73	 * pixel alpha using DPP alpha value multiplied by a global gain (plane
 74	 * alpha)
 75	 */
 76	MPCC_ALPHA_BLEND_MODE_PER_PIXEL_ALPHA_COMBINED_GLOBAL_GAIN,
 77	/**
 78	 * @MPCC_ALPHA_BLEND_MODE_GLOBAL_ALPHA: global alpha value, ignores
 79	 * pixel alpha and consider only plane alpha
 80	 */
 81	MPCC_ALPHA_BLEND_MODE_GLOBAL_ALPHA
 82};
 83
 84/**
 85 * struct mpcc_blnd_cfg - MPCC blending configuration
 86 *
 87 * @black_color: background color
 88 * @alpha_mode: alpha blend mode (MPCC_ALPHA_BLND_MODE)
 89 * @pre_multiplied_alpha: whether pixel color values were pre-multiplied by the
 90 * alpha channel (MPCC_ALPHA_MULTIPLIED_MODE)
 91 * @global_gain: used when blend mode considers both pixel alpha and plane
 92 * alpha value and assumes the global alpha value.
 93 * @global_alpha: plane alpha value
 94 * @overlap_only: whether overlapping of different planes is allowed
 95 * @bottom_gain_mode: blend mode for bottom gain setting
 96 * @background_color_bpc: background color for bpc
 97 * @top_gain: top gain setting
 98 * @bottom_inside_gain: blend mode for bottom inside
 99 * @bottom_outside_gain:  blend mode for bottom outside
100 */
101struct mpcc_blnd_cfg {
102	struct tg_color black_color;	/* background color */
103	enum mpcc_alpha_blend_mode alpha_mode;	/* alpha blend mode */
104	bool pre_multiplied_alpha;	/* alpha pre-multiplied mode flag */
105	int global_gain;
106	int global_alpha;
107	bool overlap_only;
108
109	/* MPCC top/bottom gain settings */
110	int bottom_gain_mode;
111	int background_color_bpc;
112	int top_gain;
113	int bottom_inside_gain;
114	int bottom_outside_gain;
115};
116
117struct mpc_grph_gamut_adjustment {
118	struct fixed31_32 temperature_matrix[CSC_TEMPERATURE_MATRIX_SIZE];
119	enum graphics_gamut_adjust_type gamut_adjust_type;
120};
121
122struct mpcc_sm_cfg {
123	bool enable;
124	/* 0-single plane,2-row subsampling,4-column subsampling,6-checkboard subsampling */
125	int sm_mode;
126	/* 0- disable frame alternate, 1- enable frame alternate */
127	bool frame_alt;
128	/* 0- disable field alternate, 1- enable field alternate */
129	bool field_alt;
130	/* 0-no force,2-force frame polarity from top,3-force frame polarity from bottom */
131	int force_next_frame_porlarity;
132	/* 0-no force,2-force field polarity from top,3-force field polarity from bottom */
133	int force_next_field_polarity;
134};
135
136struct mpc_denorm_clamp {
137	int clamp_max_r_cr;
138	int clamp_min_r_cr;
139	int clamp_max_g_y;
140	int clamp_min_g_y;
141	int clamp_max_b_cb;
142	int clamp_min_b_cb;
143};
144
145struct mpc_dwb_flow_control {
146	int flow_ctrl_mode;
147	int flow_ctrl_cnt0;
148	int flow_ctrl_cnt1;
149};
150
151/**
152 * struct mpcc - MPCC connection and blending configuration for a single MPCC instance.
153 * @mpcc_id: MPCC physical instance
154 * @dpp_id: DPP input to this MPCC
155 * @mpcc_bot: pointer to bottom layer MPCC. NULL when not connected.
156 * @blnd_cfg: the blending configuration for this MPCC
157 * @sm_cfg: stereo mix setting for this MPCC
158 * @shared_bottom: if MPCC output to both OPP and DWB endpoints, true. Otherwise, false.
159 *
160 * This struct is used as a node in an MPC tree.
161 */
162struct mpcc {
163	int mpcc_id;			/* MPCC physical instance */
164	int dpp_id;			/* DPP input to this MPCC */
165	struct mpcc *mpcc_bot;		/* pointer to bottom layer MPCC.  NULL when not connected */
166	struct mpcc_blnd_cfg blnd_cfg;	/* The blending configuration for this MPCC */
167	struct mpcc_sm_cfg sm_cfg;	/* stereo mix setting for this MPCC */
168	bool shared_bottom;		/* TRUE if MPCC output to both OPP and DWB endpoints, else FALSE */
169};
170
171/**
172 * struct mpc_tree - MPC tree represents all MPCC connections for a pipe.
173 *
174 * @opp_id: the OPP instance that owns this MPC tree
175 * @opp_list: the top MPCC layer of the MPC tree that outputs to OPP endpoint
176 *
177 */
178struct mpc_tree {
179	int opp_id;			/* The OPP instance that owns this MPC tree */
180	struct mpcc *opp_list;		/* The top MPCC layer of the MPC tree that outputs to OPP endpoint */
181};
182
183struct mpc {
184	const struct mpc_funcs *funcs;
185	struct dc_context *ctx;
186
187	struct mpcc mpcc_array[MAX_MPCC];
188	struct pwl_params blender_params;
189	bool cm_bypass_mode;
190};
191
192struct mpcc_state {
193	uint32_t opp_id;
194	uint32_t dpp_id;
195	uint32_t bot_mpcc_id;
196	uint32_t mode;
197	uint32_t alpha_mode;
198	uint32_t pre_multiplied_alpha;
199	uint32_t overlap_only;
200	uint32_t idle;
201	uint32_t busy;
202};
203
204/**
205 * struct mpc_funcs - funcs
206 */
207struct mpc_funcs {
208	void (*read_mpcc_state)(
209			struct mpc *mpc,
210			int mpcc_inst,
211			struct mpcc_state *s);
212
213	/**
214	 * @insert_plane:
215	 *
216	 * Insert DPP into MPC tree based on specified blending position.
217	 * Only used for planes that are part of blending chain for OPP output
218	 *
219	 * Parameters:
220	 * [in/out] mpc		- MPC context.
221	 * [in/out] tree	- MPC tree structure that plane will be added to.
222	 * [in]	blnd_cfg	- MPCC blending configuration for the new blending layer.
223	 * [in]	sm_cfg		- MPCC stereo mix configuration for the new blending layer.
224	 *			  stereo mix must disable for the very bottom layer of the tree config.
225	 * [in]	insert_above_mpcc - Insert new plane above this MPCC.  If NULL, insert as bottom plane.
226	 * [in]	dpp_id		 - DPP instance for the plane to be added.
227	 * [in]	mpcc_id		 - The MPCC physical instance to use for blending.
228	 *
229	 * Return:  struct mpcc* - MPCC that was added.
230	 */
231	struct mpcc* (*insert_plane)(
232			struct mpc *mpc,
233			struct mpc_tree *tree,
234			struct mpcc_blnd_cfg *blnd_cfg,
235			struct mpcc_sm_cfg *sm_cfg,
236			struct mpcc *insert_above_mpcc,
237			int dpp_id,
238			int mpcc_id);
239
240	/**
241	 * @remove_mpcc:
242	 *
243	 * Remove a specified MPCC from the MPC tree.
244	 *
245	 * Parameters:
246	 * [in/out] mpc		- MPC context.
247	 * [in/out] tree	- MPC tree structure that plane will be removed from.
248	 * [in/out] mpcc	- MPCC to be removed from tree.
249	 *
250	 * Return:  void
251	 */
252	void (*remove_mpcc)(
253			struct mpc *mpc,
254			struct mpc_tree *tree,
255			struct mpcc *mpcc);
256
257	/**
258	 * @mpc_init:
259	 *
260	 * Reset the MPCC HW status by disconnecting all muxes.
261	 *
262	 * Parameters:
263	 * [in/out] mpc		- MPC context.
264	 *
265	 * Return:  void
266	 */
267	void (*mpc_init)(struct mpc *mpc);
268	void (*mpc_init_single_inst)(
269			struct mpc *mpc,
270			unsigned int mpcc_id);
271
272	/**
273	 * @update_blending:
274	 *
275	 * Update the blending configuration for a specified MPCC.
276	 *
277	 * Parameters:
278	 * [in/out] mpc		- MPC context.
279	 * [in]     blnd_cfg	- MPCC blending configuration.
280	 * [in]     mpcc_id	- The MPCC physical instance.
281	 *
282	 * Return:  void
283	 */
284	void (*update_blending)(
285		struct mpc *mpc,
286		struct mpcc_blnd_cfg *blnd_cfg,
287		int mpcc_id);
288
289	/**
290	 * @cursor_lock:
291	 *
292	 * Lock cursor updates for the specified OPP.
293	 * OPP defines the set of MPCC that are locked together for cursor.
294	 *
295	 * Parameters:
296	 * [in] 	mpc		- MPC context.
297	 * [in]     opp_id	- The OPP to lock cursor updates on
298	 * [in]		lock	- lock/unlock the OPP
299	 *
300	 * Return:  void
301	 */
302	void (*cursor_lock)(
303			struct mpc *mpc,
304			int opp_id,
305			bool lock);
306
307	/**
308	 * @insert_plane_to_secondary:
309	 *
310	 * Add DPP into secondary MPC tree based on specified blending position.
311	 * Only used for planes that are part of blending chain for DWB output
312	 *
313	 * Parameters:
314	 * [in/out] mpc		- MPC context.
315	 * [in/out] tree		- MPC tree structure that plane will be added to.
316	 * [in]	blnd_cfg	- MPCC blending configuration for the new blending layer.
317	 * [in]	sm_cfg		- MPCC stereo mix configuration for the new blending layer.
318	 *			  stereo mix must disable for the very bottom layer of the tree config.
319	 * [in]	insert_above_mpcc - Insert new plane above this MPCC.  If NULL, insert as bottom plane.
320	 * [in]	dpp_id		- DPP instance for the plane to be added.
321	 * [in]	mpcc_id		- The MPCC physical instance to use for blending.
322	 *
323	 * Return:  struct mpcc* - MPCC that was added.
324	 */
325	struct mpcc* (*insert_plane_to_secondary)(
326			struct mpc *mpc,
327			struct mpc_tree *tree,
328			struct mpcc_blnd_cfg *blnd_cfg,
329			struct mpcc_sm_cfg *sm_cfg,
330			struct mpcc *insert_above_mpcc,
331			int dpp_id,
332			int mpcc_id);
333
334	/**
335	 * @remove_mpcc_from_secondary:
336	 *
337	 * Remove a specified DPP from the 'secondary' MPC tree.
338	 *
339	 * Parameters:
340	 * [in/out] mpc		- MPC context.
341	 * [in/out] tree	- MPC tree structure that plane will be removed from.
342	 * [in]     mpcc	- MPCC to be removed from tree.
343	 * Return:  void
344	 */
345	void (*remove_mpcc_from_secondary)(
346			struct mpc *mpc,
347			struct mpc_tree *tree,
348			struct mpcc *mpcc);
349
350	struct mpcc* (*get_mpcc_for_dpp_from_secondary)(
351			struct mpc_tree *tree,
352			int dpp_id);
353
354	struct mpcc* (*get_mpcc_for_dpp)(
355			struct mpc_tree *tree,
356			int dpp_id);
357
358	void (*wait_for_idle)(struct mpc *mpc, int id);
359
360	void (*assert_mpcc_idle_before_connect)(struct mpc *mpc, int mpcc_id);
361
362	void (*init_mpcc_list_from_hw)(
363		struct mpc *mpc,
364		struct mpc_tree *tree);
365
366	void (*set_denorm)(struct mpc *mpc,
367			int opp_id,
368			enum dc_color_depth output_depth);
369
370	void (*set_denorm_clamp)(
371			struct mpc *mpc,
372			int opp_id,
373			struct mpc_denorm_clamp denorm_clamp);
374
375	void (*set_output_csc)(struct mpc *mpc,
376			int opp_id,
377			const uint16_t *regval,
378			enum mpc_output_csc_mode ocsc_mode);
379
380	void (*set_ocsc_default)(struct mpc *mpc,
381			int opp_id,
382			enum dc_color_space color_space,
383			enum mpc_output_csc_mode ocsc_mode);
384
385	void (*set_output_gamma)(
386			struct mpc *mpc,
387			int mpcc_id,
388			const struct pwl_params *params);
389	void (*power_on_mpc_mem_pwr)(
390			struct mpc *mpc,
391			int mpcc_id,
392			bool power_on);
393	void (*set_dwb_mux)(
394			struct mpc *mpc,
395			int dwb_id,
396			int mpcc_id);
397
398	void (*disable_dwb_mux)(
399		struct mpc *mpc,
400		int dwb_id);
401
402	bool (*is_dwb_idle)(
403		struct mpc *mpc,
404		int dwb_id);
405
406	void (*set_out_rate_control)(
407		struct mpc *mpc,
408		int opp_id,
409		bool enable,
410		bool rate_2x_mode,
411		struct mpc_dwb_flow_control *flow_control);
412
413	void (*set_gamut_remap)(
414			struct mpc *mpc,
415			int mpcc_id,
416			const struct mpc_grph_gamut_adjustment *adjust);
417
418	bool (*program_1dlut)(
419			struct mpc *mpc,
420			const struct pwl_params *params,
421			uint32_t rmu_idx);
422
423	bool (*program_shaper)(
424			struct mpc *mpc,
425			const struct pwl_params *params,
426			uint32_t rmu_idx);
427
428	uint32_t (*acquire_rmu)(struct mpc *mpc, int mpcc_id, int rmu_idx);
429
430	bool (*program_3dlut)(
431			struct mpc *mpc,
432			const struct tetrahedral_params *params,
433			int rmu_idx);
434
435	int (*release_rmu)(struct mpc *mpc, int mpcc_id);
436
437	unsigned int (*get_mpc_out_mux)(
438			struct mpc *mpc,
439			int opp_id);
440
441	void (*set_bg_color)(struct mpc *mpc,
442			struct tg_color *bg_color,
443			int mpcc_id);
444	void (*set_mpc_mem_lp_mode)(struct mpc *mpc);
445};
446
447#endif
v5.14.15
  1/* Copyright 2012-15 Advanced Micro Devices, Inc.
  2 *
  3 * Permission is hereby granted, free of charge, to any person obtaining a
  4 * copy of this software and associated documentation files (the "Software"),
  5 * to deal in the Software without restriction, including without limitation
  6 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  7 * and/or sell copies of the Software, and to permit persons to whom the
  8 * Software is furnished to do so, subject to the following conditions:
  9 *
 10 * The above copyright notice and this permission notice shall be included in
 11 * all copies or substantial portions of the Software.
 12 *
 13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 16 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
 17 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 18 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 19 * OTHER DEALINGS IN THE SOFTWARE.
 20 *
 21 * Authors: AMD
 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 * MPCC blending configuration
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 59 */
 60struct mpcc_blnd_cfg {
 61	struct tg_color black_color;	/* background color */
 62	enum mpcc_alpha_blend_mode alpha_mode;	/* alpha blend mode */
 63	bool pre_multiplied_alpha;	/* alpha pre-multiplied mode flag */
 64	int global_gain;
 65	int global_alpha;
 66	bool overlap_only;
 67
 68	/* MPCC top/bottom gain settings */
 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	/* 0-single plane,2-row subsampling,4-column subsampling,6-checkboard subsampling */
 84	int sm_mode;
 85	/* 0- disable frame alternate, 1- enable frame alternate */
 86	bool frame_alt;
 87	/* 0- disable field alternate, 1- enable field alternate */
 88	bool field_alt;
 89	/* 0-no force,2-force frame polarity from top,3-force frame polarity from bottom */
 90	int force_next_frame_porlarity;
 91	/* 0-no force,2-force field polarity from top,3-force field polarity from bottom */
 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 * MPCC connection and blending configuration for a single MPCC instance.
 
 
 
 
 
 
 
112 * This struct is used as a node in an MPC tree.
113 */
114struct mpcc {
115	int mpcc_id;			/* MPCC physical instance */
116	int dpp_id;			/* DPP input to this MPCC */
117	struct mpcc *mpcc_bot;		/* pointer to bottom layer MPCC.  NULL when not connected */
118	struct mpcc_blnd_cfg blnd_cfg;	/* The blending configuration for this MPCC */
119	struct mpcc_sm_cfg sm_cfg;	/* stereo mix setting for this MPCC */
120	bool shared_bottom;		/* TRUE if MPCC output to both OPP and DWB endpoints, else FALSE */
121};
122
123/*
124 * MPC tree represents all MPCC connections for a pipe.
 
 
 
 
125 */
126struct mpc_tree {
127	int opp_id;			/* The OPP instance that owns this MPC tree */
128	struct mpcc *opp_list;		/* The top MPCC layer of the MPC tree that outputs to OPP endpoint */
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	 * Insert DPP into MPC tree based on specified blending position.
160	 * Only used for planes that are part of blending chain for OPP output
161	 *
162	 * Parameters:
163	 * [in/out] mpc		- MPC context.
164	 * [in/out] tree	- MPC tree structure that plane will be added to.
165	 * [in]	blnd_cfg	- MPCC blending configuration for the new blending layer.
166	 * [in]	sm_cfg		- MPCC stereo mix configuration for the new blending layer.
167	 *			  stereo mix must disable for the very bottom layer of the tree config.
168	 * [in]	insert_above_mpcc - Insert new plane above this MPCC.  If NULL, insert as bottom plane.
169	 * [in]	dpp_id		 - DPP instance for the plane to be added.
170	 * [in]	mpcc_id		 - The MPCC physical instance to use for blending.
171	 *
172	 * Return:  struct mpcc* - MPCC that was added.
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	 * Remove a specified MPCC from the MPC tree.
185	 *
186	 * Parameters:
187	 * [in/out] mpc		- MPC context.
188	 * [in/out] tree	- MPC tree structure that plane will be removed from.
189	 * [in/out] mpcc	- MPCC to be removed from tree.
190	 *
191	 * Return:  void
192	 */
193	void (*remove_mpcc)(
194			struct mpc *mpc,
195			struct mpc_tree *tree,
196			struct mpcc *mpcc);
197
198	/*
 
 
199	 * Reset the MPCC HW status by disconnecting all muxes.
200	 *
201	 * Parameters:
202	 * [in/out] mpc		- MPC context.
203	 *
204	 * Return:  void
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	 * Update the blending configuration for a specified MPCC.
213	 *
214	 * Parameters:
215	 * [in/out] mpc		- MPC context.
216	 * [in]     blnd_cfg	- MPCC blending configuration.
217	 * [in]     mpcc_id	- The MPCC physical instance.
218	 *
219	 * Return:  void
220	 */
221	void (*update_blending)(
222		struct mpc *mpc,
223		struct mpcc_blnd_cfg *blnd_cfg,
224		int mpcc_id);
225
226	/*
 
 
227	 * Lock cursor updates for the specified OPP.
228	 * OPP defines the set of MPCC that are locked together for cursor.
229	 *
230	 * Parameters:
231	 * [in] 	mpc		- MPC context.
232	 * [in]     opp_id	- The OPP to lock cursor updates on
233	 * [in]		lock	- lock/unlock the OPP
234	 *
235	 * Return:  void
236	 */
237	void (*cursor_lock)(
238			struct mpc *mpc,
239			int opp_id,
240			bool lock);
241
242	/*
243	 * Add DPP into 'secondary' MPC tree based on specified blending position.
 
 
244	 * Only used for planes that are part of blending chain for DWB output
245	 *
246	 * Parameters:
247	 * [in/out] mpc		- MPC context.
248	 * [in/out] tree		- MPC tree structure that plane will be added to.
249	 * [in]	blnd_cfg	- MPCC blending configuration for the new blending layer.
250	 * [in]	sm_cfg		- MPCC stereo mix configuration for the new blending layer.
251	 *			  stereo mix must disable for the very bottom layer of the tree config.
252	 * [in]	insert_above_mpcc - Insert new plane above this MPCC.  If NULL, insert as bottom plane.
253	 * [in]	dpp_id		- DPP instance for the plane to be added.
254	 * [in]	mpcc_id		- The MPCC physical instance to use for blending.
255	 *
256	 * Return:  struct mpcc* - MPCC that was added.
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	 * Remove a specified DPP from the 'secondary' MPC tree.
269	 *
270	 * Parameters:
271	 * [in/out] mpc		- MPC context.
272	 * [in/out] tree	- MPC tree structure that plane will be removed from.
273	 * [in]     mpcc	- MPCC to be removed from tree.
274	 * Return:  void
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