1345429a6SHarry Wentland /* Copyright 2012-17 Advanced Micro Devices, Inc.
2345429a6SHarry Wentland  *
3345429a6SHarry Wentland  * Permission is hereby granted, free of charge, to any person obtaining a
4345429a6SHarry Wentland  * copy of this software and associated documentation files (the "Software"),
5345429a6SHarry Wentland  * to deal in the Software without restriction, including without limitation
6345429a6SHarry Wentland  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
7345429a6SHarry Wentland  * and/or sell copies of the Software, and to permit persons to whom the
8345429a6SHarry Wentland  * Software is furnished to do so, subject to the following conditions:
9345429a6SHarry Wentland  *
10345429a6SHarry Wentland  * The above copyright notice and this permission notice shall be included in
11345429a6SHarry Wentland  * all copies or substantial portions of the Software.
12345429a6SHarry Wentland  *
13345429a6SHarry Wentland  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14345429a6SHarry Wentland  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15345429a6SHarry Wentland  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
16345429a6SHarry Wentland  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
17345429a6SHarry Wentland  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
18345429a6SHarry Wentland  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
19345429a6SHarry Wentland  * OTHER DEALINGS IN THE SOFTWARE.
20345429a6SHarry Wentland  *
21345429a6SHarry Wentland  * Authors: AMD
22345429a6SHarry Wentland  *
23345429a6SHarry Wentland  */
24345429a6SHarry Wentland 
25345429a6SHarry Wentland #ifndef __DC_MCIF_WB_H__
26345429a6SHarry Wentland #define __DC_MCIF_WB_H__
27345429a6SHarry Wentland 
28345429a6SHarry Wentland #include "dc_hw_types.h"
29345429a6SHarry Wentland 
30345429a6SHarry Wentland 
31345429a6SHarry Wentland enum mmhubbub_wbif_mode {
32345429a6SHarry Wentland 	PACKED_444 = 0,
33345429a6SHarry Wentland 	PACKED_444_FP16 = 1,
34345429a6SHarry Wentland 	PLANAR_420_8BPC = 2,
35345429a6SHarry Wentland 	PLANAR_420_10BPC = 3
36345429a6SHarry Wentland };
37345429a6SHarry Wentland 
38345429a6SHarry Wentland struct mcif_arb_params {
39345429a6SHarry Wentland 
40345429a6SHarry Wentland 	unsigned int		time_per_pixel;
41345429a6SHarry Wentland 	unsigned int		cli_watermark[4];
42345429a6SHarry Wentland 	unsigned int		pstate_watermark[4];
43345429a6SHarry Wentland 	unsigned int		arbitration_slice;
44345429a6SHarry Wentland 	unsigned int		slice_lines;
45345429a6SHarry Wentland 	unsigned int		max_scaled_time;
464898dc48SBhawanpreet Lakha 	unsigned int		dram_speed_change_duration;
47345429a6SHarry Wentland };
48345429a6SHarry Wentland 
49345429a6SHarry Wentland struct mcif_irq_params {
50345429a6SHarry Wentland 	unsigned int		sw_int_en;
51345429a6SHarry Wentland 	unsigned int		sw_slice_int_en;
52345429a6SHarry Wentland 	unsigned int		sw_overrun_int_en;
53345429a6SHarry Wentland 	unsigned int		vce_int_en;
54345429a6SHarry Wentland 	unsigned int		vce_slice_int_en;
55345429a6SHarry Wentland };
56345429a6SHarry Wentland 
57345429a6SHarry Wentland 
58345429a6SHarry Wentland /* / - mcif_wb_frame_dump_info is the info of the dumping WB data */
59345429a6SHarry Wentland struct mcif_wb_frame_dump_info {
60345429a6SHarry Wentland 	unsigned int		size;
61345429a6SHarry Wentland 	unsigned int		width;
62345429a6SHarry Wentland 	unsigned int		height;
63345429a6SHarry Wentland 	unsigned int		luma_pitch;
64345429a6SHarry Wentland 	unsigned int		chroma_pitch;
65345429a6SHarry Wentland 	enum dwb_scaler_mode	format;
66345429a6SHarry Wentland };
67345429a6SHarry Wentland 
68345429a6SHarry Wentland struct mcif_wb {
69345429a6SHarry Wentland 	const struct mcif_wb_funcs *funcs;
70345429a6SHarry Wentland 	struct dc_context *ctx;
71345429a6SHarry Wentland 	int inst;
72345429a6SHarry Wentland };
73345429a6SHarry Wentland 
74345429a6SHarry Wentland struct mcif_wb_funcs {
75345429a6SHarry Wentland 
76d99f1387SBhawanpreet Lakha 	void (*warmup_mcif)(
77d99f1387SBhawanpreet Lakha 		struct mcif_wb *mcif_wb,
78d99f1387SBhawanpreet Lakha 		struct mcif_warmup_params *params);
79345429a6SHarry Wentland 	void (*enable_mcif)(struct mcif_wb *mcif_wb);
80345429a6SHarry Wentland 
81345429a6SHarry Wentland 	void (*disable_mcif)(struct mcif_wb *mcif_wb);
82345429a6SHarry Wentland 
83345429a6SHarry Wentland 	void (*config_mcif_buf)(
84345429a6SHarry Wentland 		struct mcif_wb *mcif_wb,
85345429a6SHarry Wentland 		struct mcif_buf_params *params,
86345429a6SHarry Wentland 		unsigned int dest_height);
87345429a6SHarry Wentland 
88345429a6SHarry Wentland 	 void (*config_mcif_arb)(
89345429a6SHarry Wentland 		struct mcif_wb *mcif_wb,
90345429a6SHarry Wentland 		struct mcif_arb_params *params);
91345429a6SHarry Wentland 
92345429a6SHarry Wentland 	 void (*config_mcif_irq)(
93345429a6SHarry Wentland 		struct mcif_wb *mcif_wb,
94345429a6SHarry Wentland 		struct mcif_irq_params *params);
95345429a6SHarry Wentland 
96345429a6SHarry Wentland 	void (*dump_frame)(
97345429a6SHarry Wentland 		struct mcif_wb *mcif_wb,
98345429a6SHarry Wentland 		struct mcif_buf_params *mcif_params,
99345429a6SHarry Wentland 		enum dwb_scaler_mode out_format,
100345429a6SHarry Wentland 		unsigned int dest_width,
101345429a6SHarry Wentland 		unsigned int dest_height,
102345429a6SHarry Wentland 		struct mcif_wb_frame_dump_info *dump_info,
103345429a6SHarry Wentland 		unsigned char *luma_buffer,
104345429a6SHarry Wentland 		unsigned char *chroma_buffer,
105345429a6SHarry Wentland 		unsigned char *dest_luma_buffer,
106345429a6SHarry Wentland 		unsigned char *dest_chroma_buffer);
107345429a6SHarry Wentland };
108345429a6SHarry Wentland 
109345429a6SHarry Wentland #endif
110