summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell King <rmk@armlinux.org.uk>2016-11-24 09:38:24 +0000
committerRussell King <rmk@armlinux.org.uk>2016-11-24 09:38:24 +0000
commit3ef9a213f84ecacbc6b46da406a0bcf072d2cd86 (patch)
tree38c7e2865c3f3b499a532956208b4f0facd57e9e
parentee14c643bf22764d1a2949250e8851d36840c740 (diff)
etnaviv: fix blending non-ARGB8888 destination formats
The bug previously identified as RGB565 specific affects more than just that format - any destination format with a reduced number of alpha bits seems to trigger the bug. Widen the test to include all non- 8-bit alpha formats. The test for using source alpha was also wrong. Signed-off-by: Russell King <rmk@armlinux.org.uk>
-rw-r--r--etnaviv/etnaviv_render.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/etnaviv/etnaviv_render.c b/etnaviv/etnaviv_render.c
index f91438a..e95b7f5 100644
--- a/etnaviv/etnaviv_render.c
+++ b/etnaviv/etnaviv_render.c
@@ -153,14 +153,15 @@ static const struct etnaviv_blend_op etnaviv_composite_op[] = {
#undef OP
};
+/* Source alpha is used when the destination mode is not ZERO or ONE */
static Bool etnaviv_op_uses_source_alpha(struct etnaviv_blend_op *op)
{
unsigned src;
- src = op->alpha_mode & VIVS_DE_ALPHA_MODES_SRC_BLENDING_MODE__MASK;
+ src = op->alpha_mode & VIVS_DE_ALPHA_MODES_DST_BLENDING_MODE__MASK;
- if (src == VIVS_DE_ALPHA_MODES_SRC_BLENDING_MODE(DE_BLENDMODE_ZERO) ||
- src == VIVS_DE_ALPHA_MODES_SRC_BLENDING_MODE(DE_BLENDMODE_ONE))
+ if (src == VIVS_DE_ALPHA_MODES_DST_BLENDING_MODE(DE_BLENDMODE_ZERO) ||
+ src == VIVS_DE_ALPHA_MODES_DST_BLENDING_MODE(DE_BLENDMODE_ONE))
return FALSE;
return TRUE;
@@ -881,11 +882,15 @@ static int etnaviv_accel_Composite(CARD8 op, PicturePtr pSrc, PicturePtr pMask,
final_blend.dst_alpha = 255;
/*
- * PE1.0 hardware contains a bug with destinations
- * of RGB565, which force src.A to one.
+ * PE1.0 hardware contains a bug with non-A8* destinations.
+ * Even though Fb is sampled from the source, it limits the
+ * number of bits to that of the destination format:
+ * RGB565 forces the src.A to one.
+ * A1R5G5B5 limits src.A to the top bit.
+ * A4R4G4B4 limits src.A to the top four bits.
*/
- if (vDst->pict_format.format == DE_FORMAT_R5G6B5 &&
- !VIV_FEATURE(etnaviv->conn, chipMinorFeatures0, 2DPE20) &&
+ if (!VIV_FEATURE(etnaviv->conn, chipMinorFeatures0, 2DPE20) &&
+ vDst->pict_format.format != DE_FORMAT_A8R8G8B8 &&
etnaviv_op_uses_source_alpha(&final_blend))
return FALSE;
}