RE: [PATCH] drm/amd/display: fix i386 frame size warning

2022-08-24 Thread David Laight
From: Hamza Mahfooz
> Sent: 18 August 2022 17:49
> 
> Addresses the following warning:
> drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn30/display_mode_vba_30.c:3596:6:
>  error: stack frame
> size (2092) exceeds limit (2048) in 
> 'dml30_ModeSupportAndSystemConfigurationFull' [-Werror,-Wframe-
> larger-than]
> void dml30_ModeSupportAndSystemConfigurationFull(struct display_mode_lib 
> *mode_lib)
>  ^
> 
> UseMinimumDCFCLK() is eating away at
> dml30_ModeSupportAndSystemConfigurationFull()'s stack space, so use a
> pointer to struct vba_vars_st instead of passing lots of large arrays
> as parameters by value.
> 
> Signed-off-by: Hamza Mahfooz 
> ---
>  .../dc/dml/dcn30/display_mode_vba_30.c| 295 --
>  1 file changed, 63 insertions(+), 232 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c
> b/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c
> index 876b321b30ca..b7fa003ffe06 100644
> --- a/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c
> +++ b/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c
> @@ -396,64 +396,10 @@ static void CalculateUrgentBurstFactor(
> 
>  static void UseMinimumDCFCLK(
>   struct display_mode_lib *mode_lib,
> - int MaxInterDCNTileRepeaters,
> + struct vba_vars_st *v,

You should probably add 'const' in there.
Thinks will likely break if v->xxx gets changed.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, 
UK
Registration No: 1397386 (Wales)



Re: [PATCH] drm/amd/display: fix i386 frame size warning

2022-08-19 Thread Maíra Canal
Hi Hamza,

On 8/18/22 13:48, Hamza Mahfooz wrote:
> Addresses the following warning:
> drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn30/display_mode_vba_30.c:3596:6:
>  error: stack frame size (2092) exceeds limit (2048) in 
> 'dml30_ModeSupportAndSystemConfigurationFull' [-Werror,-Wframe-larger-than]
> void dml30_ModeSupportAndSystemConfigurationFull(struct display_mode_lib 
> *mode_lib)
>  ^

Could you please specify how you generated this error? I was trying to
test the patch and I couldn't reproduce this error on i386.

I ran on amd-staging-drm-next without your patch:

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

which didn't generated warnings on display_mode_vba_30.

Moreover, I applied your patch on amd-staging-drm-next and ran:

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

and I still get the warning:

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

Best Regards,
- Maíra Canal

> 
> UseMinimumDCFCLK() is eating away at
> dml30_ModeSupportAndSystemConfigurationFull()'s stack space, so use a
> pointer to struct vba_vars_st instead of passing lots of large arrays
> as parameters by value.
> 
> Signed-off-by: Hamza Mahfooz 
> ---
>  .../dc/dml/dcn30/display_mode_vba_30.c| 295 --
>  1 file changed, 63 insertions(+), 232 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c 
> b/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c
> index 876b321b30ca..b7fa003ffe06 100644
> --- a/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c
> +++ b/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c
> @@ -396,64 +396,10 @@ static void CalculateUrgentBurstFactor(
>  
>  static void UseMinimumDCFCLK(
>   struct display_mode_lib *mode_lib,
> - int MaxInterDCNTileRepeaters,
> + struct vba_vars_st *v,
>   int MaxPrefetchMode,
> - double FinalDRAMClockChangeLatency,
> - double SREnterPlusExitTime,
> - int ReturnBusWidth,
> - int RoundTripPingLatencyCycles,
> - int ReorderingBytes,
> - int PixelChunkSizeInKByte,
> - int MetaChunkSize,
> - bool GPUVMEnable,
> - int GPUVMMaxPageTableLevels,
> - bool HostVMEnable,
> - int NumberOfActivePlanes,
> - double HostVMMinPageSize,
> - int HostVMMaxNonCachedPageTableLevels,
> - bool DynamicMetadataVMEnabled,
> - enum immediate_flip_requirement ImmediateFlipRequirement,
> - bool ProgressiveToInterlaceUnitInOPP,
> - double 
> MaxAveragePercentOfIdealSDPPortBWDisplayCanUseInNormalSystemOperation,
> - double 
> PercentOfIdealDRAMFabricAndSDPPortBWReceivedAfterUrgLatencyPixelMixedWithVMData,
> - double 
> PercentOfIdealDRAMFabricAndSDPPortBWReceivedAfterUrgLatencyVMDataOnly,
> - double 
> PercentOfIdealDRAMFabricAndSDPPortBWReceivedAfterUrgLatencyPixelDataOnly,
> - int VTotal[],
> - int VActive[],
> - int DynamicMetadataTransmittedBytes[],
> - int DynamicMetadataLinesBeforeActiveRequired[],
> - bool Interlace[],
> - double RequiredDPPCLK[][2][DC__NUM_DPP__MAX],
> - double RequiredDISPCLK[][2],
> - double UrgLatency[],
> - unsigned int NoOfDPP[][2][DC__NUM_DPP__MAX],
> - double ProjectedDCFCLKDeepSleep[][2],
> - double MaximumVStartup[][2][DC__NUM_DPP__MAX],
> - double TotalVActivePixelBandwidth[][2],
> - double TotalVActiveCursorBandwidth[][2],
> - double TotalMetaRowBandwidth[][2],
> - double TotalDPTERowBandwidth[][2],
> - unsigned int TotalNumberOfActiveDPP[][2],
> - unsigned int TotalNumberOfDCCActiveDPP[][2],
> - int dpte_group_bytes[],
> - double PrefetchLinesY[][2][DC__NUM_DPP__MAX],
> - double PrefetchLinesC[][2][DC__NUM_DPP__MAX],
> - unsigned int 
> swath_width_luma_ub_all_states[][2][DC__NUM_DPP__MAX],
> - unsigned int 
> swath_width_chroma_ub_all_states[][2][DC__NUM_DPP__MAX],
> - int BytePerPixelY[],
> - int BytePerPixelC[],
> - int HTotal[],
> - double PixelClock[],
> - double PDEAndMetaPTEBytesPerFrame[][2][DC__NUM_DPP__MAX],
> - double DPTEBytesPerRow[][2][DC__NUM_DPP__MAX],
> - double MetaRowBytes[][2][DC__NUM_DPP__MAX],
> - bool DynamicMetadataEnable[],
> - 

Re: [PATCH] drm/amd/display: fix i386 frame size warning

2022-08-18 Thread Aurabindo Pillai




On 2022-08-18 12:48, Hamza Mahfooz wrote:

Addresses the following warning:
drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn30/display_mode_vba_30.c:3596:6:
 error: stack frame size (2092) exceeds limit (2048) in 
'dml30_ModeSupportAndSystemConfigurationFull' [-Werror,-Wframe-larger-than]
void dml30_ModeSupportAndSystemConfigurationFull(struct display_mode_lib 
*mode_lib)
  ^

UseMinimumDCFCLK() is eating away at
dml30_ModeSupportAndSystemConfigurationFull()'s stack space, so use a
pointer to struct vba_vars_st instead of passing lots of large arrays
as parameters by value.

Signed-off-by: Hamza Mahfooz 
---
  .../dc/dml/dcn30/display_mode_vba_30.c| 295 --
  1 file changed, 63 insertions(+), 232 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c 
b/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c
index 876b321b30ca..b7fa003ffe06 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c
+++ b/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c
@@ -396,64 +396,10 @@ static void CalculateUrgentBurstFactor(
  
  static void UseMinimumDCFCLK(

struct display_mode_lib *mode_lib,
-   int MaxInterDCNTileRepeaters,
+   struct vba_vars_st *v,
int MaxPrefetchMode,
-   double FinalDRAMClockChangeLatency,
-   double SREnterPlusExitTime,
-   int ReturnBusWidth,
-   int RoundTripPingLatencyCycles,
-   int ReorderingBytes,
-   int PixelChunkSizeInKByte,
-   int MetaChunkSize,
-   bool GPUVMEnable,
-   int GPUVMMaxPageTableLevels,
-   bool HostVMEnable,
-   int NumberOfActivePlanes,
-   double HostVMMinPageSize,
-   int HostVMMaxNonCachedPageTableLevels,
-   bool DynamicMetadataVMEnabled,
-   enum immediate_flip_requirement ImmediateFlipRequirement,
-   bool ProgressiveToInterlaceUnitInOPP,
-   double 
MaxAveragePercentOfIdealSDPPortBWDisplayCanUseInNormalSystemOperation,
-   double 
PercentOfIdealDRAMFabricAndSDPPortBWReceivedAfterUrgLatencyPixelMixedWithVMData,
-   double 
PercentOfIdealDRAMFabricAndSDPPortBWReceivedAfterUrgLatencyVMDataOnly,
-   double 
PercentOfIdealDRAMFabricAndSDPPortBWReceivedAfterUrgLatencyPixelDataOnly,
-   int VTotal[],
-   int VActive[],
-   int DynamicMetadataTransmittedBytes[],
-   int DynamicMetadataLinesBeforeActiveRequired[],
-   bool Interlace[],
-   double RequiredDPPCLK[][2][DC__NUM_DPP__MAX],
-   double RequiredDISPCLK[][2],
-   double UrgLatency[],
-   unsigned int NoOfDPP[][2][DC__NUM_DPP__MAX],
-   double ProjectedDCFCLKDeepSleep[][2],
-   double MaximumVStartup[][2][DC__NUM_DPP__MAX],
-   double TotalVActivePixelBandwidth[][2],
-   double TotalVActiveCursorBandwidth[][2],
-   double TotalMetaRowBandwidth[][2],
-   double TotalDPTERowBandwidth[][2],
-   unsigned int TotalNumberOfActiveDPP[][2],
-   unsigned int TotalNumberOfDCCActiveDPP[][2],
-   int dpte_group_bytes[],
-   double PrefetchLinesY[][2][DC__NUM_DPP__MAX],
-   double PrefetchLinesC[][2][DC__NUM_DPP__MAX],
-   unsigned int 
swath_width_luma_ub_all_states[][2][DC__NUM_DPP__MAX],
-   unsigned int 
swath_width_chroma_ub_all_states[][2][DC__NUM_DPP__MAX],
-   int BytePerPixelY[],
-   int BytePerPixelC[],
-   int HTotal[],
-   double PixelClock[],
-   double PDEAndMetaPTEBytesPerFrame[][2][DC__NUM_DPP__MAX],
-   double DPTEBytesPerRow[][2][DC__NUM_DPP__MAX],
-   double MetaRowBytes[][2][DC__NUM_DPP__MAX],
-   bool DynamicMetadataEnable[],
-   double VActivePixelBandwidth[][2][DC__NUM_DPP__MAX],
-   double VActiveCursorBandwidth[][2][DC__NUM_DPP__MAX],
-   double ReadBandwidthLuma[],
-   double ReadBandwidthChroma[],
-   double DCFCLKPerState[],
-   double DCFCLKState[][2]);
+   int ReorderingBytes);
+
  static void CalculatePixelDeliveryTimes(
unsigned int NumberOfActivePlanes,
double VRatio[],
@@ -4692,66 +4638,7 @@ void dml30_ModeSupportAndSystemConfigurationFull(struct 
display_mode_lib *mode_l
}
  
  	if (v->UseMinimumRequiredDCFCLK == true) {

-   UseMinimumDCFCLK(
-   mode_lib,
-   v->MaxInterDCNTileRepeaters,
-   MaxPrefetchMode,
-   v->FinalDRAMClockChangeLatency,
-   v->SREnterPlusExitTime,