Skip to content

Commit 59fb2d0

Browse files
Sung Leealexdeucher
authored andcommitted
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: Alvin Lee <[email protected]> Signed-off-by: Sung Lee <[email protected]> Signed-off-by: Tom Chung <[email protected]> Tested-by: Daniel Wheeler <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent abc0ad6 commit 59fb2d0

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

drivers/gpu/drm/amd/display/dc/clk_mgr/dcn401/dcn401_clk_mgr.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,6 +1345,20 @@ static void dcn401_set_hard_min_memclk(struct clk_mgr *clk_mgr_base, bool curren
13451345
dcn401_execute_block_sequence(clk_mgr_base, num_steps);
13461346
}
13471347

1348+
static int dcn401_get_hard_min_memclk(struct clk_mgr *clk_mgr_base)
1349+
{
1350+
struct clk_mgr_internal *clk_mgr = TO_CLK_MGR_INTERNAL(clk_mgr_base);
1351+
1352+
return clk_mgr->base.ctx->dc->current_state->bw_ctx.bw.dcn.clk.dramclk_khz;
1353+
}
1354+
1355+
static int dcn401_get_hard_min_fclk(struct clk_mgr *clk_mgr_base)
1356+
{
1357+
struct clk_mgr_internal *clk_mgr = TO_CLK_MGR_INTERNAL(clk_mgr_base);
1358+
1359+
return clk_mgr->base.ctx->dc->current_state->bw_ctx.bw.dcn.clk.fclk_khz;
1360+
}
1361+
13481362
/* Get current memclk states, update bounding box */
13491363
static void dcn401_get_memclk_states_from_smu(struct clk_mgr *clk_mgr_base)
13501364
{
@@ -1478,6 +1492,8 @@ static struct clk_mgr_funcs dcn401_funcs = {
14781492
.enable_pme_wa = dcn401_enable_pme_wa,
14791493
.is_smu_present = dcn401_is_smu_present,
14801494
.get_dispclk_from_dentist = dcn401_get_dispclk_from_dentist,
1495+
.get_hard_min_memclk = dcn401_get_hard_min_memclk,
1496+
.get_hard_min_fclk = dcn401_get_hard_min_fclk,
14811497
};
14821498

14831499
struct clk_mgr_internal *dcn401_clk_mgr_construct(

drivers/gpu/drm/amd/display/dc/core/dc.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5507,6 +5507,11 @@ bool dc_set_ips_disable(struct dc *dc, unsigned int disable_ips)
55075507

55085508
void dc_allow_idle_optimizations_internal(struct dc *dc, bool allow, char const *caller_name)
55095509
{
5510+
int idle_fclk_khz = 0, idle_dramclk_khz = 0, i = 0;
5511+
enum mall_stream_type subvp_pipe_type[MAX_PIPES] = {0};
5512+
struct pipe_ctx *pipe = NULL;
5513+
struct dc_state *context = dc->current_state;
5514+
55105515
if (dc->debug.disable_idle_power_optimizations) {
55115516
DC_LOG_DEBUG("%s: disabled\n", __func__);
55125517
return;
@@ -5531,6 +5536,23 @@ void dc_allow_idle_optimizations_internal(struct dc *dc, bool allow, char const
55315536
dc->idle_optimizations_allowed = allow;
55325537
DC_LOG_DEBUG("%s: %s\n", __func__, allow ? "enabled" : "disabled");
55335538
}
5539+
5540+
// log idle clocks and sub vp pipe types at idle optimization time
5541+
if (dc->clk_mgr != NULL && dc->clk_mgr->funcs->get_hard_min_fclk)
5542+
idle_fclk_khz = dc->clk_mgr->funcs->get_hard_min_fclk(dc->clk_mgr);
5543+
5544+
if (dc->clk_mgr != NULL && dc->clk_mgr->funcs->get_hard_min_memclk)
5545+
idle_dramclk_khz = dc->clk_mgr->funcs->get_hard_min_memclk(dc->clk_mgr);
5546+
5547+
for (i = 0; i < dc->res_pool->pipe_count; i++) {
5548+
pipe = &context->res_ctx.pipe_ctx[i];
5549+
subvp_pipe_type[i] = dc_state_get_pipe_subvp_type(context, pipe);
5550+
}
5551+
5552+
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",
5553+
__func__, allow, idle_fclk_khz, idle_dramclk_khz, subvp_pipe_type[0], subvp_pipe_type[1], subvp_pipe_type[2],
5554+
subvp_pipe_type[3], subvp_pipe_type[4], subvp_pipe_type[5], caller_name);
5555+
55345556
}
55355557

55365558
void dc_exit_ips_for_hw_access_internal(struct dc *dc, const char *caller_name)

drivers/gpu/drm/amd/display/dc/inc/hw/clk_mgr.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,9 @@ struct clk_mgr_funcs {
306306
*/
307307
void (*set_hard_min_memclk)(struct clk_mgr *clk_mgr, bool current_mode);
308308

309+
int (*get_hard_min_memclk)(struct clk_mgr *clk_mgr);
310+
int (*get_hard_min_fclk)(struct clk_mgr *clk_mgr);
311+
309312
/* Send message to PMFW to set hard max memclk frequency to highest DPM */
310313
void (*set_hard_max_memclk)(struct clk_mgr *clk_mgr);
311314

0 commit comments

Comments
 (0)