Commit 21485d3d authored by Nathan Chancellor's avatar Nathan Chancellor Committed by Alex Deucher

drm/amd/display: Reduce number of arguments of dml31's CalculateFlipSchedule()

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
dml31_ModeSupportAndSystemConfigurationFull() uses by 112 bytes with
LLVM 16 (1976 -> 1864), helping clear up the following clang warning:

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

Link: https://github.com/ClangBuiltLinux/linux/issues/1681Reported-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 37934d41
...@@ -251,33 +251,13 @@ static void CalculateRowBandwidth( ...@@ -251,33 +251,13 @@ static void CalculateRowBandwidth(
static void CalculateFlipSchedule( static void CalculateFlipSchedule(
struct display_mode_lib *mode_lib, struct display_mode_lib *mode_lib,
unsigned int k,
double HostVMInefficiencyFactor, double HostVMInefficiencyFactor,
double UrgentExtraLatency, double UrgentExtraLatency,
double UrgentLatency, double UrgentLatency,
unsigned int GPUVMMaxPageTableLevels,
bool HostVMEnable,
unsigned int HostVMMaxNonCachedPageTableLevels,
bool GPUVMEnable,
double HostVMMinPageSize,
double PDEAndMetaPTEBytesPerFrame, double PDEAndMetaPTEBytesPerFrame,
double MetaRowBytes, double MetaRowBytes,
double DPTEBytesPerRow, double DPTEBytesPerRow);
double BandwidthAvailableForImmediateFlip,
unsigned int TotImmediateFlipBytes,
enum source_format_class SourcePixelFormat,
double LineTime,
double VRatio,
double VRatioChroma,
double Tno_bw,
bool DCCEnable,
unsigned int dpte_row_height,
unsigned int meta_row_height,
unsigned int dpte_row_height_chroma,
unsigned int meta_row_height_chroma,
double *DestinationLinesToRequestVMInImmediateFlip,
double *DestinationLinesToRequestRowInImmediateFlip,
double *final_flip_bw,
bool *ImmediateFlipSupportedForPipe);
static double CalculateWriteBackDelay( static double CalculateWriteBackDelay(
enum source_format_class WritebackPixelFormat, enum source_format_class WritebackPixelFormat,
double WritebackHRatio, double WritebackHRatio,
...@@ -2868,33 +2848,13 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman ...@@ -2868,33 +2848,13 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman
for (k = 0; k < v->NumberOfActivePlanes; ++k) { for (k = 0; k < v->NumberOfActivePlanes; ++k) {
CalculateFlipSchedule( CalculateFlipSchedule(
mode_lib, mode_lib,
k,
HostVMInefficiencyFactor, HostVMInefficiencyFactor,
v->UrgentExtraLatency, v->UrgentExtraLatency,
v->UrgentLatency, v->UrgentLatency,
v->GPUVMMaxPageTableLevels,
v->HostVMEnable,
v->HostVMMaxNonCachedPageTableLevels,
v->GPUVMEnable,
v->HostVMMinPageSize,
v->PDEAndMetaPTEBytesFrame[k], v->PDEAndMetaPTEBytesFrame[k],
v->MetaRowByte[k], v->MetaRowByte[k],
v->PixelPTEBytesPerRow[k], v->PixelPTEBytesPerRow[k]);
v->BandwidthAvailableForImmediateFlip,
v->TotImmediateFlipBytes,
v->SourcePixelFormat[k],
v->HTotal[k] / v->PixelClock[k],
v->VRatio[k],
v->VRatioChroma[k],
v->Tno_bw[k],
v->DCCEnable[k],
v->dpte_row_height[k],
v->meta_row_height[k],
v->dpte_row_height_chroma[k],
v->meta_row_height_chroma[k],
&v->DestinationLinesToRequestVMInImmediateFlip[k],
&v->DestinationLinesToRequestRowInImmediateFlip[k],
&v->final_flip_bw[k],
&v->ImmediateFlipSupportedForPipe[k]);
} }
v->total_dcn_read_bw_with_flip = 0.0; v->total_dcn_read_bw_with_flip = 0.0;
...@@ -3526,61 +3486,43 @@ static void CalculateRowBandwidth( ...@@ -3526,61 +3486,43 @@ static void CalculateRowBandwidth(
static void CalculateFlipSchedule( static void CalculateFlipSchedule(
struct display_mode_lib *mode_lib, struct display_mode_lib *mode_lib,
unsigned int k,
double HostVMInefficiencyFactor, double HostVMInefficiencyFactor,
double UrgentExtraLatency, double UrgentExtraLatency,
double UrgentLatency, double UrgentLatency,
unsigned int GPUVMMaxPageTableLevels,
bool HostVMEnable,
unsigned int HostVMMaxNonCachedPageTableLevels,
bool GPUVMEnable,
double HostVMMinPageSize,
double PDEAndMetaPTEBytesPerFrame, double PDEAndMetaPTEBytesPerFrame,
double MetaRowBytes, double MetaRowBytes,
double DPTEBytesPerRow, double DPTEBytesPerRow)
double BandwidthAvailableForImmediateFlip,
unsigned int TotImmediateFlipBytes,
enum source_format_class SourcePixelFormat,
double LineTime,
double VRatio,
double VRatioChroma,
double Tno_bw,
bool DCCEnable,
unsigned int dpte_row_height,
unsigned int meta_row_height,
unsigned int dpte_row_height_chroma,
unsigned int meta_row_height_chroma,
double *DestinationLinesToRequestVMInImmediateFlip,
double *DestinationLinesToRequestRowInImmediateFlip,
double *final_flip_bw,
bool *ImmediateFlipSupportedForPipe)
{ {
struct vba_vars_st *v = &mode_lib->vba;
double min_row_time = 0.0; double min_row_time = 0.0;
unsigned int HostVMDynamicLevelsTrips; unsigned int HostVMDynamicLevelsTrips;
double TimeForFetchingMetaPTEImmediateFlip; double TimeForFetchingMetaPTEImmediateFlip;
double TimeForFetchingRowInVBlankImmediateFlip; double TimeForFetchingRowInVBlankImmediateFlip;
double ImmediateFlipBW; double ImmediateFlipBW;
double LineTime = v->HTotal[k] / v->PixelClock[k];
if (GPUVMEnable == true && HostVMEnable == true) { if (v->GPUVMEnable == true && v->HostVMEnable == true) {
HostVMDynamicLevelsTrips = HostVMMaxNonCachedPageTableLevels; HostVMDynamicLevelsTrips = v->HostVMMaxNonCachedPageTableLevels;
} else { } else {
HostVMDynamicLevelsTrips = 0; HostVMDynamicLevelsTrips = 0;
} }
if (GPUVMEnable == true || DCCEnable == true) { if (v->GPUVMEnable == true || v->DCCEnable[k] == true) {
ImmediateFlipBW = (PDEAndMetaPTEBytesPerFrame + MetaRowBytes + DPTEBytesPerRow) * BandwidthAvailableForImmediateFlip / TotImmediateFlipBytes; ImmediateFlipBW = (PDEAndMetaPTEBytesPerFrame + MetaRowBytes + DPTEBytesPerRow) * v->BandwidthAvailableForImmediateFlip / v->TotImmediateFlipBytes;
} }
if (GPUVMEnable == true) { if (v->GPUVMEnable == true) {
TimeForFetchingMetaPTEImmediateFlip = dml_max3( TimeForFetchingMetaPTEImmediateFlip = dml_max3(
Tno_bw + PDEAndMetaPTEBytesPerFrame * HostVMInefficiencyFactor / ImmediateFlipBW, v->Tno_bw[k] + PDEAndMetaPTEBytesPerFrame * HostVMInefficiencyFactor / ImmediateFlipBW,
UrgentExtraLatency + UrgentLatency * (GPUVMMaxPageTableLevels * (HostVMDynamicLevelsTrips + 1) - 1), UrgentExtraLatency + UrgentLatency * (v->GPUVMMaxPageTableLevels * (HostVMDynamicLevelsTrips + 1) - 1),
LineTime / 4.0); LineTime / 4.0);
} else { } else {
TimeForFetchingMetaPTEImmediateFlip = 0; TimeForFetchingMetaPTEImmediateFlip = 0;
} }
*DestinationLinesToRequestVMInImmediateFlip = dml_ceil(4.0 * (TimeForFetchingMetaPTEImmediateFlip / LineTime), 1) / 4.0; v->DestinationLinesToRequestVMInImmediateFlip[k] = dml_ceil(4.0 * (TimeForFetchingMetaPTEImmediateFlip / LineTime), 1) / 4.0;
if ((GPUVMEnable == true || DCCEnable == true)) { if ((v->GPUVMEnable == true || v->DCCEnable[k] == true)) {
TimeForFetchingRowInVBlankImmediateFlip = dml_max3( TimeForFetchingRowInVBlankImmediateFlip = dml_max3(
(MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / ImmediateFlipBW, (MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / ImmediateFlipBW,
UrgentLatency * (HostVMDynamicLevelsTrips + 1), UrgentLatency * (HostVMDynamicLevelsTrips + 1),
...@@ -3589,54 +3531,54 @@ static void CalculateFlipSchedule( ...@@ -3589,54 +3531,54 @@ static void CalculateFlipSchedule(
TimeForFetchingRowInVBlankImmediateFlip = 0; TimeForFetchingRowInVBlankImmediateFlip = 0;
} }
*DestinationLinesToRequestRowInImmediateFlip = dml_ceil(4.0 * (TimeForFetchingRowInVBlankImmediateFlip / LineTime), 1) / 4.0; v->DestinationLinesToRequestRowInImmediateFlip[k] = dml_ceil(4.0 * (TimeForFetchingRowInVBlankImmediateFlip / LineTime), 1) / 4.0;
if (GPUVMEnable == true) { if (v->GPUVMEnable == true) {
*final_flip_bw = dml_max( v->final_flip_bw[k] = dml_max(
PDEAndMetaPTEBytesPerFrame * HostVMInefficiencyFactor / (*DestinationLinesToRequestVMInImmediateFlip * LineTime), PDEAndMetaPTEBytesPerFrame * HostVMInefficiencyFactor / (v->DestinationLinesToRequestVMInImmediateFlip[k] * LineTime),
(MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / (*DestinationLinesToRequestRowInImmediateFlip * LineTime)); (MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / (v->DestinationLinesToRequestRowInImmediateFlip[k] * LineTime));
} else if ((GPUVMEnable == true || DCCEnable == true)) { } else if ((v->GPUVMEnable == true || v->DCCEnable[k] == true)) {
*final_flip_bw = (MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / (*DestinationLinesToRequestRowInImmediateFlip * LineTime); v->final_flip_bw[k] = (MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / (v->DestinationLinesToRequestRowInImmediateFlip[k] * LineTime);
} else { } else {
*final_flip_bw = 0; v->final_flip_bw[k] = 0;
} }
if (SourcePixelFormat == dm_420_8 || SourcePixelFormat == dm_420_10 || SourcePixelFormat == dm_rgbe_alpha) { if (v->SourcePixelFormat[k] == dm_420_8 || v->SourcePixelFormat[k] == dm_420_10 || v->SourcePixelFormat[k] == dm_rgbe_alpha) {
if (GPUVMEnable == true && DCCEnable != true) { if (v->GPUVMEnable == true && v->DCCEnable[k] != true) {
min_row_time = dml_min(dpte_row_height * LineTime / VRatio, dpte_row_height_chroma * LineTime / VRatioChroma); min_row_time = dml_min(v->dpte_row_height[k] * LineTime / v->VRatio[k], v->dpte_row_height_chroma[k] * LineTime / v->VRatioChroma[k]);
} else if (GPUVMEnable != true && DCCEnable == true) { } else if (v->GPUVMEnable != true && v->DCCEnable[k] == true) {
min_row_time = dml_min(meta_row_height * LineTime / VRatio, meta_row_height_chroma * LineTime / VRatioChroma); min_row_time = dml_min(v->meta_row_height[k] * LineTime / v->VRatio[k], v->meta_row_height_chroma[k] * LineTime / v->VRatioChroma[k]);
} else { } else {
min_row_time = dml_min4( min_row_time = dml_min4(
dpte_row_height * LineTime / VRatio, v->dpte_row_height[k] * LineTime / v->VRatio[k],
meta_row_height * LineTime / VRatio, v->meta_row_height[k] * LineTime / v->VRatio[k],
dpte_row_height_chroma * LineTime / VRatioChroma, v->dpte_row_height_chroma[k] * LineTime / v->VRatioChroma[k],
meta_row_height_chroma * LineTime / VRatioChroma); v->meta_row_height_chroma[k] * LineTime / v->VRatioChroma[k]);
} }
} else { } else {
if (GPUVMEnable == true && DCCEnable != true) { if (v->GPUVMEnable == true && v->DCCEnable[k] != true) {
min_row_time = dpte_row_height * LineTime / VRatio; min_row_time = v->dpte_row_height[k] * LineTime / v->VRatio[k];
} else if (GPUVMEnable != true && DCCEnable == true) { } else if (v->GPUVMEnable != true && v->DCCEnable[k] == true) {
min_row_time = meta_row_height * LineTime / VRatio; min_row_time = v->meta_row_height[k] * LineTime / v->VRatio[k];
} else { } else {
min_row_time = dml_min(dpte_row_height * LineTime / VRatio, meta_row_height * LineTime / VRatio); min_row_time = dml_min(v->dpte_row_height[k] * LineTime / v->VRatio[k], v->meta_row_height[k] * LineTime / v->VRatio[k]);
} }
} }
if (*DestinationLinesToRequestVMInImmediateFlip >= 32 || *DestinationLinesToRequestRowInImmediateFlip >= 16 if (v->DestinationLinesToRequestVMInImmediateFlip[k] >= 32 || v->DestinationLinesToRequestRowInImmediateFlip[k] >= 16
|| TimeForFetchingMetaPTEImmediateFlip + 2 * TimeForFetchingRowInVBlankImmediateFlip > min_row_time) { || TimeForFetchingMetaPTEImmediateFlip + 2 * TimeForFetchingRowInVBlankImmediateFlip > min_row_time) {
*ImmediateFlipSupportedForPipe = false; v->ImmediateFlipSupportedForPipe[k] = false;
} else { } else {
*ImmediateFlipSupportedForPipe = true; v->ImmediateFlipSupportedForPipe[k] = true;
} }
#ifdef __DML_VBA_DEBUG__ #ifdef __DML_VBA_DEBUG__
dml_print("DML::%s: DestinationLinesToRequestVMInImmediateFlip = %f\n", __func__, *DestinationLinesToRequestVMInImmediateFlip); dml_print("DML::%s: DestinationLinesToRequestVMInImmediateFlip = %f\n", __func__, v->DestinationLinesToRequestVMInImmediateFlip[k]);
dml_print("DML::%s: DestinationLinesToRequestRowInImmediateFlip = %f\n", __func__, *DestinationLinesToRequestRowInImmediateFlip); dml_print("DML::%s: DestinationLinesToRequestRowInImmediateFlip = %f\n", __func__, v->DestinationLinesToRequestRowInImmediateFlip[k]);
dml_print("DML::%s: TimeForFetchingMetaPTEImmediateFlip = %f\n", __func__, TimeForFetchingMetaPTEImmediateFlip); dml_print("DML::%s: TimeForFetchingMetaPTEImmediateFlip = %f\n", __func__, TimeForFetchingMetaPTEImmediateFlip);
dml_print("DML::%s: TimeForFetchingRowInVBlankImmediateFlip = %f\n", __func__, TimeForFetchingRowInVBlankImmediateFlip); dml_print("DML::%s: TimeForFetchingRowInVBlankImmediateFlip = %f\n", __func__, TimeForFetchingRowInVBlankImmediateFlip);
dml_print("DML::%s: min_row_time = %f\n", __func__, min_row_time); dml_print("DML::%s: min_row_time = %f\n", __func__, min_row_time);
dml_print("DML::%s: ImmediateFlipSupportedForPipe = %d\n", __func__, *ImmediateFlipSupportedForPipe); dml_print("DML::%s: ImmediateFlipSupportedForPipe = %d\n", __func__, v->ImmediateFlipSupportedForPipe[k]);
#endif #endif
} }
...@@ -5228,33 +5170,13 @@ void dml31_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l ...@@ -5228,33 +5170,13 @@ void dml31_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
for (k = 0; k < v->NumberOfActivePlanes; k++) { for (k = 0; k < v->NumberOfActivePlanes; k++) {
CalculateFlipSchedule( CalculateFlipSchedule(
mode_lib, mode_lib,
k,
HostVMInefficiencyFactor, HostVMInefficiencyFactor,
v->ExtraLatency, v->ExtraLatency,
v->UrgLatency[i], v->UrgLatency[i],
v->GPUVMMaxPageTableLevels,
v->HostVMEnable,
v->HostVMMaxNonCachedPageTableLevels,
v->GPUVMEnable,
v->HostVMMinPageSize,
v->PDEAndMetaPTEBytesPerFrame[i][j][k], v->PDEAndMetaPTEBytesPerFrame[i][j][k],
v->MetaRowBytes[i][j][k], v->MetaRowBytes[i][j][k],
v->DPTEBytesPerRow[i][j][k], v->DPTEBytesPerRow[i][j][k]);
v->BandwidthAvailableForImmediateFlip,
v->TotImmediateFlipBytes,
v->SourcePixelFormat[k],
v->HTotal[k] / v->PixelClock[k],
v->VRatio[k],
v->VRatioChroma[k],
v->Tno_bw[k],
v->DCCEnable[k],
v->dpte_row_height[k],
v->meta_row_height[k],
v->dpte_row_height_chroma[k],
v->meta_row_height_chroma[k],
&v->DestinationLinesToRequestVMInImmediateFlip[k],
&v->DestinationLinesToRequestRowInImmediateFlip[k],
&v->final_flip_bw[k],
&v->ImmediateFlipSupportedForPipe[k]);
} }
v->total_dcn_read_bw_with_flip = 0.0; v->total_dcn_read_bw_with_flip = 0.0;
for (k = 0; k < v->NumberOfActivePlanes; k++) { for (k = 0; k < v->NumberOfActivePlanes; k++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment