Commit 59fb2d06 authored by Sung Lee's avatar Sung Lee Committed by Alex Deucher
Browse files

drm/amd/display: Log Hard Min Clocks and Phantom Pipe Status



[WHY]
On entering/exiting idle power, certain parameters would be
very useful to know for power profiling purposes.

[HOW]
This commit adds certain hard min clocks and pipe types
to log output on idle optimization enter/exit.

Reviewed-by: default avatarAlvin Lee <alvin.lee2@amd.com>
Signed-off-by: default avatarSung Lee <Sung.Lee@amd.com>
Signed-off-by: default avatarTom Chung <chiahsuan.chung@amd.com>
Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent abc0ad6d
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -1345,6 +1345,20 @@ static void dcn401_set_hard_min_memclk(struct clk_mgr *clk_mgr_base, bool curren
	dcn401_execute_block_sequence(clk_mgr_base,	num_steps);
}

static int dcn401_get_hard_min_memclk(struct clk_mgr *clk_mgr_base)
{
	struct clk_mgr_internal *clk_mgr = TO_CLK_MGR_INTERNAL(clk_mgr_base);

	return clk_mgr->base.ctx->dc->current_state->bw_ctx.bw.dcn.clk.dramclk_khz;
}

static int dcn401_get_hard_min_fclk(struct clk_mgr *clk_mgr_base)
{
	struct clk_mgr_internal *clk_mgr = TO_CLK_MGR_INTERNAL(clk_mgr_base);

	return clk_mgr->base.ctx->dc->current_state->bw_ctx.bw.dcn.clk.fclk_khz;
}

/* Get current memclk states, update bounding box */
static void dcn401_get_memclk_states_from_smu(struct clk_mgr *clk_mgr_base)
{
@@ -1478,6 +1492,8 @@ static struct clk_mgr_funcs dcn401_funcs = {
		.enable_pme_wa = dcn401_enable_pme_wa,
		.is_smu_present = dcn401_is_smu_present,
		.get_dispclk_from_dentist = dcn401_get_dispclk_from_dentist,
		.get_hard_min_memclk = dcn401_get_hard_min_memclk,
		.get_hard_min_fclk = dcn401_get_hard_min_fclk,
};

struct clk_mgr_internal *dcn401_clk_mgr_construct(
+22 −0
Original line number Diff line number Diff line
@@ -5507,6 +5507,11 @@ bool dc_set_ips_disable(struct dc *dc, unsigned int disable_ips)

void dc_allow_idle_optimizations_internal(struct dc *dc, bool allow, char const *caller_name)
{
	int idle_fclk_khz = 0, idle_dramclk_khz = 0, i = 0;
	enum mall_stream_type subvp_pipe_type[MAX_PIPES] = {0};
	struct pipe_ctx *pipe = NULL;
	struct dc_state *context = dc->current_state;

	if (dc->debug.disable_idle_power_optimizations) {
		DC_LOG_DEBUG("%s: disabled\n", __func__);
		return;
@@ -5531,6 +5536,23 @@ void dc_allow_idle_optimizations_internal(struct dc *dc, bool allow, char const
		dc->idle_optimizations_allowed = allow;
		DC_LOG_DEBUG("%s: %s\n", __func__, allow ? "enabled" : "disabled");
	}

	// log idle clocks and sub vp pipe types at idle optimization time
	if (dc->clk_mgr != NULL && dc->clk_mgr->funcs->get_hard_min_fclk)
		idle_fclk_khz = dc->clk_mgr->funcs->get_hard_min_fclk(dc->clk_mgr);

	if (dc->clk_mgr != NULL && dc->clk_mgr->funcs->get_hard_min_memclk)
		idle_dramclk_khz = dc->clk_mgr->funcs->get_hard_min_memclk(dc->clk_mgr);

	for (i = 0; i < dc->res_pool->pipe_count; i++) {
		pipe = &context->res_ctx.pipe_ctx[i];
		subvp_pipe_type[i] = dc_state_get_pipe_subvp_type(context, pipe);
	}

	DC_LOG_DC("%s: allow_idle=%d\n HardMinUClk_Khz=%d HardMinDramclk_Khz=%d\n Pipe_0=%d Pipe_1=%d Pipe_2=%d Pipe_3=%d Pipe_4=%d Pipe_5=%d (caller=%s)\n",
			__func__, allow, idle_fclk_khz, idle_dramclk_khz, subvp_pipe_type[0], subvp_pipe_type[1], subvp_pipe_type[2],
			subvp_pipe_type[3], subvp_pipe_type[4], subvp_pipe_type[5], caller_name);

}

void dc_exit_ips_for_hw_access_internal(struct dc *dc, const char *caller_name)
+3 −0
Original line number Diff line number Diff line
@@ -306,6 +306,9 @@ struct clk_mgr_funcs {
	 */
	void (*set_hard_min_memclk)(struct clk_mgr *clk_mgr, bool current_mode);

	int (*get_hard_min_memclk)(struct clk_mgr *clk_mgr);
	int (*get_hard_min_fclk)(struct clk_mgr *clk_mgr);

	/* Send message to PMFW to set hard max memclk frequency to highest DPM */
	void (*set_hard_max_memclk)(struct clk_mgr *clk_mgr);