xf86-video-intel: 2 commits - src/sna/sna_accel.c src/sna/sna.h

Chris Wilson ickle at kemper.freedesktop.org
Wed Jan 4 09:38:06 PST 2012


 src/sna/sna.h       |    5 +++
 src/sna/sna_accel.c |   79 +++++++++++++++++++++++++++++++++++++++++++++-------
 2 files changed, 74 insertions(+), 10 deletions(-)

New commits:
commit 89739b711f42c3dbed7d3f4e6da0cdd61a5205ae
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jan 4 17:41:16 2012 +0000

    sna: Expand small stipples into 8x8 patterns
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna.h b/src/sna/sna.h
index 32288ca..b4d109c 100644
--- a/src/sna/sna.h
+++ b/src/sna/sna.h
@@ -703,4 +703,9 @@ memcpy_blt(const void *src, void *dst, int bpp,
 #define SNA_CREATE_FB 0x10
 #define SNA_CREATE_SCRATCH 0x11
 
+inline static bool is_power_of_two(unsigned x)
+{
+	return (x & (x-1)) == 0;
+}
+
 #endif /* _SNA_H */
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index ea178f3..da13efa 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -7008,6 +7008,58 @@ sna_poly_fill_rect_stippled_8x8_blt(DrawablePtr drawable,
 }
 
 static bool
+sna_poly_fill_rect_stippled_nxm_blt(DrawablePtr drawable,
+				    struct kgem_bo *bo,
+				    struct sna_damage **damage,
+				    GCPtr gc, int n, xRectangle *r,
+				    const BoxRec *extents, unsigned clipped)
+{
+	PixmapPtr scratch, stipple;
+	uint8_t bytes[8], *dst = bytes;
+	const uint8_t *src, *end;
+	int j, stride;
+	bool ret;
+
+	DBG(("%s: expanding %dx%d stipple to 8x8\n",
+	     __FUNCTION__,
+	     gc->stipple->drawable.width,
+	     gc->stipple->drawable.height));
+
+	scratch = GetScratchPixmapHeader(drawable->pScreen,
+					 8, 8, 1, 1, 1, bytes);
+	if (scratch == NullPixmap)
+		return false;
+
+	stipple = gc->stipple;
+	gc->stipple = scratch;
+
+	stride = stipple->devKind;
+	src = stipple->devPrivate.ptr;
+	end = src + stride * stipple->drawable.height;
+	for(j = 0; j < 8; j++) {
+		switch (stipple->drawable.width) {
+		case 1: *dst = (*src & 1) * 0xff; break;
+		case 2: *dst = (*src & 3) * 0x55; break;
+		case 4: *dst = (*src & 15) * 0x11; break;
+		case 8: *dst = *src; break;
+		default: assert(0); break;
+		}
+		dst++;
+		src += stride;
+		if (src == end)
+			src = stipple->devPrivate.ptr;
+	}
+
+	ret = sna_poly_fill_rect_stippled_8x8_blt(drawable, bo, damage,
+						  gc, n, r, extents, clipped);
+
+	gc->stipple = stipple;
+	FreeScratchPixmapHeader(scratch);
+
+	return ret;
+}
+
+static bool
 sna_poly_fill_rect_stippled_1_blt(DrawablePtr drawable,
 				  struct kgem_bo *bo,
 				  struct sna_damage **damage,
@@ -7685,11 +7737,18 @@ sna_poly_fill_rect_stippled_blt(DrawablePtr drawable,
 	     extents->y2 - gc->patOrg.y - drawable->y,
 	     stipple->drawable.width, stipple->drawable.height));
 
-	if (stipple->drawable.width == 8 && stipple->drawable.height == 8)
+	if ((stipple->drawable.width | stipple->drawable.height) == 8)
 		return sna_poly_fill_rect_stippled_8x8_blt(drawable, bo, damage,
 							   gc, n, rect,
 							   extents, clipped);
 
+	if ((stipple->drawable.width | stipple->drawable.height) <= 0xc &&
+	    is_power_of_two(stipple->drawable.width) &&
+	    is_power_of_two(stipple->drawable.height))
+		return sna_poly_fill_rect_stippled_nxm_blt(drawable, bo, damage,
+							   gc, n, rect,
+							   extents, clipped);
+
 	if (extents->x2 - gc->patOrg.x - drawable->x <= stipple->drawable.width &&
 	    extents->y2 - gc->patOrg.y - drawable->y <= stipple->drawable.height) {
 		if (stipple->drawable.width <= 8 && stipple->drawable.height <= 8)
commit 878fbfe509da0a25dff8515d6d3b38ca3826466e
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jan 4 16:56:55 2012 +0000

    sna: Align tiled stipple uploads with the stipple pixmap correctly
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 43d7aa1..ea178f3 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -7474,15 +7474,15 @@ sna_poly_fill_rect_stippled_n_box(struct sna *sna,
 			bx2 = ox + (x2 - x1);
 			if (bx2 - bx1 > gc->stipple->drawable.width) {
 				bx2 = bx1 + gc->stipple->drawable.width;
-				x2 = x1 + (bx2 - bx1);
+				x2 = x1 + (bx1-ox) + gc->stipple->drawable.width;
 			}
-			bx2 = (bx2 + 7) &~7;
+			bx2 = (bx2 + 7) & ~7;
 			bw = (bx2 - bx1)/8;
 			bw = ALIGN(bw, 2);
 			bh = y2 - y1;
 
-			DBG(("%s: box(%d, %d), (%d, %d) pat=(%d, %d)\n",
-			     __FUNCTION__, x1, y1, x2, y2, ox, oy));
+			DBG(("%s: box(%d, %d), (%d, %d) pat=(%d, %d), up=(%d, %d)\n",
+			     __FUNCTION__, x1, y1, x2, y2, ox, oy, bx1, bx2));
 
 			len = bw*bh;
 			len = ALIGN(len, 8) / 4;
@@ -7494,8 +7494,7 @@ sna_poly_fill_rect_stippled_n_box(struct sna *sna,
 			}
 
 			b = sna->kgem.batch + sna->kgem.nbatch;
-			b[0] = XY_MONO_SRC_COPY_IMM | (5 + len) | br00;
-			b[0] |= (ox & 7) << 17;
+			b[0] = br00 | (5 + len) | (ox & 7) << 17;
 			b[1] = br13;
 			b[2] = y1 << 16 | x1;
 			b[3] = y2 << 16 | x2;
@@ -7541,10 +7540,11 @@ sna_poly_fill_rect_stippled_n_blt(DrawablePtr drawable,
 	int16_t dx, dy;
 	uint32_t br00, br13;
 
-	DBG(("%s: upload (%d, %d), (%d, %d), origin (%d, %d)\n", __FUNCTION__,
+	DBG(("%s: upload (%d, %d), (%d, %d), origin (%d, %d), clipped=%d\n", __FUNCTION__,
 	     extents->x1, extents->y1,
 	     extents->x2, extents->y2,
-	     origin.x, origin.y));
+	     origin.x, origin.y,
+	     clipped));
 
 	if (gc->stipple->drawable.width > 32 ||
 	    gc->stipple->drawable.height > 32)
@@ -7553,7 +7553,7 @@ sna_poly_fill_rect_stippled_n_blt(DrawablePtr drawable,
 	get_drawable_deltas(drawable, pixmap, &dx, &dy);
 	kgem_set_mode(&sna->kgem, KGEM_BLT);
 
-	br00 = 3 << 20;
+	br00 = XY_MONO_SRC_COPY_IMM | 3 << 20;
 	br13 = bo->pitch;
 	if (sna->kgem.gen >= 40) {
 		if (bo->tiling)


More information about the xorg-commit mailing list