summaryrefslogtreecommitdiff
path: root/uxa
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2009-11-13 19:35:23 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2009-11-13 20:20:52 +0000
commitc180baf43b8a0e407448018f3a7e42491cf974ae (patch)
treed9eb5d6fe15d123de83643b84fa08dfb849f6413 /uxa
parente9064eacb0ad8867e320597453facbb3c376522c (diff)
i915: Derive the correct target color from the pixmap by checking its format
Particularly noting to route alpha to the green channel when blending with a8 destinations. Fixes: rendercheck/repeat/triangles regressed http://bugs.freedesktop.org/show_bug.cgi?id=25047 introduced with commit 14109a. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'uxa')
-rw-r--r--uxa/uxa-render.c33
-rw-r--r--uxa/uxa.h6
2 files changed, 28 insertions, 11 deletions
diff --git a/uxa/uxa-render.c b/uxa/uxa-render.c
index 79017b5e..abd0bf5a 100644
--- a/uxa/uxa-render.c
+++ b/uxa/uxa-render.c
@@ -230,6 +230,27 @@ uxa_get_rgba_from_pixel(CARD32 pixel,
return TRUE;
}
+int
+uxa_get_color_for_pixmap (PixmapPtr pixmap,
+ CARD32 src_format,
+ CARD32 dst_format,
+ CARD32 *pixel)
+{
+ CARD16 red, green, blue, alpha;
+
+ *pixel = uxa_get_pixmap_first_pixel(pixmap);
+
+ if (!uxa_get_rgba_from_pixel(*pixel, &red, &green, &blue, &alpha,
+ src_format))
+ return 0;
+
+ if (!uxa_get_pixel_from_rgba(pixel, red, green, blue, alpha,
+ dst_format))
+ return 0;
+
+ return 1;
+}
+
static int
uxa_try_driver_solid_fill(PicturePtr pSrc,
PicturePtr pDst,
@@ -244,7 +265,6 @@ uxa_try_driver_solid_fill(PicturePtr pSrc,
int dst_off_x, dst_off_y;
PixmapPtr pSrcPix, pDstPix;
CARD32 pixel;
- CARD16 red, green, blue, alpha;
pDstPix = uxa_get_drawable_pixmap(pDst->pDrawable);
pSrcPix = uxa_get_drawable_pixmap(pSrc->pDrawable);
@@ -264,21 +284,12 @@ uxa_try_driver_solid_fill(PicturePtr pSrc,
REGION_TRANSLATE(pScreen, &region, dst_off_x, dst_off_y);
- pixel = uxa_get_pixmap_first_pixel(pSrcPix);
-
if (!uxa_pixmap_is_offscreen(pDstPix)) {
REGION_UNINIT(pDst->pDrawable->pScreen, &region);
return 0;
}
- if (!uxa_get_rgba_from_pixel(pixel, &red, &green, &blue, &alpha,
- pSrc->format)) {
- REGION_UNINIT(pDst->pDrawable->pScreen, &region);
- return -1;
- }
-
- if (!uxa_get_pixel_from_rgba(&pixel, red, green, blue, alpha,
- pDst->format)) {
+ if (! uxa_get_color_for_pixmap (pSrcPix, pSrc->format, pDst->format, &pixel)) {
REGION_UNINIT(pDst->pDrawable->pScreen, &region);
return -1;
}
diff --git a/uxa/uxa.h b/uxa/uxa.h
index b1f3737a..c7e5566a 100644
--- a/uxa/uxa.h
+++ b/uxa/uxa.h
@@ -521,6 +521,12 @@ void uxa_driver_fini(ScreenPtr pScreen);
CARD32 uxa_get_pixmap_first_pixel(PixmapPtr pPixmap);
+Bool
+uxa_get_color_for_pixmap (PixmapPtr pixmap,
+ CARD32 src_format,
+ CARD32 dst_format,
+ CARD32 *pixel);
+
void uxa_set_fallback_debug(ScreenPtr screen, Bool enable);
/**