xref: /dragonfly/sys/dev/drm/amd/display/dc/core/dc_debug.c (revision 78973132)
1b843c749SSergey Zigachev /*
2b843c749SSergey Zigachev  * Copyright 2017 Advanced Micro Devices, Inc.
3b843c749SSergey Zigachev  *
4b843c749SSergey Zigachev  * Permission is hereby granted, free of charge, to any person obtaining a
5b843c749SSergey Zigachev  * copy of this software and associated documentation files (the "Software"),
6b843c749SSergey Zigachev  * to deal in the Software without restriction, including without limitation
7b843c749SSergey Zigachev  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8b843c749SSergey Zigachev  * and/or sell copies of the Software, and to permit persons to whom the
9b843c749SSergey Zigachev  * Software is furnished to do so, subject to the following conditions:
10b843c749SSergey Zigachev  *
11b843c749SSergey Zigachev  * The above copyright notice and this permission notice shall be included in
12b843c749SSergey Zigachev  * all copies or substantial portions of the Software.
13b843c749SSergey Zigachev  *
14b843c749SSergey Zigachev  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15b843c749SSergey Zigachev  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16b843c749SSergey Zigachev  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17b843c749SSergey Zigachev  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18b843c749SSergey Zigachev  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19b843c749SSergey Zigachev  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20b843c749SSergey Zigachev  * OTHER DEALINGS IN THE SOFTWARE.
21b843c749SSergey Zigachev  *
22b843c749SSergey Zigachev  */
23b843c749SSergey Zigachev /*
24b843c749SSergey Zigachev  * dc_debug.c
25b843c749SSergey Zigachev  *
26b843c749SSergey Zigachev  *  Created on: Nov 3, 2016
27b843c749SSergey Zigachev  *      Author: yonsun
28b843c749SSergey Zigachev  */
29b843c749SSergey Zigachev 
30b843c749SSergey Zigachev #include "dm_services.h"
31b843c749SSergey Zigachev 
32b843c749SSergey Zigachev #include "dc.h"
33b843c749SSergey Zigachev 
34b843c749SSergey Zigachev #include "core_status.h"
35b843c749SSergey Zigachev #include "core_types.h"
36b843c749SSergey Zigachev #include "hw_sequencer.h"
37b843c749SSergey Zigachev 
38b843c749SSergey Zigachev #include "resource.h"
39b843c749SSergey Zigachev 
40b843c749SSergey Zigachev #define DC_LOGGER_INIT(logger)
41b843c749SSergey Zigachev 
42b843c749SSergey Zigachev 
43b843c749SSergey Zigachev #define SURFACE_TRACE(...) do {\
44b843c749SSergey Zigachev 		if (dc->debug.surface_trace) \
45b843c749SSergey Zigachev 			DC_LOG_IF_TRACE(__VA_ARGS__); \
46b843c749SSergey Zigachev } while (0)
47b843c749SSergey Zigachev 
48b843c749SSergey Zigachev #define TIMING_TRACE(...) do {\
49b843c749SSergey Zigachev 	if (dc->debug.timing_trace) \
50b843c749SSergey Zigachev 		DC_LOG_SYNC(__VA_ARGS__); \
51b843c749SSergey Zigachev } while (0)
52b843c749SSergey Zigachev 
53b843c749SSergey Zigachev #define CLOCK_TRACE(...) do {\
54b843c749SSergey Zigachev 	if (dc->debug.clock_trace) \
55b843c749SSergey Zigachev 		DC_LOG_BANDWIDTH_CALCS(__VA_ARGS__); \
56b843c749SSergey Zigachev } while (0)
57b843c749SSergey Zigachev 
pre_surface_trace(struct dc * dc,const struct dc_plane_state * const * plane_states,int surface_count)58b843c749SSergey Zigachev void pre_surface_trace(
59b843c749SSergey Zigachev 		struct dc *dc,
60b843c749SSergey Zigachev 		const struct dc_plane_state *const *plane_states,
61b843c749SSergey Zigachev 		int surface_count)
62b843c749SSergey Zigachev {
63b843c749SSergey Zigachev 	int i;
64b843c749SSergey Zigachev 	DC_LOGGER_INIT(dc->ctx->logger);
65b843c749SSergey Zigachev 
66b843c749SSergey Zigachev 	for (i = 0; i < surface_count; i++) {
67b843c749SSergey Zigachev 		const struct dc_plane_state *plane_state = plane_states[i];
68b843c749SSergey Zigachev 
69b843c749SSergey Zigachev 		SURFACE_TRACE("Planes %d:\n", i);
70b843c749SSergey Zigachev 
71b843c749SSergey Zigachev 		SURFACE_TRACE(
72b843c749SSergey Zigachev 				"plane_state->visible = %d;\n"
73b843c749SSergey Zigachev 				"plane_state->flip_immediate = %d;\n"
74b843c749SSergey Zigachev 				"plane_state->address.type = %d;\n"
75*78973132SSergey Zigachev 				"plane_state->address.grph.addr.quad_part = 0x%lX;\n"
76*78973132SSergey Zigachev 				"plane_state->address.grph.meta_addr.quad_part = 0x%lX;\n"
77b843c749SSergey Zigachev 				"plane_state->scaling_quality.h_taps = %d;\n"
78b843c749SSergey Zigachev 				"plane_state->scaling_quality.v_taps = %d;\n"
79b843c749SSergey Zigachev 				"plane_state->scaling_quality.h_taps_c = %d;\n"
80b843c749SSergey Zigachev 				"plane_state->scaling_quality.v_taps_c = %d;\n",
81b843c749SSergey Zigachev 				plane_state->visible,
82b843c749SSergey Zigachev 				plane_state->flip_immediate,
83b843c749SSergey Zigachev 				plane_state->address.type,
84b843c749SSergey Zigachev 				plane_state->address.grph.addr.quad_part,
85b843c749SSergey Zigachev 				plane_state->address.grph.meta_addr.quad_part,
86b843c749SSergey Zigachev 				plane_state->scaling_quality.h_taps,
87b843c749SSergey Zigachev 				plane_state->scaling_quality.v_taps,
88b843c749SSergey Zigachev 				plane_state->scaling_quality.h_taps_c,
89b843c749SSergey Zigachev 				plane_state->scaling_quality.v_taps_c);
90b843c749SSergey Zigachev 
91b843c749SSergey Zigachev 		SURFACE_TRACE(
92b843c749SSergey Zigachev 				"plane_state->src_rect.x = %d;\n"
93b843c749SSergey Zigachev 				"plane_state->src_rect.y = %d;\n"
94b843c749SSergey Zigachev 				"plane_state->src_rect.width = %d;\n"
95b843c749SSergey Zigachev 				"plane_state->src_rect.height = %d;\n"
96b843c749SSergey Zigachev 				"plane_state->dst_rect.x = %d;\n"
97b843c749SSergey Zigachev 				"plane_state->dst_rect.y = %d;\n"
98b843c749SSergey Zigachev 				"plane_state->dst_rect.width = %d;\n"
99b843c749SSergey Zigachev 				"plane_state->dst_rect.height = %d;\n"
100b843c749SSergey Zigachev 				"plane_state->clip_rect.x = %d;\n"
101b843c749SSergey Zigachev 				"plane_state->clip_rect.y = %d;\n"
102b843c749SSergey Zigachev 				"plane_state->clip_rect.width = %d;\n"
103b843c749SSergey Zigachev 				"plane_state->clip_rect.height = %d;\n",
104b843c749SSergey Zigachev 				plane_state->src_rect.x,
105b843c749SSergey Zigachev 				plane_state->src_rect.y,
106b843c749SSergey Zigachev 				plane_state->src_rect.width,
107b843c749SSergey Zigachev 				plane_state->src_rect.height,
108b843c749SSergey Zigachev 				plane_state->dst_rect.x,
109b843c749SSergey Zigachev 				plane_state->dst_rect.y,
110b843c749SSergey Zigachev 				plane_state->dst_rect.width,
111b843c749SSergey Zigachev 				plane_state->dst_rect.height,
112b843c749SSergey Zigachev 				plane_state->clip_rect.x,
113b843c749SSergey Zigachev 				plane_state->clip_rect.y,
114b843c749SSergey Zigachev 				plane_state->clip_rect.width,
115b843c749SSergey Zigachev 				plane_state->clip_rect.height);
116b843c749SSergey Zigachev 
117b843c749SSergey Zigachev 		SURFACE_TRACE(
118b843c749SSergey Zigachev 				"plane_state->plane_size.grph.surface_size.x = %d;\n"
119b843c749SSergey Zigachev 				"plane_state->plane_size.grph.surface_size.y = %d;\n"
120b843c749SSergey Zigachev 				"plane_state->plane_size.grph.surface_size.width = %d;\n"
121b843c749SSergey Zigachev 				"plane_state->plane_size.grph.surface_size.height = %d;\n"
122b843c749SSergey Zigachev 				"plane_state->plane_size.grph.surface_pitch = %d;\n",
123b843c749SSergey Zigachev 				plane_state->plane_size.grph.surface_size.x,
124b843c749SSergey Zigachev 				plane_state->plane_size.grph.surface_size.y,
125b843c749SSergey Zigachev 				plane_state->plane_size.grph.surface_size.width,
126b843c749SSergey Zigachev 				plane_state->plane_size.grph.surface_size.height,
127b843c749SSergey Zigachev 				plane_state->plane_size.grph.surface_pitch);
128b843c749SSergey Zigachev 
129b843c749SSergey Zigachev 
130b843c749SSergey Zigachev 		SURFACE_TRACE(
131b843c749SSergey Zigachev 				"plane_state->tiling_info.gfx8.num_banks = %d;\n"
132b843c749SSergey Zigachev 				"plane_state->tiling_info.gfx8.bank_width = %d;\n"
133b843c749SSergey Zigachev 				"plane_state->tiling_info.gfx8.bank_width_c = %d;\n"
134b843c749SSergey Zigachev 				"plane_state->tiling_info.gfx8.bank_height = %d;\n"
135b843c749SSergey Zigachev 				"plane_state->tiling_info.gfx8.bank_height_c = %d;\n"
136b843c749SSergey Zigachev 				"plane_state->tiling_info.gfx8.tile_aspect = %d;\n"
137b843c749SSergey Zigachev 				"plane_state->tiling_info.gfx8.tile_aspect_c = %d;\n"
138b843c749SSergey Zigachev 				"plane_state->tiling_info.gfx8.tile_split = %d;\n"
139b843c749SSergey Zigachev 				"plane_state->tiling_info.gfx8.tile_split_c = %d;\n"
140b843c749SSergey Zigachev 				"plane_state->tiling_info.gfx8.tile_mode = %d;\n"
141b843c749SSergey Zigachev 				"plane_state->tiling_info.gfx8.tile_mode_c = %d;\n",
142b843c749SSergey Zigachev 				plane_state->tiling_info.gfx8.num_banks,
143b843c749SSergey Zigachev 				plane_state->tiling_info.gfx8.bank_width,
144b843c749SSergey Zigachev 				plane_state->tiling_info.gfx8.bank_width_c,
145b843c749SSergey Zigachev 				plane_state->tiling_info.gfx8.bank_height,
146b843c749SSergey Zigachev 				plane_state->tiling_info.gfx8.bank_height_c,
147b843c749SSergey Zigachev 				plane_state->tiling_info.gfx8.tile_aspect,
148b843c749SSergey Zigachev 				plane_state->tiling_info.gfx8.tile_aspect_c,
149b843c749SSergey Zigachev 				plane_state->tiling_info.gfx8.tile_split,
150b843c749SSergey Zigachev 				plane_state->tiling_info.gfx8.tile_split_c,
151b843c749SSergey Zigachev 				plane_state->tiling_info.gfx8.tile_mode,
152b843c749SSergey Zigachev 				plane_state->tiling_info.gfx8.tile_mode_c);
153b843c749SSergey Zigachev 
154b843c749SSergey Zigachev 		SURFACE_TRACE(
155b843c749SSergey Zigachev 				"plane_state->tiling_info.gfx8.pipe_config = %d;\n"
156b843c749SSergey Zigachev 				"plane_state->tiling_info.gfx8.array_mode = %d;\n"
157b843c749SSergey Zigachev 				"plane_state->color_space = %d;\n"
158b843c749SSergey Zigachev 				"plane_state->dcc.enable = %d;\n"
159b843c749SSergey Zigachev 				"plane_state->format = %d;\n"
160b843c749SSergey Zigachev 				"plane_state->rotation = %d;\n"
161b843c749SSergey Zigachev 				"plane_state->stereo_format = %d;\n",
162b843c749SSergey Zigachev 				plane_state->tiling_info.gfx8.pipe_config,
163b843c749SSergey Zigachev 				plane_state->tiling_info.gfx8.array_mode,
164b843c749SSergey Zigachev 				plane_state->color_space,
165b843c749SSergey Zigachev 				plane_state->dcc.enable,
166b843c749SSergey Zigachev 				plane_state->format,
167b843c749SSergey Zigachev 				plane_state->rotation,
168b843c749SSergey Zigachev 				plane_state->stereo_format);
169b843c749SSergey Zigachev 
170b843c749SSergey Zigachev 		SURFACE_TRACE("plane_state->tiling_info.gfx9.swizzle = %d;\n",
171b843c749SSergey Zigachev 				plane_state->tiling_info.gfx9.swizzle);
172b843c749SSergey Zigachev 
173b843c749SSergey Zigachev 		SURFACE_TRACE("\n");
174b843c749SSergey Zigachev 	}
175b843c749SSergey Zigachev 	SURFACE_TRACE("\n");
176b843c749SSergey Zigachev }
177b843c749SSergey Zigachev 
update_surface_trace(struct dc * dc,const struct dc_surface_update * updates,int surface_count)178b843c749SSergey Zigachev void update_surface_trace(
179b843c749SSergey Zigachev 		struct dc *dc,
180b843c749SSergey Zigachev 		const struct dc_surface_update *updates,
181b843c749SSergey Zigachev 		int surface_count)
182b843c749SSergey Zigachev {
183b843c749SSergey Zigachev 	int i;
184b843c749SSergey Zigachev 	DC_LOGGER_INIT(dc->ctx->logger);
185b843c749SSergey Zigachev 
186b843c749SSergey Zigachev 	for (i = 0; i < surface_count; i++) {
187b843c749SSergey Zigachev 		const struct dc_surface_update *update = &updates[i];
188b843c749SSergey Zigachev 
189b843c749SSergey Zigachev 		SURFACE_TRACE("Update %d\n", i);
190b843c749SSergey Zigachev 		if (update->flip_addr) {
191b843c749SSergey Zigachev 			SURFACE_TRACE("flip_addr->address.type = %d;\n"
192*78973132SSergey Zigachev 					"flip_addr->address.grph.addr.quad_part = 0x%lX;\n"
193*78973132SSergey Zigachev 					"flip_addr->address.grph.meta_addr.quad_part = 0x%lX;\n"
194b843c749SSergey Zigachev 					"flip_addr->flip_immediate = %d;\n",
195b843c749SSergey Zigachev 					update->flip_addr->address.type,
196b843c749SSergey Zigachev 					update->flip_addr->address.grph.addr.quad_part,
197b843c749SSergey Zigachev 					update->flip_addr->address.grph.meta_addr.quad_part,
198b843c749SSergey Zigachev 					update->flip_addr->flip_immediate);
199b843c749SSergey Zigachev 		}
200b843c749SSergey Zigachev 
201b843c749SSergey Zigachev 		if (update->plane_info) {
202b843c749SSergey Zigachev 			SURFACE_TRACE(
203b843c749SSergey Zigachev 					"plane_info->color_space = %d;\n"
204b843c749SSergey Zigachev 					"plane_info->format = %d;\n"
205b843c749SSergey Zigachev 					"plane_info->plane_size.grph.surface_pitch = %d;\n"
206b843c749SSergey Zigachev 					"plane_info->plane_size.grph.surface_size.height = %d;\n"
207b843c749SSergey Zigachev 					"plane_info->plane_size.grph.surface_size.width = %d;\n"
208b843c749SSergey Zigachev 					"plane_info->plane_size.grph.surface_size.x = %d;\n"
209b843c749SSergey Zigachev 					"plane_info->plane_size.grph.surface_size.y = %d;\n"
210b843c749SSergey Zigachev 					"plane_info->rotation = %d;\n"
211b843c749SSergey Zigachev 					"plane_info->stereo_format = %d;\n",
212b843c749SSergey Zigachev 					update->plane_info->color_space,
213b843c749SSergey Zigachev 					update->plane_info->format,
214b843c749SSergey Zigachev 					update->plane_info->plane_size.grph.surface_pitch,
215b843c749SSergey Zigachev 					update->plane_info->plane_size.grph.surface_size.height,
216b843c749SSergey Zigachev 					update->plane_info->plane_size.grph.surface_size.width,
217b843c749SSergey Zigachev 					update->plane_info->plane_size.grph.surface_size.x,
218b843c749SSergey Zigachev 					update->plane_info->plane_size.grph.surface_size.y,
219b843c749SSergey Zigachev 					update->plane_info->rotation,
220b843c749SSergey Zigachev 					update->plane_info->stereo_format);
221b843c749SSergey Zigachev 
222b843c749SSergey Zigachev 			SURFACE_TRACE(
223b843c749SSergey Zigachev 					"plane_info->tiling_info.gfx8.num_banks = %d;\n"
224b843c749SSergey Zigachev 					"plane_info->tiling_info.gfx8.bank_width = %d;\n"
225b843c749SSergey Zigachev 					"plane_info->tiling_info.gfx8.bank_width_c = %d;\n"
226b843c749SSergey Zigachev 					"plane_info->tiling_info.gfx8.bank_height = %d;\n"
227b843c749SSergey Zigachev 					"plane_info->tiling_info.gfx8.bank_height_c = %d;\n"
228b843c749SSergey Zigachev 					"plane_info->tiling_info.gfx8.tile_aspect = %d;\n"
229b843c749SSergey Zigachev 					"plane_info->tiling_info.gfx8.tile_aspect_c = %d;\n"
230b843c749SSergey Zigachev 					"plane_info->tiling_info.gfx8.tile_split = %d;\n"
231b843c749SSergey Zigachev 					"plane_info->tiling_info.gfx8.tile_split_c = %d;\n"
232b843c749SSergey Zigachev 					"plane_info->tiling_info.gfx8.tile_mode = %d;\n"
233b843c749SSergey Zigachev 					"plane_info->tiling_info.gfx8.tile_mode_c = %d;\n",
234b843c749SSergey Zigachev 					update->plane_info->tiling_info.gfx8.num_banks,
235b843c749SSergey Zigachev 					update->plane_info->tiling_info.gfx8.bank_width,
236b843c749SSergey Zigachev 					update->plane_info->tiling_info.gfx8.bank_width_c,
237b843c749SSergey Zigachev 					update->plane_info->tiling_info.gfx8.bank_height,
238b843c749SSergey Zigachev 					update->plane_info->tiling_info.gfx8.bank_height_c,
239b843c749SSergey Zigachev 					update->plane_info->tiling_info.gfx8.tile_aspect,
240b843c749SSergey Zigachev 					update->plane_info->tiling_info.gfx8.tile_aspect_c,
241b843c749SSergey Zigachev 					update->plane_info->tiling_info.gfx8.tile_split,
242b843c749SSergey Zigachev 					update->plane_info->tiling_info.gfx8.tile_split_c,
243b843c749SSergey Zigachev 					update->plane_info->tiling_info.gfx8.tile_mode,
244b843c749SSergey Zigachev 					update->plane_info->tiling_info.gfx8.tile_mode_c);
245b843c749SSergey Zigachev 
246b843c749SSergey Zigachev 			SURFACE_TRACE(
247b843c749SSergey Zigachev 					"plane_info->tiling_info.gfx8.pipe_config = %d;\n"
248b843c749SSergey Zigachev 					"plane_info->tiling_info.gfx8.array_mode = %d;\n"
249b843c749SSergey Zigachev 					"plane_info->visible = %d;\n"
250b843c749SSergey Zigachev 					"plane_info->per_pixel_alpha = %d;\n",
251b843c749SSergey Zigachev 					update->plane_info->tiling_info.gfx8.pipe_config,
252b843c749SSergey Zigachev 					update->plane_info->tiling_info.gfx8.array_mode,
253b843c749SSergey Zigachev 					update->plane_info->visible,
254b843c749SSergey Zigachev 					update->plane_info->per_pixel_alpha);
255b843c749SSergey Zigachev 
256b843c749SSergey Zigachev 			SURFACE_TRACE("surface->tiling_info.gfx9.swizzle = %d;\n",
257b843c749SSergey Zigachev 					update->plane_info->tiling_info.gfx9.swizzle);
258b843c749SSergey Zigachev 		}
259b843c749SSergey Zigachev 
260b843c749SSergey Zigachev 		if (update->scaling_info) {
261b843c749SSergey Zigachev 			SURFACE_TRACE(
262b843c749SSergey Zigachev 					"scaling_info->src_rect.x = %d;\n"
263b843c749SSergey Zigachev 					"scaling_info->src_rect.y = %d;\n"
264b843c749SSergey Zigachev 					"scaling_info->src_rect.width = %d;\n"
265b843c749SSergey Zigachev 					"scaling_info->src_rect.height = %d;\n"
266b843c749SSergey Zigachev 					"scaling_info->dst_rect.x = %d;\n"
267b843c749SSergey Zigachev 					"scaling_info->dst_rect.y = %d;\n"
268b843c749SSergey Zigachev 					"scaling_info->dst_rect.width = %d;\n"
269b843c749SSergey Zigachev 					"scaling_info->dst_rect.height = %d;\n"
270b843c749SSergey Zigachev 					"scaling_info->clip_rect.x = %d;\n"
271b843c749SSergey Zigachev 					"scaling_info->clip_rect.y = %d;\n"
272b843c749SSergey Zigachev 					"scaling_info->clip_rect.width = %d;\n"
273b843c749SSergey Zigachev 					"scaling_info->clip_rect.height = %d;\n"
274b843c749SSergey Zigachev 					"scaling_info->scaling_quality.h_taps = %d;\n"
275b843c749SSergey Zigachev 					"scaling_info->scaling_quality.v_taps = %d;\n"
276b843c749SSergey Zigachev 					"scaling_info->scaling_quality.h_taps_c = %d;\n"
277b843c749SSergey Zigachev 					"scaling_info->scaling_quality.v_taps_c = %d;\n",
278b843c749SSergey Zigachev 					update->scaling_info->src_rect.x,
279b843c749SSergey Zigachev 					update->scaling_info->src_rect.y,
280b843c749SSergey Zigachev 					update->scaling_info->src_rect.width,
281b843c749SSergey Zigachev 					update->scaling_info->src_rect.height,
282b843c749SSergey Zigachev 					update->scaling_info->dst_rect.x,
283b843c749SSergey Zigachev 					update->scaling_info->dst_rect.y,
284b843c749SSergey Zigachev 					update->scaling_info->dst_rect.width,
285b843c749SSergey Zigachev 					update->scaling_info->dst_rect.height,
286b843c749SSergey Zigachev 					update->scaling_info->clip_rect.x,
287b843c749SSergey Zigachev 					update->scaling_info->clip_rect.y,
288b843c749SSergey Zigachev 					update->scaling_info->clip_rect.width,
289b843c749SSergey Zigachev 					update->scaling_info->clip_rect.height,
290b843c749SSergey Zigachev 					update->scaling_info->scaling_quality.h_taps,
291b843c749SSergey Zigachev 					update->scaling_info->scaling_quality.v_taps,
292b843c749SSergey Zigachev 					update->scaling_info->scaling_quality.h_taps_c,
293b843c749SSergey Zigachev 					update->scaling_info->scaling_quality.v_taps_c);
294b843c749SSergey Zigachev 		}
295b843c749SSergey Zigachev 		SURFACE_TRACE("\n");
296b843c749SSergey Zigachev 	}
297b843c749SSergey Zigachev 	SURFACE_TRACE("\n");
298b843c749SSergey Zigachev }
299b843c749SSergey Zigachev 
post_surface_trace(struct dc * dc)300b843c749SSergey Zigachev void post_surface_trace(struct dc *dc)
301b843c749SSergey Zigachev {
302b843c749SSergey Zigachev 	DC_LOGGER_INIT(dc->ctx->logger);
303b843c749SSergey Zigachev 
304b843c749SSergey Zigachev 	SURFACE_TRACE("post surface process.\n");
305b843c749SSergey Zigachev 
306b843c749SSergey Zigachev }
307b843c749SSergey Zigachev 
context_timing_trace(struct dc * dc,struct resource_context * res_ctx)308b843c749SSergey Zigachev void context_timing_trace(
309b843c749SSergey Zigachev 		struct dc *dc,
310b843c749SSergey Zigachev 		struct resource_context *res_ctx)
311b843c749SSergey Zigachev {
312b843c749SSergey Zigachev 	int i;
313b843c749SSergey Zigachev 	struct dc  *core_dc = dc;
314b843c749SSergey Zigachev 	int h_pos[MAX_PIPES], v_pos[MAX_PIPES];
315b843c749SSergey Zigachev 	struct crtc_position position;
316b843c749SSergey Zigachev 	unsigned int underlay_idx = core_dc->res_pool->underlay_pipe_index;
317b843c749SSergey Zigachev 	DC_LOGGER_INIT(dc->ctx->logger);
318b843c749SSergey Zigachev 
319b843c749SSergey Zigachev 
320b843c749SSergey Zigachev 	for (i = 0; i < core_dc->res_pool->pipe_count; i++) {
321b843c749SSergey Zigachev 		struct pipe_ctx *pipe_ctx = &res_ctx->pipe_ctx[i];
322b843c749SSergey Zigachev 		/* get_position() returns CRTC vertical/horizontal counter
323b843c749SSergey Zigachev 		 * hence not applicable for underlay pipe
324b843c749SSergey Zigachev 		 */
325b843c749SSergey Zigachev 		if (pipe_ctx->stream == NULL
326b843c749SSergey Zigachev 				 || pipe_ctx->pipe_idx == underlay_idx)
327b843c749SSergey Zigachev 			continue;
328b843c749SSergey Zigachev 
329b843c749SSergey Zigachev 		pipe_ctx->stream_res.tg->funcs->get_position(pipe_ctx->stream_res.tg, &position);
330b843c749SSergey Zigachev 		h_pos[i] = position.horizontal_count;
331b843c749SSergey Zigachev 		v_pos[i] = position.vertical_count;
332b843c749SSergey Zigachev 	}
333b843c749SSergey Zigachev 	for (i = 0; i < core_dc->res_pool->pipe_count; i++) {
334b843c749SSergey Zigachev 		struct pipe_ctx *pipe_ctx = &res_ctx->pipe_ctx[i];
335b843c749SSergey Zigachev 
336b843c749SSergey Zigachev 		if (pipe_ctx->stream == NULL)
337b843c749SSergey Zigachev 			continue;
338b843c749SSergey Zigachev 
339b843c749SSergey Zigachev 		TIMING_TRACE("OTG_%d   H_tot:%d  V_tot:%d   H_pos:%d  V_pos:%d\n",
340b843c749SSergey Zigachev 				pipe_ctx->stream_res.tg->inst,
341b843c749SSergey Zigachev 				pipe_ctx->stream->timing.h_total,
342b843c749SSergey Zigachev 				pipe_ctx->stream->timing.v_total,
343b843c749SSergey Zigachev 				h_pos[i], v_pos[i]);
344b843c749SSergey Zigachev 	}
345b843c749SSergey Zigachev }
346b843c749SSergey Zigachev 
context_clock_trace(struct dc * dc,struct dc_state * context)347b843c749SSergey Zigachev void context_clock_trace(
348b843c749SSergey Zigachev 		struct dc *dc,
349b843c749SSergey Zigachev 		struct dc_state *context)
350b843c749SSergey Zigachev {
351b843c749SSergey Zigachev #if defined(CONFIG_DRM_AMD_DC_DCN1_0)
352b843c749SSergey Zigachev 	DC_LOGGER_INIT(dc->ctx->logger);
353b843c749SSergey Zigachev 	CLOCK_TRACE("Current: dispclk_khz:%d  max_dppclk_khz:%d  dcfclk_khz:%d\n"
354b843c749SSergey Zigachev 			"dcfclk_deep_sleep_khz:%d  fclk_khz:%d  socclk_khz:%d\n",
355b843c749SSergey Zigachev 			context->bw.dcn.clk.dispclk_khz,
356b843c749SSergey Zigachev 			context->bw.dcn.clk.dppclk_khz,
357b843c749SSergey Zigachev 			context->bw.dcn.clk.dcfclk_khz,
358b843c749SSergey Zigachev 			context->bw.dcn.clk.dcfclk_deep_sleep_khz,
359b843c749SSergey Zigachev 			context->bw.dcn.clk.fclk_khz,
360b843c749SSergey Zigachev 			context->bw.dcn.clk.socclk_khz);
361b843c749SSergey Zigachev 	CLOCK_TRACE("Calculated: dispclk_khz:%d  max_dppclk_khz:%d  dcfclk_khz:%d\n"
362b843c749SSergey Zigachev 			"dcfclk_deep_sleep_khz:%d  fclk_khz:%d  socclk_khz:%d\n",
363b843c749SSergey Zigachev 			context->bw.dcn.clk.dispclk_khz,
364b843c749SSergey Zigachev 			context->bw.dcn.clk.dppclk_khz,
365b843c749SSergey Zigachev 			context->bw.dcn.clk.dcfclk_khz,
366b843c749SSergey Zigachev 			context->bw.dcn.clk.dcfclk_deep_sleep_khz,
367b843c749SSergey Zigachev 			context->bw.dcn.clk.fclk_khz,
368b843c749SSergey Zigachev 			context->bw.dcn.clk.socclk_khz);
369b843c749SSergey Zigachev #endif
370b843c749SSergey Zigachev }
371