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.
This commit is contained in:
Zhenyu Wang 2007-08-28 21:56:21 +08:00
parent 3411eb0dba
commit 0fdbf64b34
1 changed files with 11 additions and 0 deletions

View File

@ -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.