xf86-video-intel: 2 commits - uxa/uxa-render.c
Chris Wilson
ickle at kemper.freedesktop.org
Mon Jan 25 07:51:22 PST 2010
uxa/uxa-render.c | 72 ++++++++++++++++++++++++++++++++-----------------------
1 file changed, 43 insertions(+), 29 deletions(-)
New commits:
commit 197cb08a2d54cabbfe97454d7db85cfe1f5f27ba
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Mon Jan 25 15:15:04 2010 +0000
Extract pixel value for all formats to avoid hitting fallbacks.
On failing to extract the pixel value for an alpha-only solid we
actually triggered a fallback. Since this path is commonly hitting
whilst fading in images, for example cairo_paint_with_alpha(), the
fallback was detected during the Moblin boot sequence where it was
adding a second to the overall boot time.
See
fallback intel: Moblin startup is hitting a composite fallback, costing
a ton of performance
https://bugs.freedesktop.org/show_bug.cgi?id=26189
Based on the initial patch by Arjan van de Van.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/uxa/uxa-render.c b/uxa/uxa-render.c
index 826602b..512ac02 100644
--- a/uxa/uxa-render.c
+++ b/uxa/uxa-render.c
@@ -146,11 +146,6 @@ uxa_get_pixel_from_rgba(CARD32 * pixel,
int rbits, bbits, gbits, abits;
int rshift, bshift, gshift, ashift;
- *pixel = 0;
-
- if (!PICT_FORMAT_COLOR(format))
- return FALSE;
-
rbits = PICT_FORMAT_R(format);
gbits = PICT_FORMAT_G(format);
bbits = PICT_FORMAT_B(format);
@@ -158,6 +153,14 @@ uxa_get_pixel_from_rgba(CARD32 * pixel,
if (abits == 0)
abits = PICT_FORMAT_BPP(format) - (rbits+gbits+bbits);
+ if (PICT_FORMAT_TYPE(format) == PICT_TYPE_A) {
+ *pixel = alpha >> (16 - abits);
+ return TRUE;
+ }
+
+ if (!PICT_FORMAT_COLOR(format))
+ return FALSE;
+
if (PICT_FORMAT_TYPE(format) == PICT_TYPE_ARGB) {
bshift = 0;
gshift = bbits;
@@ -170,6 +173,7 @@ uxa_get_pixel_from_rgba(CARD32 * pixel,
ashift = bshift + bbits;
}
+ *pixel = 0;
*pixel |= (blue >> (16 - bbits)) << bshift;
*pixel |= (red >> (16 - rbits)) << rshift;
*pixel |= (green >> (16 - gbits)) << gshift;
@@ -187,43 +191,53 @@ uxa_get_rgba_from_pixel(CARD32 pixel,
int rbits, bbits, gbits, abits;
int rshift, bshift, gshift, ashift;
- if (!PICT_FORMAT_COLOR(format))
- return FALSE;
-
rbits = PICT_FORMAT_R(format);
gbits = PICT_FORMAT_G(format);
bbits = PICT_FORMAT_B(format);
abits = PICT_FORMAT_A(format);
- if (PICT_FORMAT_TYPE(format) == PICT_TYPE_ARGB) {
+ if (PICT_FORMAT_TYPE(format) == PICT_TYPE_A) {
+ rshift = gshift = bshift = ashift = 0;
+ } else if (PICT_FORMAT_TYPE(format) == PICT_TYPE_ARGB) {
bshift = 0;
gshift = bbits;
rshift = gshift + gbits;
ashift = rshift + rbits;
- } else { /* PICT_TYPE_ABGR */
+ } else if (PICT_FORMAT_TYPE(format) == PICT_TYPE_ABGR) {
rshift = 0;
gshift = rbits;
bshift = gshift + gbits;
ashift = bshift + bbits;
+ } else {
+ return FALSE;
}
- *red = ((pixel >> rshift) & ((1 << rbits) - 1)) << (16 - rbits);
- while (rbits < 16) {
- *red |= *red >> rbits;
- rbits <<= 1;
- }
+ if (rbits) {
+ *red = ((pixel >> rshift) & ((1 << rbits) - 1)) << (16 - rbits);
+ while (rbits < 16) {
+ *red |= *red >> rbits;
+ rbits <<= 1;
+ }
+ } else
+ *red = 0;
- *green = ((pixel >> gshift) & ((1 << gbits) - 1)) << (16 - gbits);
- while (gbits < 16) {
- *green |= *green >> gbits;
- gbits <<= 1;
- }
+ if (gbits) {
+ *green = ((pixel >> gshift) & ((1 << gbits) - 1)) << (16 - gbits);
+ while (gbits < 16) {
+ *green |= *green >> gbits;
+ gbits <<= 1;
+ }
+ } else
+ *green = 0;
- *blue = ((pixel >> bshift) & ((1 << bbits) - 1)) << (16 - bbits);
- while (bbits < 16) {
- *blue |= *blue >> bbits;
- bbits <<= 1;
- }
+ if (bbits) {
+ *blue = ((pixel >> bshift) & ((1 << bbits) - 1)) << (16 - bbits);
+ while (bbits < 16) {
+ *blue |= *blue >> bbits;
+ bbits <<= 1;
+ }
+ } else
+ *blue = 0;
if (abits) {
*alpha =
commit 5f93d019dc6311dd16b6792ffb60dbfc45ef3d08
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Mon Jan 25 15:47:11 2010 +0000
uxa: Adjust uxa_get_color_for_pixmap to match prototype
The prototype says this function returns a Bool and not just an int, so
be pedantic and return TRUE/FALSE.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/uxa/uxa-render.c b/uxa/uxa-render.c
index bffe64f..826602b 100644
--- a/uxa/uxa-render.c
+++ b/uxa/uxa-render.c
@@ -238,7 +238,7 @@ uxa_get_rgba_from_pixel(CARD32 pixel,
return TRUE;
}
-int
+Bool
uxa_get_color_for_pixmap (PixmapPtr pixmap,
CARD32 src_format,
CARD32 dst_format,
@@ -250,13 +250,13 @@ uxa_get_color_for_pixmap (PixmapPtr pixmap,
if (!uxa_get_rgba_from_pixel(*pixel, &red, &green, &blue, &alpha,
src_format))
- return 0;
+ return FALSE;
if (!uxa_get_pixel_from_rgba(pixel, red, green, blue, alpha,
dst_format))
- return 0;
+ return FALSE;
- return 1;
+ return TRUE;
}
static int
More information about the xorg-commit
mailing list