xref: /dflybsd-src/sys/dev/drm/amd/display/dc/inc/hw/mem_input.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 #ifndef __DAL_MEM_INPUT_H__
26*b843c749SSergey Zigachev #define __DAL_MEM_INPUT_H__
27*b843c749SSergey Zigachev 
28*b843c749SSergey Zigachev #include "dc.h"
29*b843c749SSergey Zigachev #include "include/grph_object_id.h"
30*b843c749SSergey Zigachev 
31*b843c749SSergey Zigachev #include "dml/display_mode_structs.h"
32*b843c749SSergey Zigachev 
33*b843c749SSergey Zigachev struct dchub_init_data;
34*b843c749SSergey Zigachev struct cstate_pstate_watermarks_st {
35*b843c749SSergey Zigachev 	uint32_t cstate_exit_ns;
36*b843c749SSergey Zigachev 	uint32_t cstate_enter_plus_exit_ns;
37*b843c749SSergey Zigachev 	uint32_t pstate_change_ns;
38*b843c749SSergey Zigachev };
39*b843c749SSergey Zigachev 
40*b843c749SSergey Zigachev struct dcn_watermarks {
41*b843c749SSergey Zigachev 	uint32_t pte_meta_urgent_ns;
42*b843c749SSergey Zigachev 	uint32_t urgent_ns;
43*b843c749SSergey Zigachev 	struct cstate_pstate_watermarks_st cstate_pstate;
44*b843c749SSergey Zigachev };
45*b843c749SSergey Zigachev 
46*b843c749SSergey Zigachev struct dcn_watermark_set {
47*b843c749SSergey Zigachev 	struct dcn_watermarks a;
48*b843c749SSergey Zigachev 	struct dcn_watermarks b;
49*b843c749SSergey Zigachev 	struct dcn_watermarks c;
50*b843c749SSergey Zigachev 	struct dcn_watermarks d;
51*b843c749SSergey Zigachev };
52*b843c749SSergey Zigachev 
53*b843c749SSergey Zigachev struct dce_watermarks {
54*b843c749SSergey Zigachev 	int a_mark;
55*b843c749SSergey Zigachev 	int b_mark;
56*b843c749SSergey Zigachev 	int c_mark;
57*b843c749SSergey Zigachev 	int d_mark;
58*b843c749SSergey Zigachev };
59*b843c749SSergey Zigachev 
60*b843c749SSergey Zigachev struct stutter_modes {
61*b843c749SSergey Zigachev 	bool enhanced;
62*b843c749SSergey Zigachev 	bool quad_dmif_buffer;
63*b843c749SSergey Zigachev 	bool watermark_nb_pstate;
64*b843c749SSergey Zigachev };
65*b843c749SSergey Zigachev 
66*b843c749SSergey Zigachev struct mem_input {
67*b843c749SSergey Zigachev 	const struct mem_input_funcs *funcs;
68*b843c749SSergey Zigachev 	struct dc_context *ctx;
69*b843c749SSergey Zigachev 	struct dc_plane_address request_address;
70*b843c749SSergey Zigachev 	struct dc_plane_address current_address;
71*b843c749SSergey Zigachev 	int inst;
72*b843c749SSergey Zigachev 	struct stutter_modes stutter_mode;
73*b843c749SSergey Zigachev };
74*b843c749SSergey Zigachev 
75*b843c749SSergey Zigachev struct vm_system_aperture_param {
76*b843c749SSergey Zigachev 	PHYSICAL_ADDRESS_LOC sys_default;
77*b843c749SSergey Zigachev 	PHYSICAL_ADDRESS_LOC sys_low;
78*b843c749SSergey Zigachev 	PHYSICAL_ADDRESS_LOC sys_high;
79*b843c749SSergey Zigachev };
80*b843c749SSergey Zigachev 
81*b843c749SSergey Zigachev struct vm_context0_param {
82*b843c749SSergey Zigachev 	PHYSICAL_ADDRESS_LOC pte_base;
83*b843c749SSergey Zigachev 	PHYSICAL_ADDRESS_LOC pte_start;
84*b843c749SSergey Zigachev 	PHYSICAL_ADDRESS_LOC pte_end;
85*b843c749SSergey Zigachev 	PHYSICAL_ADDRESS_LOC fault_default;
86*b843c749SSergey Zigachev };
87*b843c749SSergey Zigachev 
88*b843c749SSergey Zigachev struct mem_input_funcs {
89*b843c749SSergey Zigachev 	void (*mem_input_setup)(
90*b843c749SSergey Zigachev 			struct mem_input *mem_input,
91*b843c749SSergey Zigachev 			struct _vcs_dpi_display_dlg_regs_st *dlg_regs,
92*b843c749SSergey Zigachev 			struct _vcs_dpi_display_ttu_regs_st *ttu_regs,
93*b843c749SSergey Zigachev 			struct _vcs_dpi_display_rq_regs_st *rq_regs,
94*b843c749SSergey Zigachev 			struct _vcs_dpi_display_pipe_dest_params_st *pipe_dest);
95*b843c749SSergey Zigachev 
96*b843c749SSergey Zigachev 	void (*dcc_control)(struct mem_input *mem_input, bool enable,
97*b843c749SSergey Zigachev 			bool independent_64b_blks);
98*b843c749SSergey Zigachev 	void (*mem_program_viewport)(
99*b843c749SSergey Zigachev 			struct mem_input *mem_input,
100*b843c749SSergey Zigachev 			const struct rect *viewport,
101*b843c749SSergey Zigachev 			const struct rect *viewport_c);
102*b843c749SSergey Zigachev 
103*b843c749SSergey Zigachev 	void (*mem_input_program_display_marks)(
104*b843c749SSergey Zigachev 		struct mem_input *mem_input,
105*b843c749SSergey Zigachev 		struct dce_watermarks nbp,
106*b843c749SSergey Zigachev 		struct dce_watermarks stutter,
107*b843c749SSergey Zigachev 		struct dce_watermarks stutter_enter,
108*b843c749SSergey Zigachev 		struct dce_watermarks urgent,
109*b843c749SSergey Zigachev 		uint32_t total_dest_line_time_ns);
110*b843c749SSergey Zigachev 
111*b843c749SSergey Zigachev 	void (*mem_input_program_chroma_display_marks)(
112*b843c749SSergey Zigachev 			struct mem_input *mem_input,
113*b843c749SSergey Zigachev 			struct dce_watermarks nbp,
114*b843c749SSergey Zigachev 			struct dce_watermarks stutter,
115*b843c749SSergey Zigachev 			struct dce_watermarks urgent,
116*b843c749SSergey Zigachev 			uint32_t total_dest_line_time_ns);
117*b843c749SSergey Zigachev 
118*b843c749SSergey Zigachev 	void (*allocate_mem_input)(
119*b843c749SSergey Zigachev 		struct mem_input *mem_input,
120*b843c749SSergey Zigachev 		uint32_t h_total,/* for current target */
121*b843c749SSergey Zigachev 		uint32_t v_total,/* for current target */
122*b843c749SSergey Zigachev 		uint32_t pix_clk_khz,/* for current target */
123*b843c749SSergey Zigachev 		uint32_t total_streams_num);
124*b843c749SSergey Zigachev 
125*b843c749SSergey Zigachev 	void (*free_mem_input)(
126*b843c749SSergey Zigachev 		struct mem_input *mem_input,
127*b843c749SSergey Zigachev 		uint32_t paths_num);
128*b843c749SSergey Zigachev 
129*b843c749SSergey Zigachev 	bool (*mem_input_program_surface_flip_and_addr)(
130*b843c749SSergey Zigachev 		struct mem_input *mem_input,
131*b843c749SSergey Zigachev 		const struct dc_plane_address *address,
132*b843c749SSergey Zigachev 		bool flip_immediate);
133*b843c749SSergey Zigachev 
134*b843c749SSergey Zigachev 	void (*mem_input_program_pte_vm)(
135*b843c749SSergey Zigachev 		struct mem_input *mem_input,
136*b843c749SSergey Zigachev 		enum surface_pixel_format format,
137*b843c749SSergey Zigachev 		union dc_tiling_info *tiling_info,
138*b843c749SSergey Zigachev 		enum dc_rotation_angle rotation);
139*b843c749SSergey Zigachev 
140*b843c749SSergey Zigachev 	void (*mem_input_set_vm_system_aperture_settings)(
141*b843c749SSergey Zigachev 			struct mem_input *mem_input,
142*b843c749SSergey Zigachev 			struct vm_system_aperture_param *apt);
143*b843c749SSergey Zigachev 
144*b843c749SSergey Zigachev 	void (*mem_input_set_vm_context0_settings)(
145*b843c749SSergey Zigachev 			struct mem_input *mem_input,
146*b843c749SSergey Zigachev 			const struct vm_context0_param *vm0);
147*b843c749SSergey Zigachev 
148*b843c749SSergey Zigachev 	void (*mem_input_program_surface_config)(
149*b843c749SSergey Zigachev 		struct mem_input *mem_input,
150*b843c749SSergey Zigachev 		enum surface_pixel_format format,
151*b843c749SSergey Zigachev 		union dc_tiling_info *tiling_info,
152*b843c749SSergey Zigachev 		union plane_size *plane_size,
153*b843c749SSergey Zigachev 		enum dc_rotation_angle rotation,
154*b843c749SSergey Zigachev 		struct dc_plane_dcc_param *dcc,
155*b843c749SSergey Zigachev 		bool horizontal_mirror);
156*b843c749SSergey Zigachev 
157*b843c749SSergey Zigachev 	bool (*mem_input_is_flip_pending)(struct mem_input *mem_input);
158*b843c749SSergey Zigachev 
159*b843c749SSergey Zigachev 	void (*mem_input_update_dchub)(struct mem_input *mem_input,
160*b843c749SSergey Zigachev 				struct dchub_init_data *dh_data);
161*b843c749SSergey Zigachev 
162*b843c749SSergey Zigachev 	void (*set_blank)(struct mem_input *mi, bool blank);
163*b843c749SSergey Zigachev 	void (*set_hubp_blank_en)(struct mem_input *mi, bool blank);
164*b843c749SSergey Zigachev 
165*b843c749SSergey Zigachev 	void (*set_cursor_attributes)(
166*b843c749SSergey Zigachev 			struct mem_input *mem_input,
167*b843c749SSergey Zigachev 			const struct dc_cursor_attributes *attr);
168*b843c749SSergey Zigachev 
169*b843c749SSergey Zigachev 	void (*set_cursor_position)(
170*b843c749SSergey Zigachev 			struct mem_input *mem_input,
171*b843c749SSergey Zigachev 			const struct dc_cursor_position *pos,
172*b843c749SSergey Zigachev 			const struct dc_cursor_mi_param *param);
173*b843c749SSergey Zigachev 
174*b843c749SSergey Zigachev };
175*b843c749SSergey Zigachev 
176*b843c749SSergey Zigachev #endif
177