xf86-video-intel: src/sna/sna_blt.c src/sna/sna_tiling.c

Chris Wilson ickle at kemper.freedesktop.org
Mon Nov 4 14:56:48 CET 2013


 src/sna/sna_blt.c    |    8 +++++---
 src/sna/sna_tiling.c |    3 +--
 2 files changed, 6 insertions(+), 5 deletions(-)

New commits:
commit 8f6e227ba8127a2ca034271f2a660c24abbe056f
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Nov 4 12:57:01 2013 +0000

    sna: Apply the BLT source offset for individual copies
    
    Following a complex path through multiple layers of indirections and
    tiling fallbacks, resulted in hitting a path where the source offset was
    subsequently ignored. This leads to the operation reading from invalid
    memory (or hitting the assert warning about the same).
    
    References: https://bugs.freedesktop.org/show_bug.cgi?id=70924
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_blt.c b/src/sna/sna_blt.c
index f5abeff..b4f7d0e 100644
--- a/src/sna/sna_blt.c
+++ b/src/sna/sna_blt.c
@@ -1379,8 +1379,8 @@ blt_composite_copy(struct sna *sna,
 	x2 = x1 + r->width;
 	y2 = y1 + r->height;
 
-	src_x = r->src.x - x1;
-	src_y = r->src.y - y1;
+	src_x = r->src.x - x1 + op->u.blt.sx;
+	src_y = r->src.y - y1 + op->u.blt.sy;
 
 	/* clip against dst */
 	if (x1 < 0)
@@ -1799,6 +1799,7 @@ prepare_blt_copy(struct sna *sna,
 	assert(kgem_bo_can_blt(&sna->kgem, op->dst.bo));
 	assert(kgem_bo_can_blt(&sna->kgem, bo));
 
+	kgem_set_mode(&sna->kgem, KGEM_BLT, op->dst.bo);
 	if (!kgem_check_many_bo_fenced(&sna->kgem, op->dst.bo, bo, NULL)) {
 		kgem_submit(&sna->kgem);
 		if (!kgem_check_many_bo_fenced(&sna->kgem,
@@ -2675,6 +2676,7 @@ sna_blt_composite__convert(struct sna *sna,
 			return false;
 	}
 
+	kgem_set_mode(&sna->kgem, KGEM_BLT, tmp->dst.bo);
 	if (!kgem_check_many_bo_fenced(&sna->kgem, tmp->dst.bo, tmp->src.bo, NULL)) {
 		kgem_submit(&sna->kgem);
 		if (!kgem_check_many_bo_fenced(&sna->kgem,
@@ -2687,7 +2689,7 @@ sna_blt_composite__convert(struct sna *sna,
 
 	DBG(("%s: blt dst offset (%d, %d), source offset (%d, %d), with alpha fixup? %x\n",
 	     __FUNCTION__,
-	     tmp->dst.x, tmp->dst.y, tmp->u.blt.sx, tmp->u.blt.sy, alpha_fixup));
+	     tmp->dst.x, tmp->dst.y, sx, sy, alpha_fixup));
 
 	tmp->u.blt.src_pixmap = NULL;
 	tmp->u.blt.sx = sx;
diff --git a/src/sna/sna_tiling.c b/src/sna/sna_tiling.c
index feb80dc..3bbcec7 100644
--- a/src/sna/sna_tiling.c
+++ b/src/sna/sna_tiling.c
@@ -162,14 +162,13 @@ sna_tiling_composite_done(struct sna *sna,
 			int width = step;
 			if (x + width > tile->width)
 				width = tile->width - x;
-			memset(&tmp, 0, sizeof(tmp));
 			if (sna->render.composite(sna, tile->op,
 						  tile->src, tile->mask, tile->dst,
 						  tile->src_x + x,  tile->src_y + y,
 						  tile->mask_x + x, tile->mask_y + y,
 						  tile->dst_x + x,  tile->dst_y + y,
 						  width, height,
-						  &tmp)) {
+						  memset(&tmp, 0, sizeof(tmp)))) {
 				for (n = 0; n < tile->rect_count; n++) {
 					const struct sna_composite_rectangles *r = &tile->rects[n];
 					int x1, x2, dx, y1, y2, dy;


More information about the xorg-commit mailing list