summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-04-14 17:12:37 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2014-04-14 17:12:37 +0100
commitcb35b397395cff8ff7f5155759f58c1840bfeeb5 (patch)
treea4dfa92fbe48761ed495f40d7a0e2a36a33e3a54
parentfd700c37ee2a68262b1ccfff332dd41ba8599e2c (diff)
sna: Rearrange cursor reuse to avoid sharing rotations
Try not to steal a rotated cursor that is currently in use, or else we may see a brief flash of corruption. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_display.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 3f2b9125..6c43bb08 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -3160,14 +3160,26 @@ static struct sna_cursor *__sna_get_cursor(struct sna *sna, xf86CrtcPtr crtc)
size = sna->cursor.size;
for (cursor = sna->cursor.cursors; cursor; cursor = cursor->next) {
- if (cursor->alloc >= 4*size*size && cursor->serial != sna->cursor.serial) {
+ if (cursor->alloc >= 4*size*size && cursor->rotation == rotation) {
__DBG(("%s: stealing handle=%d, serial=%d, rotation=%d, alloc=%d\n",
__FUNCTION__, cursor->handle, cursor->serial, cursor->rotation, cursor->alloc));
+ assert(cursor->serial != sna->cursor.serial);
break;
}
}
if (cursor == NULL) {
+ for (cursor = sna->cursor.cursors; cursor; cursor = cursor->next) {
+ if (cursor->alloc >= 4*size*size && cursor->serial != sna->cursor.serial) {
+ __DBG(("%s: stealing handle=%d, serial=%d, rotation=%d, alloc=%d\n",
+ __FUNCTION__, cursor->handle, cursor->serial, cursor->rotation, cursor->alloc));
+ assert(cursor->rotation != sna->cursor.rotation);
+ break;
+ }
+ }
+ }
+
+ if (cursor == NULL) {
cursor = __sna_create_cursor(sna);
if (cursor == NULL)
return NULL;