Commit c8f8e968 authored by Victor Lu's avatar Victor Lu Committed by Alex Deucher
Browse files

drm/amd/display: Guard DST_Y_PREFETCH register overflow in DCN21



[why]
DST_Y_PREFETCH can overflow when DestinationLinesForPrefetch values are
too large due to the former being limited to 8 bits.

[how]
Set the maximum value of DestinationLinesForPrefetch to be 255 * refclk
period.

Reviewed-by: default avatarLaktyushkin Dmytro <dmytro.laktyushkin@amd.com>
Acked-by: default avatarSolomon Chiu <solomon.chiu@amd.com>
Signed-off-by: default avatarVictor Lu <victorchengchi.lu@amd.com>
Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 91e27371
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -841,6 +841,9 @@ static bool CalculatePrefetchSchedule(
	else
		*DestinationLinesForPrefetch = dst_y_prefetch_equ;

	// Limit to prevent overflow in DST_Y_PREFETCH register
	*DestinationLinesForPrefetch = dml_min(*DestinationLinesForPrefetch, 63.75);

	dml_print("DML: VStartup: %d\n", VStartup);
	dml_print("DML: TCalc: %f\n", TCalc);
	dml_print("DML: TWait: %f\n", TWait);