]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
drm/amd/display: Fix frames_to_insert math
authorBayan Zabihiyan <bayan.zabihiyan@amd.com>
Wed, 10 Jul 2019 20:00:53 +0000 (16:00 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 7 Oct 2019 16:58:55 +0000 (18:58 +0200)
commit075ad48409c18bb88058a24f94b48f508cd8b578
treee2f7c2b862d3a159dc0c4217a63e64f7ca272f70
parent73de2baa5b3c54d6c457c78964615cac1408caf6
drm/amd/display: Fix frames_to_insert math

[ Upstream commit a463b263032f7c98c5912207db43be1aa34a6438 ]

[Why]
The math on deciding on how many
"frames to insert" sometimes sent us over the max refresh rate.
Also integer overflow can occur if we have high refresh rates.

[How]
Instead of clipping the  frame duration such that it doesn’t go below the min,
just remove a frame from the number of frames to insert. +
Use unsigned long long for intermediate calculations to prevent
integer overflow.

Signed-off-by: Bayan Zabihiyan <bayan.zabihiyan@amd.com>
Reviewed-by: Aric Cyr <Aric.Cyr@amd.com>
Acked-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/display/modules/freesync/freesync.c