]> git.baikalelectronics.ru Git - kernel.git/commit
drm/amd/display: Fix LFC multiplier changing erratically
authorAnthony Koo <Anthony.Koo@amd.com>
Wed, 29 Jul 2020 21:33:27 +0000 (17:33 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 10 Aug 2020 21:26:52 +0000 (17:26 -0400)
commit72d93e61b21aa93da7d8d0653eeebfe32cf413b9
tree7c51c607f1b6acd06dc2df7e9292193d2bc69b49
parentb26e216408fab26c343cefab9a714954002ed5a1
drm/amd/display: Fix LFC multiplier changing erratically

[Why]
1. There is a calculation that is using frame_time_in_us instead of
last_render_time_in_us to calculate whether choosing an LFC multiplier
would cause the inserted frame duration to be outside of range.

2. We do not handle unsigned integer subtraction correctly and it underflows
to a really large value, which causes some logic errors.

[How]
1. Fix logic to calculate 'within range' using last_render_time_in_us
2. Split out delta_from_mid_point_delta_in_us calculation to ensure
we don't underflow and wrap around

Signed-off-by: Anthony Koo <Anthony.Koo@amd.com>
Reviewed-by: Aric Cyr <Aric.Cyr@amd.com>
Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/modules/freesync/freesync.c