Skip to content

Commit e4e3678

Browse files
Wesley Chalmersalexdeucher
authored andcommitted
drm/amd/display: Fix off-by-one error in DML
[WHY] For DCN30 and later, there is no data in DML arrays indexed by state at index num_states. Signed-off-by: Wesley Chalmers <[email protected]> Reviewed-by: Dmytro Laktyushkin <[email protected]> Acked-by: Stylon Wang <[email protected]> Tested-by: Daniel Wheeler <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 3577e16 commit e4e3678

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2053,7 +2053,7 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman
20532053
v->DISPCLKWithoutRamping,
20542054
v->DISPCLKDPPCLKVCOSpeed);
20552055
v->MaxDispclkRoundedToDFSGranularity = RoundToDFSGranularityDown(
2056-
v->soc.clock_limits[mode_lib->soc.num_states].dispclk_mhz,
2056+
v->soc.clock_limits[mode_lib->soc.num_states - 1].dispclk_mhz,
20572057
v->DISPCLKDPPCLKVCOSpeed);
20582058
if (v->DISPCLKWithoutRampingRoundedToDFSGranularity
20592059
> v->MaxDispclkRoundedToDFSGranularity) {
@@ -3958,20 +3958,20 @@ void dml30_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
39583958
for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
39593959
v->PlaneRequiredDISPCLKWithoutODMCombine = v->PixelClock[k] * (1.0 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100.0)
39603960
* (1.0 + v->DISPCLKRampingMargin / 100.0);
3961-
if ((v->PlaneRequiredDISPCLKWithoutODMCombine >= v->MaxDispclk[i] && v->MaxDispclk[i] == v->MaxDispclk[mode_lib->soc.num_states]
3962-
&& v->MaxDppclk[i] == v->MaxDppclk[mode_lib->soc.num_states])) {
3961+
if ((v->PlaneRequiredDISPCLKWithoutODMCombine >= v->MaxDispclk[i] && v->MaxDispclk[i] == v->MaxDispclk[mode_lib->soc.num_states - 1]
3962+
&& v->MaxDppclk[i] == v->MaxDppclk[mode_lib->soc.num_states - 1])) {
39633963
v->PlaneRequiredDISPCLKWithoutODMCombine = v->PixelClock[k] * (1 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100.0);
39643964
}
39653965
v->PlaneRequiredDISPCLKWithODMCombine2To1 = v->PixelClock[k] / 2 * (1 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100.0)
39663966
* (1 + v->DISPCLKRampingMargin / 100.0);
3967-
if ((v->PlaneRequiredDISPCLKWithODMCombine2To1 >= v->MaxDispclk[i] && v->MaxDispclk[i] == v->MaxDispclk[mode_lib->soc.num_states]
3968-
&& v->MaxDppclk[i] == v->MaxDppclk[mode_lib->soc.num_states])) {
3967+
if ((v->PlaneRequiredDISPCLKWithODMCombine2To1 >= v->MaxDispclk[i] && v->MaxDispclk[i] == v->MaxDispclk[mode_lib->soc.num_states - 1]
3968+
&& v->MaxDppclk[i] == v->MaxDppclk[mode_lib->soc.num_states - 1])) {
39693969
v->PlaneRequiredDISPCLKWithODMCombine2To1 = v->PixelClock[k] / 2 * (1 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100.0);
39703970
}
39713971
v->PlaneRequiredDISPCLKWithODMCombine4To1 = v->PixelClock[k] / 4 * (1 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100.0)
39723972
* (1 + v->DISPCLKRampingMargin / 100.0);
3973-
if ((v->PlaneRequiredDISPCLKWithODMCombine4To1 >= v->MaxDispclk[i] && v->MaxDispclk[i] == v->MaxDispclk[mode_lib->soc.num_states]
3974-
&& v->MaxDppclk[i] == v->MaxDppclk[mode_lib->soc.num_states])) {
3973+
if ((v->PlaneRequiredDISPCLKWithODMCombine4To1 >= v->MaxDispclk[i] && v->MaxDispclk[i] == v->MaxDispclk[mode_lib->soc.num_states - 1]
3974+
&& v->MaxDppclk[i] == v->MaxDppclk[mode_lib->soc.num_states - 1])) {
39753975
v->PlaneRequiredDISPCLKWithODMCombine4To1 = v->PixelClock[k] / 4 * (1 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100.0);
39763976
}
39773977

0 commit comments

Comments
 (0)