From dac4c2eb4fe667f569ed7ddea9c43382fd88f4eb Mon Sep 17 00:00:00 2001 From: Harry Wentland Date: Tue, 12 Sep 2017 20:04:48 -0400 Subject: [PATCH 2403/4131] drm/amd/display: Reduce DC chattiness Log DC init but default log level to 0 (default for amdgpu_dc_log) otherwise. Bug reporters can still make DC more chatty by using the dc_log module param. amdgpu.dc_log = 1 v2: Only provide runtime option, no compile time config Change-Id: I2443c67546ced94531026bfe06533a4db51e8a73 Signed-off-by: Harry Wentland Acked-by: Alex Deucher --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 74 ++++++++++++---------- drivers/gpu/drm/amd/display/include/logger_types.h | 3 + 2 files changed, 42 insertions(+), 35 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 0dfbc8e..339c3fef 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -378,7 +378,6 @@ static int amdgpu_dm_init(struct amdgpu_device *adev) adev->dm.ddev = adev->ddev; adev->dm.adev = adev; - DRM_INFO("DAL is enabled\n"); /* Zero all the fields */ memset(&init_data, 0, sizeof(init_data)); @@ -418,7 +417,10 @@ static int amdgpu_dm_init(struct amdgpu_device *adev) init_data.dce_environment = DCE_ENV_PRODUCTION_DRV; - init_data.log_mask = DC_DEFAULT_LOG_MASK; + if (amdgpu_dc_log) + init_data.log_mask = DC_DEFAULT_LOG_MASK; + else + init_data.log_mask = DC_MIN_LOG_MASK; #ifdef ENABLE_FBC if (adev->family == FAMILY_CZ) @@ -428,7 +430,9 @@ static int amdgpu_dm_init(struct amdgpu_device *adev) /* Display Core create. */ adev->dm.dc = dc_create(&init_data); - if (!adev->dm.dc) + if (adev->dm.dc) + DRM_INFO("Display Core initialized!\n"); + else DRM_INFO("Display Core failed to initialize!\n"); INIT_WORK(&adev->dm.mst_hotplug_work, hotplug_notify_work_func); @@ -438,7 +442,7 @@ static int amdgpu_dm_init(struct amdgpu_device *adev) DRM_ERROR( "amdgpu: failed to initialize freesync_module.\n"); } else - DRM_INFO("amdgpu: freesync_module init done %p.\n", + DRM_DEBUG_DRIVER("amdgpu: freesync_module init done %p.\n", adev->dm.freesync_module); if (amdgpu_dm_initialize_drm_device(adev)) { @@ -462,7 +466,7 @@ static int amdgpu_dm_init(struct amdgpu_device *adev) goto error; } - DRM_INFO("KMS initialized.\n"); + DRM_DEBUG_DRIVER("KMS initialized.\n"); return 0; error: @@ -515,7 +519,7 @@ static int detect_mst_link_for_all_connectors(struct drm_device *dev) list_for_each_entry(connector, &dev->mode_config.connector_list, head) { aconnector = to_amdgpu_dm_connector(connector); if (aconnector->dc_link->type == dc_connection_mst_branch) { - DRM_INFO("DM_MST: starting TM on aconnector: %p [id: %d]\n", + DRM_DEBUG_DRIVER("DM_MST: starting TM on aconnector: %p [id: %d]\n", aconnector, aconnector->base.base.id); ret = drm_dp_mst_topology_mgr_set_mst(&aconnector->mst_mgr, true); @@ -844,12 +848,12 @@ amdgpu_dm_update_connector_after_detect(struct amdgpu_dm_connector *aconnector) if (aconnector->dc_sink == sink) { /* We got a DP short pulse (Link Loss, DP CTS, etc...). * Do nothing!! */ - DRM_INFO("DCHPD: connector_id=%d: dc_sink didn't change.\n", + DRM_DEBUG_DRIVER("DCHPD: connector_id=%d: dc_sink didn't change.\n", aconnector->connector_id); return; } - DRM_INFO("DCHPD: connector_id=%d: Old sink=%p New sink=%p\n", + DRM_DEBUG_DRIVER("DCHPD: connector_id=%d: Old sink=%p New sink=%p\n", aconnector->connector_id, aconnector->dc_sink, sink); mutex_lock(&dev->mode_config.mutex); @@ -951,7 +955,7 @@ static void dm_handle_hpd_rx_irq(struct amdgpu_dm_connector *aconnector) process_count++; - DRM_DEBUG_KMS("ESI %02x %02x %02x\n", esi[0], esi[1], esi[2]); + DRM_DEBUG_DRIVER("ESI %02x %02x %02x\n", esi[0], esi[1], esi[2]); /* handle HPD short pulse irq */ if (aconnector->mst_mgr.mst_state) drm_dp_mst_hpd_irq( @@ -989,7 +993,7 @@ static void dm_handle_hpd_rx_irq(struct amdgpu_dm_connector *aconnector) } if (process_count == max_process_count) - DRM_DEBUG_KMS("Loop exceeded max iterations\n"); + DRM_DEBUG_DRIVER("Loop exceeded max iterations\n"); } static void handle_hpd_rx_irq(void *param) @@ -1322,7 +1326,7 @@ amdgpu_dm_register_backlight_device(struct amdgpu_display_manager *dm) if (NULL == dm->backlight_dev) DRM_ERROR("DM: Backlight registration failed!\n"); else - DRM_INFO("DM: Registered Backlight device: %s\n", bl_name); + DRM_DEBUG_DRIVER("DM: Registered Backlight device: %s\n", bl_name); } #endif @@ -2072,7 +2076,7 @@ static void update_stream_scaling_settings(const struct drm_display_mode *mode, stream->src = src; stream->dst = dst; - DRM_DEBUG_KMS("Destination Rectangle x:%d y:%d width:%d height:%d\n", + DRM_DEBUG_DRIVER("Destination Rectangle x:%d y:%d width:%d height:%d\n", dst.x, dst.y, dst.width, dst.height); } @@ -2381,7 +2385,7 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector, * case, we call set mode ourselves to restore the previous mode * and the modelist may not be filled in in time. */ - DRM_INFO("No preferred mode found\n"); + DRM_DEBUG_DRIVER("No preferred mode found\n"); } else { decide_crtc_timing_for_drm_display_mode( &mode, preferred_mode, @@ -2840,7 +2844,7 @@ static struct drm_encoder *best_encoder(struct drm_connector *connector) struct drm_mode_object *obj; struct drm_encoder *encoder; - DRM_DEBUG_KMS("Finding the best encoder\n"); + DRM_DEBUG_DRIVER("Finding the best encoder\n"); /* pick the encoder ids */ if (enc_id) { @@ -3117,7 +3121,7 @@ static int dm_plane_helper_prepare_fb(struct drm_plane *plane, dm_plane_state_new = to_dm_plane_state(new_state); if (!new_state->fb) { - DRM_DEBUG_KMS("No FB bound\n"); + DRM_DEBUG_DRIVER("No FB bound\n"); return 0; } @@ -3663,7 +3667,7 @@ static int amdgpu_dm_connector_init(struct amdgpu_display_manager *dm, struct amdgpu_i2c_adapter *i2c; ((struct dc_link *)link)->priv = aconnector; - DRM_DEBUG_KMS("%s()\n", __func__); + DRM_DEBUG_DRIVER("%s()\n", __func__); i2c = create_i2c(link->ddc, link->link_index, &res); aconnector->i2c = i2c; @@ -3900,11 +3904,11 @@ static void handle_cursor_update(struct drm_plane *plane, if (!plane->state->fb && !old_plane_state->fb) return; - DRM_DEBUG_KMS("%s: crtc_id=%d with size %d to %d\n", - __func__, - amdgpu_crtc->crtc_id, - plane->state->crtc_w, - plane->state->crtc_h); + DRM_DEBUG_DRIVER("%s: crtc_id=%d with size %d to %d\n", + __func__, + amdgpu_crtc->crtc_id, + plane->state->crtc_w, + plane->state->crtc_h); ret = get_cursor_position(plane, crtc, &position); if (ret) @@ -4219,7 +4223,7 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state) old_acrtc_state = to_dm_crtc_state(old_crtc_state); #if !defined(OS_NAME_RHEL_7_2) - DRM_DEBUG_KMS( + DRM_DEBUG_DRIVER( "amdgpu_crtc id:%d crtc_state_flags: enable:%d, active:%d, " "planes_changed:%d, mode_changed:%d,active_changed:%d," "connectors_changed:%d\n", @@ -4238,7 +4242,7 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state) if (modeset_required(new_state, new_acrtc_state->stream, old_acrtc_state->stream)) { - DRM_INFO("Atomic commit: SET crtc id %d: [%p]\n", acrtc->crtc_id, acrtc); + DRM_DEBUG_DRIVER("Atomic commit: SET crtc id %d: [%p]\n", acrtc->crtc_id, acrtc); if (!new_acrtc_state->stream) { /* @@ -4256,7 +4260,7 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state) * have a sink to keep the pipe running so that * hw state is consistent with the sw state */ - DRM_DEBUG_KMS("%s: Failed to create new stream for crtc %d\n", + DRM_DEBUG_DRIVER("%s: Failed to create new stream for crtc %d\n", __func__, acrtc->base.base.id); continue; } @@ -4283,7 +4287,7 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state) acrtc->hw_mode = crtc->state->mode; crtc->hwmode = crtc->state->mode; } else if (modereset_required(new_state)) { - DRM_INFO("Atomic commit: RESET. crtc id %d:[%p]\n", acrtc->crtc_id, acrtc); + DRM_DEBUG_DRIVER("Atomic commit: RESET. crtc id %d:[%p]\n", acrtc->crtc_id, acrtc); /* i.e. reset mode */ if (old_acrtc_state->stream) @@ -4308,7 +4312,7 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state) &new_crtcs[i]->base, false); if (!aconnector) { - DRM_INFO("Atomic commit: Failed to find connector for acrtc id:%d " + DRM_DEBUG_DRIVER("Atomic commit: Failed to find connector for acrtc id:%d " "skipping freesync init\n", new_crtcs[i]->crtc_id); continue; @@ -4620,7 +4624,7 @@ static int dm_update_crtcs_state(struct dc *dc, */ if (!new_stream) { - DRM_DEBUG_KMS("%s: Failed to create new stream for crtc %d\n", + DRM_DEBUG_DRIVER("%s: Failed to create new stream for crtc %d\n", __func__, acrtc->base.base.id); break; } @@ -4631,7 +4635,7 @@ static int dm_update_crtcs_state(struct dc *dc, crtc_state->mode_changed = false; - DRM_DEBUG_KMS("Mode change not required, setting mode_changed to %d", + DRM_DEBUG_DRIVER("Mode change not required, setting mode_changed to %d", crtc_state->mode_changed); } @@ -4640,7 +4644,7 @@ static int dm_update_crtcs_state(struct dc *dc, goto next_crtc; #if !defined(OS_NAME_RHEL_7_2) - DRM_DEBUG_KMS( + DRM_DEBUG_DRIVER( "amdgpu_crtc id:%d crtc_state_flags: enable:%d, active:%d, " "planes_changed:%d, mode_changed:%d,active_changed:%d," "connectors_changed:%d\n", @@ -4659,7 +4663,7 @@ static int dm_update_crtcs_state(struct dc *dc, if (!old_acrtc_state->stream) goto next_crtc; - DRM_DEBUG_KMS("Disabling DRM crtc: %d\n", + DRM_DEBUG_DRIVER("Disabling DRM crtc: %d\n", crtc->base.id); /* i.e. reset mode */ @@ -4689,7 +4693,7 @@ static int dm_update_crtcs_state(struct dc *dc, new_acrtc_state->stream = new_stream; dc_stream_retain(new_stream); - DRM_DEBUG_KMS("Enabling DRM crtc: %d\n", + DRM_DEBUG_DRIVER("Enabling DRM crtc: %d\n", crtc->base.id); if (!dc_add_stream_to_ctx( @@ -4772,7 +4776,7 @@ static int dm_update_planes_state(struct dc *dc, if (!old_acrtc_state->stream) continue; - DRM_DEBUG_KMS("Disabling DRM plane: %d on DRM crtc %d\n", + DRM_DEBUG_DRIVER("Disabling DRM plane: %d on DRM crtc %d\n", plane->base.id, old_plane_crtc->base.id); if (!dc_remove_plane_from_context( @@ -4820,7 +4824,7 @@ static int dm_update_planes_state(struct dc *dc, new_dm_plane_state->dc_state = dc_create_plane_state(dc); - DRM_DEBUG_KMS("Enabling DRM plane: %d on DRM crtc %d\n", + DRM_DEBUG_DRIVER("Enabling DRM plane: %d on DRM crtc %d\n", plane->base.id, new_plane_crtc->base.id); if (!new_dm_plane_state->dc_state) { @@ -4979,9 +4983,9 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, fail: if (ret == -EDEADLK) - DRM_DEBUG_KMS("Atomic check stopped due to to deadlock.\n"); + DRM_DEBUG_DRIVER("Atomic check stopped due to to deadlock.\n"); else if (ret == -EINTR || ret == -EAGAIN || ret == -ERESTARTSYS) - DRM_DEBUG_KMS("Atomic check stopped due to to signal.\n"); + DRM_DEBUG_DRIVER("Atomic check stopped due to to signal.\n"); else DRM_ERROR("Atomic check failed with err: %d \n", ret); diff --git a/drivers/gpu/drm/amd/display/include/logger_types.h b/drivers/gpu/drm/amd/display/include/logger_types.h index 044805c..1f22e84 100644 --- a/drivers/gpu/drm/amd/display/include/logger_types.h +++ b/drivers/gpu/drm/amd/display/include/logger_types.h @@ -70,6 +70,9 @@ enum dc_log_type { LOG_SECTION_TOTAL_COUNT }; +#define DC_MIN_LOG_MASK ((1 << LOG_ERROR) | \ + (1 << LOG_DETECTION_EDID_PARSER)) + #define DC_DEFAULT_LOG_MASK ((1 << LOG_ERROR) | \ (1 << LOG_WARNING) | \ (1 << LOG_EVENT_MODE_SET) | \ -- 2.7.4