Skip to content

Commit

Permalink
drm/amd/display/dc/calcs/dce_calcs: Move some large variables from th…
Browse files Browse the repository at this point in the history
…e stack to the heap

Fixes the following W=1 kernel build warning(s):

 drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dce_calcs.c: In function ‘calculate_bandwidth’:
 drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dce_calcs.c:2016:1: warning: the frame size of 1216 bytes is larger than 1024 bytes [-Wframe-larger-than=]

Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Leo Li <sunpeng.li@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Colin Ian King <colin.king@canonical.com>
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
  • Loading branch information
Lee Jones authored and Alex Deucher committed Mar 19, 2021
1 parent 1c3cfc1 commit 56b5067
Showing 1 changed file with 28 additions and 4 deletions.
32 changes: 28 additions & 4 deletions drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,16 @@ static void calculate_bandwidth(
int32_t num_cursor_lines;

int32_t i, j, k;
struct bw_fixed yclk[3];
struct bw_fixed sclk[8];
struct bw_fixed *yclk;
struct bw_fixed *sclk;
bool d0_underlay_enable;
bool d1_underlay_enable;
bool fbc_enabled;
bool lpt_enabled;
enum bw_defines sclk_message;
enum bw_defines yclk_message;
enum bw_defines tiling_mode[maximum_number_of_surfaces];
enum bw_defines surface_type[maximum_number_of_surfaces];
enum bw_defines *tiling_mode;
enum bw_defines *surface_type;
enum bw_defines voltage;
enum bw_defines pipe_check;
enum bw_defines hsr_check;
Expand All @@ -122,6 +122,22 @@ static void calculate_bandwidth(
int32_t number_of_displays_enabled_with_margin = 0;
int32_t number_of_aligned_displays_with_no_margin = 0;

yclk = kcalloc(3, sizeof(*yclk), GFP_KERNEL);
if (!yclk)
return;

sclk = kcalloc(8, sizeof(*sclk), GFP_KERNEL);
if (!sclk)
goto free_yclk;

tiling_mode = kcalloc(maximum_number_of_surfaces, sizeof(*tiling_mode), GFP_KERNEL);
if (!tiling_mode)
goto free_sclk;

surface_type = kcalloc(maximum_number_of_surfaces, sizeof(*surface_type), GFP_KERNEL);
if (!surface_type)
goto free_tiling_mode;

yclk[low] = vbios->low_yclk;
yclk[mid] = vbios->mid_yclk;
yclk[high] = vbios->high_yclk;
Expand Down Expand Up @@ -2013,6 +2029,14 @@ static void calculate_bandwidth(
}
}
}

kfree(surface_type);
free_tiling_mode:
kfree(tiling_mode);
free_yclk:
kfree(yclk);
free_sclk:
kfree(sclk);
}

/*******************************************************************************
Expand Down

0 comments on commit 56b5067

Please sign in to comment.