From e501aa667699787daf7dc0dfd22c397a785564ce Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 27 Mar 2014 21:57:39 +0000 Subject: [PATCH] sna: Cursors only need to be cleared when they are shrunk If we completely overwrite the old contents, we do not need to clear it first. Signed-off-by: Chris Wilson --- src/sna/sna_display.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c index 0748758e..5ed6d211 100644 --- a/src/sna/sna_display.c +++ b/src/sna/sna_display.c @@ -2984,6 +2984,8 @@ struct sna_cursor { uint32_t *image; Rotation rotation; int size; + int last_width; + int last_height; unsigned handle; unsigned serial; unsigned alloc; @@ -3086,6 +3088,8 @@ static struct sna_cursor *__sna_create_cursor(struct sna *sna, unsigned size) __DBG(("%s: handle=%d, allocated %d\n", __FUNCTION__, c->handle, size)); c->serial = 0; + c->last_width = c->last_height = 0; /* all clear */ + c->next = sna->cursor.cursors; sna->cursor.cursors = c; @@ -3170,7 +3174,7 @@ static struct sna_cursor *__sna_get_cursor(struct sna *sna, xf86CrtcPtr crtc) } } - if (width != size || height != size) + if (width < cursor->last_width || height < cursor->last_height) memset(cursor->image, 0, 4*size*size); if (rotation == RR_Rotate_0) { memcpy_blt(src, cursor->image, 32, @@ -3199,6 +3203,8 @@ static struct sna_cursor *__sna_get_cursor(struct sna *sna, xf86CrtcPtr crtc) cursor->size = size; cursor->rotation = rotation; cursor->serial = sna->cursor.serial; + cursor->last_width = width; + cursor->last_height = height; return cursor; }