<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr">Den tis 10 apr. 2018 23:11Harry Wentland <<a href="mailto:harry.wentland@amd.com">harry.wentland@amd.com</a>> skrev:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Anthony Koo <<a href="mailto:Anthony.Koo@amd.com" target="_blank" rel="noreferrer">Anthony.Koo@amd.com</a>><br>
<br>
Signed-off-by: Anthony Koo <<a href="mailto:Anthony.Koo@amd.com" target="_blank" rel="noreferrer">Anthony.Koo@amd.com</a>><br>
Reviewed-by: Aric Cyr <<a href="mailto:Aric.Cyr@amd.com" target="_blank" rel="noreferrer">Aric.Cyr@amd.com</a>><br>
Acked-by: Harry Wentland <<a href="mailto:harry.wentland@amd.com" target="_blank" rel="noreferrer">harry.wentland@amd.com</a>><br>
---<br>
 drivers/gpu/drm/amd/display/modules/freesync/freesync.c | 13 ++++++++++++-<br>
 1 file changed, 12 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c<br>
index 4887c888bbe7..abd5c9374eb3 100644<br>
--- a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c<br>
+++ b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c<br>
@@ -896,6 +896,17 @@ bool mod_freesync_is_valid_range(struct mod_freesync *mod_freesync,<br>
        unsigned long long nominal_field_rate_in_uhz =<br>
                        mod_freesync_calc_nominal_field_rate(stream);<br>
<br>
+       /* Allow for some rounding error of actual video timing by taking ceil.<br>
+        * For example, 144 Hz mode timing may actually be 143.xxx Hz when<br>
+        * calculated from pixel rate and vertical/horizontal totals, but<br>
+        * this should be allowed instead of blocking FreeSync.<br>
+        */<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Hi, with this change the var names ending in *_in_uhz are a bit confusing, also the integer division will not round up (take ceil) as seems to be the intention from the above comment. Perhaps the comment needs to be improved?</div><div dir="auto"><br></div><div dir="auto">BR</div><div dir="auto">Nils</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+       nominal_field_rate_in_uhz = div_u64(nominal_field_rate_in_uhz, 1000000);<br>
+       min_refresh_cap_in_uhz /= 1000000;<br>
+       max_refresh_cap_in_uhz /= 1000000;<br>
+       min_refresh_request_in_uhz /= 1000000;<br>
+       max_refresh_request_in_uhz /= 1000000;<br>
+<br>
        // Check nominal is within range<br>
        if (nominal_field_rate_in_uhz > max_refresh_cap_in_uhz ||<br>
                nominal_field_rate_in_uhz < min_refresh_cap_in_uhz)<br>
@@ -921,7 +932,7 @@ bool mod_freesync_is_valid_range(struct mod_freesync *mod_freesync,<br>
<br>
        // For variable range, check for at least 10 Hz range<br>
        if ((max_refresh_request_in_uhz != min_refresh_request_in_uhz) &&<br>
-               (max_refresh_request_in_uhz - min_refresh_request_in_uhz < 10000000))<br>
+               (max_refresh_request_in_uhz - min_refresh_request_in_uhz < 10))<br>
                return false;<br>
<br>
        return true;<br>
-- <br>
2.15.1<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
<a href="mailto:amd-gfx@lists.freedesktop.org" target="_blank" rel="noreferrer">amd-gfx@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx" rel="noreferrer noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><br>
</blockquote></div></div></div>