diff options
author | Russell King <rmk@armlinux.org.uk> | 2016-11-27 15:08:23 +0000 |
---|---|---|
committer | Russell King <rmk@armlinux.org.uk> | 2016-11-27 15:08:23 +0000 |
commit | 89ea230ed870c7f9a7d2a20ec74394dc96fc9acf (patch) | |
tree | 09fec33cc677ac25c6185c8328531d794ce070fc | |
parent | a8725dd61e04896c2ddb3e77b2b5feb0ed45bc0d (diff) |
etnaviv: move destination alpha workaround away from global alpha subsitution
Make the code slightly simpler by changing the non-alpha destination
workaround to subsitute a constant value blend mode rather than one
which depends on the destination alpha. This means there's no
possibility of the alpha subsitution causing conflicts.
Signed-off-by: Russell King <rmk@armlinux.org.uk>
-rw-r--r-- | etnaviv/etnaviv_render.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/etnaviv/etnaviv_render.c b/etnaviv/etnaviv_render.c index cc410ea..c4f87cd 100644 --- a/etnaviv/etnaviv_render.c +++ b/etnaviv/etnaviv_render.c @@ -830,6 +830,7 @@ static Bool etnaviv_accel_reduce_mask(struct etnaviv_composite_state *state, * Fa = Ad but we need Fa = mask.A * dst.A, so replace the * destination alpha with a scaled version. However, we can * only do this on non-alpha destinations, hence Fa = mask.A. + * Note: non-alpha destinations should never see NORMAL here. */ case DE_BLENDMODE_ONE: /* @@ -853,6 +854,7 @@ static Bool etnaviv_accel_reduce_mask(struct etnaviv_composite_state *state, /* * Fa = mask.A * (1 - dst.A) supportable for non-alpha * destinations as dst.A is defined as 1.0, making Fa = 0. + * Note: non-alpha destinations should never see INVERSED here. */ if (PICT_FORMAT_A(pDst->format)) return FALSE; @@ -957,13 +959,20 @@ static int etnaviv_accel_Composite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, if (etnaviv_workaround_nonalpha(&state.dst.format) && op != PictOpClear) { /* - * Destination alpha channel subsitution - this needs - * to happen before we modify the final blend for any - * optimisations, which may change the destination alpha - * value, such as in etnaviv_accel_reduce_mask(). + * When the destination does not have an alpha channel, we + * need to provide an alpha value of 1.0, and the computed + * alpha is irrelevant. Replace source modes which depend + * on destination alpha with their corresponding constant + * value modes, rather than using global alpha subsitution. */ - state.final_blend.alpha_mode |= VIVS_DE_ALPHA_MODES_GLOBAL_DST_ALPHA_MODE_GLOBAL; - state.final_blend.dst_alpha = 255; + switch (state.final_blend.src_mode) { + case DE_BLENDMODE_NORMAL: + state.final_blend.src_mode = DE_BLENDMODE_ONE; + break; + case DE_BLENDMODE_INVERSED: + state.final_blend.src_mode = DE_BLENDMODE_ZERO; + break; + } /* * PE1.0 hardware contains a bug with non-A8* destinations. |