drm/amd/display: Round calculated vtotal
authorjsg <jsg@openbsd.org>
Mon, 7 Oct 2024 05:28:20 +0000 (05:28 +0000)
committerjsg <jsg@openbsd.org>
Mon, 7 Oct 2024 05:28:20 +0000 (05:28 +0000)
From Robin Chen
9ce1ee22dc6829175ec2dfd74d78d79eb20e0732 in linux-6.6.y/6.6.54
c03fca619fc687338a3b6511fdbed94096abdf79 in mainline linux

sys/dev/pci/drm/amd/display/modules/freesync/freesync.c

index 04602d6..fb9e86a 100644 (file)
@@ -133,7 +133,7 @@ unsigned int mod_freesync_calc_v_total_from_refresh(
 
        v_total = div64_u64(div64_u64(((unsigned long long)(
                        frame_duration_in_ns) * (stream->timing.pix_clk_100hz / 10)),
-                       stream->timing.h_total), 1000000);
+                       stream->timing.h_total) + 500000, 1000000);
 
        /* v_total cannot be less than nominal */
        if (v_total < stream->timing.v_total) {