xref: /openbmc/linux/drivers/gpu/drm/amd/display/dc/inc/hw/hubp.h (revision 496091fa041fe8e8a6b2da745ba4fbcb8caed2dd)
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_2 = 1,
42 	CURSOR_LINE_PER_CHUNK_4,
43 	CURSOR_LINE_PER_CHUNK_8,
44 	CURSOR_LINE_PER_CHUNK_16
45 };
46 
47 struct hubp {
48 	const struct hubp_funcs *funcs;
49 	struct dc_context *ctx;
50 	struct dc_plane_address request_address;
51 	int inst;
52 
53 	/* run time states */
54 	int opp_id;
55 	int mpcc_id;
56 	struct dc_cursor_attributes curs_attr;
57 	bool power_gated;
58 };
59 
60 struct hubp_funcs {
61 	void (*hubp_setup)(
62 			struct hubp *hubp,
63 			struct _vcs_dpi_display_dlg_regs_st *dlg_regs,
64 			struct _vcs_dpi_display_ttu_regs_st *ttu_regs,
65 			struct _vcs_dpi_display_rq_regs_st *rq_regs,
66 			struct _vcs_dpi_display_pipe_dest_params_st *pipe_dest);
67 
68 	void (*hubp_setup_interdependent)(
69 			struct hubp *hubp,
70 			struct _vcs_dpi_display_dlg_regs_st *dlg_regs,
71 			struct _vcs_dpi_display_ttu_regs_st *ttu_regs);
72 
73 	void (*dcc_control)(struct hubp *hubp, bool enable,
74 			bool independent_64b_blks);
75 	void (*mem_program_viewport)(
76 			struct hubp *hubp,
77 			const struct rect *viewport,
78 			const struct rect *viewport_c);
79 
80 	bool (*hubp_program_surface_flip_and_addr)(
81 		struct hubp *hubp,
82 		const struct dc_plane_address *address,
83 		bool flip_immediate);
84 
85 	void (*hubp_program_pte_vm)(
86 		struct hubp *hubp,
87 		enum surface_pixel_format format,
88 		union dc_tiling_info *tiling_info,
89 		enum dc_rotation_angle rotation);
90 
91 	void (*hubp_set_vm_system_aperture_settings)(
92 			struct hubp *hubp,
93 			struct vm_system_aperture_param *apt);
94 
95 	void (*hubp_set_vm_context0_settings)(
96 			struct hubp *hubp,
97 			const struct vm_context0_param *vm0);
98 
99 	void (*hubp_program_surface_config)(
100 		struct hubp *hubp,
101 		enum surface_pixel_format format,
102 		union dc_tiling_info *tiling_info,
103 		union plane_size *plane_size,
104 		enum dc_rotation_angle rotation,
105 		struct dc_plane_dcc_param *dcc,
106 		bool horizontal_mirror,
107 		unsigned int compa_level);
108 
109 	bool (*hubp_is_flip_pending)(struct hubp *hubp);
110 
111 	void (*hubp_update_dchub)(struct hubp *hubp,
112 				struct dchub_init_data *dh_data);
113 
114 	void (*set_blank)(struct hubp *hubp, bool blank);
115 	void (*set_hubp_blank_en)(struct hubp *hubp, bool blank);
116 
117 	void (*set_cursor_attributes)(
118 			struct hubp *hubp,
119 			const struct dc_cursor_attributes *attr);
120 
121 	void (*set_cursor_position)(
122 			struct hubp *hubp,
123 			const struct dc_cursor_position *pos,
124 			const struct dc_cursor_mi_param *param);
125 
126 	void (*hubp_disconnect)(struct hubp *hubp);
127 
128 	void (*hubp_clk_cntl)(struct hubp *hubp, bool enable);
129 	void (*hubp_vtg_sel)(struct hubp *hubp, uint32_t otg_inst);
130 	void (*hubp_read_state)(struct hubp *hubp);
131 	void (*hubp_clear_underflow)(struct hubp *hubp);
132 	void (*hubp_disable_control)(struct hubp *hubp, bool disable_hubp);
133 	unsigned int (*hubp_get_underflow_status)(struct hubp *hubp);
134 	void (*hubp_init)(struct hubp *hubp);
135 
136 };
137 
138 #endif
139