Skip to contentSkip to conversation

drm/amd/display: fix cursor-plane-only atomic commits not triggering pageflips

PATCH In review Xaver Hugl 2 participants 4 messages Dec 7, 2023

Subsystems (4)
lore
Share & tools
lore

Xaver Hugl

author
#0 lore raw

PATCH 1/1 drm/amd/display: fix cursor-plane-only atomic commits not triggering pageflips

With VRR, every atomic commit affecting a given display must trigger a new scanout cycle, so that userspace is able to control the refresh rate of the display. Before this commit, this was not the case for atomic commits that only contain cursor plane properties.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +8 -2
index b452796fc6d3..b379c859fbef 100644
@@ -8149,9 +8149,15 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
 		/* Cursor plane is handled after stream updates */
 		if (plane->type == DRM_PLANE_TYPE_CURSOR) {
 			if ((fb && crtc == pcrtc) ||
-			    (old_plane_state->fb && old_plane_state->crtc == pcrtc))
+			    (old_plane_state->fb && old_plane_state->crtc == pcrtc)) {
 				cursor_update = true;
-
+				/*
+				 * With atomic modesetting, cursor changes must
+				 * also trigger a new refresh period with vrr
+				 */
+				if (!state->legacy_cursor_update)
+					pflip_present = true;
+			}
 			continue;
 		}
 
Signature · 1 line
2.43.0
author
#1 lore raw

Sorry, it looks like I sent this too soon. I tested the patch on a second PC and it doesn't fix the issue there.

Am Do., 7. Dez. 2023 um 19:25 Uhr schrieb Xaver Hugl <[email protected]>:

Quoted 39 lines

With VRR, every atomic commit affecting a given display must trigger a new scanout cycle, so that userspace is able to control the refresh rate of the display. Before this commit, this was not the case for atomic commits that only contain cursor plane properties.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +8 -3
index b452796fc6d3..b379c859fbef 100644
@@ -8149,9 +8149,15 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
                /* Cursor plane is handled after stream updates */
                if (plane->type == DRM_PLANE_TYPE_CURSOR) {
                        if ((fb && crtc == pcrtc) ||
-                           (old_plane_state->fb && old_plane_state->crtc == pcrtc))
+                           (old_plane_state->fb && old_plane_state->crtc == pcrtc)) {
                                cursor_update = true;
-
+                               /*
+                                * With atomic modesetting, cursor changes must
+                                * also trigger a new refresh period with vrr
+                                */
+                               if (!state->legacy_cursor_update)
+                                       pflip_present = true;
+                       }
                        continue;
                }
 
--

2.43.0

maintainer
#2 lore raw
Quoted 3 lines · Xaver Hugl

Sorry, it looks like I sent this too soon. I tested the patch on a second PC and it doesn't fix the issue there.

Ah, too bad. Won't merge it then.

Harry

Quoted 41 lines

Am Do., 7. Dez. 2023 um 19:25 Uhr schrieb Xaver Hugl <[email protected]>:

Quoted 39 lines

With VRR, every atomic commit affecting a given display must trigger a new scanout cycle, so that userspace is able to control the refresh rate of the display. Before this commit, this was not the case for atomic commits that only contain cursor plane properties.

---
  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 10 ++++++++--
  1 file changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +8 -3
index b452796fc6d3..b379c859fbef 100644
@@ -8149,9 +8149,15 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
                 /* Cursor plane is handled after stream updates */
                 if (plane->type == DRM_PLANE_TYPE_CURSOR) {
                         if ((fb && crtc == pcrtc) ||
-                           (old_plane_state->fb && old_plane_state->crtc == pcrtc))
+                           (old_plane_state->fb && old_plane_state->crtc == pcrtc)) {
                                 cursor_update = true;
-
+                               /*
+                                * With atomic modesetting, cursor changes must
+                                * also trigger a new refresh period with vrr
+                                */
+                               if (!state->legacy_cursor_update)
+                                       pflip_present = true;
+                       }
                         continue;
                 }
 
--

2.43.0

maintainer Reviewed-by on v1 1/1
#3 lore raw
In reply to Xaver Hugl
Quoted 9 lines · Xaver Hugl

With VRR, every atomic commit affecting a given display must trigger a new scanout cycle, so that userspace is able to control the refresh rate of the display. Before this commit, this was not the case for atomic commits that only contain cursor plane properties.

Harry

Quoted 26 lines
---
  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 10 ++++++++--
  1 file changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +8 -2
index b452796fc6d3..b379c859fbef 100644
@@ -8149,9 +8149,15 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
  		/* Cursor plane is handled after stream updates */
  		if (plane->type == DRM_PLANE_TYPE_CURSOR) {
  			if ((fb && crtc == pcrtc) ||
-			    (old_plane_state->fb && old_plane_state->crtc == pcrtc))
+			    (old_plane_state->fb && old_plane_state->crtc == pcrtc)) {
  				cursor_update = true;
-
+				/*
+				 * With atomic modesetting, cursor changes must
+				 * also trigger a new refresh period with vrr
+				 */
+				if (!state->legacy_cursor_update)
+					pflip_present = true;
+			}
  			continue;
  		}