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

Russell King rmk at armlinux.org.uk
Tue Nov 22 14:59:55 UTC 2016


On Tue, Nov 22, 2016 at 12:44:20PM +0100, Lucas Stach wrote:
> Otherwise the offset will be lost, as etnaviv_drawable_offset()
> overwrites whatever is passed in.

I would much rather prefer this instead:

 etnaviv/etnaviv_render.c |   20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/etnaviv/etnaviv_render.c b/etnaviv/etnaviv_render.c
index 5e5ef99..d30c4c4 100644
--- a/etnaviv/etnaviv_render.c
+++ b/etnaviv/etnaviv_render.c
@@ -641,6 +641,7 @@ static int etnaviv_accel_composite_masked(PicturePtr pSrc, PicturePtr pMask,
 	}
 
 	if (pMask->pDrawable) {
+		xPoint mo;
 		int tx, ty;
 
 		if (!transform_is_integer_translation(pMask->transform, &tx, &ty))
@@ -656,18 +657,21 @@ static int etnaviv_accel_composite_masked(PicturePtr pSrc, PicturePtr pMask,
 
 		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, &mo);
+		if (!vMask)
+			goto fallback;
+
+		mask_offset.x += mo.x;
+		mask_offset.y += mo.y;
 	} 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);
 
 	/*

-- 
Russell King


More information about the etnaviv mailing list