drm/amd/display: Correct prefetch calculation
authorTungYu Lu <tungyu.lu@amd.com>
Fri, 11 Apr 2025 02:41:48 +0000 (10:41 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 22 Apr 2025 12:51:45 +0000 (08:51 -0400)
[Why]
The minimum value of the dst_y_prefetch_equ was not correct
in prefetch calculation whice causes OPTC underflow.

[How]
Add the min operation of dst_y_prefetch_equ in prefetch calculation
for legacy DML.

Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Signed-off-by: TungYu Lu <tungyu.lu@amd.com>
Signed-off-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
Tested-by: Mark Broadworth <mark.broadworth@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c
drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c
drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c

index f1fe49401bc0ac6f8a9301137b487e96f7729dd6..8d24763938ea6dc08b08a797884f9598e0acd4d8 100644 (file)
@@ -1002,6 +1002,7 @@ static bool CalculatePrefetchSchedule(
 
        dst_y_prefetch_equ = VStartup - (Tsetup + dml_max(TWait + TCalc, *Tdmdl)) / LineTime
                        - (*DSTYAfterScaler + *DSTXAfterScaler / myPipe->HTotal);
+       dst_y_prefetch_equ = dml_min(dst_y_prefetch_equ, 63.75); // limit to the reg limit of U6.2 for DST_Y_PREFETCH
 
        Lsw_oto = dml_max(PrefetchSourceLinesY, PrefetchSourceLinesC);
        Tsw_oto = Lsw_oto * LineTime;
index f567a9023682d1ac25b7992c42beda7f3d7dc1a2..ed59c77bc6f60a737071c98c38c2302c84286067 100644 (file)
@@ -1105,6 +1105,7 @@ static bool CalculatePrefetchSchedule(
        Tr0_oto_lines = dml_ceil(4.0 * Tr0_oto / LineTime, 1) / 4.0;
        dst_y_prefetch_oto = Tvm_oto_lines + 2 * Tr0_oto_lines + Lsw_oto;
        dst_y_prefetch_equ =  VStartup - (*TSetup + dml_max(TWait + TCalc, *Tdmdl)) / LineTime - (*DSTYAfterScaler + *DSTXAfterScaler / myPipe->HTotal);
+       dst_y_prefetch_equ = dml_min(dst_y_prefetch_equ, 63.75); // limit to the reg limit of U6.2 for DST_Y_PREFETCH
        dst_y_prefetch_equ = dml_floor(4.0 * (dst_y_prefetch_equ + 0.125), 1) / 4.0;
        Tpre_rounded = dst_y_prefetch_equ * LineTime;
 
index 5865e8fa2d8e8fda11591c4749ddb9d18a419d7e..9f3938a50240f3819e0cd78a0657c53db6ada19c 100644 (file)
@@ -1123,6 +1123,7 @@ static bool CalculatePrefetchSchedule(
        Tr0_oto_lines = dml_ceil(4.0 * Tr0_oto / LineTime, 1) / 4.0;
        dst_y_prefetch_oto = Tvm_oto_lines + 2 * Tr0_oto_lines + Lsw_oto;
        dst_y_prefetch_equ =  VStartup - (*TSetup + dml_max(TWait + TCalc, *Tdmdl)) / LineTime - (*DSTYAfterScaler + *DSTXAfterScaler / myPipe->HTotal);
+       dst_y_prefetch_equ = dml_min(dst_y_prefetch_equ, 63.75); // limit to the reg limit of U6.2 for DST_Y_PREFETCH
        dst_y_prefetch_equ = dml_floor(4.0 * (dst_y_prefetch_equ + 0.125), 1) / 4.0;
        Tpre_rounded = dst_y_prefetch_equ * LineTime;