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

Chris Wilson ickle at kemper.freedesktop.org
Sat Jul 20 14:04:43 PDT 2013


 src/sna/sna_composite.c |   90 ++++++++++++++++++++++++++----------------------
 1 file changed, 50 insertions(+), 40 deletions(-)

New commits:
commit 2c78403cb56841f342692b97bb53e995c3ff6b9f
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Jul 20 21:55:16 2013 +0100

    sna: Remember to apply drawable offsets for composite memcpy
    
    Yet another missing chunk from
    commit 6921abd81017c9ed7f3b2413784068fbc609a0ea
    Author: Chris Wilson <chris at chris-wilson.co.uk>
    Date:   Thu Jul 18 16:21:27 2013 +0100
    
        sna: Add a fast path for the most common fallback for CPU-CPU blits
    
    I had the composite offsets, but not the normal window offsets!
    
    Reported-by: F.Brown <francisbrwn9 at gmail.com>
    Reported-by: Jiri Slaby <jirislaby at gmail.com>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67124
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67064
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_composite.c b/src/sna/sna_composite.c
index 38f1219..f293807 100644
--- a/src/sna/sna_composite.c
+++ b/src/sna/sna_composite.c
@@ -526,49 +526,59 @@ sna_composite_fb(CARD8 op,
 	    src->filter != PictFilterConvolution &&
 	    (op == PictOpSrc || (op == PictOpOver && !PICT_FORMAT_A(src->format))) &&
 	    (dst->format == src->format || dst->format == alphaless(src->format)) &&
-	    sna_transform_is_integer_translation(src->transform, &tx, &ty) &&
-	    region->extents.x1 + src_x + tx >= 0 &&
-	    region->extents.y1 + src_y + ty >= 0 &&
-	    region->extents.x2 + src_x + tx <= src->pDrawable->width &&
-	    region->extents.y2 + src_y + ty <= src->pDrawable->height) {
+	    sna_transform_is_integer_translation(src->transform, &tx, &ty)) {
 		PixmapPtr dst_pixmap = get_drawable_pixmap(dst->pDrawable);
 		PixmapPtr src_pixmap = get_drawable_pixmap(src->pDrawable);
-		int nbox = RegionNumRects(region);
-		BoxPtr box = RegionRects(region);
-
-		src_x += tx; src_y += ty;
-
-		if (get_drawable_deltas(src->pDrawable, src_pixmap, &tx, &ty))
-			src_x += tx, src_y += ty;
-
-		if (get_drawable_deltas(dst->pDrawable, dst_pixmap, &tx, &ty))
-			dst_x += tx, dst_y += ty;
-
-		do {
-			assert(box->x1 + src_x >= 0);
-			assert(box->x2 + src_x <= src_pixmap->drawable.width);
-			assert(box->y1 + src_y >= 0);
-			assert(box->y2 + src_y <= src_pixmap->drawable.height);
-
-			assert(box->x1 + dst_x >= 0);
-			assert(box->x2 + dst_x <= dst_pixmap->drawable.width);
-			assert(box->y1 + dst_y >= 0);
-			assert(box->y2 + dst_y <= dst_pixmap->drawable.height);
-
-			assert(box->x2 > box->x1 && box->y2 > box->y1);
-
-			memcpy_blt(src_pixmap->devPrivate.ptr,
-				   dst_pixmap->devPrivate.ptr,
-				   dst_pixmap->drawable.bitsPerPixel,
-				   src_pixmap->devKind,
-				   dst_pixmap->devKind,
-				   box->x1 + src_x, box->y1 + src_y,
-				   box->x1 + dst_x, box->y1 + dst_y,
-				   box->x2 - box->x1, box->y2 - box->y1);
-			box++;
-		} while (--nbox);
+		int16_t sx = src_x + tx, sy = src_y + ty;
+		if (region->extents.x1 + sx >= 0 &&
+		    region->extents.y1 + sy >= 0 &&
+		    region->extents.x2 + sx <= src->pDrawable->width &&
+		    region->extents.y2 + sy <= src->pDrawable->height) {
+			BoxPtr box = RegionRects(region);
+			int nbox = RegionNumRects(region);
+
+			sx += src->pDrawable->x;
+			sy += src->pDrawable->y;
+			if (get_drawable_deltas(src->pDrawable, src_pixmap, &tx, &ty))
+				sx += tx, sy += ty;
+
+			assert(region->extents.x1 + sx >= 0);
+			assert(region->extents.x2 + sx <= src_pixmap->drawable.width);
+			assert(region->extents.y1 + sy >= 0);
+			assert(region->extents.y2 + sy <= src_pixmap->drawable.height);
+
+			dst_x += dst->pDrawable->x;
+			dst_y += dst->pDrawable->y;
+			if (get_drawable_deltas(dst->pDrawable, dst_pixmap, &tx, &ty))
+				dst_x += tx, dst_y += ty;
+
+			assert(nbox);
+			do {
+				assert(box->x1 + sx >= 0);
+				assert(box->x2 + sx <= src_pixmap->drawable.width);
+				assert(box->y1 + sy >= 0);
+				assert(box->y2 + sy <= src_pixmap->drawable.height);
+
+				assert(box->x1 + dst_x >= 0);
+				assert(box->x2 + dst_x <= dst_pixmap->drawable.width);
+				assert(box->y1 + dst_y >= 0);
+				assert(box->y2 + dst_y <= dst_pixmap->drawable.height);
+
+				assert(box->x2 > box->x1 && box->y2 > box->y1);
+
+				memcpy_blt(src_pixmap->devPrivate.ptr,
+					   dst_pixmap->devPrivate.ptr,
+					   dst_pixmap->drawable.bitsPerPixel,
+					   src_pixmap->devKind,
+					   dst_pixmap->devKind,
+					   box->x1 + sx, box->y1 + sy,
+					   box->x1 + dst_x, box->y1 + dst_y,
+					   box->x2 - box->x1, box->y2 - box->y1);
+				box++;
+			} while (--nbox);
 
-		return;
+			return;
+		}
 	}
 
 	src_image = image_from_pict(src, FALSE, &src_xoff, &src_yoff);


More information about the xorg-commit mailing list