1 /* Copyright 2012-17 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_MCIF_WB_H__
26 #define __DC_MCIF_WB_H__
27 
28 #include "dc_hw_types.h"
29 
30 
31 enum mmhubbub_wbif_mode {
32 	PACKED_444 = 0,
33 	PACKED_444_FP16 = 1,
34 	PLANAR_420_8BPC = 2,
35 	PLANAR_420_10BPC = 3
36 };
37 
38 struct mcif_arb_params {
39 
40 	unsigned int		time_per_pixel;
41 	unsigned int		cli_watermark[4];
42 	unsigned int		pstate_watermark[4];
43 	unsigned int		arbitration_slice;
44 	unsigned int		slice_lines;
45 	unsigned int		max_scaled_time;
46 	unsigned int		dram_speed_change_duration;
47 };
48 
49 struct mcif_irq_params {
50 	unsigned int		sw_int_en;
51 	unsigned int		sw_slice_int_en;
52 	unsigned int		sw_overrun_int_en;
53 	unsigned int		vce_int_en;
54 	unsigned int		vce_slice_int_en;
55 };
56 
57 
58 /* / - mcif_wb_frame_dump_info is the info of the dumping WB data */
59 struct mcif_wb_frame_dump_info {
60 	unsigned int		size;
61 	unsigned int		width;
62 	unsigned int		height;
63 	unsigned int		luma_pitch;
64 	unsigned int		chroma_pitch;
65 	enum dwb_scaler_mode	format;
66 };
67 
68 struct mcif_wb {
69 	const struct mcif_wb_funcs *funcs;
70 	struct dc_context *ctx;
71 	int inst;
72 };
73 
74 struct mcif_wb_funcs {
75 
76 	void (*warmup_mcif)(
77 		struct mcif_wb *mcif_wb,
78 		struct mcif_warmup_params *params);
79 	void (*enable_mcif)(struct mcif_wb *mcif_wb);
80 
81 	void (*disable_mcif)(struct mcif_wb *mcif_wb);
82 
83 	void (*config_mcif_buf)(
84 		struct mcif_wb *mcif_wb,
85 		struct mcif_buf_params *params,
86 		unsigned int dest_height);
87 
88 	 void (*config_mcif_arb)(
89 		struct mcif_wb *mcif_wb,
90 		struct mcif_arb_params *params);
91 
92 	 void (*config_mcif_irq)(
93 		struct mcif_wb *mcif_wb,
94 		struct mcif_irq_params *params);
95 
96 	void (*dump_frame)(
97 		struct mcif_wb *mcif_wb,
98 		struct mcif_buf_params *mcif_params,
99 		enum dwb_scaler_mode out_format,
100 		unsigned int dest_width,
101 		unsigned int dest_height,
102 		struct mcif_wb_frame_dump_info *dump_info,
103 		unsigned char *luma_buffer,
104 		unsigned char *chroma_buffer,
105 		unsigned char *dest_luma_buffer,
106 		unsigned char *dest_chroma_buffer);
107 };
108 
109 #endif
110