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

Chris Wilson ickle at kemper.freedesktop.org
Sat Jan 21 12:02:45 PST 2012


 src/sna/sna_blt.c |   19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

New commits:
commit dd079dd1f64e7832c6343c24958aa9eeb2f58789
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Jan 21 19:38:40 2012 +0000

    sna: Check the blt composite op is within the source bounds
    
    If we attempt to read from a drawable that is partially off its backing
    pixmap (such as a partially offscreen composite window) we need to fixup
    the read from the out-of-bounds regions to return clear. Since we don't,
    the easier answer is to just to switch to the render pipeline for such
    an operation.
    
    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 6607b11..86cc311 100644
--- a/src/sna/sna_blt.c
+++ b/src/sna/sna_blt.c
@@ -1667,12 +1667,13 @@ sna_blt_composite(struct sna *sna,
 		return FALSE;
 	}
 
-	/* XXX tiling? */
+	/* XXX tiling? fixup extend none? */
 	if (x < 0 || y < 0 ||
 	    x + width > src->pDrawable->width ||
 	    y + height > src->pDrawable->height) {
-		DBG(("%s: source extends outside of valid area\n",
-		     __FUNCTION__));
+		DBG(("%s: source extends outside (%d, %d), (%d, %d) of valid drawable %dx%d\n",
+		     __FUNCTION__,
+		     x, y, x+width, y+width, src->pDrawable->width, src->pDrawable->height));
 		return FALSE;
 	}
 
@@ -1680,10 +1681,14 @@ sna_blt_composite(struct sna *sna,
 	get_drawable_deltas(src->pDrawable, blt->src_pixmap, &tx, &ty);
 	x += tx + src->pDrawable->x;
 	y += ty + src->pDrawable->y;
-	assert(x >= 0);
-	assert(y >= 0);
-	assert(x + width <= blt->src_pixmap->drawable.width);
-	assert(y + height <= blt->src_pixmap->drawable.height);
+	if (x < 0 || y < 0 ||
+	    x + width > blt->src_pixmap->drawable.width ||
+	    y + height > blt->src_pixmap->drawable.height) {
+		DBG(("%s: source extends outside (%d, %d), (%d, %d) of valid pixmap %dx%d\n",
+		     __FUNCTION__,
+		     x, y, x+width, y+width, blt->src_pixmap->drawable.width, blt->src_pixmap->drawable.height));
+		return FALSE;
+	}
 
 	tmp->u.blt.sx = x - dst_x;
 	tmp->u.blt.sy = y - dst_y;


More information about the xorg-commit mailing list