xf86-video-intel: 2 commits - src/sna/sna_display.c
Chris Wilson
ickle at kemper.freedesktop.org
Thu Mar 27 14:54:23 PDT 2014
src/sna/sna_display.c | 29 ++++++++++++++++++++---------
1 file changed, 20 insertions(+), 9 deletions(-)
New commits:
commit 5c4d6d1ad748fe5301fa88d9c15c19a07c55149f
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Thu Mar 27 21:16:31 2014 +0000
sna: Reorder the cursor cache search
Search for an exact match first, before looking for a cursor we can
reuse. This should help reuse with multiple rotated screens not stealing
the others' cursor on every pass.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 35f4ea3..0748758 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -3103,9 +3103,10 @@ static struct sna_cursor *__sna_get_cursor(struct sna *sna, xf86CrtcPtr crtc)
if (sna->cursor.ref == NULL || sna->cursor.ref->bits == NULL)
return NULL;
- __DBG(("%s: cursor=%dx%d\n", __FUNCTION__,
+ __DBG(("%s: cursor=%dx%d, serial=%d\n", __FUNCTION__,
sna->cursor.ref->bits->width,
- sna->cursor.ref->bits->height));
+ sna->cursor.ref->bits->height,
+ sna->cursor.serial));
i = MAX(sna->cursor.ref->bits->width, sna->cursor.ref->bits->height);
for (size = 64; size < i; size <<= 1)
@@ -3113,9 +3114,22 @@ static struct sna_cursor *__sna_get_cursor(struct sna *sna, xf86CrtcPtr crtc)
assert(size <= sna->cursor.max_width && size <= sna->cursor.max_height);
rotation = crtc->transform_in_use ? crtc->rotation : RR_Rotate_0;
- for (cursor = sna->cursor.cursors; cursor; cursor = cursor->next)
- if (cursor->size >= size && cursor->rotation == rotation)
+ for (cursor = sna->cursor.cursors; cursor; cursor = cursor->next) {
+ if (cursor->serial == sna->cursor.serial && cursor->rotation == rotation) {
+ __DBG(("%s: reusing handle=%d, serial=%d, rotation=%d\n",
+ __FUNCTION__, cursor->handle, cursor->serial, cursor->rotation));
+ assert(cursor->size == size);
+ return cursor;
+ }
+ }
+
+ 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));
break;
+ }
+ }
if (cursor == NULL) {
cursor = __sna_create_cursor(sna, size);
@@ -3123,11 +3137,6 @@ static struct sna_cursor *__sna_get_cursor(struct sna *sna, xf86CrtcPtr crtc)
return NULL;
}
- __DBG(("%s: using handle=%d, serial=%d, current=%d\n",
- __FUNCTION__, cursor->handle, cursor->serial, sna->cursor.serial));
- if (cursor->serial == sna->cursor.serial)
- return cursor;
-
width = sna->cursor.ref->bits->width;
height = sna->cursor.ref->bits->height;
src = sna->cursor.ref->bits->argb;
commit e8be2a438d7a413ba6c64005971ce814b0076fc7
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Thu Mar 27 21:09:45 2014 +0000
sna: Clear the surrounding areas of small cursors
If the cursor does not completely fill the size of the hardware cursor,
we will retain whatever contents already filled that area.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index d327583..35f4ea3 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -3161,6 +3161,8 @@ static struct sna_cursor *__sna_get_cursor(struct sna *sna, xf86CrtcPtr crtc)
}
}
+ if (width != size || height != size)
+ memset(cursor->image, 0, 4*size*size);
if (rotation == RR_Rotate_0) {
memcpy_blt(src, cursor->image, 32,
width * 4, size * 4,
More information about the xorg-commit
mailing list