Skip to content

Commit 6a7fd76

Browse files
Sung Leealexdeucher
authored andcommitted
drm/amd/display: Add option to retrieve detile buffer size
[WHY] For better power profiling knowing the detile buffer size at a given point in time would be useful. [HOW] Add interface to retrieve detile buffer from dc state. Cc: Mario Limonciello <[email protected]> Cc: Alex Deucher <[email protected]> Cc: [email protected] Reviewed-by: Aric Cyr <[email protected]> Signed-off-by: Sung Lee <[email protected]> Signed-off-by: Alex Hung <[email protected]> Tested-by: Daniel Wheeler <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 63e7ee6 commit 6a7fd76

File tree

10 files changed

+36
-0
lines changed

10 files changed

+36
-0
lines changed

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6109,3 +6109,21 @@ struct dc_power_profile dc_get_power_profile_for_dc_state(const struct dc_state
61096109
profile.power_level = dc->res_pool->funcs->get_power_profile(context);
61106110
return profile;
61116111
}
6112+
6113+
/*
6114+
**********************************************************************************
6115+
* dc_get_det_buffer_size_from_state() - extracts detile buffer size from dc state
6116+
*
6117+
* Called when DM wants to log detile buffer size from dc_state
6118+
*
6119+
**********************************************************************************
6120+
*/
6121+
unsigned int dc_get_det_buffer_size_from_state(const struct dc_state *context)
6122+
{
6123+
struct dc *dc = context->clk_mgr->ctx->dc;
6124+
6125+
if (dc->res_pool->funcs->get_det_buffer_size)
6126+
return dc->res_pool->funcs->get_det_buffer_size(context);
6127+
else
6128+
return 0;
6129+
}

drivers/gpu/drm/amd/display/dc/dc.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2550,6 +2550,8 @@ struct dc_power_profile {
25502550

25512551
struct dc_power_profile dc_get_power_profile_for_dc_state(const struct dc_state *context);
25522552

2553+
unsigned int dc_get_det_buffer_size_from_state(const struct dc_state *context);
2554+
25532555
/* DSC Interfaces */
25542556
#include "dc_dsc.h"
25552557

drivers/gpu/drm/amd/display/dc/inc/core_types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ struct resource_funcs {
219219
* Get indicator of power from a context that went through full validation
220220
*/
221221
int (*get_power_profile)(const struct dc_state *context);
222+
unsigned int (*get_det_buffer_size)(const struct dc_state *context);
222223
};
223224

224225
struct audio_support{

drivers/gpu/drm/amd/display/dc/resource/dcn31/dcn31_resource.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1720,6 +1720,12 @@ int dcn31_populate_dml_pipes_from_context(
17201720
return pipe_cnt;
17211721
}
17221722

1723+
unsigned int dcn31_get_det_buffer_size(
1724+
const struct dc_state *context)
1725+
{
1726+
return context->bw_ctx.dml.ip.det_buffer_size_kbytes;
1727+
}
1728+
17231729
void dcn31_calculate_wm_and_dlg(
17241730
struct dc *dc, struct dc_state *context,
17251731
display_e2e_pipe_params_st *pipes,
@@ -1842,6 +1848,7 @@ static struct resource_funcs dcn31_res_pool_funcs = {
18421848
.update_bw_bounding_box = dcn31_update_bw_bounding_box,
18431849
.patch_unknown_plane_state = dcn20_patch_unknown_plane_state,
18441850
.get_panel_config_defaults = dcn31_get_panel_config_defaults,
1851+
.get_det_buffer_size = dcn31_get_det_buffer_size,
18451852
};
18461853

18471854
static struct clock_source *dcn30_clock_source_create(

drivers/gpu/drm/amd/display/dc/resource/dcn31/dcn31_resource.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ struct resource_pool *dcn31_create_resource_pool(
6363
const struct dc_init_data *init_data,
6464
struct dc *dc);
6565

66+
unsigned int dcn31_get_det_buffer_size(
67+
const struct dc_state *context);
68+
6669
/*temp: B0 specific before switch to dcn313 headers*/
6770
#ifndef regPHYPLLF_PIXCLK_RESYNC_CNTL
6871
#define regPHYPLLF_PIXCLK_RESYNC_CNTL 0x007e

drivers/gpu/drm/amd/display/dc/resource/dcn314/dcn314_resource.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1777,6 +1777,7 @@ static struct resource_funcs dcn314_res_pool_funcs = {
17771777
.patch_unknown_plane_state = dcn20_patch_unknown_plane_state,
17781778
.get_panel_config_defaults = dcn314_get_panel_config_defaults,
17791779
.get_preferred_eng_id_dpia = dcn314_get_preferred_eng_id_dpia,
1780+
.get_det_buffer_size = dcn31_get_det_buffer_size,
17801781
};
17811782

17821783
static struct clock_source *dcn30_clock_source_create(

drivers/gpu/drm/amd/display/dc/resource/dcn315/dcn315_resource.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1845,6 +1845,7 @@ static struct resource_funcs dcn315_res_pool_funcs = {
18451845
.patch_unknown_plane_state = dcn20_patch_unknown_plane_state,
18461846
.get_panel_config_defaults = dcn315_get_panel_config_defaults,
18471847
.get_power_profile = dcn315_get_power_profile,
1848+
.get_det_buffer_size = dcn31_get_det_buffer_size,
18481849
};
18491850

18501851
static bool dcn315_resource_construct(

drivers/gpu/drm/amd/display/dc/resource/dcn316/dcn316_resource.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,6 +1719,7 @@ static struct resource_funcs dcn316_res_pool_funcs = {
17191719
.update_bw_bounding_box = dcn316_update_bw_bounding_box,
17201720
.patch_unknown_plane_state = dcn20_patch_unknown_plane_state,
17211721
.get_panel_config_defaults = dcn316_get_panel_config_defaults,
1722+
.get_det_buffer_size = dcn31_get_det_buffer_size,
17221723
};
17231724

17241725
static bool dcn316_resource_construct(

drivers/gpu/drm/amd/display/dc/resource/dcn35/dcn35_resource.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1778,6 +1778,7 @@ static struct resource_funcs dcn35_res_pool_funcs = {
17781778
.patch_unknown_plane_state = dcn20_patch_unknown_plane_state,
17791779
.get_panel_config_defaults = dcn35_get_panel_config_defaults,
17801780
.get_preferred_eng_id_dpia = dcn35_get_preferred_eng_id_dpia,
1781+
.get_det_buffer_size = dcn31_get_det_buffer_size,
17811782
};
17821783

17831784
static bool dcn35_resource_construct(

drivers/gpu/drm/amd/display/dc/resource/dcn351/dcn351_resource.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1757,6 +1757,7 @@ static struct resource_funcs dcn351_res_pool_funcs = {
17571757
.patch_unknown_plane_state = dcn20_patch_unknown_plane_state,
17581758
.get_panel_config_defaults = dcn35_get_panel_config_defaults,
17591759
.get_preferred_eng_id_dpia = dcn351_get_preferred_eng_id_dpia,
1760+
.get_det_buffer_size = dcn31_get_det_buffer_size,
17601761
};
17611762

17621763
static bool dcn351_resource_construct(

0 commit comments

Comments
 (0)