Commit 730ac573 authored by Tvrtko Ursulin's avatar Tvrtko Ursulin Committed by Alex Deucher

drm/amd/display: Convert some legacy DRM debug macros into appropriate categories

Currently when one enables driver debugging dmesg gets spammed, at I
suspect vblank rate, with messages like:

 [drm:amdgpu_dm_atomic_check [amdgpu]] MPO enablement requested on crtc:[00000000f073c3bb]

Fix if by converting some logging from deprecated and incorrect
DRM_DEBUG_DRIVER to drm_dbg_atomic. Plus some localized drive-by changes
to drm_dbg_kms.

By no means an exhaustive conversion but at least it allows turning on
driver debug selectively.
Signed-off-by: default avatarTvrtko Ursulin <tvrtko.ursulin@igalia.com>
Signed-off-by: default avatarHamza Mahfooz <hamza.mahfooz@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 473af28d
...@@ -2486,13 +2486,13 @@ static int detect_mst_link_for_all_connectors(struct drm_device *dev) ...@@ -2486,13 +2486,13 @@ static int detect_mst_link_for_all_connectors(struct drm_device *dev)
aconnector = to_amdgpu_dm_connector(connector); aconnector = to_amdgpu_dm_connector(connector);
if (aconnector->dc_link->type == dc_connection_mst_branch && if (aconnector->dc_link->type == dc_connection_mst_branch &&
aconnector->mst_mgr.aux) { aconnector->mst_mgr.aux) {
DRM_DEBUG_DRIVER("DM_MST: starting TM on aconnector: %p [id: %d]\n", drm_dbg_kms(dev, "DM_MST: starting TM on aconnector: %p [id: %d]\n",
aconnector, aconnector,
aconnector->base.base.id); aconnector->base.base.id);
ret = drm_dp_mst_topology_mgr_set_mst(&aconnector->mst_mgr, true); ret = drm_dp_mst_topology_mgr_set_mst(&aconnector->mst_mgr, true);
if (ret < 0) { if (ret < 0) {
DRM_ERROR("DM_MST: Failed to start MST\n"); drm_err(dev, "DM_MST: Failed to start MST\n");
aconnector->dc_link->type = aconnector->dc_link->type =
dc_connection_single; dc_connection_single;
ret = dm_helpers_dp_mst_stop_top_mgr(aconnector->dc_link->ctx, ret = dm_helpers_dp_mst_stop_top_mgr(aconnector->dc_link->ctx,
...@@ -3421,14 +3421,14 @@ void amdgpu_dm_update_connector_after_detect( ...@@ -3421,14 +3421,14 @@ void amdgpu_dm_update_connector_after_detect(
* We got a DP short pulse (Link Loss, DP CTS, etc...). * We got a DP short pulse (Link Loss, DP CTS, etc...).
* Do nothing!! * Do nothing!!
*/ */
DRM_DEBUG_DRIVER("DCHPD: connector_id=%d: dc_sink didn't change.\n", drm_dbg_kms(dev, "DCHPD: connector_id=%d: dc_sink didn't change.\n",
aconnector->connector_id); aconnector->connector_id);
if (sink) if (sink)
dc_sink_release(sink); dc_sink_release(sink);
return; return;
} }
DRM_DEBUG_DRIVER("DCHPD: connector_id=%d: Old sink=%p New sink=%p\n", drm_dbg_kms(dev, "DCHPD: connector_id=%d: Old sink=%p New sink=%p\n",
aconnector->connector_id, aconnector->dc_sink, sink); aconnector->connector_id, aconnector->dc_sink, sink);
mutex_lock(&dev->mode_config.mutex); mutex_lock(&dev->mode_config.mutex);
...@@ -9314,7 +9314,9 @@ static void amdgpu_dm_commit_streams(struct drm_atomic_state *state, ...@@ -9314,7 +9314,9 @@ static void amdgpu_dm_commit_streams(struct drm_atomic_state *state,
if (amdgpu_dm_crtc_modeset_required(new_crtc_state, dm_new_crtc_state->stream, dm_old_crtc_state->stream)) { if (amdgpu_dm_crtc_modeset_required(new_crtc_state, dm_new_crtc_state->stream, dm_old_crtc_state->stream)) {
DRM_DEBUG_ATOMIC("Atomic commit: SET crtc id %d: [%p]\n", acrtc->crtc_id, acrtc); drm_dbg_atomic(dev,
"Atomic commit: SET crtc id %d: [%p]\n",
acrtc->crtc_id, acrtc);
if (!dm_new_crtc_state->stream) { if (!dm_new_crtc_state->stream) {
/* /*
...@@ -9332,8 +9334,9 @@ static void amdgpu_dm_commit_streams(struct drm_atomic_state *state, ...@@ -9332,8 +9334,9 @@ static void amdgpu_dm_commit_streams(struct drm_atomic_state *state,
* have a sink to keep the pipe running so that * have a sink to keep the pipe running so that
* hw state is consistent with the sw state * hw state is consistent with the sw state
*/ */
DRM_DEBUG_DRIVER("%s: Failed to create new stream for crtc %d\n", drm_dbg_atomic(dev,
__func__, acrtc->base.base.id); "Failed to create new stream for crtc %d\n",
acrtc->base.base.id);
continue; continue;
} }
...@@ -9347,7 +9350,9 @@ static void amdgpu_dm_commit_streams(struct drm_atomic_state *state, ...@@ -9347,7 +9350,9 @@ static void amdgpu_dm_commit_streams(struct drm_atomic_state *state,
crtc->hwmode = new_crtc_state->mode; crtc->hwmode = new_crtc_state->mode;
mode_set_reset_required = true; mode_set_reset_required = true;
} else if (modereset_required(new_crtc_state)) { } else if (modereset_required(new_crtc_state)) {
DRM_DEBUG_ATOMIC("Atomic commit: RESET. crtc id %d:[%p]\n", acrtc->crtc_id, acrtc); drm_dbg_atomic(dev,
"Atomic commit: RESET. crtc id %d:[%p]\n",
acrtc->crtc_id, acrtc);
/* i.e. reset mode */ /* i.e. reset mode */
if (dm_old_crtc_state->stream) if (dm_old_crtc_state->stream)
remove_stream(adev, acrtc, dm_old_crtc_state->stream); remove_stream(adev, acrtc, dm_old_crtc_state->stream);
...@@ -9802,7 +9807,7 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state) ...@@ -9802,7 +9807,7 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
#endif #endif
if (amdgpu_dm_crtc_configure_crc_source( if (amdgpu_dm_crtc_configure_crc_source(
crtc, dm_new_crtc_state, cur_crc_src)) crtc, dm_new_crtc_state, cur_crc_src))
DRM_DEBUG_DRIVER("Failed to configure crc source"); drm_dbg_atomic(dev, "Failed to configure crc source");
} }
} }
#endif #endif
...@@ -10974,7 +10979,7 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, ...@@ -10974,7 +10979,7 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
ret = drm_atomic_helper_check_modeset(dev, state); ret = drm_atomic_helper_check_modeset(dev, state);
if (ret) { if (ret) {
DRM_DEBUG_DRIVER("drm_atomic_helper_check_modeset() failed\n"); drm_dbg_atomic(dev, "drm_atomic_helper_check_modeset() failed\n");
goto fail; goto fail;
} }
...@@ -10989,7 +10994,7 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, ...@@ -10989,7 +10994,7 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
new_crtc_state = drm_atomic_get_crtc_state(state, new_con_state->crtc); new_crtc_state = drm_atomic_get_crtc_state(state, new_con_state->crtc);
if (IS_ERR(new_crtc_state)) { if (IS_ERR(new_crtc_state)) {
DRM_DEBUG_DRIVER("drm_atomic_get_crtc_state() failed\n"); drm_dbg_atomic(dev, "drm_atomic_get_crtc_state() failed\n");
ret = PTR_ERR(new_crtc_state); ret = PTR_ERR(new_crtc_state);
goto fail; goto fail;
} }
...@@ -11004,7 +11009,7 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, ...@@ -11004,7 +11009,7 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
if (drm_atomic_crtc_needs_modeset(new_crtc_state)) { if (drm_atomic_crtc_needs_modeset(new_crtc_state)) {
ret = add_affected_mst_dsc_crtcs(state, crtc); ret = add_affected_mst_dsc_crtcs(state, crtc);
if (ret) { if (ret) {
DRM_DEBUG_DRIVER("add_affected_mst_dsc_crtcs() failed\n"); drm_dbg_atomic(dev, "add_affected_mst_dsc_crtcs() failed\n");
goto fail; goto fail;
} }
} }
...@@ -11021,7 +11026,7 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, ...@@ -11021,7 +11026,7 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
ret = amdgpu_dm_verify_lut_sizes(new_crtc_state); ret = amdgpu_dm_verify_lut_sizes(new_crtc_state);
if (ret) { if (ret) {
DRM_DEBUG_DRIVER("amdgpu_dm_verify_lut_sizes() failed\n"); drm_dbg_atomic(dev, "amdgpu_dm_verify_lut_sizes() failed\n");
goto fail; goto fail;
} }
...@@ -11030,13 +11035,13 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, ...@@ -11030,13 +11035,13 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
ret = drm_atomic_add_affected_connectors(state, crtc); ret = drm_atomic_add_affected_connectors(state, crtc);
if (ret) { if (ret) {
DRM_DEBUG_DRIVER("drm_atomic_add_affected_connectors() failed\n"); drm_dbg_atomic(dev, "drm_atomic_add_affected_connectors() failed\n");
goto fail; goto fail;
} }
ret = drm_atomic_add_affected_planes(state, crtc); ret = drm_atomic_add_affected_planes(state, crtc);
if (ret) { if (ret) {
DRM_DEBUG_DRIVER("drm_atomic_add_affected_planes() failed\n"); drm_dbg_atomic(dev, "drm_atomic_add_affected_planes() failed\n");
goto fail; goto fail;
} }
...@@ -11075,7 +11080,7 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, ...@@ -11075,7 +11080,7 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
if (IS_ERR(new_plane_state)) { if (IS_ERR(new_plane_state)) {
ret = PTR_ERR(new_plane_state); ret = PTR_ERR(new_plane_state);
DRM_DEBUG_DRIVER("new_plane_state is BAD\n"); drm_dbg_atomic(dev, "new_plane_state is BAD\n");
goto fail; goto fail;
} }
} }
...@@ -11107,7 +11112,7 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, ...@@ -11107,7 +11112,7 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
&lock_and_validation_needed, &lock_and_validation_needed,
&is_top_most_overlay); &is_top_most_overlay);
if (ret) { if (ret) {
DRM_DEBUG_DRIVER("dm_update_plane_state() failed\n"); drm_dbg_atomic(dev, "dm_update_plane_state() failed\n");
goto fail; goto fail;
} }
} }
...@@ -11120,7 +11125,7 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, ...@@ -11120,7 +11125,7 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
false, false,
&lock_and_validation_needed); &lock_and_validation_needed);
if (ret) { if (ret) {
DRM_DEBUG_DRIVER("DISABLE: dm_update_crtc_state() failed\n"); drm_dbg_atomic(dev, "DISABLE: dm_update_crtc_state() failed\n");
goto fail; goto fail;
} }
} }
...@@ -11133,7 +11138,7 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, ...@@ -11133,7 +11138,7 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
true, true,
&lock_and_validation_needed); &lock_and_validation_needed);
if (ret) { if (ret) {
DRM_DEBUG_DRIVER("ENABLE: dm_update_crtc_state() failed\n"); drm_dbg_atomic(dev, "ENABLE: dm_update_crtc_state() failed\n");
goto fail; goto fail;
} }
} }
...@@ -11147,7 +11152,7 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, ...@@ -11147,7 +11152,7 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
&lock_and_validation_needed, &lock_and_validation_needed,
&is_top_most_overlay); &is_top_most_overlay);
if (ret) { if (ret) {
DRM_DEBUG_DRIVER("dm_update_plane_state() failed\n"); drm_dbg_atomic(dev, "dm_update_plane_state() failed\n");
goto fail; goto fail;
} }
} }
...@@ -11163,21 +11168,21 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, ...@@ -11163,21 +11168,21 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
/* Run this here since we want to validate the streams we created */ /* Run this here since we want to validate the streams we created */
ret = drm_atomic_helper_check_planes(dev, state); ret = drm_atomic_helper_check_planes(dev, state);
if (ret) { if (ret) {
DRM_DEBUG_DRIVER("drm_atomic_helper_check_planes() failed\n"); drm_dbg_atomic(dev, "drm_atomic_helper_check_planes() failed\n");
goto fail; goto fail;
} }
for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
dm_new_crtc_state = to_dm_crtc_state(new_crtc_state); dm_new_crtc_state = to_dm_crtc_state(new_crtc_state);
if (dm_new_crtc_state->mpo_requested) if (dm_new_crtc_state->mpo_requested)
DRM_DEBUG_DRIVER("MPO enablement requested on crtc:[%p]\n", crtc); drm_dbg_atomic(dev, "MPO enablement requested on crtc:[%p]\n", crtc);
} }
/* Check cursor planes scaling */ /* Check cursor planes scaling */
for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
ret = dm_check_crtc_cursor(state, crtc, new_crtc_state); ret = dm_check_crtc_cursor(state, crtc, new_crtc_state);
if (ret) { if (ret) {
DRM_DEBUG_DRIVER("dm_check_crtc_cursor() failed\n"); drm_dbg_atomic(dev, "dm_check_crtc_cursor() failed\n");
goto fail; goto fail;
} }
} }
...@@ -11260,13 +11265,13 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, ...@@ -11260,13 +11265,13 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
if (lock_and_validation_needed) { if (lock_and_validation_needed) {
ret = dm_atomic_get_state(state, &dm_state); ret = dm_atomic_get_state(state, &dm_state);
if (ret) { if (ret) {
DRM_DEBUG_DRIVER("dm_atomic_get_state() failed\n"); drm_dbg_atomic(dev, "dm_atomic_get_state() failed\n");
goto fail; goto fail;
} }
ret = do_aquire_global_lock(dev, state); ret = do_aquire_global_lock(dev, state);
if (ret) { if (ret) {
DRM_DEBUG_DRIVER("do_aquire_global_lock() failed\n"); drm_dbg_atomic(dev, "do_aquire_global_lock() failed\n");
goto fail; goto fail;
} }
...@@ -11274,7 +11279,7 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, ...@@ -11274,7 +11279,7 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
if (dc_resource_is_dsc_encoding_supported(dc)) { if (dc_resource_is_dsc_encoding_supported(dc)) {
ret = compute_mst_dsc_configs_for_state(state, dm_state->context, vars); ret = compute_mst_dsc_configs_for_state(state, dm_state->context, vars);
if (ret) { if (ret) {
DRM_DEBUG_DRIVER("compute_mst_dsc_configs_for_state() failed\n"); drm_dbg_atomic(dev, "compute_mst_dsc_configs_for_state() failed\n");
ret = -EINVAL; ret = -EINVAL;
goto fail; goto fail;
} }
...@@ -11283,7 +11288,7 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, ...@@ -11283,7 +11288,7 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
ret = dm_update_mst_vcpi_slots_for_dsc(state, dm_state->context, vars); ret = dm_update_mst_vcpi_slots_for_dsc(state, dm_state->context, vars);
if (ret) { if (ret) {
DRM_DEBUG_DRIVER("dm_update_mst_vcpi_slots_for_dsc() failed\n"); drm_dbg_atomic(dev, "dm_update_mst_vcpi_slots_for_dsc() failed\n");
goto fail; goto fail;
} }
...@@ -11295,12 +11300,12 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, ...@@ -11295,12 +11300,12 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
*/ */
ret = drm_dp_mst_atomic_check(state); ret = drm_dp_mst_atomic_check(state);
if (ret) { if (ret) {
DRM_DEBUG_DRIVER("drm_dp_mst_atomic_check() failed\n"); drm_dbg_atomic(dev, "drm_dp_mst_atomic_check() failed\n");
goto fail; goto fail;
} }
status = dc_validate_global_state(dc, dm_state->context, true); status = dc_validate_global_state(dc, dm_state->context, true);
if (status != DC_OK) { if (status != DC_OK) {
DRM_DEBUG_DRIVER("DC global validation failure: %s (%d)", drm_dbg_atomic(dev, "DC global validation failure: %s (%d)",
dc_status_to_str(status), status); dc_status_to_str(status), status);
ret = -EINVAL; ret = -EINVAL;
goto fail; goto fail;
...@@ -11378,11 +11383,11 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, ...@@ -11378,11 +11383,11 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
fail: fail:
if (ret == -EDEADLK) if (ret == -EDEADLK)
DRM_DEBUG_DRIVER("Atomic check stopped to avoid deadlock.\n"); drm_dbg_atomic(dev, "Atomic check stopped to avoid deadlock.\n");
else if (ret == -EINTR || ret == -EAGAIN || ret == -ERESTARTSYS) else if (ret == -EINTR || ret == -EAGAIN || ret == -ERESTARTSYS)
DRM_DEBUG_DRIVER("Atomic check stopped due to signal.\n"); drm_dbg_atomic(dev, "Atomic check stopped due to signal.\n");
else else
DRM_DEBUG_DRIVER("Atomic check failed with err: %d\n", ret); drm_dbg_atomic(dev, "Atomic check failed with err: %d\n", ret);
trace_amdgpu_dm_atomic_check_finish(state, ret); trace_amdgpu_dm_atomic_check_finish(state, ret);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment