Skip to contentSkip to conversation

sna: Ensure we re-calculate fb_to_cursor transform if sharing cursor

PATCH In review Matt Roper 2 participants 2 messages Nov 15, 2016 – Nov 16, 2016

lore
Share & tools
lore

Matt Roper

author
#0 lore raw

PATCH 1/1 sna: Ensure we re-calculate fb_to_cursor transform if sharing cursor

If we find that we're sharing the cursor, we wind up bailing out of __sna_get_cursor() before the fb_to_cursor transform is computed. For rotated displays, this can prevent the hotspot transformation from happening properly, so the cursor's visible position won't match the software's idea of where it is.

---
 src/sna/sna_display.c | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)
src/sna/sna_display.c +15 -14
index ebfeb6a..46af672 100644
@@ -5839,20 +5839,6 @@ static struct sna_cursor *__sna_get_cursor(struct sna *sna, xf86CrtcPtr crtc)
 	transformed = to_sna_crtc(crtc)->cursor_transform;
 	rotation = (!transformed && crtc->transform_in_use) ? crtc->rotation : RR_Rotate_0;
 
-	/* Don't allow phys cursor sharing */
-	if (sna->cursor.use_gtt && !transformed) {
-		for (cursor = sna->cursor.cursors; cursor; cursor = cursor->next) {
-			if (cursor->serial == sna->cursor.serial &&
-			    cursor->rotation == rotation &&
-			    !cursor->transformed) {
-				__DBG(("%s: reusing handle=%d, serial=%d, rotation=%d, size=%d\n",
-				       __FUNCTION__, cursor->handle, cursor->serial, cursor->rotation, cursor->size));
-				assert(cursor->size == sna->cursor.size);
-				return cursor;
-			}
-		}
-	}
-
 	if (transformed) {
 		struct pixman_box16 box;
 
@@ -5910,6 +5896,21 @@ static struct sna_cursor *__sna_get_cursor(struct sna *sna, xf86CrtcPtr crtc)
 		       to_sna_crtc(crtc)->cursor_to_fb.m[2][2]));
 	}
 
+	/* Don't allow phys cursor sharing */
+	if (sna->cursor.use_gtt && !transformed) {
+		for (cursor = sna->cursor.cursors; cursor; cursor = cursor->next) {
+			if (cursor->serial == sna->cursor.serial &&
+			    cursor->rotation == rotation &&
+			    !cursor->transformed) {
+				__DBG(("%s: reusing handle=%d, serial=%d, rotation=%d, size=%d\n",
+				       __FUNCTION__, cursor->handle, cursor->serial, cursor->rotation, cursor->size));
+				assert(cursor->size == sna->cursor.size);
+				return cursor;
+			}
+		}
+	}
+
+
 	cursor = to_sna_crtc(crtc)->cursor;
 	if (cursor && cursor->alloc < 4*size*size)
 		cursor = NULL;
Signature · 6 lines
2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 8 lines · Matt Roper

If we find that we're sharing the cursor, we wind up bailing out of __sna_get_cursor() before the fb_to_cursor transform is computed. For rotated displays, this can prevent the hotspot transformation from happening properly, so the cursor's visible position won't match the software's idea of where it is.

Hopefully the finally fix in this series! Thanks,
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx