From: Robin Chen <robin.c...@amd.com>

[WHY]
The calculated vtotal may has 1 line deviation. To get precisely
vtotal number, round the vtotal result.

Cc: Mario Limonciello <mario.limoncie...@amd.com>
Cc: Alex Deucher <alexander.deuc...@amd.com>
Cc: sta...@vger.kernel.org
Reviewed-by: Anthony Koo <anthony....@amd.com>
Signed-off-by: Robin Chen <robin.c...@amd.com>
Signed-off-by: Alex Hung <alex.h...@amd.com>
---
 drivers/gpu/drm/amd/display/modules/freesync/freesync.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c 
b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
index a40e6590215a..bbd259cea4f4 100644
--- a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
+++ b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
@@ -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) {
-- 
2.34.1

Reply via email to