[PATCH 7/7] etnaviv: get mask drawable offset before applying offset

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


Otherwise the offset will be lost, as etnaviv_drawable_offset()
overwrites whatever is passed in.

Signed-off-by: Lucas Stach <l.stach at pengutronix.de>
---
 etnaviv/etnaviv_render.c | 31 +++++++++++++------------------
 1 file changed, 13 insertions(+), 18 deletions(-)

diff --git a/etnaviv/etnaviv_render.c b/etnaviv/etnaviv_render.c
index e736a3cde7cc..ee94e166c954 100644
--- a/etnaviv/etnaviv_render.c
+++ b/etnaviv/etnaviv_render.c
@@ -612,8 +612,6 @@ static int etnaviv_accel_composite_masked(PicturePtr pSrc, PicturePtr pMask,
 
 	src_topleft.x = xSrc;
 	src_topleft.y = ySrc;
-	mask_offset.x = xMask;
-	mask_offset.y = yMask;
 
 	/* Include the destination drawable's position on the pixmap */
 	xDst += pDst->pDrawable->x;
@@ -663,31 +661,28 @@ static int etnaviv_accel_composite_masked(PicturePtr pSrc, PicturePtr pMask,
 		if (!transform_is_integer_translation(pMask->transform, &tx, &ty))
 			goto fallback;
 
-		mask_offset.x += tx;
-		mask_offset.y += ty;
-
 		/* We don't handle mask repeats (yet) */
-		if (picture_needs_repeat(pMask, mask_offset.x, mask_offset.y,
+		if (picture_needs_repeat(pMask, tx + xMask, ty + yMask,
 					 clip_temp.x2, clip_temp.y2))
 			goto fallback;
 
-		mask_offset.x += pMask->pDrawable->x;
-		mask_offset.y += pMask->pDrawable->y;
+		/*
+		 * Check whether the mask has a etna bo backing it.  If not,
+		 * fallback to software for the mask operation.
+		 */
+		vMask = etnaviv_drawable_offset(pMask->pDrawable, &mask_offset);
+		if (!vMask)
+			goto fallback;
+
+		mask_offset.x += pMask->pDrawable->x + tx + xMask;
+		mask_offset.y += pMask->pDrawable->y + ty + yMask;
+
+		etnaviv_set_format(vMask, pMask);
 	} else {
 		goto fallback;
 	}
 
 	/*
-	 * Check whether the mask has a etna bo backing it.  If not,
-	 * fallback to software for the mask operation.
-	 */
-	vMask = etnaviv_drawable_offset(pMask->pDrawable, &mask_offset);
-	if (!vMask)
-		goto fallback;
-
-	etnaviv_set_format(vMask, pMask);
-
-	/*
 	 * Get the source.  The source image will be described by vSrc with
 	 * origin src_topleft.  This will always be the temporary image,
 	 * which will always have alpha - which is required for the final
-- 
2.10.2



More information about the etnaviv mailing list