drm/amd/display: Spinlock before reading event
authorjsg <jsg@openbsd.org>
Mon, 9 Sep 2024 08:57:58 +0000 (08:57 +0000)
committerjsg <jsg@openbsd.org>
Mon, 9 Sep 2024 08:57:58 +0000 (08:57 +0000)
From Alex Hung
af43ed726fa517b19f900b56965ad29933820545 in linux-6.6.y/6.6.50
ae13c8a5cff92015b9a3eb7cee65ebc75859487f in mainline linux

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

index 1c7289d..4773734 100644 (file)
@@ -8292,15 +8292,13 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
                                bundle->stream_update.vrr_infopacket =
                                        &acrtc_state->stream->vrr_infopacket;
                }
-       } else if (cursor_update && acrtc_state->active_planes > 0 &&
-                  acrtc_attach->base.state->event) {
-               drm_crtc_vblank_get(pcrtc);
-
+       } else if (cursor_update && acrtc_state->active_planes > 0) {
                spin_lock_irqsave(&pcrtc->dev->event_lock, flags);
-
-               acrtc_attach->event = acrtc_attach->base.state->event;
-               acrtc_attach->base.state->event = NULL;
-
+               if (acrtc_attach->base.state->event) {
+                       drm_crtc_vblank_get(pcrtc);
+                       acrtc_attach->event = acrtc_attach->base.state->event;
+                       acrtc_attach->base.state->event = NULL;
+               }
                spin_unlock_irqrestore(&pcrtc->dev->event_lock, flags);
        }