[Intel-gfx] i915 forces the RGB source alpha to 1...
Chris Wilson
chris at chris-wilson.co.uk
Tue Nov 10 16:52:20 CET 2009
Doing so causes a bug when RENDERing as we extend surfaces with black
instead of clear. (See the various examples in the cairo test suite)
Why? Currently for xRGB we are supposed to ignore the incoming alpha, but
why don't we just set the alpha channel to 1 in doShmPutImage, for
illustration:
diff --git a/Xext/shm.c b/Xext/shm.c
index 8106c40..74a7265 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -539,6 +539,30 @@ doShmPutImage(DrawablePtr dst, GCPtr pGC,
PixmapPtr pPixmap;
if (format == ZPixmap || depth == 1) {
+ if (depth == 24) { /* force the xRGB alpha channel to a sane value */
+ pixman_image_t *src, *dst;
+
+ src = pixman_image_create_bits (PIXMAN_x8r8g8b8,
+ w, h,
+ data,
+ PixmapBytePad(w, depth));
+ dst = pixman_image_create_bits (PIXMAN_a8r8g8b8,
+ w, h,
+ data,
+ PixmapBytePad(w, depth));
+ if (src != NULL && dst != NULL) {
+ pixman_image_composite (PIXMAN_OP_SRC,
+ src, NULL, dst,
+ 0, 0, 0, 0, 0, 0,
+ w, h);
+ }
+
+ if (src != NULL)
+ pixman_image_unref (src);
+ if (dst != NULL)
+ pixman_image_unref (dst);
+ }
+
pPixmap = GetScratchPixmapHeader(dst->pScreen, w, h, depth,
BitsPerPixel(depth),
PixmapBytePad(w, depth),
-ickle
More information about the Intel-gfx
mailing list