[PATCH 6/7] etnaviv: apply non-alpha workaround for reduced masks

Russell King rmk at armlinux.org.uk
Tue Nov 22 12:17:01 UTC 2016


On Tue, Nov 22, 2016 at 12:44:19PM +0100, Lucas Stach wrote:
> If accel_reduce_mask() succeeded in replacing the mask by constant
> alpha the source format still needs to be switched to an alpha one
> to get correct swizzles. We only want to avoid clobbering the alpha
> mode setup done by accel_reduce_mask().

Definitely not.  You're correct that the test order is important, and
the test order is intentionally the way it is, so that
etnaviv_accel_reduce_mask() works.

The effect that your patch will have is to corrupt all the state which
etnaviv_accel_reduce_mask() has computed to effect the combining of the
constant A8 mask with the source - overriding its alpha with a constant
255.

NAK.

> 
> Signed-off-by: Lucas Stach <l.stach at pengutronix.de>
> ---
>  etnaviv/etnaviv_render.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/etnaviv/etnaviv_render.c b/etnaviv/etnaviv_render.c
> index 1ab10aa54348..e736a3cde7cc 100644
> --- a/etnaviv/etnaviv_render.c
> +++ b/etnaviv/etnaviv_render.c
> @@ -567,10 +567,13 @@ static int etnaviv_accel_composite_srconly(PicturePtr pSrc, PicturePtr pDst,
>  
>  	/*
>  	 * Apply the same work-around for a non-alpha source as for
> -	 * a non-alpha destination.
> +	 * a non-alpha destination. The test order is important here: we always need
> +	 * to switch to the alpha format to get correct swizzle, but we don't want
> +	 * to adjust the alpha mode if it's already set up to something other than
> +	 * normal mode.
>  	 */
> -	if (etnaviv_blend_src_alpha_normal(final_blend) &&
> -	    etnaviv_workaround_nonalpha(vSrc)) {
> +	if (etnaviv_workaround_nonalpha(vSrc) &&
> +		etnaviv_blend_src_alpha_normal(final_blend)) {
>  		final_blend->alpha_mode |= VIVS_DE_ALPHA_MODES_GLOBAL_SRC_ALPHA_MODE_GLOBAL;
>  		final_blend->src_alpha = 255;
>  	}
> -- 
> 2.10.2
> 

-- 
Russell King


More information about the etnaviv mailing list