drm/amd/display: use drm_dbg_driver() in amdgpu_dm.c
authorAurabindo Pillai <aurabindo.pillai@amd.com>
Tue, 6 May 2025 17:22:25 +0000 (13:22 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 13 May 2025 13:21:21 +0000 (09:21 -0400)
Replace all use of DRM_DEBUG_DRIVER in amdgpu_dm.c with
drm_dbg_driver(). The latter prints the instance of the drm device
associated with the error which would helpful in debugging scenarios
involving multiple GPUs

Signed-off-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

index 8984e211dd1c522e38866d7372397fac4e14f25d..46fc4c94a8791854248be94679ada0f2de821f02 100644 (file)
@@ -866,7 +866,7 @@ static void dmub_hpd_callback(struct amdgpu_device *adev,
 static void dmub_hpd_sense_callback(struct amdgpu_device *adev,
                              struct dmub_notification *notify)
 {
-       DRM_DEBUG_DRIVER("DMUB HPD SENSE callback.\n");
+       drm_dbg_driver(adev_to_drm(adev), "DMUB HPD SENSE callback.\n");
 }
 
 /**
@@ -963,7 +963,7 @@ static void dm_dmub_outbox1_low_irq(void *interrupt_params)
                        trace_amdgpu_dmub_trace_high_irq(entry.trace_code, entry.tick_count,
                                                        entry.param0, entry.param1);
 
-                       DRM_DEBUG_DRIVER("trace_code:%u, tick_count:%u, param0:%u, param1:%u\n",
+                       drm_dbg_driver(adev_to_drm(adev), "trace_code:%u, tick_count:%u, param0:%u, param1:%u\n",
                                 entry.trace_code, entry.tick_count, entry.param0, entry.param1);
                } else
                        break;
@@ -973,7 +973,7 @@ static void dm_dmub_outbox1_low_irq(void *interrupt_params)
        } while (count <= DMUB_TRACE_MAX_READ);
 
        if (count > DMUB_TRACE_MAX_READ)
-               DRM_DEBUG_DRIVER("Warning : count > DMUB_TRACE_MAX_READ");
+               drm_dbg_driver(adev_to_drm(adev), "Warning : count > DMUB_TRACE_MAX_READ");
 
        if (dc_enable_dmub_notifications(adev->dm.dc) &&
                irq_params->irq_src == DC_IRQ_SOURCE_DMCUB_OUTBOX) {
@@ -2200,7 +2200,7 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
                drm_err(adev_to_drm(adev),
                "amdgpu: failed to initialize freesync_module.\n");
        } else
-               DRM_DEBUG_DRIVER("amdgpu: freesync_module init done %p.\n",
+               drm_dbg_driver(adev_to_drm(adev), "amdgpu: freesync_module init done %p.\n",
                                adev->dm.freesync_module);
 
        amdgpu_dm_init_color_mod();
@@ -2222,7 +2222,7 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
                if (!adev->dm.hdcp_workqueue)
                        drm_err(adev_to_drm(adev), "amdgpu: failed to initialize hdcp_workqueue.\n");
                else
-                       DRM_DEBUG_DRIVER("amdgpu: hdcp_workqueue init done %p.\n", adev->dm.hdcp_workqueue);
+                       drm_dbg_driver(adev_to_drm(adev), "amdgpu: hdcp_workqueue init done %p.\n", adev->dm.hdcp_workqueue);
 
                dc_init_callbacks(adev->dm.dc, &init_params);
        }
@@ -2299,7 +2299,7 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
 
 #endif
 
-       DRM_DEBUG_DRIVER("KMS initialized.\n");
+       drm_dbg_driver(adev_to_drm(adev), "KMS initialized.\n");
 
        return 0;
 error:
@@ -5097,7 +5097,7 @@ amdgpu_dm_register_backlight_device(struct amdgpu_dm_connector *aconnector)
                drm_err(drm, "DM: Backlight registration failed!\n");
                dm->backlight_dev[aconnector->bl_idx] = NULL;
        } else
-               DRM_DEBUG_DRIVER("DM: Registered Backlight device: %s\n", bl_name);
+               drm_dbg_driver(drm, "DM: Registered Backlight device: %s\n", bl_name);
 }
 
 static int initialize_plane(struct amdgpu_display_manager *dm,
@@ -6749,7 +6749,7 @@ get_highest_refresh_rate_mode(struct amdgpu_dm_connector *aconnector,
                m_pref = list_first_entry_or_null(
                                &aconnector->base.modes, struct drm_display_mode, head);
                if (!m_pref) {
-                       DRM_DEBUG_DRIVER("No preferred mode found in EDID\n");
+                       drm_dbg_driver(aconnector->base.dev, "No preferred mode found in EDID\n");
                        return NULL;
                }
        }
@@ -6924,7 +6924,7 @@ static void apply_dsc_policy_for_stream(struct amdgpu_dm_connector *aconnector,
                                                dc_link_get_highest_encoding_format(aconnector->dc_link),
                                                &stream->timing.dsc_cfg)) {
                                stream->timing.flags.DSC = 1;
-                               DRM_DEBUG_DRIVER("%s: SST_DSC [%s] DSC is selected from SST RX\n",
+                               drm_dbg_driver(drm_connector->dev, "%s: SST_DSC [%s] DSC is selected from SST RX\n",
                                                        __func__, drm_connector->name);
                        }
                } else if (sink->link->dpcd_caps.dongle_type == DISPLAY_DONGLE_DP_HDMI_CONVERTER) {
@@ -6944,7 +6944,7 @@ static void apply_dsc_policy_for_stream(struct amdgpu_dm_connector *aconnector,
                                                dc_link_get_highest_encoding_format(aconnector->dc_link),
                                                &stream->timing.dsc_cfg)) {
                                        stream->timing.flags.DSC = 1;
-                                       DRM_DEBUG_DRIVER("%s: SST_DSC [%s] DSC is selected from DP-HDMI PCON\n",
+                                       drm_dbg_driver(drm_connector->dev, "%s: SST_DSC [%s] DSC is selected from DP-HDMI PCON\n",
                                                                         __func__, drm_connector->name);
                                }
                }
@@ -7053,7 +7053,7 @@ create_stream_for_sink(struct drm_connector *connector,
                 * case, we call set mode ourselves to restore the previous mode
                 * and the modelist may not be filled in time.
                 */
-               DRM_DEBUG_DRIVER("No preferred mode found\n");
+               drm_dbg_driver(dev, "No preferred mode found\n");
        } else if (aconnector) {
                recalculate_timing = amdgpu_freesync_vid_mode &&
                                 is_freesync_video_mode(&mode, aconnector);
@@ -9201,7 +9201,7 @@ static void amdgpu_dm_handle_vrr_transition(struct dm_crtc_state *old_state,
                 */
                WARN_ON(amdgpu_dm_crtc_set_vupdate_irq(new_state->base.crtc, true) != 0);
                WARN_ON(drm_crtc_vblank_get(new_state->base.crtc) != 0);
-               DRM_DEBUG_DRIVER("%s: crtc=%u VRR off->on: Get vblank ref\n",
+               drm_dbg_driver(new_state->base.crtc->dev, "%s: crtc=%u VRR off->on: Get vblank ref\n",
                                 __func__, new_state->base.crtc->base.id);
        } else if (old_vrr_active && !new_vrr_active) {
                /* Transition VRR active -> inactive:
@@ -9209,7 +9209,7 @@ static void amdgpu_dm_handle_vrr_transition(struct dm_crtc_state *old_state,
                 */
                WARN_ON(amdgpu_dm_crtc_set_vupdate_irq(new_state->base.crtc, false) != 0);
                drm_crtc_vblank_put(new_state->base.crtc);
-               DRM_DEBUG_DRIVER("%s: crtc=%u VRR on->off: Drop vblank ref\n",
+               drm_dbg_driver(new_state->base.crtc->dev, "%s: crtc=%u VRR on->off: Drop vblank ref\n",
                                 __func__, new_state->base.crtc->base.id);
        }
 }
@@ -10836,6 +10836,7 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm,
        struct dm_atomic_state *dm_state = NULL;
        struct dm_crtc_state *dm_old_crtc_state, *dm_new_crtc_state;
        struct dc_stream_state *new_stream;
+       struct amdgpu_device *adev = dm->adev;
        int ret = 0;
 
        /*
@@ -10889,7 +10890,7 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm,
                 */
 
                if (!new_stream) {
-                       DRM_DEBUG_DRIVER("%s: Failed to create new stream for crtc %d\n",
+                       drm_dbg_driver(adev_to_drm(adev), "%s: Failed to create new stream for crtc %d\n",
                                        __func__, acrtc->base.base.id);
                        ret = -ENOMEM;
                        goto fail;
@@ -10927,7 +10928,7 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm,
                    dc_is_stream_unchanged(new_stream, dm_old_crtc_state->stream) &&
                    dc_is_stream_scaling_unchanged(new_stream, dm_old_crtc_state->stream)) {
                        new_crtc_state->mode_changed = false;
-                       DRM_DEBUG_DRIVER("Mode change not required, setting mode_changed to %d",
+                       drm_dbg_driver(adev_to_drm(adev), "Mode change not required, setting mode_changed to %d",
                                         new_crtc_state->mode_changed);
                }
        }
@@ -10965,7 +10966,7 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm,
                    is_timing_unchanged_for_freesync(new_crtc_state,
                                                     old_crtc_state)) {
                        new_crtc_state->mode_changed = false;
-                       DRM_DEBUG_DRIVER(
+                       drm_dbg_driver(adev_to_drm(adev),
                                "Mode change not required for front porch change, setting mode_changed to %d",
                                new_crtc_state->mode_changed);
 
@@ -10986,7 +10987,7 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm,
                if (ret)
                        goto fail;
 
-               DRM_DEBUG_DRIVER("Disabling DRM crtc: %d\n",
+               drm_dbg_driver(adev_to_drm(adev), "Disabling DRM crtc: %d\n",
                                crtc->base.id);
 
                /* i.e. reset mode */