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>
This commit is contained in:
Chris Wilson 2014-04-14 17:12:37 +01:00
parent fd700c37ee
commit cb35b39739
1 changed files with 13 additions and 1 deletions

View File

@ -3160,13 +3160,25 @@ 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)