]> git.dujemihanovic.xyz Git - linux.git/commitdiff
drm/amd/display: Round calculated vtotal
authorRobin Chen <robin.chen@amd.com>
Fri, 23 Aug 2024 07:00:28 +0000 (15:00 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 18 Sep 2024 20:15:06 +0000 (16:15 -0400)
[WHY]
The calculated vtotal may has 1 line deviation. To get precisely
vtotal number, round the vtotal result.

Cc: Mario Limonciello <mario.limonciello@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
Reviewed-by: Anthony Koo <anthony.koo@amd.com>
Signed-off-by: Robin Chen <robin.chen@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/modules/freesync/freesync.c

index a40e6590215a647c0a2b573b029061c14b4afb18..bbd259cea4f4f68ff5aead69693777c3b1e8e662 100644 (file)
@@ -134,7 +134,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) {