Commit be922ff7 authored by Anthony Koo's avatar Anthony Koo Committed by Alex Deucher

drm/amd/display: Add back code to allow for rounding error

Signed-off-by: default avatarAnthony Koo <Anthony.Koo@amd.com>
Reviewed-by: default avatarAric Cyr <Aric.Cyr@amd.com>
Acked-by: default avatarHarry Wentland <harry.wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 050790cc
......@@ -896,6 +896,17 @@ bool mod_freesync_is_valid_range(struct mod_freesync *mod_freesync,
unsigned long long nominal_field_rate_in_uhz =
mod_freesync_calc_nominal_field_rate(stream);
/* Allow for some rounding error of actual video timing by taking ceil.
* For example, 144 Hz mode timing may actually be 143.xxx Hz when
* calculated from pixel rate and vertical/horizontal totals, but
* this should be allowed instead of blocking FreeSync.
*/
nominal_field_rate_in_uhz = div_u64(nominal_field_rate_in_uhz, 1000000);
min_refresh_cap_in_uhz /= 1000000;
max_refresh_cap_in_uhz /= 1000000;
min_refresh_request_in_uhz /= 1000000;
max_refresh_request_in_uhz /= 1000000;
// Check nominal is within range
if (nominal_field_rate_in_uhz > max_refresh_cap_in_uhz ||
nominal_field_rate_in_uhz < min_refresh_cap_in_uhz)
......@@ -921,7 +932,7 @@ bool mod_freesync_is_valid_range(struct mod_freesync *mod_freesync,
// For variable range, check for at least 10 Hz range
if ((max_refresh_request_in_uhz != min_refresh_request_in_uhz) &&
(max_refresh_request_in_uhz - min_refresh_request_in_uhz < 10000000))
(max_refresh_request_in_uhz - min_refresh_request_in_uhz < 10))
return false;
return true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment