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

Lucas Stach l.stach at pengutronix.de
Tue Nov 22 11:44:19 UTC 2016


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().

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



More information about the etnaviv mailing list