<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<p style="font-family:Arial;font-size:10pt;color:#008000;margin:15pt;" align="Left">
[Public]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Acked-by: Alex Deucher <alexander.deucher@amd.com><br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Aurabindo Pillai <aurabindo.pillai@amd.com><br>
<b>Sent:</b> Friday, June 10, 2022 1:26 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>; Deucher, Alexander <Alexander.Deucher@amd.com><br>
<b>Cc:</b> Siqueira, Rodrigo <Rodrigo.Siqueira@amd.com>; Wentland, Harry <Harry.Wentland@amd.com><br>
<b>Subject:</b> [PATCH] drm/amd/display: dml: move some variables to heap</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">[Why&How]<br>
To reduce stack usage, move some variables into heap in the DML function<br>
dml32_ModeSupportAndSystemConfigurationFull()<br>
<br>
Fixes: d03037269bf2d ("drm/amd/display: DML changes for DCN32/321")<br>
Signed-off-by: Aurabindo Pillai <aurabindo.pillai@amd.com><br>
---<br>
 .../display/dc/dml/dcn32/display_mode_vba_32.c  | 17 +++++++----------<br>
 .../drm/amd/display/dc/dml/display_mode_vba.h   |  3 +++<br>
 2 files changed, 10 insertions(+), 10 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c<br>
index 5828e60f291d..b9f5bfa67791 100644<br>
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c<br>
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c<br>
@@ -1675,9 +1675,6 @@ void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l<br>
         bool FullFrameMALLPStateMethod;<br>
         bool SubViewportMALLPStateMethod;<br>
         bool PhantomPipeMALLPStateMethod;<br>
-       double MaxTotalVActiveRDBandwidth;<br>
-       double DSTYAfterScaler[DC__NUM_DPP__MAX];<br>
-       double DSTXAfterScaler[DC__NUM_DPP__MAX];<br>
         unsigned int MaximumMPCCombine;<br>
 <br>
 #ifdef __DML_VBA_DEBUG__<br>
@@ -3095,10 +3092,10 @@ void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l<br>
         }<br>
 <br>
         //Vertical Active BW support check<br>
-       MaxTotalVActiveRDBandwidth = 0;<br>
+       v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.MaxTotalVActiveRDBandwidth = 0;<br>
 <br>
         for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {<br>
-               MaxTotalVActiveRDBandwidth = MaxTotalVActiveRDBandwidth + mode_lib->vba.ReadBandwidthLuma[k]<br>
+               v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.MaxTotalVActiveRDBandwidth += mode_lib->vba.ReadBandwidthLuma[k]<br>
                                 + mode_lib->vba.ReadBandwidthChroma[k];<br>
         }<br>
 <br>
@@ -3115,7 +3112,7 @@ void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l<br>
                                         * mode_lib->vba.DRAMChannelWidth<br>
                                         * (i < 2 ? mode_lib->vba.MaxAveragePercentOfIdealDRAMBWDisplayCanUseInNormalSystemOperationSTROBE : mode_lib->vba.MaxAveragePercentOfIdealDRAMBWDisplayCanUseInNormalSystemOperation) / 100);<br>
 <br>
-                       if (MaxTotalVActiveRDBandwidth<br>
+                       if (v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.MaxTotalVActiveRDBandwidth<br>
                                         <= mode_lib->vba.MaxTotalVerticalActiveAvailableBandwidth[i][j]) {<br>
                                 mode_lib->vba.TotalVerticalActiveBandwidthSupport[i][j] = true;<br>
                         } else {<br>
@@ -3281,8 +3278,8 @@ void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l<br>
                                                         mode_lib->vba.SwathHeightCThisState[k], mode_lib->vba.TWait,<br>
 <br>
                                                         /* Output */<br>
-                                                       &DSTXAfterScaler[k],<br>
-                                                       &DSTYAfterScaler[k],<br>
+                                                       &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.DSTXAfterScaler[k],<br>
+                                                       &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.DSTYAfterScaler[k],<br>
                                                         &mode_lib->vba.LineTimesForPrefetch[k],<br>
                                                         &mode_lib->vba.PrefetchBW[k],<br>
                                                         &mode_lib->vba.LinesForMetaPTE[k],<br>
@@ -3579,8 +3576,8 @@ void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l<br>
                                                 mode_lib->vba.NoOfDPPThisState,<br>
                                                 mode_lib->vba.BytePerPixelInDETY,<br>
                                                 mode_lib->vba.BytePerPixelInDETC,<br>
-                                               DSTXAfterScaler,<br>
-                                               DSTYAfterScaler,<br>
+                                               v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.DSTXAfterScaler,<br>
+                                               v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.DSTYAfterScaler,<br>
                                                 mode_lib->vba.WritebackEnable,<br>
                                                 mode_lib->vba.WritebackPixelFormat,<br>
                                                 mode_lib->vba.WritebackDestinationWidth,<br>
diff --git a/drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.h b/drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.h<br>
index 43e327080552..9ad49ad38814 100644<br>
--- a/drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.h<br>
+++ b/drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.h<br>
@@ -204,6 +204,9 @@ struct dml32_ModeSupportAndSystemConfigurationFull {<br>
         SOCParametersList mSOCParameters;<br>
         unsigned int MaximumSwathWidthSupportLuma;<br>
         unsigned int MaximumSwathWidthSupportChroma;<br>
+       double DSTYAfterScaler[DC__NUM_DPP__MAX];<br>
+       double DSTXAfterScaler[DC__NUM_DPP__MAX];<br>
+       double MaxTotalVActiveRDBandwidth;<br>
 };<br>
 <br>
 struct dummy_vars {<br>
-- <br>
2.36.1<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>