summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell King <rmk@armlinux.org.uk>2016-11-25 12:49:09 +0000
committerRussell King <rmk@armlinux.org.uk>2016-11-25 12:49:09 +0000
commitc687d8f3f182bc7a0200676ef2761cb0cf66554d (patch)
tree657653f947e609fe513b3ccb4f92146918123ef7
parent700a8dce91d9305fa6adcc51e5096f9091f28de5 (diff)
etnaviv: avoid redundant opaque mask operation
If the mask is opaque, there's no point in going through the expense of using the mask for any composite operation, so bypass it entirely. Signed-off-by: Russell King <rmk@armlinux.org.uk>
-rw-r--r--etnaviv/etnaviv_render.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/etnaviv/etnaviv_render.c b/etnaviv/etnaviv_render.c
index e0c055f..dc9056b 100644
--- a/etnaviv/etnaviv_render.c
+++ b/etnaviv/etnaviv_render.c
@@ -775,6 +775,21 @@ static Bool etnaviv_accel_reduce_mask(struct etnaviv_blend_op *final_blend,
return TRUE;
/*
+ * The mask must be a solid colour for any reducing. At this
+ * point, the only thing that matters is the value of the alpha
+ * component.
+ */
+ if (!etnaviv_pict_solid_argb(pMask, &colour))
+ return FALSE;
+
+ /* Convert the colour to A8 */
+ colour >>= 24;
+
+ /* If the alpha value is 1.0, the mask has no effect. */
+ if (colour == 0xff)
+ return TRUE;
+
+ /*
* A PictOpOver with a mask looks like this:
*
* dst.A = src.A * mask.A + dst.A * (1 - src.A * mask.A)
@@ -802,14 +817,9 @@ static Bool etnaviv_accel_reduce_mask(struct etnaviv_blend_op *final_blend,
* and hence will be incorrect. Therefore, the destination
* format must not have an alpha channel.
*/
- if (op == PictOpOver &&
- !PICT_FORMAT_A(pDst->format) &&
- etnaviv_pict_solid_argb(pMask, &colour)) {
+ if (op == PictOpOver && !PICT_FORMAT_A(pDst->format)) {
uint32_t src_alpha_mode;
- /* Convert the colour to A8 */
- colour >>= 24;
-
final_blend->src_alpha =
final_blend->dst_alpha = colour;