summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell King <rmk@armlinux.org.uk>2016-11-22 16:42:22 +0000
committerRussell King <rmk@armlinux.org.uk>2016-11-22 22:01:22 +0000
commitac0ee0fe3bc6176623dd778bbfe2157107b04cb3 (patch)
tree639e04b8cc88bf05ff0047c1ae5924b2a6175006
parent53e70fcf904a2d5c4714383dedf4844cb634eca6 (diff)
etnaviv: fix non-alpha mask composite operations
The composite operation is defined to be: (src IN mask) OP dst The IN operation is: Fa = A(mask), Fb = 0, which gives an equation of: C = C(src) * A(mask) + C(mask) * 0 When the mask has no alpha channel, A(mask) is defined to be 1.0, so this becomes: C = C(src) meaning that the resulting composite operation becomes: src OP dst We can make use of the more efficient etnaviv_accel_composite_srconly() path to perform this operation as it has no dependency on the mask. This fixes this rendercheck failure on GC600: Src composite test error of 255.0000 at (1, 0) -- R G B A got: 0.000 0.000 0.000 0.000 expected: 1.000 1.000 1.000 1.000 src color: 1.00 1.00 1.00 1.00 msk color: 1.00 1.00 1.00 1.00 dst color: 1.00 1.00 1.00 1.00 src: 1x1R a8r8g8b8, mask: 10x10 x8r8g8b8, dst: a8r8g8b8 and this failure on GC320: Src composite test error of 255.0000 at (1, 3) -- R G B A got: 0.000 0.000 0.000 0.000 expected: 1.000 1.000 1.000 1.000 src color: 1.00 1.00 1.00 1.00 msk color: 1.00 1.00 1.00 1.00 dst color: 1.00 1.00 1.00 1.00 src: 10x10 x8r8g8b8, mask: 10x10 x8r8g8b8, dst: a8r8g8b8 Signed-off-by: Russell King <rmk@armlinux.org.uk>
-rw-r--r--etnaviv/etnaviv_render.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/etnaviv/etnaviv_render.c b/etnaviv/etnaviv_render.c
index 0fb3ac9..ffefc12 100644
--- a/etnaviv/etnaviv_render.c
+++ b/etnaviv/etnaviv_render.c
@@ -745,6 +745,13 @@ static Bool etnaviv_accel_reduce_mask(struct etnaviv_blend_op *final_blend,
uint32_t colour;
/*
+ * If the mask has no alpha, then the alpha channel is treated
+ * as constant 1.0. This makes the IN operation redundant.
+ */
+ if (!PICT_FORMAT_A(pMask->format) && !pMask->componentAlpha)
+ return TRUE;
+
+ /*
* A PictOpOver with a mask looks like this:
*
* dst.A = src.A * mask.A + dst.A * (1 - src.A * mask.A)