hc
2024-05-10 61598093bbdd283a7edc367d900f223070ead8d2
kernel/drivers/gpu/drm/amd/display/dc/core/dc_debug.c
....@@ -33,7 +33,6 @@
3333
3434 #include "core_status.h"
3535 #include "core_types.h"
36
-#include "hw_sequencer.h"
3736
3837 #include "resource.h"
3938
....@@ -115,16 +114,16 @@
115114 plane_state->clip_rect.height);
116115
117116 SURFACE_TRACE(
118
- "plane_state->plane_size.grph.surface_size.x = %d;\n"
119
- "plane_state->plane_size.grph.surface_size.y = %d;\n"
120
- "plane_state->plane_size.grph.surface_size.width = %d;\n"
121
- "plane_state->plane_size.grph.surface_size.height = %d;\n"
122
- "plane_state->plane_size.grph.surface_pitch = %d;\n",
123
- plane_state->plane_size.grph.surface_size.x,
124
- plane_state->plane_size.grph.surface_size.y,
125
- plane_state->plane_size.grph.surface_size.width,
126
- plane_state->plane_size.grph.surface_size.height,
127
- plane_state->plane_size.grph.surface_pitch);
117
+ "plane_state->plane_size.surface_size.x = %d;\n"
118
+ "plane_state->plane_size.surface_size.y = %d;\n"
119
+ "plane_state->plane_size.surface_size.width = %d;\n"
120
+ "plane_state->plane_size.surface_size.height = %d;\n"
121
+ "plane_state->plane_size.surface_pitch = %d;\n",
122
+ plane_state->plane_size.surface_size.x,
123
+ plane_state->plane_size.surface_size.y,
124
+ plane_state->plane_size.surface_size.width,
125
+ plane_state->plane_size.surface_size.height,
126
+ plane_state->plane_size.surface_pitch);
128127
129128
130129 SURFACE_TRACE(
....@@ -202,20 +201,20 @@
202201 SURFACE_TRACE(
203202 "plane_info->color_space = %d;\n"
204203 "plane_info->format = %d;\n"
205
- "plane_info->plane_size.grph.surface_pitch = %d;\n"
206
- "plane_info->plane_size.grph.surface_size.height = %d;\n"
207
- "plane_info->plane_size.grph.surface_size.width = %d;\n"
208
- "plane_info->plane_size.grph.surface_size.x = %d;\n"
209
- "plane_info->plane_size.grph.surface_size.y = %d;\n"
204
+ "plane_info->plane_size.surface_pitch = %d;\n"
205
+ "plane_info->plane_size.surface_size.height = %d;\n"
206
+ "plane_info->plane_size.surface_size.width = %d;\n"
207
+ "plane_info->plane_size.surface_size.x = %d;\n"
208
+ "plane_info->plane_size.surface_size.y = %d;\n"
210209 "plane_info->rotation = %d;\n"
211210 "plane_info->stereo_format = %d;\n",
212211 update->plane_info->color_space,
213212 update->plane_info->format,
214
- update->plane_info->plane_size.grph.surface_pitch,
215
- update->plane_info->plane_size.grph.surface_size.height,
216
- update->plane_info->plane_size.grph.surface_size.width,
217
- update->plane_info->plane_size.grph.surface_size.x,
218
- update->plane_info->plane_size.grph.surface_size.y,
213
+ update->plane_info->plane_size.surface_pitch,
214
+ update->plane_info->plane_size.surface_size.height,
215
+ update->plane_info->plane_size.surface_size.width,
216
+ update->plane_info->plane_size.surface_size.x,
217
+ update->plane_info->plane_size.surface_size.y,
219218 update->plane_info->rotation,
220219 update->plane_info->stereo_format);
221220
....@@ -310,30 +309,28 @@
310309 struct resource_context *res_ctx)
311310 {
312311 int i;
313
- struct dc *core_dc = dc;
314
- int h_pos[MAX_PIPES], v_pos[MAX_PIPES];
312
+ int h_pos[MAX_PIPES] = {0}, v_pos[MAX_PIPES] = {0};
315313 struct crtc_position position;
316
- unsigned int underlay_idx = core_dc->res_pool->underlay_pipe_index;
314
+ unsigned int underlay_idx = dc->res_pool->underlay_pipe_index;
317315 DC_LOGGER_INIT(dc->ctx->logger);
318316
319317
320
- for (i = 0; i < core_dc->res_pool->pipe_count; i++) {
318
+ for (i = 0; i < dc->res_pool->pipe_count; i++) {
321319 struct pipe_ctx *pipe_ctx = &res_ctx->pipe_ctx[i];
322320 /* get_position() returns CRTC vertical/horizontal counter
323321 * hence not applicable for underlay pipe
324322 */
325
- if (pipe_ctx->stream == NULL
326
- || pipe_ctx->pipe_idx == underlay_idx)
323
+ if (pipe_ctx->stream == NULL || pipe_ctx->pipe_idx == underlay_idx)
327324 continue;
328325
329326 pipe_ctx->stream_res.tg->funcs->get_position(pipe_ctx->stream_res.tg, &position);
330327 h_pos[i] = position.horizontal_count;
331328 v_pos[i] = position.vertical_count;
332329 }
333
- for (i = 0; i < core_dc->res_pool->pipe_count; i++) {
330
+ for (i = 0; i < dc->res_pool->pipe_count; i++) {
334331 struct pipe_ctx *pipe_ctx = &res_ctx->pipe_ctx[i];
335332
336
- if (pipe_ctx->stream == NULL)
333
+ if (pipe_ctx->stream == NULL || pipe_ctx->pipe_idx == underlay_idx)
337334 continue;
338335
339336 TIMING_TRACE("OTG_%d H_tot:%d V_tot:%d H_pos:%d V_pos:%d\n",
....@@ -348,23 +345,82 @@
348345 struct dc *dc,
349346 struct dc_state *context)
350347 {
351
-#if defined(CONFIG_DRM_AMD_DC_DCN1_0)
348
+#if defined(CONFIG_DRM_AMD_DC_DCN)
352349 DC_LOGGER_INIT(dc->ctx->logger);
353350 CLOCK_TRACE("Current: dispclk_khz:%d max_dppclk_khz:%d dcfclk_khz:%d\n"
354351 "dcfclk_deep_sleep_khz:%d fclk_khz:%d socclk_khz:%d\n",
355
- context->bw.dcn.clk.dispclk_khz,
356
- context->bw.dcn.clk.dppclk_khz,
357
- context->bw.dcn.clk.dcfclk_khz,
358
- context->bw.dcn.clk.dcfclk_deep_sleep_khz,
359
- context->bw.dcn.clk.fclk_khz,
360
- context->bw.dcn.clk.socclk_khz);
352
+ context->bw_ctx.bw.dcn.clk.dispclk_khz,
353
+ context->bw_ctx.bw.dcn.clk.dppclk_khz,
354
+ context->bw_ctx.bw.dcn.clk.dcfclk_khz,
355
+ context->bw_ctx.bw.dcn.clk.dcfclk_deep_sleep_khz,
356
+ context->bw_ctx.bw.dcn.clk.fclk_khz,
357
+ context->bw_ctx.bw.dcn.clk.socclk_khz);
361358 CLOCK_TRACE("Calculated: dispclk_khz:%d max_dppclk_khz:%d dcfclk_khz:%d\n"
362359 "dcfclk_deep_sleep_khz:%d fclk_khz:%d socclk_khz:%d\n",
363
- context->bw.dcn.clk.dispclk_khz,
364
- context->bw.dcn.clk.dppclk_khz,
365
- context->bw.dcn.clk.dcfclk_khz,
366
- context->bw.dcn.clk.dcfclk_deep_sleep_khz,
367
- context->bw.dcn.clk.fclk_khz,
368
- context->bw.dcn.clk.socclk_khz);
360
+ context->bw_ctx.bw.dcn.clk.dispclk_khz,
361
+ context->bw_ctx.bw.dcn.clk.dppclk_khz,
362
+ context->bw_ctx.bw.dcn.clk.dcfclk_khz,
363
+ context->bw_ctx.bw.dcn.clk.dcfclk_deep_sleep_khz,
364
+ context->bw_ctx.bw.dcn.clk.fclk_khz,
365
+ context->bw_ctx.bw.dcn.clk.socclk_khz);
369366 #endif
370367 }
368
+
369
+/**
370
+ * dc_status_to_str - convert dc_status to a human readable string
371
+ * @status: dc_status to be converted
372
+ *
373
+ * Return:
374
+ * A string describing the DC status.
375
+ */
376
+char *dc_status_to_str(enum dc_status status)
377
+{
378
+ switch (status) {
379
+ case DC_OK:
380
+ return "DC OK";
381
+ case DC_NO_CONTROLLER_RESOURCE:
382
+ return "No controller resource";
383
+ case DC_NO_STREAM_ENC_RESOURCE:
384
+ return "No stream encoder";
385
+ case DC_NO_CLOCK_SOURCE_RESOURCE:
386
+ return "No clock source";
387
+ case DC_FAIL_CONTROLLER_VALIDATE:
388
+ return "Controller validation failure";
389
+ case DC_FAIL_ENC_VALIDATE:
390
+ return "Encoder validation failure";
391
+ case DC_FAIL_ATTACH_SURFACES:
392
+ return "Surfaces attachment failure";
393
+ case DC_FAIL_DETACH_SURFACES:
394
+ return "Surfaces detachment failure";
395
+ case DC_FAIL_SURFACE_VALIDATE:
396
+ return "Surface validation failure";
397
+ case DC_NO_DP_LINK_BANDWIDTH:
398
+ return "No DP link bandwidth";
399
+ case DC_EXCEED_DONGLE_CAP:
400
+ return "Exceed dongle capability";
401
+ case DC_SURFACE_PIXEL_FORMAT_UNSUPPORTED:
402
+ return "Unsupported pixel format";
403
+ case DC_FAIL_BANDWIDTH_VALIDATE:
404
+ return "Bandwidth validation failure (BW and Watermark)";
405
+ case DC_FAIL_SCALING:
406
+ return "Scaling failure";
407
+ case DC_FAIL_DP_LINK_TRAINING:
408
+ return "DP link training failure";
409
+ case DC_FAIL_DSC_VALIDATE:
410
+ return "DSC validation failure";
411
+ case DC_NO_DSC_RESOURCE:
412
+ return "No DSC resource";
413
+ case DC_FAIL_UNSUPPORTED_1:
414
+ return "Unsupported";
415
+ case DC_FAIL_CLK_EXCEED_MAX:
416
+ return "Clk exceed max failure";
417
+ case DC_FAIL_CLK_BELOW_MIN:
418
+ return "Fail clk below minimum";
419
+ case DC_FAIL_CLK_BELOW_CFG_REQUIRED:
420
+ return "Fail clk below required CFG (hard_min in PPLIB)";
421
+ case DC_ERROR_UNEXPECTED:
422
+ return "Unexpected error";
423
+ }
424
+
425
+ return "Unexpected status error";
426
+}