Skip to content

Commit f525ed1

Browse files
nathanchancealexdeucher
authored andcommitted
drm/amd/display: Reduce number of arguments of dml314'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 dml314_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/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: ClangBuiltLinux#1710 Reported-by: "kernelci.org bot" <[email protected]> Tested-by: Maíra Canal <[email protected]> Signed-off-by: Nathan Chancellor <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent faed5d0 commit f525ed1

File tree

1 file changed

+47
-125
lines changed

1 file changed

+47
-125
lines changed

drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c

Lines changed: 47 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -265,33 +265,13 @@ static void CalculateRowBandwidth(
265265

266266
static void CalculateFlipSchedule(
267267
struct display_mode_lib *mode_lib,
268+
unsigned int k,
268269
double HostVMInefficiencyFactor,
269270
double UrgentExtraLatency,
270271
double UrgentLatency,
271-
unsigned int GPUVMMaxPageTableLevels,
272-
bool HostVMEnable,
273-
unsigned int HostVMMaxNonCachedPageTableLevels,
274-
bool GPUVMEnable,
275-
double HostVMMinPageSize,
276272
double PDEAndMetaPTEBytesPerFrame,
277273
double MetaRowBytes,
278-
double DPTEBytesPerRow,
279-
double BandwidthAvailableForImmediateFlip,
280-
unsigned int TotImmediateFlipBytes,
281-
enum source_format_class SourcePixelFormat,
282-
double LineTime,
283-
double VRatio,
284-
double VRatioChroma,
285-
double Tno_bw,
286-
bool DCCEnable,
287-
unsigned int dpte_row_height,
288-
unsigned int meta_row_height,
289-
unsigned int dpte_row_height_chroma,
290-
unsigned int meta_row_height_chroma,
291-
double *DestinationLinesToRequestVMInImmediateFlip,
292-
double *DestinationLinesToRequestRowInImmediateFlip,
293-
double *final_flip_bw,
294-
bool *ImmediateFlipSupportedForPipe);
274+
double DPTEBytesPerRow);
295275
static double CalculateWriteBackDelay(
296276
enum source_format_class WritebackPixelFormat,
297277
double WritebackHRatio,
@@ -2892,33 +2872,13 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman
28922872
for (k = 0; k < v->NumberOfActivePlanes; ++k) {
28932873
CalculateFlipSchedule(
28942874
mode_lib,
2875+
k,
28952876
HostVMInefficiencyFactor,
28962877
v->UrgentExtraLatency,
28972878
v->UrgentLatency,
2898-
v->GPUVMMaxPageTableLevels,
2899-
v->HostVMEnable,
2900-
v->HostVMMaxNonCachedPageTableLevels,
2901-
v->GPUVMEnable,
2902-
v->HostVMMinPageSize,
29032879
v->PDEAndMetaPTEBytesFrame[k],
29042880
v->MetaRowByte[k],
2905-
v->PixelPTEBytesPerRow[k],
2906-
v->BandwidthAvailableForImmediateFlip,
2907-
v->TotImmediateFlipBytes,
2908-
v->SourcePixelFormat[k],
2909-
v->HTotal[k] / v->PixelClock[k],
2910-
v->VRatio[k],
2911-
v->VRatioChroma[k],
2912-
v->Tno_bw[k],
2913-
v->DCCEnable[k],
2914-
v->dpte_row_height[k],
2915-
v->meta_row_height[k],
2916-
v->dpte_row_height_chroma[k],
2917-
v->meta_row_height_chroma[k],
2918-
&v->DestinationLinesToRequestVMInImmediateFlip[k],
2919-
&v->DestinationLinesToRequestRowInImmediateFlip[k],
2920-
&v->final_flip_bw[k],
2921-
&v->ImmediateFlipSupportedForPipe[k]);
2881+
v->PixelPTEBytesPerRow[k]);
29222882
}
29232883

29242884
v->total_dcn_read_bw_with_flip = 0.0;
@@ -3638,61 +3598,43 @@ static void CalculateRowBandwidth(
36383598

36393599
static void CalculateFlipSchedule(
36403600
struct display_mode_lib *mode_lib,
3601+
unsigned int k,
36413602
double HostVMInefficiencyFactor,
36423603
double UrgentExtraLatency,
36433604
double UrgentLatency,
3644-
unsigned int GPUVMMaxPageTableLevels,
3645-
bool HostVMEnable,
3646-
unsigned int HostVMMaxNonCachedPageTableLevels,
3647-
bool GPUVMEnable,
3648-
double HostVMMinPageSize,
36493605
double PDEAndMetaPTEBytesPerFrame,
36503606
double MetaRowBytes,
3651-
double DPTEBytesPerRow,
3652-
double BandwidthAvailableForImmediateFlip,
3653-
unsigned int TotImmediateFlipBytes,
3654-
enum source_format_class SourcePixelFormat,
3655-
double LineTime,
3656-
double VRatio,
3657-
double VRatioChroma,
3658-
double Tno_bw,
3659-
bool DCCEnable,
3660-
unsigned int dpte_row_height,
3661-
unsigned int meta_row_height,
3662-
unsigned int dpte_row_height_chroma,
3663-
unsigned int meta_row_height_chroma,
3664-
double *DestinationLinesToRequestVMInImmediateFlip,
3665-
double *DestinationLinesToRequestRowInImmediateFlip,
3666-
double *final_flip_bw,
3667-
bool *ImmediateFlipSupportedForPipe)
3607+
double DPTEBytesPerRow)
36683608
{
3609+
struct vba_vars_st *v = &mode_lib->vba;
36693610
double min_row_time = 0.0;
36703611
unsigned int HostVMDynamicLevelsTrips;
36713612
double TimeForFetchingMetaPTEImmediateFlip;
36723613
double TimeForFetchingRowInVBlankImmediateFlip;
36733614
double ImmediateFlipBW;
3615+
double LineTime = v->HTotal[k] / v->PixelClock[k];
36743616

3675-
if (GPUVMEnable == true && HostVMEnable == true) {
3676-
HostVMDynamicLevelsTrips = HostVMMaxNonCachedPageTableLevels;
3617+
if (v->GPUVMEnable == true && v->HostVMEnable == true) {
3618+
HostVMDynamicLevelsTrips = v->HostVMMaxNonCachedPageTableLevels;
36773619
} else {
36783620
HostVMDynamicLevelsTrips = 0;
36793621
}
36803622

3681-
if (GPUVMEnable == true || DCCEnable == true) {
3682-
ImmediateFlipBW = (PDEAndMetaPTEBytesPerFrame + MetaRowBytes + DPTEBytesPerRow) * BandwidthAvailableForImmediateFlip / TotImmediateFlipBytes;
3623+
if (v->GPUVMEnable == true || v->DCCEnable[k] == true) {
3624+
ImmediateFlipBW = (PDEAndMetaPTEBytesPerFrame + MetaRowBytes + DPTEBytesPerRow) * v->BandwidthAvailableForImmediateFlip / v->TotImmediateFlipBytes;
36833625
}
36843626

3685-
if (GPUVMEnable == true) {
3627+
if (v->GPUVMEnable == true) {
36863628
TimeForFetchingMetaPTEImmediateFlip = dml_max3(
3687-
Tno_bw + PDEAndMetaPTEBytesPerFrame * HostVMInefficiencyFactor / ImmediateFlipBW,
3688-
UrgentExtraLatency + UrgentLatency * (GPUVMMaxPageTableLevels * (HostVMDynamicLevelsTrips + 1) - 1),
3629+
v->Tno_bw[k] + PDEAndMetaPTEBytesPerFrame * HostVMInefficiencyFactor / ImmediateFlipBW,
3630+
UrgentExtraLatency + UrgentLatency * (v->GPUVMMaxPageTableLevels * (HostVMDynamicLevelsTrips + 1) - 1),
36893631
LineTime / 4.0);
36903632
} else {
36913633
TimeForFetchingMetaPTEImmediateFlip = 0;
36923634
}
36933635

3694-
*DestinationLinesToRequestVMInImmediateFlip = dml_ceil(4.0 * (TimeForFetchingMetaPTEImmediateFlip / LineTime), 1) / 4.0;
3695-
if ((GPUVMEnable == true || DCCEnable == true)) {
3636+
v->DestinationLinesToRequestVMInImmediateFlip[k] = dml_ceil(4.0 * (TimeForFetchingMetaPTEImmediateFlip / LineTime), 1) / 4.0;
3637+
if ((v->GPUVMEnable == true || v->DCCEnable[k] == true)) {
36963638
TimeForFetchingRowInVBlankImmediateFlip = dml_max3(
36973639
(MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / ImmediateFlipBW,
36983640
UrgentLatency * (HostVMDynamicLevelsTrips + 1),
@@ -3701,54 +3643,54 @@ static void CalculateFlipSchedule(
37013643
TimeForFetchingRowInVBlankImmediateFlip = 0;
37023644
}
37033645

3704-
*DestinationLinesToRequestRowInImmediateFlip = dml_ceil(4.0 * (TimeForFetchingRowInVBlankImmediateFlip / LineTime), 1) / 4.0;
3646+
v->DestinationLinesToRequestRowInImmediateFlip[k] = dml_ceil(4.0 * (TimeForFetchingRowInVBlankImmediateFlip / LineTime), 1) / 4.0;
37053647

3706-
if (GPUVMEnable == true) {
3707-
*final_flip_bw = dml_max(
3708-
PDEAndMetaPTEBytesPerFrame * HostVMInefficiencyFactor / (*DestinationLinesToRequestVMInImmediateFlip * LineTime),
3709-
(MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / (*DestinationLinesToRequestRowInImmediateFlip * LineTime));
3710-
} else if ((GPUVMEnable == true || DCCEnable == true)) {
3711-
*final_flip_bw = (MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / (*DestinationLinesToRequestRowInImmediateFlip * LineTime);
3648+
if (v->GPUVMEnable == true) {
3649+
v->final_flip_bw[k] = dml_max(
3650+
PDEAndMetaPTEBytesPerFrame * HostVMInefficiencyFactor / (v->DestinationLinesToRequestVMInImmediateFlip[k] * LineTime),
3651+
(MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / (v->DestinationLinesToRequestRowInImmediateFlip[k] * LineTime));
3652+
} else if ((v->GPUVMEnable == true || v->DCCEnable[k] == true)) {
3653+
v->final_flip_bw[k] = (MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / (v->DestinationLinesToRequestRowInImmediateFlip[k] * LineTime);
37123654
} else {
3713-
*final_flip_bw = 0;
3655+
v->final_flip_bw[k] = 0;
37143656
}
37153657

3716-
if (SourcePixelFormat == dm_420_8 || SourcePixelFormat == dm_420_10 || SourcePixelFormat == dm_rgbe_alpha) {
3717-
if (GPUVMEnable == true && DCCEnable != true) {
3718-
min_row_time = dml_min(dpte_row_height * LineTime / VRatio, dpte_row_height_chroma * LineTime / VRatioChroma);
3719-
} else if (GPUVMEnable != true && DCCEnable == true) {
3720-
min_row_time = dml_min(meta_row_height * LineTime / VRatio, meta_row_height_chroma * LineTime / VRatioChroma);
3658+
if (v->SourcePixelFormat[k] == dm_420_8 || v->SourcePixelFormat[k] == dm_420_10 || v->SourcePixelFormat[k] == dm_rgbe_alpha) {
3659+
if (v->GPUVMEnable == true && v->DCCEnable[k] != true) {
3660+
min_row_time = dml_min(v->dpte_row_height[k] * LineTime / v->VRatio[k], v->dpte_row_height_chroma[k] * LineTime / v->VRatioChroma[k]);
3661+
} else if (v->GPUVMEnable != true && v->DCCEnable[k] == true) {
3662+
min_row_time = dml_min(v->meta_row_height[k] * LineTime / v->VRatio[k], v->meta_row_height_chroma[k] * LineTime / v->VRatioChroma[k]);
37213663
} else {
37223664
min_row_time = dml_min4(
3723-
dpte_row_height * LineTime / VRatio,
3724-
meta_row_height * LineTime / VRatio,
3725-
dpte_row_height_chroma * LineTime / VRatioChroma,
3726-
meta_row_height_chroma * LineTime / VRatioChroma);
3665+
v->dpte_row_height[k] * LineTime / v->VRatio[k],
3666+
v->meta_row_height[k] * LineTime / v->VRatio[k],
3667+
v->dpte_row_height_chroma[k] * LineTime / v->VRatioChroma[k],
3668+
v->meta_row_height_chroma[k] * LineTime / v->VRatioChroma[k]);
37273669
}
37283670
} else {
3729-
if (GPUVMEnable == true && DCCEnable != true) {
3730-
min_row_time = dpte_row_height * LineTime / VRatio;
3731-
} else if (GPUVMEnable != true && DCCEnable == true) {
3732-
min_row_time = meta_row_height * LineTime / VRatio;
3671+
if (v->GPUVMEnable == true && v->DCCEnable[k] != true) {
3672+
min_row_time = v->dpte_row_height[k] * LineTime / v->VRatio[k];
3673+
} else if (v->GPUVMEnable != true && v->DCCEnable[k] == true) {
3674+
min_row_time = v->meta_row_height[k] * LineTime / v->VRatio[k];
37333675
} else {
3734-
min_row_time = dml_min(dpte_row_height * LineTime / VRatio, meta_row_height * LineTime / VRatio);
3676+
min_row_time = dml_min(v->dpte_row_height[k] * LineTime / v->VRatio[k], v->meta_row_height[k] * LineTime / v->VRatio[k]);
37353677
}
37363678
}
37373679

3738-
if (*DestinationLinesToRequestVMInImmediateFlip >= 32 || *DestinationLinesToRequestRowInImmediateFlip >= 16
3680+
if (v->DestinationLinesToRequestVMInImmediateFlip[k] >= 32 || v->DestinationLinesToRequestRowInImmediateFlip[k] >= 16
37393681
|| TimeForFetchingMetaPTEImmediateFlip + 2 * TimeForFetchingRowInVBlankImmediateFlip > min_row_time) {
3740-
*ImmediateFlipSupportedForPipe = false;
3682+
v->ImmediateFlipSupportedForPipe[k] = false;
37413683
} else {
3742-
*ImmediateFlipSupportedForPipe = true;
3684+
v->ImmediateFlipSupportedForPipe[k] = true;
37433685
}
37443686

37453687
#ifdef __DML_VBA_DEBUG__
3746-
dml_print("DML::%s: DestinationLinesToRequestVMInImmediateFlip = %f\n", __func__, *DestinationLinesToRequestVMInImmediateFlip);
3747-
dml_print("DML::%s: DestinationLinesToRequestRowInImmediateFlip = %f\n", __func__, *DestinationLinesToRequestRowInImmediateFlip);
3688+
dml_print("DML::%s: DestinationLinesToRequestVMInImmediateFlip = %f\n", __func__, v->DestinationLinesToRequestVMInImmediateFlip[k]);
3689+
dml_print("DML::%s: DestinationLinesToRequestRowInImmediateFlip = %f\n", __func__, v->DestinationLinesToRequestRowInImmediateFlip[k]);
37483690
dml_print("DML::%s: TimeForFetchingMetaPTEImmediateFlip = %f\n", __func__, TimeForFetchingMetaPTEImmediateFlip);
37493691
dml_print("DML::%s: TimeForFetchingRowInVBlankImmediateFlip = %f\n", __func__, TimeForFetchingRowInVBlankImmediateFlip);
37503692
dml_print("DML::%s: min_row_time = %f\n", __func__, min_row_time);
3751-
dml_print("DML::%s: ImmediateFlipSupportedForPipe = %d\n", __func__, *ImmediateFlipSupportedForPipe);
3693+
dml_print("DML::%s: ImmediateFlipSupportedForPipe = %d\n", __func__, v->ImmediateFlipSupportedForPipe[k]);
37523694
#endif
37533695

37543696
}
@@ -5340,33 +5282,13 @@ void dml314_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_
53405282
for (k = 0; k < v->NumberOfActivePlanes; k++) {
53415283
CalculateFlipSchedule(
53425284
mode_lib,
5285+
k,
53435286
HostVMInefficiencyFactor,
53445287
v->ExtraLatency,
53455288
v->UrgLatency[i],
5346-
v->GPUVMMaxPageTableLevels,
5347-
v->HostVMEnable,
5348-
v->HostVMMaxNonCachedPageTableLevels,
5349-
v->GPUVMEnable,
5350-
v->HostVMMinPageSize,
53515289
v->PDEAndMetaPTEBytesPerFrame[i][j][k],
53525290
v->MetaRowBytes[i][j][k],
5353-
v->DPTEBytesPerRow[i][j][k],
5354-
v->BandwidthAvailableForImmediateFlip,
5355-
v->TotImmediateFlipBytes,
5356-
v->SourcePixelFormat[k],
5357-
v->HTotal[k] / v->PixelClock[k],
5358-
v->VRatio[k],
5359-
v->VRatioChroma[k],
5360-
v->Tno_bw[k],
5361-
v->DCCEnable[k],
5362-
v->dpte_row_height[k],
5363-
v->meta_row_height[k],
5364-
v->dpte_row_height_chroma[k],
5365-
v->meta_row_height_chroma[k],
5366-
&v->DestinationLinesToRequestVMInImmediateFlip[k],
5367-
&v->DestinationLinesToRequestRowInImmediateFlip[k],
5368-
&v->final_flip_bw[k],
5369-
&v->ImmediateFlipSupportedForPipe[k]);
5291+
v->DPTEBytesPerRow[i][j][k]);
53705292
}
53715293
v->total_dcn_read_bw_with_flip = 0.0;
53725294
for (k = 0; k < v->NumberOfActivePlanes; k++) {

0 commit comments

Comments
 (0)