Re: [PATCH 1/2] drm/amd/display: Reduce number of arguments of dml314's CalculateWatermarksAndDRAMSpeedChangeSupport()

2022-09-20 Thread Alex Deucher
On Tue, Sep 20, 2022 at 7:48 PM Nathan Chancellor  wrote:
>
> On Tue, Sep 20, 2022 at 12:06:46PM -0400, Alex Deucher wrote:
> > Applied the series.  Thanks!
>
> Great, thank you so much! Hopefully these could also be applied to the
> 6.0 branch so that this error can be resolved there as well. No worries
> on timeline if that was already the plan but I just want to keep -Werror
> on for arm64 and x86_64 allmodconfig for this release.

Yes, that is the plan.

Alex

>
> Cheers,
> Nathan
>
> > On Sat, Sep 17, 2022 at 8:38 AM Maíra Canal  wrote:
> > >
> > > Hi Nathan,
> > >
> > > On 9/16/22 18:06, Nathan Chancellor wrote:
> > > > Most of the arguments are identical between the two call sites and they
> > > > can be accessed through the 'struct vba_vars_st' pointer. This reduces
> > > > the total amount of stack space that
> > > > dml314_ModeSupportAndSystemConfigurationFull() uses by 240 bytes with
> > > > LLVM 16 (2216 -> 1976), helping clear up the following clang warning:
> > > >
> > > >   
> > > > drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn314/display_mode_vba_314.c:4020:6:
> > > >  error: stack frame size (2216) exceeds limit (2048) in 
> > > > 'dml314_ModeSupportAndSystemConfigurationFull' 
> > > > [-Werror,-Wframe-larger-than]
> > > >   void dml314_ModeSupportAndSystemConfigurationFull(struct 
> > > > display_mode_lib *mode_lib)
> > > >^
> > > >   1 error generated.
> > > >
> > > > Link: https://github.com/ClangBuiltLinux/linux/issues/1710
> > > > Reported-by: "kernelci.org bot" 
> > > > Signed-off-by: Nathan Chancellor 
> > >
> > > I have built-tested the whole series with clang 14.0.5 (Fedora
> > > 14.0.5-1.fc36), using:
> > >
> > > $ make -kj"$(nproc)" ARCH=x86_64 LLVM=1 mrproper allmodconfig
> > > drivers/gpu/drm/amd/amdgpu/
> > >
> > > Another great patch to the DML! As Tom, I also would like to see this
> > > expand to all display_mode_vba files, but so far this is great to
> > > unbreak the build.
> > >
> > > To the whole series:
> > >
> > > Tested-by: Maíra Canal 
> > >
> > > Best Regards,
> > > - Maíra Canal
> > >
> > > > ---
> > > >
> > > > This is just commit ab2ac59c32db ("drm/amd/display: Reduce number of
> > > > arguments of dml31's CalculateWatermarksAndDRAMSpeedChangeSupport()")
> > > > applied to dml314.
> > > >
> > > >  .../dc/dml/dcn314/display_mode_vba_314.c  | 248 --
> > > >  1 file changed, 52 insertions(+), 196 deletions(-)
> > > >
> > > > diff --git 
> > > > a/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c 
> > > > b/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c
> > > > index 2829f179f982..32ceb72f7a14 100644
> > > > --- a/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c
> > > > +++ b/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c
> > > > @@ -325,64 +325,28 @@ static void 
> > > > CalculateVupdateAndDynamicMetadataParameters(
> > > >  static void CalculateWatermarksAndDRAMSpeedChangeSupport(
> > > >   struct display_mode_lib *mode_lib,
> > > >   unsigned int PrefetchMode,
> > > > - unsigned int NumberOfActivePlanes,
> > > > - unsigned int MaxLineBufferLines,
> > > > - unsigned int LineBufferSize,
> > > > - unsigned int WritebackInterfaceBufferSize,
> > > >   double DCFCLK,
> > > >   double ReturnBW,
> > > > - bool SynchronizedVBlank,
> > > > - unsigned int dpte_group_bytes[],
> > > > - unsigned int MetaChunkSize,
> > > >   double UrgentLatency,
> > > >   double ExtraLatency,
> > > > - double WritebackLatency,
> > > > - double WritebackChunkSize,
> > > >   double SOCCLK,
> > > > - double DRAMClockChangeLatency,
> > > > - double SRExitTime,
> > > > - double SREnterPlusExitTime,
> > > > - double SRExitZ8Time,
> > > > - double SREnterPlusExitZ8Time,
> > > >   double DCFCLKDeepSleep,
> > > >   unsigned int DETBufferSizeY[],
> > > >   unsigned int DETBufferSizeC[],
> > > >   unsigned int SwathHeightY[],
> > > >   unsigned int SwathHeightC[],
> > > > - unsigned int LBBitPerPixel[],
> > > >   double SwathWidthY[],
> > > >   double SwathWidthC[],
> > > > - double HRatio[],
> > > > - double HRatioChroma[],
> > > > - unsigned int vtaps[],
> > > > - unsigned int VTAPsChroma[],
> > > > - double VRatio[],
> > > > - double VRatioChroma[],
> > > > - unsigned int HTotal[],
> > > > - double PixelClock[],
> > > > - unsigned int BlendingAndTiming[],
> > > >   unsigned int DPPPerPlane[],
> > > >   double BytePerPixelDETY[],
> > > >   double BytePerPixelDETC[],
> > > > - double DSTXAfterScaler[],
> > > > 

Re: [PATCH 1/2] drm/amd/display: Reduce number of arguments of dml314's CalculateWatermarksAndDRAMSpeedChangeSupport()

2022-09-20 Thread Nathan Chancellor
On Tue, Sep 20, 2022 at 12:06:46PM -0400, Alex Deucher wrote:
> Applied the series.  Thanks!

Great, thank you so much! Hopefully these could also be applied to the
6.0 branch so that this error can be resolved there as well. No worries
on timeline if that was already the plan but I just want to keep -Werror
on for arm64 and x86_64 allmodconfig for this release.

Cheers,
Nathan

> On Sat, Sep 17, 2022 at 8:38 AM Maíra Canal  wrote:
> >
> > Hi Nathan,
> >
> > On 9/16/22 18:06, Nathan Chancellor wrote:
> > > Most of the arguments are identical between the two call sites and they
> > > can be accessed through the 'struct vba_vars_st' pointer. This reduces
> > > the total amount of stack space that
> > > dml314_ModeSupportAndSystemConfigurationFull() uses by 240 bytes with
> > > LLVM 16 (2216 -> 1976), helping clear up the following clang warning:
> > >
> > >   
> > > drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn314/display_mode_vba_314.c:4020:6:
> > >  error: stack frame size (2216) exceeds limit (2048) in 
> > > 'dml314_ModeSupportAndSystemConfigurationFull' 
> > > [-Werror,-Wframe-larger-than]
> > >   void dml314_ModeSupportAndSystemConfigurationFull(struct 
> > > display_mode_lib *mode_lib)
> > >^
> > >   1 error generated.
> > >
> > > Link: https://github.com/ClangBuiltLinux/linux/issues/1710
> > > Reported-by: "kernelci.org bot" 
> > > Signed-off-by: Nathan Chancellor 
> >
> > I have built-tested the whole series with clang 14.0.5 (Fedora
> > 14.0.5-1.fc36), using:
> >
> > $ make -kj"$(nproc)" ARCH=x86_64 LLVM=1 mrproper allmodconfig
> > drivers/gpu/drm/amd/amdgpu/
> >
> > Another great patch to the DML! As Tom, I also would like to see this
> > expand to all display_mode_vba files, but so far this is great to
> > unbreak the build.
> >
> > To the whole series:
> >
> > Tested-by: Maíra Canal 
> >
> > Best Regards,
> > - Maíra Canal
> >
> > > ---
> > >
> > > This is just commit ab2ac59c32db ("drm/amd/display: Reduce number of
> > > arguments of dml31's CalculateWatermarksAndDRAMSpeedChangeSupport()")
> > > applied to dml314.
> > >
> > >  .../dc/dml/dcn314/display_mode_vba_314.c  | 248 --
> > >  1 file changed, 52 insertions(+), 196 deletions(-)
> > >
> > > diff --git 
> > > a/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c 
> > > b/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c
> > > index 2829f179f982..32ceb72f7a14 100644
> > > --- a/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c
> > > +++ b/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c
> > > @@ -325,64 +325,28 @@ static void 
> > > CalculateVupdateAndDynamicMetadataParameters(
> > >  static void CalculateWatermarksAndDRAMSpeedChangeSupport(
> > >   struct display_mode_lib *mode_lib,
> > >   unsigned int PrefetchMode,
> > > - unsigned int NumberOfActivePlanes,
> > > - unsigned int MaxLineBufferLines,
> > > - unsigned int LineBufferSize,
> > > - unsigned int WritebackInterfaceBufferSize,
> > >   double DCFCLK,
> > >   double ReturnBW,
> > > - bool SynchronizedVBlank,
> > > - unsigned int dpte_group_bytes[],
> > > - unsigned int MetaChunkSize,
> > >   double UrgentLatency,
> > >   double ExtraLatency,
> > > - double WritebackLatency,
> > > - double WritebackChunkSize,
> > >   double SOCCLK,
> > > - double DRAMClockChangeLatency,
> > > - double SRExitTime,
> > > - double SREnterPlusExitTime,
> > > - double SRExitZ8Time,
> > > - double SREnterPlusExitZ8Time,
> > >   double DCFCLKDeepSleep,
> > >   unsigned int DETBufferSizeY[],
> > >   unsigned int DETBufferSizeC[],
> > >   unsigned int SwathHeightY[],
> > >   unsigned int SwathHeightC[],
> > > - unsigned int LBBitPerPixel[],
> > >   double SwathWidthY[],
> > >   double SwathWidthC[],
> > > - double HRatio[],
> > > - double HRatioChroma[],
> > > - unsigned int vtaps[],
> > > - unsigned int VTAPsChroma[],
> > > - double VRatio[],
> > > - double VRatioChroma[],
> > > - unsigned int HTotal[],
> > > - double PixelClock[],
> > > - unsigned int BlendingAndTiming[],
> > >   unsigned int DPPPerPlane[],
> > >   double BytePerPixelDETY[],
> > >   double BytePerPixelDETC[],
> > > - double DSTXAfterScaler[],
> > > - double DSTYAfterScaler[],
> > > - bool WritebackEnable[],
> > > - enum source_format_class WritebackPixelFormat[],
> > > - double WritebackDestinationWidth[],
> > > - double WritebackDestinationHeight[],
> > > - double WritebackSourceHeight[]

Re: [PATCH 1/2] drm/amd/display: Reduce number of arguments of dml314's CalculateWatermarksAndDRAMSpeedChangeSupport()

2022-09-20 Thread Alex Deucher
Applied the series.  Thanks!

Alex

On Sat, Sep 17, 2022 at 8:38 AM Maíra Canal  wrote:
>
> Hi Nathan,
>
> On 9/16/22 18:06, Nathan Chancellor wrote:
> > Most of the arguments are identical between the two call sites and they
> > can be accessed through the 'struct vba_vars_st' pointer. This reduces
> > the total amount of stack space that
> > dml314_ModeSupportAndSystemConfigurationFull() uses by 240 bytes with
> > LLVM 16 (2216 -> 1976), helping clear up the following clang warning:
> >
> >   
> > drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn314/display_mode_vba_314.c:4020:6:
> >  error: stack frame size (2216) exceeds limit (2048) in 
> > 'dml314_ModeSupportAndSystemConfigurationFull' [-Werror,-Wframe-larger-than]
> >   void dml314_ModeSupportAndSystemConfigurationFull(struct display_mode_lib 
> > *mode_lib)
> >^
> >   1 error generated.
> >
> > Link: https://github.com/ClangBuiltLinux/linux/issues/1710
> > Reported-by: "kernelci.org bot" 
> > Signed-off-by: Nathan Chancellor 
>
> I have built-tested the whole series with clang 14.0.5 (Fedora
> 14.0.5-1.fc36), using:
>
> $ make -kj"$(nproc)" ARCH=x86_64 LLVM=1 mrproper allmodconfig
> drivers/gpu/drm/amd/amdgpu/
>
> Another great patch to the DML! As Tom, I also would like to see this
> expand to all display_mode_vba files, but so far this is great to
> unbreak the build.
>
> To the whole series:
>
> Tested-by: Maíra Canal 
>
> Best Regards,
> - Maíra Canal
>
> > ---
> >
> > This is just commit ab2ac59c32db ("drm/amd/display: Reduce number of
> > arguments of dml31's CalculateWatermarksAndDRAMSpeedChangeSupport()")
> > applied to dml314.
> >
> >  .../dc/dml/dcn314/display_mode_vba_314.c  | 248 --
> >  1 file changed, 52 insertions(+), 196 deletions(-)
> >
> > diff --git 
> > a/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c 
> > b/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c
> > index 2829f179f982..32ceb72f7a14 100644
> > --- a/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c
> > +++ b/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c
> > @@ -325,64 +325,28 @@ static void 
> > CalculateVupdateAndDynamicMetadataParameters(
> >  static void CalculateWatermarksAndDRAMSpeedChangeSupport(
> >   struct display_mode_lib *mode_lib,
> >   unsigned int PrefetchMode,
> > - unsigned int NumberOfActivePlanes,
> > - unsigned int MaxLineBufferLines,
> > - unsigned int LineBufferSize,
> > - unsigned int WritebackInterfaceBufferSize,
> >   double DCFCLK,
> >   double ReturnBW,
> > - bool SynchronizedVBlank,
> > - unsigned int dpte_group_bytes[],
> > - unsigned int MetaChunkSize,
> >   double UrgentLatency,
> >   double ExtraLatency,
> > - double WritebackLatency,
> > - double WritebackChunkSize,
> >   double SOCCLK,
> > - double DRAMClockChangeLatency,
> > - double SRExitTime,
> > - double SREnterPlusExitTime,
> > - double SRExitZ8Time,
> > - double SREnterPlusExitZ8Time,
> >   double DCFCLKDeepSleep,
> >   unsigned int DETBufferSizeY[],
> >   unsigned int DETBufferSizeC[],
> >   unsigned int SwathHeightY[],
> >   unsigned int SwathHeightC[],
> > - unsigned int LBBitPerPixel[],
> >   double SwathWidthY[],
> >   double SwathWidthC[],
> > - double HRatio[],
> > - double HRatioChroma[],
> > - unsigned int vtaps[],
> > - unsigned int VTAPsChroma[],
> > - double VRatio[],
> > - double VRatioChroma[],
> > - unsigned int HTotal[],
> > - double PixelClock[],
> > - unsigned int BlendingAndTiming[],
> >   unsigned int DPPPerPlane[],
> >   double BytePerPixelDETY[],
> >   double BytePerPixelDETC[],
> > - double DSTXAfterScaler[],
> > - double DSTYAfterScaler[],
> > - bool WritebackEnable[],
> > - enum source_format_class WritebackPixelFormat[],
> > - double WritebackDestinationWidth[],
> > - double WritebackDestinationHeight[],
> > - double WritebackSourceHeight[],
> >   bool UnboundedRequestEnabled,
> >   unsigned int CompressedBufferSizeInkByte,
> >   enum clock_change_support *DRAMClockChangeSupport,
> > - double *UrgentWatermark,
> > - double *WritebackUrgentWatermark,
> > - double *DRAMClockChangeWatermark,
> > - double *WritebackDRAMClockChangeWatermark,
> >   double *StutterExitWatermark,
> >   double *StutterEnterPlusExitWatermark,
> >   double *Z8StutterExitWatermark,
> > - double 

Re: [PATCH 1/2] drm/amd/display: Reduce number of arguments of dml314's CalculateWatermarksAndDRAMSpeedChangeSupport()

2022-09-19 Thread Tom Rix



On 9/16/22 2:06 PM, Nathan Chancellor wrote:

Most of the arguments are identical between the two call sites and they
can be accessed through the 'struct vba_vars_st' pointer. This reduces
the total amount of stack space that
dml314_ModeSupportAndSystemConfigurationFull() uses by 240 bytes with
LLVM 16 (2216 -> 1976), helping clear up the following clang warning:

   
drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn314/display_mode_vba_314.c:4020:6:
 error: stack frame size (2216) exceeds limit (2048) in 
'dml314_ModeSupportAndSystemConfigurationFull' [-Werror,-Wframe-larger-than]
   void dml314_ModeSupportAndSystemConfigurationFull(struct display_mode_lib 
*mode_lib)
^
   1 error generated.

Link: https://github.com/ClangBuiltLinux/linux/issues/1710
Reported-by: "kernelci.org bot" 
Signed-off-by: Nathan Chancellor 


Nathan,

I like this change but I don't think it goes far enough.

There are many similar functions in this file and there other 
display_node_vba_*.c files that pass too many vba_vars_st elements.


I think most/all of the static functions should be refactored to pass 
vba_vars_st * or vba_vars_st **


fwiw, i found the calling function 
DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation, 
hilariously long :)


I'll do the change if you want to pass this to me, I promise not to add 
to the above function name.


Tom


---

This is just commit ab2ac59c32db ("drm/amd/display: Reduce number of
arguments of dml31's CalculateWatermarksAndDRAMSpeedChangeSupport()")
applied to dml314.

  .../dc/dml/dcn314/display_mode_vba_314.c  | 248 --
  1 file changed, 52 insertions(+), 196 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c 
b/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c
index 2829f179f982..32ceb72f7a14 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c
@@ -325,64 +325,28 @@ static void CalculateVupdateAndDynamicMetadataParameters(
  static void CalculateWatermarksAndDRAMSpeedChangeSupport(
struct display_mode_lib *mode_lib,
unsigned int PrefetchMode,
-   unsigned int NumberOfActivePlanes,
-   unsigned int MaxLineBufferLines,
-   unsigned int LineBufferSize,
-   unsigned int WritebackInterfaceBufferSize,
double DCFCLK,
double ReturnBW,
-   bool SynchronizedVBlank,
-   unsigned int dpte_group_bytes[],
-   unsigned int MetaChunkSize,
double UrgentLatency,
double ExtraLatency,
-   double WritebackLatency,
-   double WritebackChunkSize,
double SOCCLK,
-   double DRAMClockChangeLatency,
-   double SRExitTime,
-   double SREnterPlusExitTime,
-   double SRExitZ8Time,
-   double SREnterPlusExitZ8Time,
double DCFCLKDeepSleep,
unsigned int DETBufferSizeY[],
unsigned int DETBufferSizeC[],
unsigned int SwathHeightY[],
unsigned int SwathHeightC[],
-   unsigned int LBBitPerPixel[],
double SwathWidthY[],
double SwathWidthC[],
-   double HRatio[],
-   double HRatioChroma[],
-   unsigned int vtaps[],
-   unsigned int VTAPsChroma[],
-   double VRatio[],
-   double VRatioChroma[],
-   unsigned int HTotal[],
-   double PixelClock[],
-   unsigned int BlendingAndTiming[],
unsigned int DPPPerPlane[],
double BytePerPixelDETY[],
double BytePerPixelDETC[],
-   double DSTXAfterScaler[],
-   double DSTYAfterScaler[],
-   bool WritebackEnable[],
-   enum source_format_class WritebackPixelFormat[],
-   double WritebackDestinationWidth[],
-   double WritebackDestinationHeight[],
-   double WritebackSourceHeight[],
bool UnboundedRequestEnabled,
unsigned int CompressedBufferSizeInkByte,
enum clock_change_support *DRAMClockChangeSupport,
-   double *UrgentWatermark,
-   double *WritebackUrgentWatermark,
-   double *DRAMClockChangeWatermark,
-   double *WritebackDRAMClockChangeWatermark,
double *StutterExitWatermark,
double *StutterEnterPlusExitWatermark,
double *Z8StutterExitWatermark,
-   double *Z8StutterEnterPlusExitWatermark,
-   double *MinActiveDRAMClockChangeLatencySupported);
+   double *Z8StutterEnterPlusExitWatermark);
  
  static void CalculateDCFCLKDeepSleep(

struct display_m

Re: [PATCH 1/2] drm/amd/display: Reduce number of arguments of dml314's CalculateWatermarksAndDRAMSpeedChangeSupport()

2022-09-17 Thread Maíra Canal
Hi Nathan,

On 9/16/22 18:06, Nathan Chancellor wrote:
> Most of the arguments are identical between the two call sites and they
> can be accessed through the 'struct vba_vars_st' pointer. This reduces
> the total amount of stack space that
> dml314_ModeSupportAndSystemConfigurationFull() uses by 240 bytes with
> LLVM 16 (2216 -> 1976), helping clear up the following clang warning:
> 
>   
> drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn314/display_mode_vba_314.c:4020:6:
>  error: stack frame size (2216) exceeds limit (2048) in 
> 'dml314_ModeSupportAndSystemConfigurationFull' [-Werror,-Wframe-larger-than]
>   void dml314_ModeSupportAndSystemConfigurationFull(struct display_mode_lib 
> *mode_lib)
>^
>   1 error generated.
> 
> Link: https://github.com/ClangBuiltLinux/linux/issues/1710
> Reported-by: "kernelci.org bot" 
> Signed-off-by: Nathan Chancellor 

I have built-tested the whole series with clang 14.0.5 (Fedora
14.0.5-1.fc36), using:

$ make -kj"$(nproc)" ARCH=x86_64 LLVM=1 mrproper allmodconfig
drivers/gpu/drm/amd/amdgpu/

Another great patch to the DML! As Tom, I also would like to see this
expand to all display_mode_vba files, but so far this is great to
unbreak the build.

To the whole series:

Tested-by: Maíra Canal 

Best Regards,
- Maíra Canal

> ---
> 
> This is just commit ab2ac59c32db ("drm/amd/display: Reduce number of
> arguments of dml31's CalculateWatermarksAndDRAMSpeedChangeSupport()")
> applied to dml314.
> 
>  .../dc/dml/dcn314/display_mode_vba_314.c  | 248 --
>  1 file changed, 52 insertions(+), 196 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c 
> b/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c
> index 2829f179f982..32ceb72f7a14 100644
> --- a/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c
> +++ b/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c
> @@ -325,64 +325,28 @@ static void 
> CalculateVupdateAndDynamicMetadataParameters(
>  static void CalculateWatermarksAndDRAMSpeedChangeSupport(
>   struct display_mode_lib *mode_lib,
>   unsigned int PrefetchMode,
> - unsigned int NumberOfActivePlanes,
> - unsigned int MaxLineBufferLines,
> - unsigned int LineBufferSize,
> - unsigned int WritebackInterfaceBufferSize,
>   double DCFCLK,
>   double ReturnBW,
> - bool SynchronizedVBlank,
> - unsigned int dpte_group_bytes[],
> - unsigned int MetaChunkSize,
>   double UrgentLatency,
>   double ExtraLatency,
> - double WritebackLatency,
> - double WritebackChunkSize,
>   double SOCCLK,
> - double DRAMClockChangeLatency,
> - double SRExitTime,
> - double SREnterPlusExitTime,
> - double SRExitZ8Time,
> - double SREnterPlusExitZ8Time,
>   double DCFCLKDeepSleep,
>   unsigned int DETBufferSizeY[],
>   unsigned int DETBufferSizeC[],
>   unsigned int SwathHeightY[],
>   unsigned int SwathHeightC[],
> - unsigned int LBBitPerPixel[],
>   double SwathWidthY[],
>   double SwathWidthC[],
> - double HRatio[],
> - double HRatioChroma[],
> - unsigned int vtaps[],
> - unsigned int VTAPsChroma[],
> - double VRatio[],
> - double VRatioChroma[],
> - unsigned int HTotal[],
> - double PixelClock[],
> - unsigned int BlendingAndTiming[],
>   unsigned int DPPPerPlane[],
>   double BytePerPixelDETY[],
>   double BytePerPixelDETC[],
> - double DSTXAfterScaler[],
> - double DSTYAfterScaler[],
> - bool WritebackEnable[],
> - enum source_format_class WritebackPixelFormat[],
> - double WritebackDestinationWidth[],
> - double WritebackDestinationHeight[],
> - double WritebackSourceHeight[],
>   bool UnboundedRequestEnabled,
>   unsigned int CompressedBufferSizeInkByte,
>   enum clock_change_support *DRAMClockChangeSupport,
> - double *UrgentWatermark,
> - double *WritebackUrgentWatermark,
> - double *DRAMClockChangeWatermark,
> - double *WritebackDRAMClockChangeWatermark,
>   double *StutterExitWatermark,
>   double *StutterEnterPlusExitWatermark,
>   double *Z8StutterExitWatermark,
> - double *Z8StutterEnterPlusExitWatermark,
> - double *MinActiveDRAMClockChangeLatencySupported);
> + double *Z8StutterEnterPlusExitWatermark);
>  
>  static void CalculateDCFCLKDeepSleep(
>   struct display_mode_lib *mode_lib,
> @@ -3041,64 +3005,28 @@ static void 
> DISPCLKDPPCLKDCF

Re: [PATCH 1/2] drm/amd/display: Reduce number of arguments of dml314's CalculateWatermarksAndDRAMSpeedChangeSupport()

2022-09-16 Thread Nathan Chancellor
On Fri, Sep 16, 2022 at 03:04:53PM -0700, Tom Rix wrote:
> 
> On 9/16/22 2:06 PM, Nathan Chancellor wrote:
> > Most of the arguments are identical between the two call sites and they
> > can be accessed through the 'struct vba_vars_st' pointer. This reduces
> > the total amount of stack space that
> > dml314_ModeSupportAndSystemConfigurationFull() uses by 240 bytes with
> > LLVM 16 (2216 -> 1976), helping clear up the following clang warning:
> > 
> >
> > drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn314/display_mode_vba_314.c:4020:6:
> >  error: stack frame size (2216) exceeds limit (2048) in 
> > 'dml314_ModeSupportAndSystemConfigurationFull' [-Werror,-Wframe-larger-than]
> >void dml314_ModeSupportAndSystemConfigurationFull(struct 
> > display_mode_lib *mode_lib)
> > ^
> >1 error generated.
> > 
> > Link: https://github.com/ClangBuiltLinux/linux/issues/1710
> > Reported-by: "kernelci.org bot" 
> > Signed-off-by: Nathan Chancellor 
> 
> Nathan,
> 
> I like this change but I don't think it goes far enough.
> 
> There are many similar functions in this file and there other
> display_node_vba_*.c files that pass too many vba_vars_st elements.
> 
> I think most/all of the static functions should be refactored to pass
> vba_vars_st * or vba_vars_st **
> 
> fwiw, i found the calling function 
> DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation,
> hilariously long :)
> 
> I'll do the change if you want to pass this to me, I promise not to add to
> the above function name.

Right, there is definitely more that could be done here; I just picked
the couple of functions that would appear to make the most impact, as I
am only concerned with keeping the code warning free with clang so that
-Werror does not break us. I think it makes sense to take this series to
fix the warnings right now (especially since this patch has technically
already been accepted, as it was applied to dcn31) then follow up with
refactoring, which I am more than happy to let you do if you so desire
:)

Thank you for the input as always!

Cheers,
Nathan

> > ---
> > 
> > This is just commit ab2ac59c32db ("drm/amd/display: Reduce number of
> > arguments of dml31's CalculateWatermarksAndDRAMSpeedChangeSupport()")
> > applied to dml314.
> > 
> >   .../dc/dml/dcn314/display_mode_vba_314.c  | 248 --
> >   1 file changed, 52 insertions(+), 196 deletions(-)
> > 
> > diff --git 
> > a/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c 
> > b/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c
> > index 2829f179f982..32ceb72f7a14 100644
> > --- a/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c
> > +++ b/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c
> > @@ -325,64 +325,28 @@ static void 
> > CalculateVupdateAndDynamicMetadataParameters(
> >   static void CalculateWatermarksAndDRAMSpeedChangeSupport(
> > struct display_mode_lib *mode_lib,
> > unsigned int PrefetchMode,
> > -   unsigned int NumberOfActivePlanes,
> > -   unsigned int MaxLineBufferLines,
> > -   unsigned int LineBufferSize,
> > -   unsigned int WritebackInterfaceBufferSize,
> > double DCFCLK,
> > double ReturnBW,
> > -   bool SynchronizedVBlank,
> > -   unsigned int dpte_group_bytes[],
> > -   unsigned int MetaChunkSize,
> > double UrgentLatency,
> > double ExtraLatency,
> > -   double WritebackLatency,
> > -   double WritebackChunkSize,
> > double SOCCLK,
> > -   double DRAMClockChangeLatency,
> > -   double SRExitTime,
> > -   double SREnterPlusExitTime,
> > -   double SRExitZ8Time,
> > -   double SREnterPlusExitZ8Time,
> > double DCFCLKDeepSleep,
> > unsigned int DETBufferSizeY[],
> > unsigned int DETBufferSizeC[],
> > unsigned int SwathHeightY[],
> > unsigned int SwathHeightC[],
> > -   unsigned int LBBitPerPixel[],
> > double SwathWidthY[],
> > double SwathWidthC[],
> > -   double HRatio[],
> > -   double HRatioChroma[],
> > -   unsigned int vtaps[],
> > -   unsigned int VTAPsChroma[],
> > -   double VRatio[],
> > -   double VRatioChroma[],
> > -   unsigned int HTotal[],
> > -   double PixelClock[],
> > -   unsigned int BlendingAndTiming[],
> > unsigned int DPPPerPlane[],
> > double BytePerPixelDETY[],
> > double BytePerPixelDETC[],
> > -   double DSTXAfterScaler[],
> > -   double DSTYAfterScaler[],
> > -   bool WritebackEnable[],
> > -   enum source_format_class WritebackPixelFormat[],
> > -   double WritebackDestinationWidth[],
> > -   double WritebackDestinationHeight[],
> > -   double WritebackSourceHeight[

[PATCH 1/2] drm/amd/display: Reduce number of arguments of dml314's CalculateWatermarksAndDRAMSpeedChangeSupport()

2022-09-16 Thread Nathan Chancellor
Most of the arguments are identical between the two call sites and they
can be accessed through the 'struct vba_vars_st' pointer. This reduces
the total amount of stack space that
dml314_ModeSupportAndSystemConfigurationFull() uses by 240 bytes with
LLVM 16 (2216 -> 1976), helping clear up the following clang warning:

  
drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn314/display_mode_vba_314.c:4020:6:
 error: stack frame size (2216) exceeds limit (2048) in 
'dml314_ModeSupportAndSystemConfigurationFull' [-Werror,-Wframe-larger-than]
  void dml314_ModeSupportAndSystemConfigurationFull(struct display_mode_lib 
*mode_lib)
   ^
  1 error generated.

Link: https://github.com/ClangBuiltLinux/linux/issues/1710
Reported-by: "kernelci.org bot" 
Signed-off-by: Nathan Chancellor 
---

This is just commit ab2ac59c32db ("drm/amd/display: Reduce number of
arguments of dml31's CalculateWatermarksAndDRAMSpeedChangeSupport()")
applied to dml314.

 .../dc/dml/dcn314/display_mode_vba_314.c  | 248 --
 1 file changed, 52 insertions(+), 196 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c 
b/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c
index 2829f179f982..32ceb72f7a14 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c
@@ -325,64 +325,28 @@ static void CalculateVupdateAndDynamicMetadataParameters(
 static void CalculateWatermarksAndDRAMSpeedChangeSupport(
struct display_mode_lib *mode_lib,
unsigned int PrefetchMode,
-   unsigned int NumberOfActivePlanes,
-   unsigned int MaxLineBufferLines,
-   unsigned int LineBufferSize,
-   unsigned int WritebackInterfaceBufferSize,
double DCFCLK,
double ReturnBW,
-   bool SynchronizedVBlank,
-   unsigned int dpte_group_bytes[],
-   unsigned int MetaChunkSize,
double UrgentLatency,
double ExtraLatency,
-   double WritebackLatency,
-   double WritebackChunkSize,
double SOCCLK,
-   double DRAMClockChangeLatency,
-   double SRExitTime,
-   double SREnterPlusExitTime,
-   double SRExitZ8Time,
-   double SREnterPlusExitZ8Time,
double DCFCLKDeepSleep,
unsigned int DETBufferSizeY[],
unsigned int DETBufferSizeC[],
unsigned int SwathHeightY[],
unsigned int SwathHeightC[],
-   unsigned int LBBitPerPixel[],
double SwathWidthY[],
double SwathWidthC[],
-   double HRatio[],
-   double HRatioChroma[],
-   unsigned int vtaps[],
-   unsigned int VTAPsChroma[],
-   double VRatio[],
-   double VRatioChroma[],
-   unsigned int HTotal[],
-   double PixelClock[],
-   unsigned int BlendingAndTiming[],
unsigned int DPPPerPlane[],
double BytePerPixelDETY[],
double BytePerPixelDETC[],
-   double DSTXAfterScaler[],
-   double DSTYAfterScaler[],
-   bool WritebackEnable[],
-   enum source_format_class WritebackPixelFormat[],
-   double WritebackDestinationWidth[],
-   double WritebackDestinationHeight[],
-   double WritebackSourceHeight[],
bool UnboundedRequestEnabled,
unsigned int CompressedBufferSizeInkByte,
enum clock_change_support *DRAMClockChangeSupport,
-   double *UrgentWatermark,
-   double *WritebackUrgentWatermark,
-   double *DRAMClockChangeWatermark,
-   double *WritebackDRAMClockChangeWatermark,
double *StutterExitWatermark,
double *StutterEnterPlusExitWatermark,
double *Z8StutterExitWatermark,
-   double *Z8StutterEnterPlusExitWatermark,
-   double *MinActiveDRAMClockChangeLatencySupported);
+   double *Z8StutterEnterPlusExitWatermark);
 
 static void CalculateDCFCLKDeepSleep(
struct display_mode_lib *mode_lib,
@@ -3041,64 +3005,28 @@ static void 
DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman
CalculateWatermarksAndDRAMSpeedChangeSupport(
mode_lib,
PrefetchMode,
-   v->NumberOfActivePlanes,
-   v->MaxLineBufferLines,
-   v->LineBufferSize,
-   v->WritebackInterfaceBufferSize,
v->DCFCLK,
v->ReturnBW,
-