All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amd/display: dml: move some variables to heap
@ 2022-06-10 17:26 Aurabindo Pillai
  2022-06-10 18:44 ` Deucher, Alexander
  0 siblings, 1 reply; 2+ messages in thread
From: Aurabindo Pillai @ 2022-06-10 17:26 UTC (permalink / raw)
  To: amd-gfx, alexander.deucher; +Cc: rodrigo.siqueira, harry.wentland

[Why&How]
To reduce stack usage, move some variables into heap in the DML function
dml32_ModeSupportAndSystemConfigurationFull()

Fixes: d03037269bf2d ("drm/amd/display: DML changes for DCN32/321")
Signed-off-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
---
 .../display/dc/dml/dcn32/display_mode_vba_32.c  | 17 +++++++----------
 .../drm/amd/display/dc/dml/display_mode_vba.h   |  3 +++
 2 files changed, 10 insertions(+), 10 deletions(-)

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
index 5828e60f291d..b9f5bfa67791 100644
--- 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
@@ -1675,9 +1675,6 @@ void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
 	bool FullFrameMALLPStateMethod;
 	bool SubViewportMALLPStateMethod;
 	bool PhantomPipeMALLPStateMethod;
-	double MaxTotalVActiveRDBandwidth;
-	double DSTYAfterScaler[DC__NUM_DPP__MAX];
-	double DSTXAfterScaler[DC__NUM_DPP__MAX];
 	unsigned int MaximumMPCCombine;
 
 #ifdef __DML_VBA_DEBUG__
@@ -3095,10 +3092,10 @@ void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
 	}
 
 	//Vertical Active BW support check
-	MaxTotalVActiveRDBandwidth = 0;
+	v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.MaxTotalVActiveRDBandwidth = 0;
 
 	for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
-		MaxTotalVActiveRDBandwidth = MaxTotalVActiveRDBandwidth + mode_lib->vba.ReadBandwidthLuma[k]
+		v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.MaxTotalVActiveRDBandwidth += mode_lib->vba.ReadBandwidthLuma[k]
 				+ mode_lib->vba.ReadBandwidthChroma[k];
 	}
 
@@ -3115,7 +3112,7 @@ void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
 					* mode_lib->vba.DRAMChannelWidth
 					* (i < 2 ? mode_lib->vba.MaxAveragePercentOfIdealDRAMBWDisplayCanUseInNormalSystemOperationSTROBE : mode_lib->vba.MaxAveragePercentOfIdealDRAMBWDisplayCanUseInNormalSystemOperation) / 100);
 
-			if (MaxTotalVActiveRDBandwidth
+			if (v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.MaxTotalVActiveRDBandwidth
 					<= mode_lib->vba.MaxTotalVerticalActiveAvailableBandwidth[i][j]) {
 				mode_lib->vba.TotalVerticalActiveBandwidthSupport[i][j] = true;
 			} else {
@@ -3281,8 +3278,8 @@ void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
 							mode_lib->vba.SwathHeightCThisState[k], mode_lib->vba.TWait,
 
 							/* Output */
-							&DSTXAfterScaler[k],
-							&DSTYAfterScaler[k],
+							&v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.DSTXAfterScaler[k],
+							&v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.DSTYAfterScaler[k],
 							&mode_lib->vba.LineTimesForPrefetch[k],
 							&mode_lib->vba.PrefetchBW[k],
 							&mode_lib->vba.LinesForMetaPTE[k],
@@ -3579,8 +3576,8 @@ void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
 						mode_lib->vba.NoOfDPPThisState,
 						mode_lib->vba.BytePerPixelInDETY,
 						mode_lib->vba.BytePerPixelInDETC,
-						DSTXAfterScaler,
-						DSTYAfterScaler,
+						v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.DSTXAfterScaler,
+						v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.DSTYAfterScaler,
 						mode_lib->vba.WritebackEnable,
 						mode_lib->vba.WritebackPixelFormat,
 						mode_lib->vba.WritebackDestinationWidth,
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
index 43e327080552..9ad49ad38814 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.h
+++ b/drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.h
@@ -204,6 +204,9 @@ struct dml32_ModeSupportAndSystemConfigurationFull {
 	SOCParametersList mSOCParameters;
 	unsigned int MaximumSwathWidthSupportLuma;
 	unsigned int MaximumSwathWidthSupportChroma;
+	double DSTYAfterScaler[DC__NUM_DPP__MAX];
+	double DSTXAfterScaler[DC__NUM_DPP__MAX];
+	double MaxTotalVActiveRDBandwidth;
 };
 
 struct dummy_vars {
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/amd/display: dml: move some variables to heap
  2022-06-10 17:26 [PATCH] drm/amd/display: dml: move some variables to heap Aurabindo Pillai
@ 2022-06-10 18:44 ` Deucher, Alexander
  0 siblings, 0 replies; 2+ messages in thread
From: Deucher, Alexander @ 2022-06-10 18:44 UTC (permalink / raw)
  To: Pillai, Aurabindo, amd-gfx; +Cc: Wentland, Harry, Siqueira, Rodrigo

[-- Attachment #1: Type: text/plain, Size: 5991 bytes --]

[Public]

Acked-by: Alex Deucher <alexander.deucher@amd.com>
________________________________
From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Aurabindo Pillai <aurabindo.pillai@amd.com>
Sent: Friday, June 10, 2022 1:26 PM
To: amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>; Deucher, Alexander <Alexander.Deucher@amd.com>
Cc: Siqueira, Rodrigo <Rodrigo.Siqueira@amd.com>; Wentland, Harry <Harry.Wentland@amd.com>
Subject: [PATCH] drm/amd/display: dml: move some variables to heap

[Why&How]
To reduce stack usage, move some variables into heap in the DML function
dml32_ModeSupportAndSystemConfigurationFull()

Fixes: d03037269bf2d ("drm/amd/display: DML changes for DCN32/321")
Signed-off-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
---
 .../display/dc/dml/dcn32/display_mode_vba_32.c  | 17 +++++++----------
 .../drm/amd/display/dc/dml/display_mode_vba.h   |  3 +++
 2 files changed, 10 insertions(+), 10 deletions(-)

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
index 5828e60f291d..b9f5bfa67791 100644
--- 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
@@ -1675,9 +1675,6 @@ void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
         bool FullFrameMALLPStateMethod;
         bool SubViewportMALLPStateMethod;
         bool PhantomPipeMALLPStateMethod;
-       double MaxTotalVActiveRDBandwidth;
-       double DSTYAfterScaler[DC__NUM_DPP__MAX];
-       double DSTXAfterScaler[DC__NUM_DPP__MAX];
         unsigned int MaximumMPCCombine;

 #ifdef __DML_VBA_DEBUG__
@@ -3095,10 +3092,10 @@ void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
         }

         //Vertical Active BW support check
-       MaxTotalVActiveRDBandwidth = 0;
+       v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.MaxTotalVActiveRDBandwidth = 0;

         for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
-               MaxTotalVActiveRDBandwidth = MaxTotalVActiveRDBandwidth + mode_lib->vba.ReadBandwidthLuma[k]
+               v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.MaxTotalVActiveRDBandwidth += mode_lib->vba.ReadBandwidthLuma[k]
                                 + mode_lib->vba.ReadBandwidthChroma[k];
         }

@@ -3115,7 +3112,7 @@ void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
                                         * mode_lib->vba.DRAMChannelWidth
                                         * (i < 2 ? mode_lib->vba.MaxAveragePercentOfIdealDRAMBWDisplayCanUseInNormalSystemOperationSTROBE : mode_lib->vba.MaxAveragePercentOfIdealDRAMBWDisplayCanUseInNormalSystemOperation) / 100);

-                       if (MaxTotalVActiveRDBandwidth
+                       if (v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.MaxTotalVActiveRDBandwidth
                                         <= mode_lib->vba.MaxTotalVerticalActiveAvailableBandwidth[i][j]) {
                                 mode_lib->vba.TotalVerticalActiveBandwidthSupport[i][j] = true;
                         } else {
@@ -3281,8 +3278,8 @@ void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
                                                         mode_lib->vba.SwathHeightCThisState[k], mode_lib->vba.TWait,

                                                         /* Output */
-                                                       &DSTXAfterScaler[k],
-                                                       &DSTYAfterScaler[k],
+                                                       &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.DSTXAfterScaler[k],
+                                                       &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.DSTYAfterScaler[k],
                                                         &mode_lib->vba.LineTimesForPrefetch[k],
                                                         &mode_lib->vba.PrefetchBW[k],
                                                         &mode_lib->vba.LinesForMetaPTE[k],
@@ -3579,8 +3576,8 @@ void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
                                                 mode_lib->vba.NoOfDPPThisState,
                                                 mode_lib->vba.BytePerPixelInDETY,
                                                 mode_lib->vba.BytePerPixelInDETC,
-                                               DSTXAfterScaler,
-                                               DSTYAfterScaler,
+                                               v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.DSTXAfterScaler,
+                                               v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.DSTYAfterScaler,
                                                 mode_lib->vba.WritebackEnable,
                                                 mode_lib->vba.WritebackPixelFormat,
                                                 mode_lib->vba.WritebackDestinationWidth,
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
index 43e327080552..9ad49ad38814 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.h
+++ b/drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.h
@@ -204,6 +204,9 @@ struct dml32_ModeSupportAndSystemConfigurationFull {
         SOCParametersList mSOCParameters;
         unsigned int MaximumSwathWidthSupportLuma;
         unsigned int MaximumSwathWidthSupportChroma;
+       double DSTYAfterScaler[DC__NUM_DPP__MAX];
+       double DSTXAfterScaler[DC__NUM_DPP__MAX];
+       double MaxTotalVActiveRDBandwidth;
 };

 struct dummy_vars {
--
2.36.1


[-- Attachment #2: Type: text/html, Size: 14354 bytes --]

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-06-10 18:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-10 17:26 [PATCH] drm/amd/display: dml: move some variables to heap Aurabindo Pillai
2022-06-10 18:44 ` Deucher, Alexander

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.