As we increase the vtotal to accommodate lower resfresh rate for fixed
modes, adjust the vtotal-vsync distance also.

Signed-off-by: Ankit Nautiyal <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_panel.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/intel_panel.c 
b/drivers/gpu/drm/i915/display/intel_panel.c
index 20c548eea6da..14c7eea8ccb1 100644
--- a/drivers/gpu/drm/i915/display/intel_panel.c
+++ b/drivers/gpu/drm/i915/display/intel_panel.c
@@ -237,11 +237,18 @@ int intel_panel_compute_config(struct intel_connector 
*connector,
 
        drm_mode_copy(adjusted_mode, fixed_mode);
 
-       if (is_vrr && fixed_mode_vrefresh != vrefresh)
+       if (is_vrr && fixed_mode_vrefresh != vrefresh) {
+               int vsync_start_diff = adjusted_mode->vtotal - 
adjusted_mode->vsync_start;
+               int vsync_end_diff = adjusted_mode->vtotal - 
adjusted_mode->vsync_end;
+
                adjusted_mode->vtotal =
                        DIV_ROUND_CLOSEST(adjusted_mode->clock * 1000,
                                          adjusted_mode->htotal * vrefresh);
 
+               adjusted_mode->vsync_start = adjusted_mode->vtotal - 
vsync_start_diff;
+               adjusted_mode->vsync_end = adjusted_mode->vtotal - 
vsync_end_diff;
+       }
+
        drm_mode_set_crtcinfo(adjusted_mode, 0);
 
        return 0;
-- 
2.45.2

Reply via email to