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