Skip to content

Commit 21485d3

Browse files
nathanchancealexdeucher
authored andcommitted
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: ClangBuiltLinux#1681 Reported-by: "Sudip Mukherjee (Codethink)" <[email protected]> Tested-by: Maíra Canal <[email protected]> Reviewed-by: Rodrigo Siqueira <[email protected]> Signed-off-by: Nathan Chancellor <[email protected]> Signed-off-by: Rodrigo Siqueira <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 37934d4 commit 21485d3

File tree

1 file changed

+47
-125
lines changed

1 file changed

+47
-125
lines changed

drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c

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

252252
static void CalculateFlipSchedule(
253253
struct display_mode_lib *mode_lib,
254+
unsigned int k,
254255
double HostVMInefficiencyFactor,
255256
double UrgentExtraLatency,
256257
double UrgentLatency,
257-
unsigned int GPUVMMaxPageTableLevels,
258-
bool HostVMEnable,
259-
unsigned int HostVMMaxNonCachedPageTableLevels,
260-
bool GPUVMEnable,
261-
double HostVMMinPageSize,
262258
double PDEAndMetaPTEBytesPerFrame,
263259
double MetaRowBytes,
264-
double DPTEBytesPerRow,
265-
double BandwidthAvailableForImmediateFlip,
266-
unsigned int TotImmediateFlipBytes,
267-
enum source_format_class SourcePixelFormat,
268-
double LineTime,
269-
double VRatio,
270-
double VRatioChroma,
271-
double Tno_bw,
272-
bool DCCEnable,
273-
unsigned int dpte_row_height,
274-
unsigned int meta_row_height,
275-
unsigned int dpte_row_height_chroma,
276-
unsigned int meta_row_height_chroma,
277-
double *DestinationLinesToRequestVMInImmediateFlip,
278-
double *DestinationLinesToRequestRowInImmediateFlip,
279-
double *final_flip_bw,
280-
bool *ImmediateFlipSupportedForPipe);
260+
double DPTEBytesPerRow);
281261
static double CalculateWriteBackDelay(
282262
enum source_format_class WritebackPixelFormat,
283263
double WritebackHRatio,
@@ -2868,33 +2848,13 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman
28682848
for (k = 0; k < v->NumberOfActivePlanes; ++k) {
28692849
CalculateFlipSchedule(
28702850
mode_lib,
2851+
k,
28712852
HostVMInefficiencyFactor,
28722853
v->UrgentExtraLatency,
28732854
v->UrgentLatency,
2874-
v->GPUVMMaxPageTableLevels,
2875-
v->HostVMEnable,
2876-
v->HostVMMaxNonCachedPageTableLevels,
2877-
v->GPUVMEnable,
2878-
v->HostVMMinPageSize,
28792855
v->PDEAndMetaPTEBytesFrame[k],
28802856
v->MetaRowByte[k],
2881-
v->PixelPTEBytesPerRow[k],
2882-
v->BandwidthAvailableForImmediateFlip,
2883-
v->TotImmediateFlipBytes,
2884-
v->SourcePixelFormat[k],
2885-
v->HTotal[k] / v->PixelClock[k],
2886-
v->VRatio[k],
2887-
v->VRatioChroma[k],
2888-
v->Tno_bw[k],
2889-
v->DCCEnable[k],
2890-
v->dpte_row_height[k],
2891-
v->meta_row_height[k],
2892-
v->dpte_row_height_chroma[k],
2893-
v->meta_row_height_chroma[k],
2894-
&v->DestinationLinesToRequestVMInImmediateFlip[k],
2895-
&v->DestinationLinesToRequestRowInImmediateFlip[k],
2896-
&v->final_flip_bw[k],
2897-
&v->ImmediateFlipSupportedForPipe[k]);
2857+
v->PixelPTEBytesPerRow[k]);
28982858
}
28992859

29002860
v->total_dcn_read_bw_with_flip = 0.0;
@@ -3526,61 +3486,43 @@ static void CalculateRowBandwidth(
35263486

35273487
static void CalculateFlipSchedule(
35283488
struct display_mode_lib *mode_lib,
3489+
unsigned int k,
35293490
double HostVMInefficiencyFactor,
35303491
double UrgentExtraLatency,
35313492
double UrgentLatency,
3532-
unsigned int GPUVMMaxPageTableLevels,
3533-
bool HostVMEnable,
3534-
unsigned int HostVMMaxNonCachedPageTableLevels,
3535-
bool GPUVMEnable,
3536-
double HostVMMinPageSize,
35373493
double PDEAndMetaPTEBytesPerFrame,
35383494
double MetaRowBytes,
3539-
double DPTEBytesPerRow,
3540-
double BandwidthAvailableForImmediateFlip,
3541-
unsigned int TotImmediateFlipBytes,
3542-
enum source_format_class SourcePixelFormat,
3543-
double LineTime,
3544-
double VRatio,
3545-
double VRatioChroma,
3546-
double Tno_bw,
3547-
bool DCCEnable,
3548-
unsigned int dpte_row_height,
3549-
unsigned int meta_row_height,
3550-
unsigned int dpte_row_height_chroma,
3551-
unsigned int meta_row_height_chroma,
3552-
double *DestinationLinesToRequestVMInImmediateFlip,
3553-
double *DestinationLinesToRequestRowInImmediateFlip,
3554-
double *final_flip_bw,
3555-
bool *ImmediateFlipSupportedForPipe)
3495+
double DPTEBytesPerRow)
35563496
{
3497+
struct vba_vars_st *v = &mode_lib->vba;
35573498
double min_row_time = 0.0;
35583499
unsigned int HostVMDynamicLevelsTrips;
35593500
double TimeForFetchingMetaPTEImmediateFlip;
35603501
double TimeForFetchingRowInVBlankImmediateFlip;
35613502
double ImmediateFlipBW;
3503+
double LineTime = v->HTotal[k] / v->PixelClock[k];
35623504

3563-
if (GPUVMEnable == true && HostVMEnable == true) {
3564-
HostVMDynamicLevelsTrips = HostVMMaxNonCachedPageTableLevels;
3505+
if (v->GPUVMEnable == true && v->HostVMEnable == true) {
3506+
HostVMDynamicLevelsTrips = v->HostVMMaxNonCachedPageTableLevels;
35653507
} else {
35663508
HostVMDynamicLevelsTrips = 0;
35673509
}
35683510

3569-
if (GPUVMEnable == true || DCCEnable == true) {
3570-
ImmediateFlipBW = (PDEAndMetaPTEBytesPerFrame + MetaRowBytes + DPTEBytesPerRow) * BandwidthAvailableForImmediateFlip / TotImmediateFlipBytes;
3511+
if (v->GPUVMEnable == true || v->DCCEnable[k] == true) {
3512+
ImmediateFlipBW = (PDEAndMetaPTEBytesPerFrame + MetaRowBytes + DPTEBytesPerRow) * v->BandwidthAvailableForImmediateFlip / v->TotImmediateFlipBytes;
35713513
}
35723514

3573-
if (GPUVMEnable == true) {
3515+
if (v->GPUVMEnable == true) {
35743516
TimeForFetchingMetaPTEImmediateFlip = dml_max3(
3575-
Tno_bw + PDEAndMetaPTEBytesPerFrame * HostVMInefficiencyFactor / ImmediateFlipBW,
3576-
UrgentExtraLatency + UrgentLatency * (GPUVMMaxPageTableLevels * (HostVMDynamicLevelsTrips + 1) - 1),
3517+
v->Tno_bw[k] + PDEAndMetaPTEBytesPerFrame * HostVMInefficiencyFactor / ImmediateFlipBW,
3518+
UrgentExtraLatency + UrgentLatency * (v->GPUVMMaxPageTableLevels * (HostVMDynamicLevelsTrips + 1) - 1),
35773519
LineTime / 4.0);
35783520
} else {
35793521
TimeForFetchingMetaPTEImmediateFlip = 0;
35803522
}
35813523

3582-
*DestinationLinesToRequestVMInImmediateFlip = dml_ceil(4.0 * (TimeForFetchingMetaPTEImmediateFlip / LineTime), 1) / 4.0;
3583-
if ((GPUVMEnable == true || DCCEnable == true)) {
3524+
v->DestinationLinesToRequestVMInImmediateFlip[k] = dml_ceil(4.0 * (TimeForFetchingMetaPTEImmediateFlip / LineTime), 1) / 4.0;
3525+
if ((v->GPUVMEnable == true || v->DCCEnable[k] == true)) {
35843526
TimeForFetchingRowInVBlankImmediateFlip = dml_max3(
35853527
(MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / ImmediateFlipBW,
35863528
UrgentLatency * (HostVMDynamicLevelsTrips + 1),
@@ -3589,54 +3531,54 @@ static void CalculateFlipSchedule(
35893531
TimeForFetchingRowInVBlankImmediateFlip = 0;
35903532
}
35913533

3592-
*DestinationLinesToRequestRowInImmediateFlip = dml_ceil(4.0 * (TimeForFetchingRowInVBlankImmediateFlip / LineTime), 1) / 4.0;
3534+
v->DestinationLinesToRequestRowInImmediateFlip[k] = dml_ceil(4.0 * (TimeForFetchingRowInVBlankImmediateFlip / LineTime), 1) / 4.0;
35933535

3594-
if (GPUVMEnable == true) {
3595-
*final_flip_bw = dml_max(
3596-
PDEAndMetaPTEBytesPerFrame * HostVMInefficiencyFactor / (*DestinationLinesToRequestVMInImmediateFlip * LineTime),
3597-
(MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / (*DestinationLinesToRequestRowInImmediateFlip * LineTime));
3598-
} else if ((GPUVMEnable == true || DCCEnable == true)) {
3599-
*final_flip_bw = (MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / (*DestinationLinesToRequestRowInImmediateFlip * LineTime);
3536+
if (v->GPUVMEnable == true) {
3537+
v->final_flip_bw[k] = dml_max(
3538+
PDEAndMetaPTEBytesPerFrame * HostVMInefficiencyFactor / (v->DestinationLinesToRequestVMInImmediateFlip[k] * LineTime),
3539+
(MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / (v->DestinationLinesToRequestRowInImmediateFlip[k] * LineTime));
3540+
} else if ((v->GPUVMEnable == true || v->DCCEnable[k] == true)) {
3541+
v->final_flip_bw[k] = (MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / (v->DestinationLinesToRequestRowInImmediateFlip[k] * LineTime);
36003542
} else {
3601-
*final_flip_bw = 0;
3543+
v->final_flip_bw[k] = 0;
36023544
}
36033545

3604-
if (SourcePixelFormat == dm_420_8 || SourcePixelFormat == dm_420_10 || SourcePixelFormat == dm_rgbe_alpha) {
3605-
if (GPUVMEnable == true && DCCEnable != true) {
3606-
min_row_time = dml_min(dpte_row_height * LineTime / VRatio, dpte_row_height_chroma * LineTime / VRatioChroma);
3607-
} else if (GPUVMEnable != true && DCCEnable == true) {
3608-
min_row_time = dml_min(meta_row_height * LineTime / VRatio, meta_row_height_chroma * LineTime / VRatioChroma);
3546+
if (v->SourcePixelFormat[k] == dm_420_8 || v->SourcePixelFormat[k] == dm_420_10 || v->SourcePixelFormat[k] == dm_rgbe_alpha) {
3547+
if (v->GPUVMEnable == true && v->DCCEnable[k] != true) {
3548+
min_row_time = dml_min(v->dpte_row_height[k] * LineTime / v->VRatio[k], v->dpte_row_height_chroma[k] * LineTime / v->VRatioChroma[k]);
3549+
} else if (v->GPUVMEnable != true && v->DCCEnable[k] == true) {
3550+
min_row_time = dml_min(v->meta_row_height[k] * LineTime / v->VRatio[k], v->meta_row_height_chroma[k] * LineTime / v->VRatioChroma[k]);
36093551
} else {
36103552
min_row_time = dml_min4(
3611-
dpte_row_height * LineTime / VRatio,
3612-
meta_row_height * LineTime / VRatio,
3613-
dpte_row_height_chroma * LineTime / VRatioChroma,
3614-
meta_row_height_chroma * LineTime / VRatioChroma);
3553+
v->dpte_row_height[k] * LineTime / v->VRatio[k],
3554+
v->meta_row_height[k] * LineTime / v->VRatio[k],
3555+
v->dpte_row_height_chroma[k] * LineTime / v->VRatioChroma[k],
3556+
v->meta_row_height_chroma[k] * LineTime / v->VRatioChroma[k]);
36153557
}
36163558
} else {
3617-
if (GPUVMEnable == true && DCCEnable != true) {
3618-
min_row_time = dpte_row_height * LineTime / VRatio;
3619-
} else if (GPUVMEnable != true && DCCEnable == true) {
3620-
min_row_time = meta_row_height * LineTime / VRatio;
3559+
if (v->GPUVMEnable == true && v->DCCEnable[k] != true) {
3560+
min_row_time = v->dpte_row_height[k] * LineTime / v->VRatio[k];
3561+
} else if (v->GPUVMEnable != true && v->DCCEnable[k] == true) {
3562+
min_row_time = v->meta_row_height[k] * LineTime / v->VRatio[k];
36213563
} else {
3622-
min_row_time = dml_min(dpte_row_height * LineTime / VRatio, meta_row_height * LineTime / VRatio);
3564+
min_row_time = dml_min(v->dpte_row_height[k] * LineTime / v->VRatio[k], v->meta_row_height[k] * LineTime / v->VRatio[k]);
36233565
}
36243566
}
36253567

3626-
if (*DestinationLinesToRequestVMInImmediateFlip >= 32 || *DestinationLinesToRequestRowInImmediateFlip >= 16
3568+
if (v->DestinationLinesToRequestVMInImmediateFlip[k] >= 32 || v->DestinationLinesToRequestRowInImmediateFlip[k] >= 16
36273569
|| TimeForFetchingMetaPTEImmediateFlip + 2 * TimeForFetchingRowInVBlankImmediateFlip > min_row_time) {
3628-
*ImmediateFlipSupportedForPipe = false;
3570+
v->ImmediateFlipSupportedForPipe[k] = false;
36293571
} else {
3630-
*ImmediateFlipSupportedForPipe = true;
3572+
v->ImmediateFlipSupportedForPipe[k] = true;
36313573
}
36323574

36333575
#ifdef __DML_VBA_DEBUG__
3634-
dml_print("DML::%s: DestinationLinesToRequestVMInImmediateFlip = %f\n", __func__, *DestinationLinesToRequestVMInImmediateFlip);
3635-
dml_print("DML::%s: DestinationLinesToRequestRowInImmediateFlip = %f\n", __func__, *DestinationLinesToRequestRowInImmediateFlip);
3576+
dml_print("DML::%s: DestinationLinesToRequestVMInImmediateFlip = %f\n", __func__, v->DestinationLinesToRequestVMInImmediateFlip[k]);
3577+
dml_print("DML::%s: DestinationLinesToRequestRowInImmediateFlip = %f\n", __func__, v->DestinationLinesToRequestRowInImmediateFlip[k]);
36363578
dml_print("DML::%s: TimeForFetchingMetaPTEImmediateFlip = %f\n", __func__, TimeForFetchingMetaPTEImmediateFlip);
36373579
dml_print("DML::%s: TimeForFetchingRowInVBlankImmediateFlip = %f\n", __func__, TimeForFetchingRowInVBlankImmediateFlip);
36383580
dml_print("DML::%s: min_row_time = %f\n", __func__, min_row_time);
3639-
dml_print("DML::%s: ImmediateFlipSupportedForPipe = %d\n", __func__, *ImmediateFlipSupportedForPipe);
3581+
dml_print("DML::%s: ImmediateFlipSupportedForPipe = %d\n", __func__, v->ImmediateFlipSupportedForPipe[k]);
36403582
#endif
36413583

36423584
}
@@ -5228,33 +5170,13 @@ void dml31_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
52285170
for (k = 0; k < v->NumberOfActivePlanes; k++) {
52295171
CalculateFlipSchedule(
52305172
mode_lib,
5173+
k,
52315174
HostVMInefficiencyFactor,
52325175
v->ExtraLatency,
52335176
v->UrgLatency[i],
5234-
v->GPUVMMaxPageTableLevels,
5235-
v->HostVMEnable,
5236-
v->HostVMMaxNonCachedPageTableLevels,
5237-
v->GPUVMEnable,
5238-
v->HostVMMinPageSize,
52395177
v->PDEAndMetaPTEBytesPerFrame[i][j][k],
52405178
v->MetaRowBytes[i][j][k],
5241-
v->DPTEBytesPerRow[i][j][k],
5242-
v->BandwidthAvailableForImmediateFlip,
5243-
v->TotImmediateFlipBytes,
5244-
v->SourcePixelFormat[k],
5245-
v->HTotal[k] / v->PixelClock[k],
5246-
v->VRatio[k],
5247-
v->VRatioChroma[k],
5248-
v->Tno_bw[k],
5249-
v->DCCEnable[k],
5250-
v->dpte_row_height[k],
5251-
v->meta_row_height[k],
5252-
v->dpte_row_height_chroma[k],
5253-
v->meta_row_height_chroma[k],
5254-
&v->DestinationLinesToRequestVMInImmediateFlip[k],
5255-
&v->DestinationLinesToRequestRowInImmediateFlip[k],
5256-
&v->final_flip_bw[k],
5257-
&v->ImmediateFlipSupportedForPipe[k]);
5179+
v->DPTEBytesPerRow[i][j][k]);
52585180
}
52595181
v->total_dcn_read_bw_with_flip = 0.0;
52605182
for (k = 0; k < v->NumberOfActivePlanes; k++) {

0 commit comments

Comments
 (0)