aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
diff options
context:
space:
mode:
authorAnthony Koo <Anthony.Koo@amd.com>2018-04-05 15:20:15 -0400
committerAlex Deucher <alexander.deucher@amd.com>2018-08-27 12:10:53 -0400
commitbe922ff750e40b292824959577aa914388ff6c8b (patch)
tree5943bf3ab6c877938ce4c6f75c93c89e2f013e7e /drivers/gpu/drm/amd/display/modules/freesync/freesync.c
parent050790cc59732cd99789235cb118df23e9b42911 (diff)
drm/amd/display: Add back code to allow for rounding error
Signed-off-by: Anthony Koo <Anthony.Koo@amd.com> Reviewed-by: Aric Cyr <Aric.Cyr@amd.com> Acked-by: Harry Wentland <harry.wentland@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/display/modules/freesync/freesync.c')
-rw-r--r--drivers/gpu/drm/amd/display/modules/freesync/freesync.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
index 4887c888bbe7..abd5c9374eb3 100644
--- a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
+++ b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
@@ -896,6 +896,17 @@ bool mod_freesync_is_valid_range(struct mod_freesync *mod_freesync,
896 unsigned long long nominal_field_rate_in_uhz = 896 unsigned long long nominal_field_rate_in_uhz =
897 mod_freesync_calc_nominal_field_rate(stream); 897 mod_freesync_calc_nominal_field_rate(stream);
898 898
899 /* Allow for some rounding error of actual video timing by taking ceil.
900 * For example, 144 Hz mode timing may actually be 143.xxx Hz when
901 * calculated from pixel rate and vertical/horizontal totals, but
902 * this should be allowed instead of blocking FreeSync.
903 */
904 nominal_field_rate_in_uhz = div_u64(nominal_field_rate_in_uhz, 1000000);
905 min_refresh_cap_in_uhz /= 1000000;
906 max_refresh_cap_in_uhz /= 1000000;
907 min_refresh_request_in_uhz /= 1000000;
908 max_refresh_request_in_uhz /= 1000000;
909
899 // Check nominal is within range 910 // Check nominal is within range
900 if (nominal_field_rate_in_uhz > max_refresh_cap_in_uhz || 911 if (nominal_field_rate_in_uhz > max_refresh_cap_in_uhz ||
901 nominal_field_rate_in_uhz < min_refresh_cap_in_uhz) 912 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,
921 932
922 // For variable range, check for at least 10 Hz range 933 // For variable range, check for at least 10 Hz range
923 if ((max_refresh_request_in_uhz != min_refresh_request_in_uhz) && 934 if ((max_refresh_request_in_uhz != min_refresh_request_in_uhz) &&
924 (max_refresh_request_in_uhz - min_refresh_request_in_uhz < 10000000)) 935 (max_refresh_request_in_uhz - min_refresh_request_in_uhz < 10))
925 return false; 936 return false;
926 937
927 return true; 938 return true;