]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/amd/display: avoid large stack allocation in commit_planes_do_stream_update_sequence
authorArnd Bergmann <arnd@arndb.de>
Thu, 11 Jun 2026 13:01:19 +0000 (15:01 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 1 Jul 2026 16:58:43 +0000 (12:58 -0400)
The function has two arrays on the stack to hold temporary dsc_optc_config
and dsc_config objects. The combination blows through common stack frame
warning limits in combination with the other local variables:

drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:4070:22: error: stack frame size (1352) exceeds limit
      (1280) in 'commit_planes_do_stream_update_sequence' [-Werror,-Wframe-larger-than]

Since neither array is initialized or used outside of the
add_link_update_dsc_config_sequence() function, there is no actual
need to keep each element around.

Replace the arrays with a single instance each to reduce the stack usage
to less than half.

Fixes: 9f49d3cd7e71 ("drm/amd/display: Implement block sequencing infrastructure for modular hardware operations.")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Acked-by: George Zhang <george.zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 9e0896fa6f7dbe9ca3dbbd3b593fa91670f4820b)
Cc: stable@vger.kernel.org
drivers/gpu/drm/amd/display/dc/core/dc.c

index bcdbf347103977764b857742b53a113f770a319e..72762c4fa392f0b7dc1045227ac25e3019c91ee8 100644 (file)
@@ -4077,8 +4077,6 @@ static void commit_planes_do_stream_update_sequence(struct dc *dc,
 {
        int j;
        struct block_sequence_state seq_state = { .steps = block_sequence, .num_steps = num_steps };
-       struct dsc_config dsc_cfgs[MAX_PIPES];
-       struct dsc_optc_config dsc_optc_cfgs[MAX_PIPES];
        unsigned int dsc_cfg_index = 0;
        *num_steps = 0; // Initialize to 0
 
@@ -4150,11 +4148,13 @@ static void commit_planes_do_stream_update_sequence(struct dc *dc,
 
                        if (stream_update->dsc_config)
                                if (dsc_cfg_index < MAX_PIPES) {
+                                       struct dsc_config dsc_cfg;
+                                       struct dsc_optc_config dsc_optc_cfg;
+
                                        add_link_update_dsc_config_sequence(&seq_state,
                                                pipe_ctx,
-                                               &dsc_cfgs[dsc_cfg_index],
-                                               &dsc_optc_cfgs[dsc_cfg_index]);
-                                       dsc_cfg_index++;
+                                               &dsc_cfg,
+                                               &dsc_optc_cfg);
                                }
 
                        if (stream_update->mst_bw_update) {