Commit 1df7e569 authored by Nathan Chancellor's avatar Nathan Chancellor Committed by Alex Deucher
Browse files

drm/amd/display: Reduce number of arguments of...

drm/amd/display: Reduce number of arguments of dml32_CalculateWatermarksMALLUseAndDRAMSpeedChangeSupport()

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

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

Additionally, while modifying the arguments to
dml32_CalculateWatermarksMALLUseAndDRAMSpeedChangeSupport(), use 'v'
consistently, instead of 'v' mixed with 'mode_lib->vba'.

Link: https://github.com/ClangBuiltLinux/linux/issues/1681


Reported-by: default avatar"Sudip Mukherjee (Codethink)" <sudipm.mukherjee@gmail.com>
Tested-by: default avatarMaíra Canal <mairacanal@riseup.net>
Reviewed-by: default avatarRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: default avatarNathan Chancellor <nathan@kernel.org>
Signed-off-by: default avatarRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 419c1452
Loading
Loading
Loading
Loading
+29 −89
Original line number Diff line number Diff line
@@ -1163,58 +1163,28 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman
		v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.mmSOCParameters.SMNLatency = mode_lib->vba.SMNLatency;

		dml32_CalculateWatermarksMALLUseAndDRAMSpeedChangeSupport(
			mode_lib->vba.USRRetrainingRequiredFinal,
			mode_lib->vba.UsesMALLForPStateChange,
			mode_lib->vba.PrefetchModePerState[mode_lib->vba.VoltageLevel][mode_lib->vba.maxMpcComb],
			mode_lib->vba.NumberOfActiveSurfaces,
			mode_lib->vba.MaxLineBufferLines,
			mode_lib->vba.LineBufferSizeFinal,
			mode_lib->vba.WritebackInterfaceBufferSize,
			mode_lib->vba.DCFCLK,
			mode_lib->vba.ReturnBW,
			mode_lib->vba.SynchronizeTimingsFinal,
			mode_lib->vba.SynchronizeDRRDisplaysForUCLKPStateChangeFinal,
			mode_lib->vba.DRRDisplay,
			v->dpte_group_bytes,
			v->meta_row_height,
			v->meta_row_height_chroma,
			v,
			v->PrefetchModePerState[v->VoltageLevel][v->maxMpcComb],
			v->DCFCLK,
			v->ReturnBW,
			v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.mmSOCParameters,
			mode_lib->vba.WritebackChunkSize,
			mode_lib->vba.SOCCLK,
			v->SOCCLK,
			v->DCFCLKDeepSleep,
			mode_lib->vba.DETBufferSizeY,
			mode_lib->vba.DETBufferSizeC,
			mode_lib->vba.SwathHeightY,
			mode_lib->vba.SwathHeightC,
			mode_lib->vba.LBBitPerPixel,
			v->DETBufferSizeY,
			v->DETBufferSizeC,
			v->SwathHeightY,
			v->SwathHeightC,
			v->SwathWidthY,
			v->SwathWidthC,
			mode_lib->vba.HRatio,
			mode_lib->vba.HRatioChroma,
			mode_lib->vba.vtaps,
			mode_lib->vba.VTAPsChroma,
			mode_lib->vba.VRatio,
			mode_lib->vba.VRatioChroma,
			mode_lib->vba.HTotal,
			mode_lib->vba.VTotal,
			mode_lib->vba.VActive,
			mode_lib->vba.PixelClock,
			mode_lib->vba.BlendingAndTiming,
			mode_lib->vba.DPPPerPlane,
			v->DPPPerPlane,
			v->BytePerPixelDETY,
			v->BytePerPixelDETC,
			v->DSTXAfterScaler,
			v->DSTYAfterScaler,
			mode_lib->vba.WritebackEnable,
			mode_lib->vba.WritebackPixelFormat,
			mode_lib->vba.WritebackDestinationWidth,
			mode_lib->vba.WritebackDestinationHeight,
			mode_lib->vba.WritebackSourceHeight,
			v->UnboundedRequestEnabled,
			v->CompressedBufferSizeInkByte,

			/* Output */
			&v->Watermark,
			&v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.dummy_dramchange_support,
			v->MaxActiveDRAMClockChangeLatencySupported,
			v->SubViewportLinesNeededInMALL,
@@ -3559,62 +3529,32 @@ void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l

			{
				dml32_CalculateWatermarksMALLUseAndDRAMSpeedChangeSupport(
						mode_lib->vba.USRRetrainingRequiredFinal,
						mode_lib->vba.UsesMALLForPStateChange,
						mode_lib->vba.PrefetchModePerState[i][j],
						mode_lib->vba.NumberOfActiveSurfaces,
						mode_lib->vba.MaxLineBufferLines,
						mode_lib->vba.LineBufferSizeFinal,
						mode_lib->vba.WritebackInterfaceBufferSize,
						mode_lib->vba.DCFCLKState[i][j],
						mode_lib->vba.ReturnBWPerState[i][j],
						mode_lib->vba.SynchronizeTimingsFinal,
						mode_lib->vba.SynchronizeDRRDisplaysForUCLKPStateChangeFinal,
						mode_lib->vba.DRRDisplay,
						mode_lib->vba.dpte_group_bytes,
						mode_lib->vba.meta_row_height,
						mode_lib->vba.meta_row_height_chroma,
						v,
						v->PrefetchModePerState[i][j],
						v->DCFCLKState[i][j],
						v->ReturnBWPerState[i][j],
						v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.mSOCParameters,
						mode_lib->vba.WritebackChunkSize,
						mode_lib->vba.SOCCLKPerState[i],
						mode_lib->vba.ProjectedDCFCLKDeepSleep[i][j],
						mode_lib->vba.DETBufferSizeYThisState,
						mode_lib->vba.DETBufferSizeCThisState,
						mode_lib->vba.SwathHeightYThisState,
						mode_lib->vba.SwathHeightCThisState,
						mode_lib->vba.LBBitPerPixel,
						mode_lib->vba.SwathWidthYThisState, // 24
						mode_lib->vba.SwathWidthCThisState,
						mode_lib->vba.HRatio,
						mode_lib->vba.HRatioChroma,
						mode_lib->vba.vtaps,
						mode_lib->vba.VTAPsChroma,
						mode_lib->vba.VRatio,
						mode_lib->vba.VRatioChroma,
						mode_lib->vba.HTotal,
						mode_lib->vba.VTotal,
						mode_lib->vba.VActive,
						mode_lib->vba.PixelClock,
						mode_lib->vba.BlendingAndTiming,
						mode_lib->vba.NoOfDPPThisState,
						mode_lib->vba.BytePerPixelInDETY,
						mode_lib->vba.BytePerPixelInDETC,
						v->SOCCLKPerState[i],
						v->ProjectedDCFCLKDeepSleep[i][j],
						v->DETBufferSizeYThisState,
						v->DETBufferSizeCThisState,
						v->SwathHeightYThisState,
						v->SwathHeightCThisState,
						v->SwathWidthYThisState, // 24
						v->SwathWidthCThisState,
						v->NoOfDPPThisState,
						v->BytePerPixelInDETY,
						v->BytePerPixelInDETC,
						v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.DSTXAfterScaler,
						v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.DSTYAfterScaler,
						mode_lib->vba.WritebackEnable,
						mode_lib->vba.WritebackPixelFormat,
						mode_lib->vba.WritebackDestinationWidth,
						mode_lib->vba.WritebackDestinationHeight,
						mode_lib->vba.WritebackSourceHeight,
						mode_lib->vba.UnboundedRequestEnabledThisState,
						mode_lib->vba.CompressedBufferSizeInkByteThisState,
						v->UnboundedRequestEnabledThisState,
						v->CompressedBufferSizeInkByteThisState,

						/* Output */
						&mode_lib->vba.Watermark, // Store the values in vba
						&mode_lib->vba.DRAMClockChangeSupport[i][j],
						&v->DRAMClockChangeSupport[i][j],
						&v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_single2[0], // double *MaxActiveDRAMClockChangeLatencySupported
						&v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_integer[0], // Long SubViewportLinesNeededInMALL[]
						&mode_lib->vba.FCLKChangeSupport[i][j],
						&v->FCLKChangeSupport[i][j],
						&v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_single2[1], // double *MinActiveFCLKChangeLatencySupported
						&mode_lib->vba.USRRetrainingSupport[i][j],
						mode_lib->vba.ActiveDRAMClockChangeLatencyMarginPerState[i][j]);
+109 −139

File changed.

Preview size limit exceeded, changes collapsed.

+2 −31
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@
#include "os_types.h"
#include "../dc_features.h"
#include "../display_mode_structs.h"
#include "dml/display_mode_vba.h"

unsigned int dml32_dscceComputeDelay(
		unsigned int bpc,
@@ -808,58 +809,28 @@ void dml32_CalculateFlipSchedule(
		bool *ImmediateFlipSupportedForPipe);

void dml32_CalculateWatermarksMALLUseAndDRAMSpeedChangeSupport(
		bool USRRetrainingRequiredFinal,
		enum dm_use_mall_for_pstate_change_mode UseMALLForPStateChange[],
		struct vba_vars_st *v,
		unsigned int PrefetchMode,
		unsigned int NumberOfActiveSurfaces,
		unsigned int MaxLineBufferLines,
		unsigned int LineBufferSize,
		unsigned int WritebackInterfaceBufferSize,
		double DCFCLK,
		double ReturnBW,
		bool SynchronizeTimingsFinal,
		bool SynchronizeDRRDisplaysForUCLKPStateChangeFinal,
		bool DRRDisplay[],
		unsigned int dpte_group_bytes[],
		unsigned int meta_row_height[],
		unsigned int meta_row_height_chroma[],
		SOCParametersList mmSOCParameters,
		unsigned int WritebackChunkSize,
		double SOCCLK,
		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[],
		unsigned int VTotal[],
		unsigned int VActive[],
		double PixelClock[],
		unsigned int BlendingAndTiming[],
		unsigned int DPPPerSurface[],
		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,

		/* Output */
		Watermarks *Watermark,
		enum clock_change_support *DRAMClockChangeSupport,
		double MaxActiveDRAMClockChangeLatencySupported[],
		unsigned int SubViewportLinesNeededInMALL[],