xf86-video-intel: 2 commits - src/sna/sna_display.c
Chris Wilson
ickle at kemper.freedesktop.org
Thu Mar 27 16:09:43 PDT 2014
src/sna/sna_display.c | 34 +++++++++++++++++++++-------------
1 file changed, 21 insertions(+), 13 deletions(-)
New commits:
commit e07f8e2e625fb34f9ad795ca8fffc9a9e88e25b2
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Thu Mar 27 23:06:15 2014 +0000
sna: Fix 2-color to ARGB cursor conversion
It helps to remember to advance through the source/mask images after
each row.
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 5ed6d21..0eac267 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -3147,6 +3147,7 @@ static struct sna_cursor *__sna_get_cursor(struct sna *sna, xf86CrtcPtr crtc)
if (src == NULL) {
const uint8_t *source = sna->cursor.ref->bits->source;
const uint8_t *mask = sna->cursor.ref->bits->mask;
+ int pitch = BitmapBytePad(width);
uint32_t *p;
__DBG(("%s: converting from 2-color to ARGB\n", __FUNCTION__));
@@ -3157,20 +3158,21 @@ static struct sna_cursor *__sna_get_cursor(struct sna *sna, xf86CrtcPtr crtc)
p = src;
for (y = 0; y < height; y++) {
- for (x = 0; x < width / 8; x++) {
+ for (x = 0; x < width; x++) {
+ int byte = x / 8;
+ int bit = x & 7;
uint32_t pixel;
- for (i = 0; i < 8; i++) {
- if (mask[x] & (1 << i)) {
- if (source[x] & (1 << i))
- pixel = sna->cursor.fg;
- else
- pixel = sna->cursor.bg;
- } else
- pixel = 0;
- *p++ = pixel;
-
- }
+ if (mask[byte] & (1 << bit)) {
+ if (source[byte] & (1 << bit))
+ pixel = sna->cursor.fg;
+ else
+ pixel = sna->cursor.bg;
+ } else
+ pixel = 0;
+ *p++ = pixel;
}
+ mask += pitch;
+ source += pitch;
}
}
commit e501aa667699787daf7dc0dfd22c397a785564ce
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Thu Mar 27 21:57:39 2014 +0000
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 <chris at chris-wilson.co.uk>
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 0748758..5ed6d21 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;
}
More information about the xorg-commit
mailing list