xref: /openbmc/linux/drivers/gpu/drm/amd/display/dc/inc/hw/hubp.h (revision 2b77dcc5)
1 /*
2  * Copyright 2012-15 Advanced Micro Devices, Inc.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20  * OTHER DEALINGS IN THE SOFTWARE.
21  *
22  * Authors: AMD
23  *
24  */
25 
26 #ifndef __DAL_HUBP_H__
27 #define __DAL_HUBP_H__
28 
29 #include "mem_input.h"
30 
31 #define OPP_ID_INVALID 0xf
32 
33 
34 enum cursor_pitch {
35 	CURSOR_PITCH_64_PIXELS = 0,
36 	CURSOR_PITCH_128_PIXELS,
37 	CURSOR_PITCH_256_PIXELS
38 };
39 
40 enum cursor_lines_per_chunk {
41 	CURSOR_LINE_PER_CHUNK_1 = 0, /* new for DCN2 */
42 	CURSOR_LINE_PER_CHUNK_2 = 1,
43 	CURSOR_LINE_PER_CHUNK_4,
44 	CURSOR_LINE_PER_CHUNK_8,
45 	CURSOR_LINE_PER_CHUNK_16
46 };
47 
48 enum hubp_ind_block_size {
49 	hubp_ind_block_unconstrained = 0,
50 	hubp_ind_block_64b,
51 };
52 
53 struct hubp {
54 	const struct hubp_funcs *funcs;
55 	struct dc_context *ctx;
56 	struct dc_plane_address request_address;
57 	int inst;
58 
59 	/* run time states */
60 	int opp_id;
61 	int mpcc_id;
62 	struct dc_cursor_attributes curs_attr;
63 	bool power_gated;
64 };
65 
66 struct hubp_funcs {
67 	void (*hubp_setup)(
68 			struct hubp *hubp,
69 			struct _vcs_dpi_display_dlg_regs_st *dlg_regs,
70 			struct _vcs_dpi_display_ttu_regs_st *ttu_regs,
71 			struct _vcs_dpi_display_rq_regs_st *rq_regs,
72 			struct _vcs_dpi_display_pipe_dest_params_st *pipe_dest);
73 
74 	void (*hubp_setup_interdependent)(
75 			struct hubp *hubp,
76 			struct _vcs_dpi_display_dlg_regs_st *dlg_regs,
77 			struct _vcs_dpi_display_ttu_regs_st *ttu_regs);
78 
79 	void (*dcc_control)(struct hubp *hubp, bool enable,
80 			enum hubp_ind_block_size blk_size);
81 
82 	void (*mem_program_viewport)(
83 			struct hubp *hubp,
84 			const struct rect *viewport,
85 			const struct rect *viewport_c);
86 
87 	bool (*hubp_program_surface_flip_and_addr)(
88 		struct hubp *hubp,
89 		const struct dc_plane_address *address,
90 		bool flip_immediate);
91 
92 	void (*hubp_program_pte_vm)(
93 		struct hubp *hubp,
94 		enum surface_pixel_format format,
95 		union dc_tiling_info *tiling_info,
96 		enum dc_rotation_angle rotation);
97 
98 	void (*hubp_set_vm_system_aperture_settings)(
99 			struct hubp *hubp,
100 			struct vm_system_aperture_param *apt);
101 
102 	void (*hubp_set_vm_context0_settings)(
103 			struct hubp *hubp,
104 			const struct vm_context0_param *vm0);
105 
106 	void (*hubp_program_surface_config)(
107 		struct hubp *hubp,
108 		enum surface_pixel_format format,
109 		union dc_tiling_info *tiling_info,
110 		struct plane_size *plane_size,
111 		enum dc_rotation_angle rotation,
112 		struct dc_plane_dcc_param *dcc,
113 		bool horizontal_mirror,
114 		unsigned int compa_level);
115 
116 	bool (*hubp_is_flip_pending)(struct hubp *hubp);
117 
118 	void (*set_blank)(struct hubp *hubp, bool blank);
119 	void (*set_hubp_blank_en)(struct hubp *hubp, bool blank);
120 
121 	void (*set_cursor_attributes)(
122 			struct hubp *hubp,
123 			const struct dc_cursor_attributes *attr);
124 
125 	void (*set_cursor_position)(
126 			struct hubp *hubp,
127 			const struct dc_cursor_position *pos,
128 			const struct dc_cursor_mi_param *param);
129 
130 	void (*hubp_disconnect)(struct hubp *hubp);
131 
132 	void (*hubp_clk_cntl)(struct hubp *hubp, bool enable);
133 	void (*hubp_vtg_sel)(struct hubp *hubp, uint32_t otg_inst);
134 	void (*hubp_read_state)(struct hubp *hubp);
135 	void (*hubp_clear_underflow)(struct hubp *hubp);
136 	void (*hubp_disable_control)(struct hubp *hubp, bool disable_hubp);
137 	unsigned int (*hubp_get_underflow_status)(struct hubp *hubp);
138 	void (*hubp_init)(struct hubp *hubp);
139 
140 	void (*dmdata_set_attributes)(
141 			struct hubp *hubp,
142 			const struct dc_dmdata_attributes *attr);
143 
144 	void (*dmdata_load)(
145 			struct hubp *hubp,
146 			uint32_t dmdata_sw_size,
147 			const uint32_t *dmdata_sw_data);
148 	bool (*dmdata_status_done)(struct hubp *hubp);
149 	void (*hubp_enable_tripleBuffer)(
150 		struct hubp *hubp,
151 		bool enable);
152 
153 	bool (*hubp_is_triplebuffer_enabled)(
154 		struct hubp *hubp);
155 
156 	void (*hubp_set_flip_control_surface_gsl)(
157 		struct hubp *hubp,
158 		bool enable);
159 
160 	void (*validate_dml_output)(
161 			struct hubp *hubp,
162 			struct dc_context *ctx,
163 			struct _vcs_dpi_display_rq_regs_st *dml_rq_regs,
164 			struct _vcs_dpi_display_dlg_regs_st *dml_dlg_attr,
165 			struct _vcs_dpi_display_ttu_regs_st *dml_ttu_attr);
166 
167 };
168 
169 #endif
170