From: Harry Wentland <harry.wentland@amd.com>
To: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>,
amd-gfx@lists.freedesktop.org
Cc: Alex Deucher <alexander.deucher@amd.com>,
Stephen Rothwell <sfr@canb.auug.org.au>,
Aurabindo Pillai <aurabindo.pillai@amd.com>,
Hamza Mahfooz <hamza.mahfooz@amd.com>
Subject: Re: [PATCH 2/6] drm/amd/display: Reduce frame size in the bouding box for DCN20
Date: Mon, 6 Jun 2022 10:05:19 -0400 [thread overview]
Message-ID: <42d357c6-7676-b0db-8529-a36b924b06db@amd.com> (raw)
In-Reply-To: <20220603185042.3408844-3-Rodrigo.Siqueira@amd.com>
On 2022-06-03 14:50, Rodrigo Siqueira wrote:
> GCC throw warnings for the function dcn20_update_bounding_box due to its
> frame size that looks like this:
>
> error: the frame size of 1936 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
>
> This commit fixes this issue by eliminating an intermediary variable
> that creates a large array.
>
> Cc: Stephen Rothwell <sfr@canb.auug.org.au>
> Cc: Hamza Mahfooz <hamza.mahfooz@amd.com>
> Cc: Aurabindo Pillai <aurabindo.pillai@amd.com>
> Signed-off-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Harry
> ---
> .../drm/amd/display/dc/dml/dcn20/dcn20_fpu.c | 38 +++++++++----------
> 1 file changed, 18 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn20/dcn20_fpu.c b/drivers/gpu/drm/amd/display/dc/dml/dcn20/dcn20_fpu.c
> index eeec40f6fd0a..d9cc178f6980 100644
> --- a/drivers/gpu/drm/amd/display/dc/dml/dcn20/dcn20_fpu.c
> +++ b/drivers/gpu/drm/amd/display/dc/dml/dcn20/dcn20_fpu.c
> @@ -1456,21 +1456,20 @@ void dcn20_calculate_wm(
> void dcn20_update_bounding_box(struct dc *dc, struct _vcs_dpi_soc_bounding_box_st *bb,
> struct pp_smu_nv_clock_table *max_clocks, unsigned int *uclk_states, unsigned int num_states)
> {
> - struct _vcs_dpi_voltage_scaling_st calculated_states[DC__VOLTAGE_STATES];
> - int i;
> int num_calculated_states = 0;
> int min_dcfclk = 0;
> + int i;
>
> dc_assert_fp_enabled();
>
> if (num_states == 0)
> return;
>
> - memset(calculated_states, 0, sizeof(calculated_states));
> + memset(bb->clock_limits, 0, sizeof(bb->clock_limits));
>
> - if (dc->bb_overrides.min_dcfclk_mhz > 0)
> + if (dc->bb_overrides.min_dcfclk_mhz > 0) {
> min_dcfclk = dc->bb_overrides.min_dcfclk_mhz;
> - else {
> + } else {
> if (ASICREV_IS_NAVI12_P(dc->ctx->asic_id.hw_internal_rev))
> min_dcfclk = 310;
> else
> @@ -1481,36 +1480,35 @@ void dcn20_update_bounding_box(struct dc *dc, struct _vcs_dpi_soc_bounding_box_s
>
> for (i = 0; i < num_states; i++) {
> int min_fclk_required_by_uclk;
> - calculated_states[i].state = i;
> - calculated_states[i].dram_speed_mts = uclk_states[i] * 16 / 1000;
> + bb->clock_limits[i].state = i;
> + bb->clock_limits[i].dram_speed_mts = uclk_states[i] * 16 / 1000;
>
> // FCLK:UCLK ratio is 1.08
> min_fclk_required_by_uclk = div_u64(((unsigned long long)uclk_states[i]) * 1080,
> 1000000);
>
> - calculated_states[i].fabricclk_mhz = (min_fclk_required_by_uclk < min_dcfclk) ?
> + bb->clock_limits[i].fabricclk_mhz = (min_fclk_required_by_uclk < min_dcfclk) ?
> min_dcfclk : min_fclk_required_by_uclk;
>
> - calculated_states[i].socclk_mhz = (calculated_states[i].fabricclk_mhz > max_clocks->socClockInKhz / 1000) ?
> - max_clocks->socClockInKhz / 1000 : calculated_states[i].fabricclk_mhz;
> + bb->clock_limits[i].socclk_mhz = (bb->clock_limits[i].fabricclk_mhz > max_clocks->socClockInKhz / 1000) ?
> + max_clocks->socClockInKhz / 1000 : bb->clock_limits[i].fabricclk_mhz;
>
> - calculated_states[i].dcfclk_mhz = (calculated_states[i].fabricclk_mhz > max_clocks->dcfClockInKhz / 1000) ?
> - max_clocks->dcfClockInKhz / 1000 : calculated_states[i].fabricclk_mhz;
> + bb->clock_limits[i].dcfclk_mhz = (bb->clock_limits[i].fabricclk_mhz > max_clocks->dcfClockInKhz / 1000) ?
> + max_clocks->dcfClockInKhz / 1000 : bb->clock_limits[i].fabricclk_mhz;
>
> - calculated_states[i].dispclk_mhz = max_clocks->displayClockInKhz / 1000;
> - calculated_states[i].dppclk_mhz = max_clocks->displayClockInKhz / 1000;
> - calculated_states[i].dscclk_mhz = max_clocks->displayClockInKhz / (1000 * 3);
> + bb->clock_limits[i].dispclk_mhz = max_clocks->displayClockInKhz / 1000;
> + bb->clock_limits[i].dppclk_mhz = max_clocks->displayClockInKhz / 1000;
> + bb->clock_limits[i].dscclk_mhz = max_clocks->displayClockInKhz / (1000 * 3);
>
> - calculated_states[i].phyclk_mhz = max_clocks->phyClockInKhz / 1000;
> + bb->clock_limits[i].phyclk_mhz = max_clocks->phyClockInKhz / 1000;
>
> num_calculated_states++;
> }
>
> - calculated_states[num_calculated_states - 1].socclk_mhz = max_clocks->socClockInKhz / 1000;
> - calculated_states[num_calculated_states - 1].fabricclk_mhz = max_clocks->socClockInKhz / 1000;
> - calculated_states[num_calculated_states - 1].dcfclk_mhz = max_clocks->dcfClockInKhz / 1000;
> + bb->clock_limits[num_calculated_states - 1].socclk_mhz = max_clocks->socClockInKhz / 1000;
> + bb->clock_limits[num_calculated_states - 1].fabricclk_mhz = max_clocks->socClockInKhz / 1000;
> + bb->clock_limits[num_calculated_states - 1].dcfclk_mhz = max_clocks->dcfClockInKhz / 1000;
>
> - memcpy(bb->clock_limits, calculated_states, sizeof(bb->clock_limits));
> bb->num_states = num_calculated_states;
>
> // Duplicate the last state, DML always an extra state identical to max state to work
next prev parent reply other threads:[~2022-06-06 14:06 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-03 18:50 [PATCH 0/6] Cleaning up some GCC warnings and other minor issues Rodrigo Siqueira
2022-06-03 18:50 ` [PATCH 1/6] drm/amd/display: Remove duplicated macro Rodrigo Siqueira
2022-06-06 14:04 ` Harry Wentland
2022-06-03 18:50 ` [PATCH 2/6] drm/amd/display: Reduce frame size in the bouding box for DCN20 Rodrigo Siqueira
2022-06-06 14:05 ` Harry Wentland [this message]
2022-06-03 18:50 ` [PATCH 3/6] drm/amd/display: Reduce frame size in the bouding box for DCN301 Rodrigo Siqueira
2022-06-06 14:08 ` Harry Wentland
2022-06-03 18:50 ` [PATCH 4/6] drm/amd/display: Reduce frame size in the bouding box for DCN31/316 Rodrigo Siqueira
2022-06-06 14:10 ` Harry Wentland
2022-06-03 18:50 ` [PATCH 5/6] drm/amd/display: Reduce frame size in the bouding box for DCN21 Rodrigo Siqueira
2022-06-06 14:11 ` Harry Wentland
2022-06-03 18:50 ` [PATCH 6/6] Revert "drm/amd/display: Drop unnecessary guard from DC resource" Rodrigo Siqueira
2022-06-06 14:16 ` Harry Wentland
2022-06-06 16:17 ` Alex Deucher
2022-06-06 18:01 ` Harry Wentland
2022-06-06 18:04 ` Alex Deucher
2022-06-03 19:40 ` [PATCH 0/6] Cleaning up some GCC warnings and other minor issues Alex Deucher
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=42d357c6-7676-b0db-8529-a36b924b06db@amd.com \
--to=harry.wentland@amd.com \
--cc=Rodrigo.Siqueira@amd.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=aurabindo.pillai@amd.com \
--cc=hamza.mahfooz@amd.com \
--cc=sfr@canb.auug.org.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox