Skip to contentSkip to conversation

drm/nouveau/kms/nv50-: Check plane size for cursors, not fb size

PATCH In review Lyude Paul 2 participants 3 messages Mar 18, 2021

Subsystems (3)
lore
Share & tools
lore

Lyude Paul

author maintainer
#0 lore raw

PATCH 1/1 drm/nouveau/kms/nv50-: Check plane size for cursors, not fb size

Found this while trying to make some changes to the kms_cursor_crc test. curs507a_acquire checks that the width and height of the cursor framebuffer are equal (asyw->image.{w,h}). This is actually wrong though, as we only want to be concerned that the actual width/height of the plane are the same. It's fine if we scan out from an fb that's slightly larger than the cursor plane (in fact, some igt tests actually do this).

Note that I'm not entirely sure why this wasn't previously breaking kms_cursor_crc tests - they all set up cursors with the height being one pixel larger than the actual size of the cursor. But this seems to fix things, and the code before was definitely incorrect - so it's not really worth looking into further imho.

Cc Martin Peres <[email protected]>
Cc Jeremy Cline <[email protected]>
---
 drivers/gpu/drm/nouveau/dispnv50/curs507a.c | 2 +-
 drivers/gpu/drm/nouveau/dispnv50/head507d.c | 2 +-
 drivers/gpu/drm/nouveau/dispnv50/head917d.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/nouveau/dispnv50/curs507a.c +1 -1
index 54fbd6fe751d..7a7f80e51ec0 100644
@@ -109,7 +109,7 @@ curs507a_acquire(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw,
 	if (ret || !asyh->curs.visible)
 		return ret;
 
-	if (asyw->image.w != asyw->image.h)
+	if (asyw->state.crtc_w != asyw->state.crtc_h)
 		return -EINVAL;
 
 	ret = head->func->curs_layout(head, asyw, asyh);
drivers/gpu/drm/nouveau/dispnv50/head507d.c +1 -1
index 09b89983864b..3d230ca488c9 100644
@@ -176,7 +176,7 @@ int
 head507d_curs_layout(struct nv50_head *head, struct nv50_wndw_atom *asyw,
 		     struct nv50_head_atom *asyh)
 {
-	switch (asyw->image.w) {
+	switch (asyw->state.crtc_w) {
 	case 32: asyh->curs.layout = NV507D_HEAD_SET_CONTROL_CURSOR_SIZE_W32_H32; break;
 	case 64: asyh->curs.layout = NV507D_HEAD_SET_CONTROL_CURSOR_SIZE_W64_H64; break;
 	default:
drivers/gpu/drm/nouveau/dispnv50/head917d.c +1 -1
index 4ce47b55f72c..caa7d633691b 100644
@@ -103,7 +103,7 @@ int
 head917d_curs_layout(struct nv50_head *head, struct nv50_wndw_atom *asyw,
 		     struct nv50_head_atom *asyh)
 {
-	switch (asyw->state.fb->width) {
+	switch (asyw->state.crtc_w) {
 	case  32: asyh->curs.layout = NV917D_HEAD_SET_CONTROL_CURSOR_SIZE_W32_H32; break;
 	case  64: asyh->curs.layout = NV917D_HEAD_SET_CONTROL_CURSOR_SIZE_W64_H64; break;
 	case 128: asyh->curs.layout = NV917D_HEAD_SET_CONTROL_CURSOR_SIZE_W128_H128; break;
Signature · 6 lines
2.29.2

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau
#1 lore raw
Quoted 7 lines · Lyude Paul

Found this while trying to make some changes to the kms_cursor_crc test. curs507a_acquire checks that the width and height of the cursor framebuffer are equal (asyw->image.{w,h}). This is actually wrong though, as we only want to be concerned that the actual width/height of the plane are the same. It's fine if we scan out from an fb that's slightly larger than the cursor plane (in fact, some igt tests actually do this).

How so? The scanout engine expects the data to be packed. Height can be larger, but width has to match.

-ilia
_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

author maintainer
#2 lore raw
Quoted 11 lines · Ilia Mirkin
Quoted 7 lines · Lyude Paul

Found this while trying to make some changes to the kms_cursor_crc test. curs507a_acquire checks that the width and height of the cursor framebuffer are equal (asyw->image.{w,h}). This is actually wrong though, as we only want to be concerned that the actual width/height of the plane are the same. It's fine if we scan out from an fb that's slightly larger than the cursor plane (in fact, some igt tests actually do this).

How so? The scanout engine expects the data to be packed. Height can be larger, but width has to match.

Huh - wasn't expecting that, nice catch. I'll fix this up in a moment

Quoted 3 lines

  -ilia

Signature · 13 lines
Sincerely,
   Lyude Paul (she/her)
   Software Engineer at Red Hat
   
Note: I deal with a lot of emails and have a lot of bugs on my plate. If you've
asked me a question, are waiting for a review/merge on a patch, etc. and I
haven't responded in a while, please feel free to send me another email to check
on my status. I don't bite!

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel