]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/amd/display: more liberal vmin/vmax update for freesync
authorAurabindo Pillai <aurabindo.pillai@amd.com>
Wed, 16 Apr 2025 15:26:54 +0000 (11:26 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 18 May 2025 06:24:07 +0000 (08:24 +0200)
commit f1c6be3999d2be2673a51a9be0caf9348e254e52 upstream.

[Why]
FAMS2 expects vmin/vmax to be updated in the case when freesync is
off, but supported. But we only update it when freesync is enabled.

[How]
Change the vsync handler such that dc_stream_adjust_vmin_vmax() its called
irrespective of whether freesync is enabled. If freesync is supported,
then there is no harm in updating vmin/vmax registers.

Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3546
Reviewed-by: ChiaHsuan Chung <chiahsuan.chung@amd.com>
Signed-off-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Signed-off-by: Ray Wu <ray.wu@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit cfb2d41831ee5647a4ae0ea7c24971a92d5dfa0d)
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

index 4c731b6c020c15ee31e12e4b176618b79157e3e8..dd643563a5e8d1b44cc4c94c0da7af039b6b8b77 100644 (file)
@@ -610,15 +610,21 @@ static void dm_crtc_high_irq(void *interrupt_params)
        spin_lock_irqsave(&adev_to_drm(adev)->event_lock, flags);
 
        if (acrtc->dm_irq_params.stream &&
-           acrtc->dm_irq_params.vrr_params.supported &&
-           acrtc->dm_irq_params.freesync_config.state ==
-                   VRR_STATE_ACTIVE_VARIABLE) {
+               acrtc->dm_irq_params.vrr_params.supported) {
+               bool replay_en = acrtc->dm_irq_params.stream->link->replay_settings.replay_feature_enabled;
+               bool psr_en = acrtc->dm_irq_params.stream->link->psr_settings.psr_feature_enabled;
+               bool fs_active_var_en = acrtc->dm_irq_params.freesync_config.state == VRR_STATE_ACTIVE_VARIABLE;
+
                mod_freesync_handle_v_update(adev->dm.freesync_module,
                                             acrtc->dm_irq_params.stream,
                                             &acrtc->dm_irq_params.vrr_params);
 
-               dc_stream_adjust_vmin_vmax(adev->dm.dc, acrtc->dm_irq_params.stream,
-                                          &acrtc->dm_irq_params.vrr_params.adjust);
+               /* update vmin_vmax only if freesync is enabled, or only if PSR and REPLAY are disabled */
+               if (fs_active_var_en || (!fs_active_var_en && !replay_en && !psr_en)) {
+                       dc_stream_adjust_vmin_vmax(adev->dm.dc,
+                                       acrtc->dm_irq_params.stream,
+                                       &acrtc->dm_irq_params.vrr_params.adjust);
+               }
        }
 
        /*