[PATCH 4/7] etnaviv: apply non-alpha workaround to mask
Russell King
rmk at armlinux.org.uk
Tue Nov 22 16:41:15 UTC 2016
On Tue, Nov 22, 2016 at 12:44:17PM +0100, Lucas Stach wrote:
> This fixes a lot of rendercheck errors with non-alpha masks.
>
> Signed-off-by: Lucas Stach <l.stach at pengutronix.de>
> ---
> etnaviv/etnaviv_render.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/etnaviv/etnaviv_render.c b/etnaviv/etnaviv_render.c
> index d547aefe5c1e..d9feeee55c61 100644
> --- a/etnaviv/etnaviv_render.c
> +++ b/etnaviv/etnaviv_render.c
> @@ -688,6 +688,11 @@ static int etnaviv_accel_composite_masked(PicturePtr pSrc, PicturePtr pMask,
> dump_vPix(etnaviv, vMask, 1, "A-MASK%2.2x-%p", op, pMask);
> #endif
>
> + if (etnaviv_workaround_nonalpha(vMask)) {
> + mask_op.alpha_mode |= VIVS_DE_ALPHA_MODES_GLOBAL_SRC_ALPHA_MODE_GLOBAL;
> + mask_op.src_alpha = 255;
> + }
> +
Thinking more about this case, there's a possibility for a big
optimisation here.
The operation is:
(src IN mask) OP dst
The IN operation is defined as:
C = Csrc * Amask + Cmask * 0
Since Amask is a constant - 255 - the result is:
C = Csrc
So, this results in the overall operation becoming:
src OP dst
Or, in other words, a non-masked blend. So we can completely eliminate
the complexity of doing a masked blend and use the simpler
etnaviv_accel_composite_srconly().
So, I'm committing this optimisation instead of your patch.
--
Russell King
More information about the etnaviv
mailing list