Skip to contentSkip to conversation

drm/amd/display: Fix cursor disable with horizontally split planes

PATCH In review Yuling Li 3 participants 3 messages Aug 31 – Sep 1

Subsystems (3)
lore
Share & tools
lore

Yuling Li

author
#0 lore raw

PATCH 1/1 drm/amd/display: Fix cursor disable with horizontally split planes

From: Yuling Li <[email protected]>

[WHY]
resource_can_pipe_disable_cursor() disables the hardware cursor on a pipe when a higher layer fully covers that pipe's recout, to avoid double-cursor and scaling artifacts.

When merging pipe-split halves of the same overlay layer, the inner loop walks every pipe above the current one and looks for siblings sharing test_pipe's layer_index. Because test_pipe itself satisfies that condition, it can be treated as its own split partner. That incorrectly doubles r2.width and makes the covering check succeed even when the overlay does not fully contain the underlying pipe.

On horizontally split or multi-quadrant layouts this causes the cursor to disappear over overlay regions while input/coordinate mapping remains correct.

[HOW]
Skip test_pipe when searching for a pipe-split sibling on the same layer, so only the other half of the split plane is merged into r2.

---
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +5 -1
index ac558e715b72..7bbbe118e365 100644
@@ -1801,7 +1801,10 @@ bool resource_can_pipe_disable_cursor(struct pipe_ctx *pipe_ctx)
 		 * pipe-split, merge together per same height.
 		 */
 		for (split_pipe = pipe_ctx->top_pipe; split_pipe;
-		     split_pipe = split_pipe->top_pipe)
+		     split_pipe = split_pipe->top_pipe) {
+			if (split_pipe == test_pipe)
+				continue;
+
 			if (split_pipe->plane_state->layer_index == test_pipe->plane_state->layer_index) {
 				struct rect r2_half;
 
@@ -1813,6 +1816,7 @@ bool resource_can_pipe_disable_cursor(struct pipe_ctx *pipe_ctx)
 				r2_bottom = min(r2_bottom, r2_half.y + r2_half.height);
 				break;
 			}
+		}
 
 		if (r1.x >= r2.x && r1.y >= r2.y && r1_right <= r2_right && r1_bottom <= r2_bottom)
 			return true;
Signature · 1 line
2.43.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 32 lines · Yuling Li

From: Yuling Li <[email protected]>

[WHY]
resource_can_pipe_disable_cursor() disables the hardware cursor on a pipe when a higher layer fully covers that pipe's recout, to avoid double-cursor and scaling artifacts.

When merging pipe-split halves of the same overlay layer, the inner loop walks every pipe above the current one and looks for siblings sharing test_pipe's layer_index. Because test_pipe itself satisfies that condition, it can be treated as its own split partner. That incorrectly doubles r2.width and makes the covering check succeed even when the overlay does not fully contain the underlying pipe.

On horizontally split or multi-quadrant layouts this causes the cursor to disappear over overlay regions while input/coordinate mapping remains correct.

[HOW]
Skip test_pipe when searching for a pipe-split sibling on the same layer, so only the other half of the split plane is merged into r2.

---
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +0 -0
index ac558e715b72..7bbbe118e365 100644

drivers/gpu/drm/amd/display/dc/core/dc_resource.c bool resource_can_pipe_disable_cursor(struct pipe_ctx *pipe_ctx) · line 1804

Quoted 5 lines
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +1 -1
@@ -1801,7 +1801,10 @@ bool resource_can_pipe_disable_cursor(struct pipe_ctx *pipe_ctx)
 		 * pipe-split, merge together per same height.
 		 */
 		for (split_pipe = pipe_ctx->top_pipe; split_pipe;
-		     split_pipe = split_pipe->top_pipe)
+		     split_pipe = split_pipe->top_pipe) {

Nit: add a newline here.

Otherwise, it makes sense to me:

Curious, what was the specific use case where you saw the cursor disappearing? Which compositor/app?

Thanks,
Leo

Quoted 14 lines
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +4 -0
+			if (split_pipe == test_pipe)
+				continue;
+
 			if (split_pipe->plane_state->layer_index == test_pipe->plane_state->layer_index) {
 				struct rect r2_half;
 
@@ -1813,6 +1816,7 @@ bool resource_can_pipe_disable_cursor(struct pipe_ctx *pipe_ctx)
 				r2_bottom = min(r2_bottom, r2_half.y + r2_half.height);
 				break;
 			}
+		}
 
 		if (r1.x >= r2.x && r1.y >= r2.y && r1_right <= r2_right && r1_bottom <= r2_bottom)
 			return true;
Reviewed-by Leo Li
#2 lore raw

AMD General

Hi Leo,

I wrote a test case originally on Android VM to test plane offset and happened to find this issue. It was run on SurfaceFlinger in guest and Weston in host. And I then wrote another test case on bare metal with DRM/KMS directly to confirm the error's location. For the test case (see as below), each quadrant tile is a plane, and they can switch position by dragging. With 4 planes, kernel first hit Surface: can not attach plane_state ... Maximum is: 4. Then after some switches, the cursor will disappear on one of the right overlay planes. [cid:e98526f9-1c25-41b0-9666-0fbc99166164]

Sincerely
Yuling

________________________________
From: Leo Li <[email protected]>
Sent: Tuesday, September 1, 2026 12:26 AM
To: Li, Yuling <[email protected]>; [email protected] <[email protected]>
Cc: Wentland, Harry <[email protected]>; Li, Yuling <[email protected]>
Subject: Re: [PATCH] drm/amd/display: Fix cursor disable with horizontally split planes

Quoted 32 lines · Yuling Li

From: Yuling Li <[email protected]>

[WHY]
resource_can_pipe_disable_cursor() disables the hardware cursor on a pipe when a higher layer fully covers that pipe's recout, to avoid double-cursor and scaling artifacts.

When merging pipe-split halves of the same overlay layer, the inner loop walks every pipe above the current one and looks for siblings sharing test_pipe's layer_index. Because test_pipe itself satisfies that condition, it can be treated as its own split partner. That incorrectly doubles r2.width and makes the covering check succeed even when the overlay does not fully contain the underlying pipe.

On horizontally split or multi-quadrant layouts this causes the cursor to disappear over overlay regions while input/coordinate mapping remains correct.

[HOW]
Skip test_pipe when searching for a pipe-split sibling on the same layer, so only the other half of the split plane is merged into r2.

---
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +0 -0
index ac558e715b72..7bbbe118e365 100644

drivers/gpu/drm/amd/display/dc/core/dc_resource.c bool resource_can_pipe_disable_cursor(struct pipe_ctx *pipe_ctx) · line 1804

Quoted 5 lines
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +1 -1
@@ -1801,7 +1801,10 @@ bool resource_can_pipe_disable_cursor(struct pipe_ctx *pipe_ctx)
                * pipe-split, merge together per same height.
                */
               for (split_pipe = pipe_ctx->top_pipe; split_pipe;
-                  split_pipe = split_pipe->top_pipe)
+                  split_pipe = split_pipe->top_pipe) {

Nit: add a newline here.

Otherwise, it makes sense to me:

Curious, what was the specific use case where you saw the cursor disappearing? Which compositor/app?

Thanks,
Leo

Quoted 14 lines
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +4 -0
+                     if (split_pipe == test_pipe)
+                             continue;
+
                       if (split_pipe->plane_state->layer_index == test_pipe->plane_state->layer_index) {
                               struct rect r2_half;
 
@@ -1813,6 +1816,7 @@ bool resource_can_pipe_disable_cursor(struct pipe_ctx *pipe_ctx)
                               r2_bottom = min(r2_bottom, r2_half.y + r2_half.height);
                               break;
                       }
+             }
 
               if (r1.x >= r2.x && r1.y >= r2.y && r1_right <= r2_right && r1_bottom <= r2_bottom)
                       return true;