Commit 5d4b05dd authored by Bhawanpreet Lakha's avatar Bhawanpreet Lakha Committed by Alex Deucher
Browse files

drm/amd/display: Add Dynamic debug prints



Created Macros for DC_LOG_XXX to pr_debug() & DRM_DEBUG_KMS.

Signed-off-by: default avatarBhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Reviewed-by: default avatarHarry Wentland <Harry.Wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 63bd5444
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -433,11 +433,6 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)

	init_data.dce_environment = DCE_ENV_PRODUCTION_DRV;

	if (amdgpu_dc_log)
		init_data.log_mask = DC_DEFAULT_LOG_MASK;
	else
		init_data.log_mask = DC_MIN_LOG_MASK;

	/*
	 * TODO debug why this doesn't work on Raven
	 */
+8 −12
Original line number Diff line number Diff line
@@ -36,8 +36,9 @@
#include "hw_sequencer.h"

#include "resource.h"
#define DC_LOGGER \
	logger

#define DC_LOGGER_INIT(logger)


#define SURFACE_TRACE(...) do {\
		if (dc->debug.surface_trace) \
@@ -60,8 +61,7 @@ void pre_surface_trace(
		int surface_count)
{
	int i;
	struct dc  *core_dc = dc;
	struct dal_logger *logger =  core_dc->ctx->logger;
	DC_LOGGER_INIT(dc->ctx->logger);

	for (i = 0; i < surface_count; i++) {
		const struct dc_plane_state *plane_state = plane_states[i];
@@ -183,8 +183,7 @@ void update_surface_trace(
		int surface_count)
{
	int i;
	struct dc  *core_dc = dc;
	struct dal_logger *logger =  core_dc->ctx->logger;
	DC_LOGGER_INIT(dc->ctx->logger);

	for (i = 0; i < surface_count; i++) {
		const struct dc_surface_update *update = &updates[i];
@@ -304,8 +303,7 @@ void update_surface_trace(

void post_surface_trace(struct dc *dc)
{
	struct dc  *core_dc = dc;
	struct dal_logger *logger =  core_dc->ctx->logger;
	DC_LOGGER_INIT(dc->ctx->logger);

	SURFACE_TRACE("post surface process.\n");

@@ -317,10 +315,10 @@ void context_timing_trace(
{
	int i;
	struct dc  *core_dc = dc;
	struct dal_logger *logger =  core_dc->ctx->logger;
	int h_pos[MAX_PIPES], v_pos[MAX_PIPES];
	struct crtc_position position;
	unsigned int underlay_idx = core_dc->res_pool->underlay_pipe_index;
	DC_LOGGER_INIT(dc->ctx->logger);


	for (i = 0; i < core_dc->res_pool->pipe_count; i++) {
@@ -355,9 +353,7 @@ void context_clock_trace(
		struct dc_state *context)
{
#if defined(CONFIG_DRM_AMD_DC_DCN1_0)
	struct dc  *core_dc = dc;
	struct dal_logger *logger =  core_dc->ctx->logger;

	DC_LOGGER_INIT(dc->ctx->logger);
	CLOCK_TRACE("Current: dispclk_khz:%d  max_dppclk_khz:%d  dcfclk_khz:%d\n"
			"dcfclk_deep_sleep_khz:%d  fclk_khz:%d  socclk_khz:%d\n",
			context->bw.dcn.calc_clk.dispclk_khz,
+11 −8
Original line number Diff line number Diff line
@@ -45,8 +45,9 @@
#include "dce/dce_11_0_d.h"
#include "dce/dce_11_0_enum.h"
#include "dce/dce_11_0_sh_mask.h"
#define DC_LOGGER \
	dc_ctx->logger

#define DC_LOGGER_INIT(logger)


#define LINK_INFO(...) \
	DC_LOG_HW_HOTPLUG(  \
@@ -561,7 +562,7 @@ bool dc_link_detect(struct dc_link *link, enum dc_detect_reason reason)
	struct dc_context *dc_ctx = link->ctx;
	struct dc_sink *sink = NULL;
	enum dc_connection_type new_connection_type = dc_connection_none;

	DC_LOGGER_INIT(link->ctx->logger);
	if (link->connector_signal == SIGNAL_TYPE_VIRTUAL)
		return false;

@@ -927,6 +928,7 @@ static bool construct(
	struct integrated_info info = {{{ 0 }}};
	struct dc_bios *bios = init_params->dc->ctx->dc_bios;
	const struct dc_vbios_funcs *bp_funcs = bios->funcs;
	DC_LOGGER_INIT(dc_ctx->logger);

	link->irq_source_hpd = DC_IRQ_SOURCE_INVALID;
	link->irq_source_hpd_rx = DC_IRQ_SOURCE_INVALID;
@@ -1135,7 +1137,8 @@ static void dpcd_configure_panel_mode(
{
	union dpcd_edp_config edp_config_set;
	bool panel_mode_edp = false;
	struct dc_context *dc_ctx = link->ctx;
	DC_LOGGER_INIT(link->ctx->logger);

	memset(&edp_config_set, '\0', sizeof(union dpcd_edp_config));

	if (DP_PANEL_MODE_DEFAULT != panel_mode) {
@@ -1968,10 +1971,10 @@ bool dc_link_set_backlight_level(const struct dc_link *link, uint32_t level,
	struct dc  *core_dc = link->ctx->dc;
	struct abm *abm = core_dc->res_pool->abm;
	struct dmcu *dmcu = core_dc->res_pool->dmcu;
	struct dc_context *dc_ctx = link->ctx;
	unsigned int controller_id = 0;
	bool use_smooth_brightness = true;
	int i;
	DC_LOGGER_INIT(link->ctx->logger);

	if ((dmcu == NULL) ||
		(abm == NULL) ||
@@ -2154,8 +2157,8 @@ static enum dc_status allocate_mst_payload(struct pipe_ctx *pipe_ctx)
	struct fixed31_32 avg_time_slots_per_mtp;
	struct fixed31_32 pbn;
	struct fixed31_32 pbn_per_slot;
	struct dc_context *dc_ctx = link->ctx;
	uint8_t i;
	DC_LOGGER_INIT(link->ctx->logger);

	/* enable_link_dp_mst already check link->enabled_stream_count
	 * and stream is in link->stream[]. This is called during set mode,
@@ -2234,7 +2237,7 @@ static enum dc_status deallocate_mst_payload(struct pipe_ctx *pipe_ctx)
	struct fixed31_32 avg_time_slots_per_mtp = dal_fixed31_32_from_int(0);
	uint8_t i;
	bool mst_mode = (link->type == dc_connection_mst_branch);
	struct dc_context *dc_ctx = link->ctx;
	DC_LOGGER_INIT(link->ctx->logger);

	/* deallocate_mst_payload is called before disable link. When mode or
	 * disable/enable monitor, new stream is created which is not in link
@@ -2307,8 +2310,8 @@ void core_link_enable_stream(
		struct pipe_ctx *pipe_ctx)
{
	struct dc  *core_dc = pipe_ctx->stream->ctx->dc;
	struct dc_context *dc_ctx = pipe_ctx->stream->ctx;
	enum dc_status status;
	DC_LOGGER_INIT(pipe_ctx->stream->ctx->logger);

	/* eDP lit up by bios already, no need to enable again. */
	if (pipe_ctx->stream->signal == SIGNAL_TYPE_EDP &&
+4 −3
Original line number Diff line number Diff line
@@ -45,8 +45,9 @@
#include "dcn10/dcn10_resource.h"
#endif
#include "dce120/dce120_resource.h"
#define DC_LOGGER \
	ctx->logger

#define DC_LOGGER_INIT(logger)

enum dce_version resource_parse_asic_id(struct hw_asic_id asic_id)
{
	enum dce_version dc_version = DCE_VERSION_UNKNOWN;
@@ -835,7 +836,7 @@ bool resource_build_scaling_params(struct pipe_ctx *pipe_ctx)
	struct dc_crtc_timing *timing = &pipe_ctx->stream->timing;
	struct view recout_skip = { 0 };
	bool res = false;
	struct dc_context *ctx = pipe_ctx->stream->ctx;
	DC_LOGGER_INIT(pipe_ctx->stream->ctx->logger);
	/* Important: scaling ratio calculation requires pixel format,
	 * lb depth calculation requires recout and taps require scaling ratios.
	 * Inits require viewport, taps, ratios and recout of split pipe
+5 −4
Original line number Diff line number Diff line
@@ -33,8 +33,9 @@

#define CTX \
	aud->base.ctx
#define DC_LOGGER \
	aud->base.ctx->logger

#define DC_LOGGER_INIT()

#define REG(reg)\
	(aud->regs->reg)

@@ -348,8 +349,8 @@ static void set_audio_latency(

void dce_aud_az_enable(struct audio *audio)
{
	struct dce_audio *aud = DCE_AUD(audio);
	uint32_t value = AZ_REG_READ(AZALIA_F0_CODEC_PIN_CONTROL_HOT_PLUG_CONTROL);
	DC_LOGGER_INIT();

	set_reg_field_value(value, 1,
			    AZALIA_F0_CODEC_PIN_CONTROL_HOT_PLUG_CONTROL,
@@ -371,7 +372,7 @@ void dce_aud_az_enable(struct audio *audio)
void dce_aud_az_disable(struct audio *audio)
{
	uint32_t value;
	struct dce_audio *aud = DCE_AUD(audio);
	DC_LOGGER_INIT();

	value = AZ_REG_READ(AZALIA_F0_CODEC_PIN_CONTROL_HOT_PLUG_CONTROL);
	set_reg_field_value(value, 1,
Loading