Skip to content

Commit 5d72e24

Browse files
effective-lightalexdeucher
authored andcommitted
drm/amd/display: switch DC over to the new DRM logging macros
For multi-GPU systems it is difficult to tell which GPU a particular message is being printed for and that is undesirable because it complicates debugging efforts. Also, the new macros allow us to enable logging for particular parts of the codebase more selectively (since we no longer need to throw everything at DRM_DEBUG_KMS()). So, for the reasons outlined above we should switch to the new macros. We can accomplish this by using the existing DC_LOGGER code to pass around the relevant `struct drm_device` which will be fed to the new macros in logger_types.h. Also, we must get rid of all instances of the DC_LOG_.*() functions that are currently in amdgpu_dm since we don't use the DC logger there and we can simply refer to the macros directly there instead. Reviewed-by: Rodrigo Siqueira <[email protected]> Signed-off-by: Hamza Mahfooz <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent a73d4e8 commit 5d72e24

39 files changed

+236
-225
lines changed

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

Lines changed: 37 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,7 @@ static void dm_pflip_high_irq(void *interrupt_params)
413413
struct amdgpu_crtc *amdgpu_crtc;
414414
struct common_irq_params *irq_params = interrupt_params;
415415
struct amdgpu_device *adev = irq_params->adev;
416+
struct drm_device *dev = adev_to_drm(adev);
416417
unsigned long flags;
417418
struct drm_pending_vblank_event *e;
418419
u32 vpos, hpos, v_blank_start, v_blank_end;
@@ -423,18 +424,17 @@ static void dm_pflip_high_irq(void *interrupt_params)
423424
/* IRQ could occur when in initial stage */
424425
/* TODO work and BO cleanup */
425426
if (amdgpu_crtc == NULL) {
426-
DC_LOG_PFLIP("CRTC is null, returning.\n");
427+
drm_dbg_state(dev, "CRTC is null, returning.\n");
427428
return;
428429
}
429430

430431
spin_lock_irqsave(&adev_to_drm(adev)->event_lock, flags);
431432

432433
if (amdgpu_crtc->pflip_status != AMDGPU_FLIP_SUBMITTED) {
433-
DC_LOG_PFLIP("amdgpu_crtc->pflip_status = %d !=AMDGPU_FLIP_SUBMITTED(%d) on crtc:%d[%p]\n",
434-
amdgpu_crtc->pflip_status,
435-
AMDGPU_FLIP_SUBMITTED,
436-
amdgpu_crtc->crtc_id,
437-
amdgpu_crtc);
434+
drm_dbg_state(dev,
435+
"amdgpu_crtc->pflip_status = %d != AMDGPU_FLIP_SUBMITTED(%d) on crtc:%d[%p]\n",
436+
amdgpu_crtc->pflip_status, AMDGPU_FLIP_SUBMITTED,
437+
amdgpu_crtc->crtc_id, amdgpu_crtc);
438438
spin_unlock_irqrestore(&adev_to_drm(adev)->event_lock, flags);
439439
return;
440440
}
@@ -500,9 +500,9 @@ static void dm_pflip_high_irq(void *interrupt_params)
500500
amdgpu_crtc->pflip_status = AMDGPU_FLIP_NONE;
501501
spin_unlock_irqrestore(&adev_to_drm(adev)->event_lock, flags);
502502

503-
DC_LOG_PFLIP("crtc:%d[%p], pflip_stat:AMDGPU_FLIP_NONE, vrr[%d]-fp %d\n",
504-
amdgpu_crtc->crtc_id, amdgpu_crtc,
505-
vrr_active, (int) !e);
503+
drm_dbg_state(dev,
504+
"crtc:%d[%p], pflip_stat:AMDGPU_FLIP_NONE, vrr[%d]-fp %d\n",
505+
amdgpu_crtc->crtc_id, amdgpu_crtc, vrr_active, (int)!e);
506506
}
507507

508508
static void dm_vupdate_high_irq(void *interrupt_params)
@@ -532,9 +532,9 @@ static void dm_vupdate_high_irq(void *interrupt_params)
532532
atomic64_set(&irq_params->previous_timestamp, vblank->time);
533533
}
534534

535-
DC_LOG_VBLANK("crtc:%d, vupdate-vrr:%d\n",
536-
acrtc->crtc_id,
537-
vrr_active);
535+
drm_dbg_vbl(drm_dev,
536+
"crtc:%d, vupdate-vrr:%d\n", acrtc->crtc_id,
537+
vrr_active);
538538

539539
/* Core vblank handling is done here after end of front-porch in
540540
* vrr mode, as vblank timestamping will give valid results
@@ -585,8 +585,9 @@ static void dm_crtc_high_irq(void *interrupt_params)
585585

586586
vrr_active = amdgpu_dm_crtc_vrr_active_irq(acrtc);
587587

588-
DC_LOG_VBLANK("crtc:%d, vupdate-vrr:%d, planes:%d\n", acrtc->crtc_id,
589-
vrr_active, acrtc->dm_irq_params.active_planes);
588+
drm_dbg_vbl(adev_to_drm(adev),
589+
"crtc:%d, vupdate-vrr:%d, planes:%d\n", acrtc->crtc_id,
590+
vrr_active, acrtc->dm_irq_params.active_planes);
590591

591592
/**
592593
* Core vblank handling at start of front-porch is only possible
@@ -2700,6 +2701,7 @@ static void emulated_link_detect(struct dc_link *link)
27002701
struct display_sink_capability sink_caps = { 0 };
27012702
enum dc_edid_status edid_status;
27022703
struct dc_context *dc_ctx = link->ctx;
2704+
struct drm_device *dev = adev_to_drm(dc_ctx->driver_context);
27032705
struct dc_sink *sink = NULL;
27042706
struct dc_sink *prev_sink = NULL;
27052707

@@ -2749,7 +2751,7 @@ static void emulated_link_detect(struct dc_link *link)
27492751
}
27502752

27512753
default:
2752-
DC_ERROR("Invalid connector type! signal:%d\n",
2754+
drm_err(dev, "Invalid connector type! signal:%d\n",
27532755
link->connector_signal);
27542756
return;
27552757
}
@@ -2759,7 +2761,7 @@ static void emulated_link_detect(struct dc_link *link)
27592761

27602762
sink = dc_sink_create(&sink_init_data);
27612763
if (!sink) {
2762-
DC_ERROR("Failed to create sink!\n");
2764+
drm_err(dev, "Failed to create sink!\n");
27632765
return;
27642766
}
27652767

@@ -2772,7 +2774,7 @@ static void emulated_link_detect(struct dc_link *link)
27722774
sink);
27732775

27742776
if (edid_status != EDID_OK)
2775-
DC_ERROR("Failed to read EDID");
2777+
drm_err(dev, "Failed to read EDID\n");
27762778

27772779
}
27782780

@@ -2791,7 +2793,7 @@ static void dm_gpureset_commit_state(struct dc_state *dc_state,
27912793
bundle = kzalloc(sizeof(*bundle), GFP_KERNEL);
27922794

27932795
if (!bundle) {
2794-
dm_error("Failed to allocate update bundle\n");
2796+
drm_err(dm->ddev, "Failed to allocate update bundle\n");
27952797
goto cleanup;
27962798
}
27972799

@@ -3243,7 +3245,8 @@ void amdgpu_dm_update_connector_after_detect(
32433245
aconnector->timing_requested =
32443246
kzalloc(sizeof(struct dc_crtc_timing), GFP_KERNEL);
32453247
if (!aconnector->timing_requested)
3246-
dm_error("failed to create aconnector->requested_timing\n");
3248+
drm_err(dev,
3249+
"failed to create aconnector->requested_timing\n");
32473250
}
32483251

32493252
drm_connector_update_edid_property(connector, aconnector->edid);
@@ -6159,10 +6162,10 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector,
61596162
requested_bpc);
61606163

61616164
if (aconnector->timing_changed) {
6162-
DC_LOG_DEBUG("%s: overriding timing for automated test, bpc %d, changing to %d\n",
6163-
__func__,
6164-
stream->timing.display_color_depth,
6165-
aconnector->timing_requested->display_color_depth);
6165+
drm_dbg(aconnector->base.dev,
6166+
"overriding timing for automated test, bpc %d, changing to %d\n",
6167+
stream->timing.display_color_depth,
6168+
aconnector->timing_requested->display_color_depth);
61666169
stream->timing = *aconnector->timing_requested;
61676170
}
61686171

@@ -7882,8 +7885,9 @@ static void prepare_flip_isr(struct amdgpu_crtc *acrtc)
78827885
/* Mark this event as consumed */
78837886
acrtc->base.state->event = NULL;
78847887

7885-
DC_LOG_PFLIP("crtc:%d, pflip_stat:AMDGPU_FLIP_SUBMITTED\n",
7886-
acrtc->crtc_id);
7888+
drm_dbg_state(acrtc->base.dev,
7889+
"crtc:%d, pflip_stat:AMDGPU_FLIP_SUBMITTED\n",
7890+
acrtc->crtc_id);
78877891
}
78887892

78897893
static void update_freesync_state_on_stream(
@@ -8126,7 +8130,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
81268130
bundle = kzalloc(sizeof(*bundle), GFP_KERNEL);
81278131

81288132
if (!bundle) {
8129-
dm_error("Failed to allocate update bundle\n");
8133+
drm_err(dev, "Failed to allocate update bundle\n");
81308134
goto cleanup;
81318135
}
81328136

@@ -8714,7 +8718,9 @@ static void amdgpu_dm_commit_streams(struct drm_atomic_state *state,
87148718
status = dc_stream_get_status_from_state(dc_state,
87158719
dm_new_crtc_state->stream);
87168720
if (!status)
8717-
DC_ERR("got no status for stream %p on acrtc%p\n", dm_new_crtc_state->stream, acrtc);
8721+
drm_err(dev,
8722+
"got no status for stream %p on acrtc%p\n",
8723+
dm_new_crtc_state->stream, acrtc);
87188724
else
87198725
acrtc->otg_inst = status->primary_otg_inst;
87208726
}
@@ -10902,7 +10908,8 @@ void dm_write_reg_func(const struct dc_context *ctx, uint32_t address,
1090210908
{
1090310909
#ifdef DM_CHECK_ADDR_0
1090410910
if (address == 0) {
10905-
DC_ERR("invalid register write. address = 0");
10911+
drm_err(adev_to_drm(ctx->driver_context),
10912+
"invalid register write. address = 0");
1090610913
return;
1090710914
}
1090810915
#endif
@@ -10916,7 +10923,8 @@ uint32_t dm_read_reg_func(const struct dc_context *ctx, uint32_t address,
1091610923
u32 value;
1091710924
#ifdef DM_CHECK_ADDR_0
1091810925
if (address == 0) {
10919-
DC_ERR("invalid register read; address = 0\n");
10926+
drm_err(adev_to_drm(ctx->driver_context),
10927+
"invalid register read; address = 0\n");
1092010928
return 0;
1092110929
}
1092210930
#endif

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c

Lines changed: 40 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,8 @@ bool dm_helpers_dp_read_dpcd(
535535
struct amdgpu_dm_connector *aconnector = link->priv;
536536

537537
if (!aconnector) {
538-
DC_LOG_DC("Failed to find connector for link!\n");
538+
drm_dbg_dp(aconnector->base.dev,
539+
"Failed to find connector for link!\n");
539540
return false;
540541
}
541542

@@ -657,7 +658,7 @@ static bool execute_synaptics_rc_command(struct drm_dp_aux *aux,
657658
drm_dp_dpcd_read(aux, SYNAPTICS_RC_DATA, data, length);
658659
}
659660

660-
DC_LOG_DC("%s: success = %d\n", __func__, success);
661+
drm_dbg_dp(aux->drm_dev, "success = %d\n", success);
661662

662663
return success;
663664
}
@@ -666,7 +667,7 @@ static void apply_synaptics_fifo_reset_wa(struct drm_dp_aux *aux)
666667
{
667668
unsigned char data[16] = {0};
668669

669-
DC_LOG_DC("Start %s\n", __func__);
670+
drm_dbg_dp(aux->drm_dev, "Start\n");
670671

671672
// Step 2
672673
data[0] = 'P';
@@ -724,7 +725,7 @@ static void apply_synaptics_fifo_reset_wa(struct drm_dp_aux *aux)
724725
if (!execute_synaptics_rc_command(aux, true, 0x02, 0, 0, NULL))
725726
return;
726727

727-
DC_LOG_DC("Done %s\n", __func__);
728+
drm_dbg_dp(aux->drm_dev, "Done\n");
728729
}
729730

730731
/* MST Dock */
@@ -737,7 +738,8 @@ static uint8_t write_dsc_enable_synaptics_non_virtual_dpcd_mst(
737738
{
738739
uint8_t ret = 0;
739740

740-
DC_LOG_DC("Configure DSC to non-virtual dpcd synaptics\n");
741+
drm_dbg_dp(aux->drm_dev,
742+
"Configure DSC to non-virtual dpcd synaptics\n");
741743

742744
if (enable) {
743745
/* When DSC is enabled on previous boot and reboot with the hub,
@@ -775,7 +777,9 @@ bool dm_helpers_dp_write_dsc_enable(
775777
static const uint8_t DSC_DECODING = 0x01;
776778
static const uint8_t DSC_PASSTHROUGH = 0x02;
777779

778-
struct amdgpu_dm_connector *aconnector;
780+
struct amdgpu_dm_connector *aconnector =
781+
(struct amdgpu_dm_connector *)stream->dm_stream_context;
782+
struct drm_device *dev = aconnector->base.dev;
779783
struct drm_dp_mst_port *port;
780784
uint8_t enable_dsc = enable ? DSC_DECODING : DSC_DISABLE;
781785
uint8_t enable_passthrough = enable ? DSC_PASSTHROUGH : DSC_DISABLE;
@@ -785,8 +789,6 @@ bool dm_helpers_dp_write_dsc_enable(
785789
return false;
786790

787791
if (stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST) {
788-
aconnector = (struct amdgpu_dm_connector *)stream->dm_stream_context;
789-
790792
if (!aconnector->dsc_aux)
791793
return false;
792794

@@ -803,41 +805,49 @@ bool dm_helpers_dp_write_dsc_enable(
803805
ret = drm_dp_dpcd_write(port->passthrough_aux,
804806
DP_DSC_ENABLE,
805807
&enable_passthrough, 1);
806-
DC_LOG_DC("Sent DSC pass-through enable to virtual dpcd port, ret = %u\n",
807-
ret);
808+
drm_dbg_dp(dev,
809+
"Sent DSC pass-through enable to virtual dpcd port, ret = %u\n",
810+
ret);
808811
}
809812

810813
ret = drm_dp_dpcd_write(aconnector->dsc_aux,
811814
DP_DSC_ENABLE, &enable_dsc, 1);
812-
DC_LOG_DC("Sent DSC decoding enable to %s port, ret = %u\n",
813-
(port->passthrough_aux) ? "remote RX" :
814-
"virtual dpcd",
815-
ret);
815+
drm_dbg_dp(dev,
816+
"Sent DSC decoding enable to %s port, ret = %u\n",
817+
(port->passthrough_aux) ? "remote RX" :
818+
"virtual dpcd",
819+
ret);
816820
} else {
817821
ret = drm_dp_dpcd_write(aconnector->dsc_aux,
818822
DP_DSC_ENABLE, &enable_dsc, 1);
819-
DC_LOG_DC("Sent DSC decoding disable to %s port, ret = %u\n",
820-
(port->passthrough_aux) ? "remote RX" :
821-
"virtual dpcd",
822-
ret);
823+
drm_dbg_dp(dev,
824+
"Sent DSC decoding disable to %s port, ret = %u\n",
825+
(port->passthrough_aux) ? "remote RX" :
826+
"virtual dpcd",
827+
ret);
823828

824829
if (port->passthrough_aux) {
825830
ret = drm_dp_dpcd_write(port->passthrough_aux,
826831
DP_DSC_ENABLE,
827832
&enable_passthrough, 1);
828-
DC_LOG_DC("Sent DSC pass-through disable to virtual dpcd port, ret = %u\n",
829-
ret);
833+
drm_dbg_dp(dev,
834+
"Sent DSC pass-through disable to virtual dpcd port, ret = %u\n",
835+
ret);
830836
}
831837
}
832838
}
833839

834840
if (stream->signal == SIGNAL_TYPE_DISPLAY_PORT || stream->signal == SIGNAL_TYPE_EDP) {
835841
if (stream->sink->link->dpcd_caps.dongle_type == DISPLAY_DONGLE_NONE) {
836842
ret = dm_helpers_dp_write_dpcd(ctx, stream->link, DP_DSC_ENABLE, &enable_dsc, 1);
837-
DC_LOG_DC("Send DSC %s to SST RX\n", enable_dsc ? "enable" : "disable");
843+
drm_dbg_dp(dev,
844+
"Send DSC %s to SST RX\n",
845+
enable_dsc ? "enable" : "disable");
838846
} else if (stream->sink->link->dpcd_caps.dongle_type == DISPLAY_DONGLE_DP_HDMI_CONVERTER) {
839847
ret = dm_helpers_dp_write_dpcd(ctx, stream->link, DP_DSC_ENABLE, &enable_dsc, 1);
840-
DC_LOG_DC("Send DSC %s to DP-HDMI PCON\n", enable_dsc ? "enable" : "disable");
848+
drm_dbg_dp(dev,
849+
"Send DSC %s to DP-HDMI PCON\n",
850+
enable_dsc ? "enable" : "disable");
841851
}
842852
}
843853

@@ -1106,6 +1116,7 @@ bool dm_helpers_dp_handle_test_pattern_request(
11061116
struct pipe_ctx *pipes = link->dc->current_state->res_ctx.pipe_ctx;
11071117
struct pipe_ctx *pipe_ctx = NULL;
11081118
struct amdgpu_dm_connector *aconnector = link->priv;
1119+
struct drm_device *dev = aconnector->base.dev;
11091120
int i;
11101121

11111122
for (i = 0; i < MAX_PIPES; i++) {
@@ -1183,12 +1194,12 @@ bool dm_helpers_dp_handle_test_pattern_request(
11831194
&& pipe_ctx->stream->timing.display_color_depth != requestColorDepth)
11841195
|| (requestPixelEncoding != PIXEL_ENCODING_UNDEFINED
11851196
&& pipe_ctx->stream->timing.pixel_encoding != requestPixelEncoding)) {
1186-
DC_LOG_DEBUG("%s: original bpc %d pix encoding %d, changing to %d %d\n",
1187-
__func__,
1188-
pipe_ctx->stream->timing.display_color_depth,
1189-
pipe_ctx->stream->timing.pixel_encoding,
1190-
requestColorDepth,
1191-
requestPixelEncoding);
1197+
drm_dbg(dev,
1198+
"original bpc %d pix encoding %d, changing to %d %d\n",
1199+
pipe_ctx->stream->timing.display_color_depth,
1200+
pipe_ctx->stream->timing.pixel_encoding,
1201+
requestColorDepth,
1202+
requestPixelEncoding);
11921203
pipe_ctx->stream->timing.display_color_depth = requestColorDepth;
11931204
pipe_ctx->stream->timing.pixel_encoding = requestPixelEncoding;
11941205

@@ -1199,7 +1210,7 @@ bool dm_helpers_dp_handle_test_pattern_request(
11991210
if (aconnector->timing_requested)
12001211
*aconnector->timing_requested = pipe_ctx->stream->timing;
12011212
else
1202-
DC_LOG_ERROR("%s: timing storage failed\n", __func__);
1213+
drm_err(dev, "timing storage failed\n");
12031214

12041215
}
12051216

0 commit comments

Comments
 (0)