Skip to contentSkip to conversation

drm/amd/display: Add primary plane to commits for correct VRR handling

PATCH In review Michel Dänzer 3 participants 5 messages Jul 30, 2025 – Aug 5, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amd/display: Add primary plane to commits for correct VRR handling

From: Michel Dänzer <[email protected]>

amdgpu_dm_commit_planes calls update_freesync_state_on_stream only for the primary plane. If a commit affects a CRTC but not its primary plane, it would previously not trigger a refresh cycle or affect LFC, violating current UAPI semantics.

Fixes e.g. atomic commits affecting only the cursor plane being limited to the minimum refresh rate.

Don't do this for the legacy cursor ioctls though, it would break the UAPI semantics for those.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c +9 -0
index 2551823382f8..010172f930ae 100644
@@ -661,6 +661,15 @@ static int amdgpu_dm_crtc_helper_atomic_check(struct drm_crtc *crtc,
 		return -EINVAL;
 	}
 
+	if (!state->legacy_cursor_update && amdgpu_dm_crtc_vrr_active(dm_crtc_state)) {
+		struct drm_plane_state *primary_state;
+
+		/* Pull in primary plane for correct VRR handling */
+		primary_state = drm_atomic_get_plane_state(state, crtc->primary);
+		if (IS_ERR(primary_state))
+			return PTR_ERR(primary_state);
+	}
+
 	/* In some use cases, like reset, no stream is attached */
 	if (!dm_crtc_state->stream)
 		return 0;
Signature · 1 line
2.50.0
#1 lore raw

I can confirm that this works. Thank you!

- Xaver

Am Mi., 30. Juli 2025 um 10:09 Uhr schrieb Michel Dänzer <[email protected]>:

Quoted 44 lines

From: Michel Dänzer <[email protected]>

amdgpu_dm_commit_planes calls update_freesync_state_on_stream only for the primary plane. If a commit affects a CRTC but not its primary plane, it would previously not trigger a refresh cycle or affect LFC, violating current UAPI semantics.

Fixes e.g. atomic commits affecting only the cursor plane being limited to the minimum refresh rate.

Don't do this for the legacy cursor ioctls though, it would break the UAPI semantics for those.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c +9 -1
index 2551823382f8..010172f930ae 100644
@@ -661,6 +661,15 @@ static int amdgpu_dm_crtc_helper_atomic_check(struct drm_crtc *crtc,
                return -EINVAL;
        }
 
+       if (!state->legacy_cursor_update && amdgpu_dm_crtc_vrr_active(dm_crtc_state)) {
+               struct drm_plane_state *primary_state;
+
+               /* Pull in primary plane for correct VRR handling */
+               primary_state = drm_atomic_get_plane_state(state, crtc->primary);
+               if (IS_ERR(primary_state))
+                       return PTR_ERR(primary_state);
+       }
+
        /* In some use cases, like reset, no stream is attached */
        if (!dm_crtc_state->stream)
                return 0;
--

2.50.0

maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Michel Dänzer
Quoted 10 lines · Michel Dänzer

From: Michel Dänzer <[email protected]>

amdgpu_dm_commit_planes calls update_freesync_state_on_stream only for the primary plane. If a commit affects a CRTC but not its primary plane, it would previously not trigger a refresh cycle or affect LFC, violating current UAPI semantics.

Fixes e.g. atomic commits affecting only the cursor plane being limited to the minimum refresh rate.

Quoted 6 lines

Don't do this for the legacy cursor ioctls though, it would break the UAPI semantics for those.

Harry

Quoted 24 lines
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c +9 -0
index 2551823382f8..010172f930ae 100644
@@ -661,6 +661,15 @@ static int amdgpu_dm_crtc_helper_atomic_check(struct drm_crtc *crtc,
 		return -EINVAL;
 	}
 
+	if (!state->legacy_cursor_update && amdgpu_dm_crtc_vrr_active(dm_crtc_state)) {
+		struct drm_plane_state *primary_state;
+
+		/* Pull in primary plane for correct VRR handling */
+		primary_state = drm_atomic_get_plane_state(state, crtc->primary);
+		if (IS_ERR(primary_state))
+			return PTR_ERR(primary_state);
+	}
+
 	/* In some use cases, like reset, no stream is attached */
 	if (!dm_crtc_state->stream)
 		return 0;
#3 lore raw
Quoted 11 lines · Harry Wentland
Quoted 10 lines · Michel Dänzer

From: Michel Dänzer <[email protected]>

amdgpu_dm_commit_planes calls update_freesync_state_on_stream only for the primary plane. If a commit affects a CRTC but not its primary plane, it would previously not trigger a refresh cycle or affect LFC, violating current UAPI semantics.

Fixes e.g. atomic commits affecting only the cursor plane being limited to the minimum refresh rate.

Quoted 8 lines
Quoted 6 lines

Don't do this for the legacy cursor ioctls though, it would break the UAPI semantics for those.

Thanks Harry.

It occurred to me that Cc: stable might be appropriate for this fix, what do you think?

Signature · 2 lines
Earthling Michel Dänzer       \        GNOME / Xwayland / Mesa developer
https://redhat.com             \               Libre software enthusiast
maintainer
#4 lore raw
Quoted 19 lines · Michel Dänzer
Quoted 18 lines · Harry Wentland
Quoted 16 lines · Michel Dänzer

From: Michel Dänzer <[email protected]>

amdgpu_dm_commit_planes calls update_freesync_state_on_stream only for the primary plane. If a commit affects a CRTC but not its primary plane, it would previously not trigger a refresh cycle or affect LFC, violating current UAPI semantics.

Fixes e.g. atomic commits affecting only the cursor plane being limited to the minimum refresh rate.

Don't do this for the legacy cursor ioctls though, it would break the UAPI semantics for those.

Quoted 7 lines
Quoted 1 line

Thanks Harry.

It occurred to me that Cc: stable might be appropriate for this fix, what do you think?

Agreed.

Harry

Quoted 1 line