drm/amd/display: fix the system hang while disable PSR
authorjsg <jsg@openbsd.org>
Wed, 5 Jul 2023 10:40:14 +0000 (10:40 +0000)
committerjsg <jsg@openbsd.org>
Wed, 5 Jul 2023 10:40:14 +0000 (10:40 +0000)
From Tom Chung
9bcac453890bf2c0ab5a7cefb407c0a9d6cbc4cb in linux-6.1.y/6.1.36
ea2062dd1f0384ae1b136d333ee4ced15bedae38 in mainline linux

sys/dev/pci/drm/amd/display/amdgpu_dm/amdgpu_dm.c

index dc46e09..9f59a07 100644 (file)
@@ -7906,6 +7906,12 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
                if (acrtc_state->abm_level != dm_old_crtc_state->abm_level)
                        bundle->stream_update.abm_level = &acrtc_state->abm_level;
 
+               mutex_lock(&dm->dc_lock);
+               if ((acrtc_state->update_type > UPDATE_TYPE_FAST) &&
+                               acrtc_state->stream->link->psr_settings.psr_allow_active)
+                       amdgpu_dm_psr_disable(acrtc_state->stream);
+               mutex_unlock(&dm->dc_lock);
+
                /*
                 * If FreeSync state on the stream has changed then we need to
                 * re-adjust the min/max bounds now that DC doesn't handle this
@@ -7919,10 +7925,6 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
                        spin_unlock_irqrestore(&pcrtc->dev->event_lock, flags);
                }
                mutex_lock(&dm->dc_lock);
-               if ((acrtc_state->update_type > UPDATE_TYPE_FAST) &&
-                               acrtc_state->stream->link->psr_settings.psr_allow_active)
-                       amdgpu_dm_psr_disable(acrtc_state->stream);
-
                update_planes_and_stream_adapter(dm->dc,
                                         acrtc_state->update_type,
                                         planes_count,