summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhenyu Wang <zhenyu.z.wang@intel.com>2007-08-28 21:56:21 +0800
committerZhenyu Wang <zhenyu.z.wang@intel.com>2007-08-28 21:57:06 +0800
commit0fdbf64b34e4114c2b89d696b268b9c7464f1efd (patch)
tree77f8ff74104aad11b003033ed383941ca7655989
parent3411eb0dbae470b910af3116a4ab960c821b9b20 (diff)
downloadxorg-driver-xf86-video-intel-0fdbf64b34e4114c2b89d696b268b9c7464f1efd.tar.gz
Fix i915 a8 color buffer blending
From spec, i915 engine uses green channel when reading from 8bit color buffer for blending, and also writes back green channel. Fix blend factor in dest alpha case by using dest color instead. Now rendercheck can pass a8 tests.
-rw-r--r--src/i915_render.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/i915_render.c b/src/i915_render.c
index 7546dfd7..ca85bf73 100644
--- a/src/i915_render.c
+++ b/src/i915_render.c
@@ -123,6 +123,17 @@ static CARD32 i915_get_blend_cntl(int op, PicturePtr pMask, CARD32 dst_format)
sblend = BLENDFACT_ZERO;
}
+ /* i915 engine reads 8bit color buffer into green channel in cases
+ like color buffer blending .etc, and also writes back green channel.
+ So with dst_alpha blend we should use color factor. See spec on
+ "8-bit rendering" */
+ if ((dst_format == PICT_a8) && i915_blend_op[op].dst_alpha) {
+ if (sblend == BLENDFACT_DST_ALPHA)
+ sblend = BLENDFACT_DST_COLR;
+ else if (sblend == BLENDFACT_INV_DST_ALPHA)
+ sblend = BLENDFACT_INV_DST_COLR;
+ }
+
/* If the source alpha is being used, then we should only be in a case
* where the source blend factor is 0, and the source blend value is the
* mask channels multiplied by the source picture's alpha.