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

Chris Wilson ickle at kemper.freedesktop.org
Thu May 31 14:23:49 PDT 2012


 src/sna/sna_accel.c |   78 ++++++++++++++++++++++++++++++++++------------------
 1 file changed, 51 insertions(+), 27 deletions(-)

New commits:
commit bc4323558bebd53e474fbc5404e1c41ab16d02e6
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu May 31 21:19:26 2012 +0100

    sna: Handle negative values when computing the stipple modulus
    
    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 7f3af05..d7750c7 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -9772,6 +9772,8 @@ sna_poly_fill_rect_stippled_n_box(struct sna *sna,
 
 	for (y1 = box->y1; y1 < box->y2; y1 = y2) {
 		int oy = (y1 - origin->y) % gc->stipple->drawable.height;
+		if (oy < 0)
+			oy += gc->stipple->drawable.height;
 
 		y2 = box->y2;
 		if (y2 - y1 > gc->stipple->drawable.height - oy)
@@ -9783,6 +9785,8 @@ sna_poly_fill_rect_stippled_n_box(struct sna *sna,
 
 			x2 = box->x2;
 			ox = (x1 - origin->x) % gc->stipple->drawable.width;
+			if (ox < 0)
+				ox += gc->stipple->drawable.width;
 			bx1 = ox & ~7;
 			bx2 = ox + (x2 - x1);
 			if (bx2 > gc->stipple->drawable.width) {
commit aca994e03e6e0e16f55841418b0061b175e91e5d
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu May 31 21:17:24 2012 +0100

    sna: Fill early break for clip process of spans
    
    When on the same Y-band as the span, as soon as the clip boxes are too
    far to the right, we can stop searching for more intersections.
    
    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 1ea5074..7f3af05 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -4155,12 +4155,10 @@ sna_fill_spans__cpu(DrawablePtr drawable,
 		    GCPtr gc, int n,
 		    DDXPointPtr pt, int *width, int sorted)
 {
-	RegionRec *clip = sna_gc(gc)->priv;
-	BoxRec extents;
+	const RegionRec *clip = sna_gc(gc)->priv;
 
 	DBG(("%s x %d\n", __FUNCTION__, n));
 
-	extents = clip->extents;
 	while (n--) {
 		BoxRec b;
 
@@ -4171,26 +4169,37 @@ sna_fill_spans__cpu(DrawablePtr drawable,
 		b.x2 = b.x1 + *width++;
 		b.y2 = b.y1 + 1;
 
-		if (!box_intersect(&b, &extents))
+		if (!box_intersect(&b, &clip->extents))
 			continue;
 
 		if (region_is_singular(clip)) {
+			DBG(("%s: singular fill: (%d, %d) x %d\n",
+			     __FUNCTION__, b.x1, b.y1, b.x2 - b.x1));
 			fbFill(drawable, gc, b.x1, b.y1, b.x2 - b.x1, 1);
 		} else {
 			const BoxRec * const clip_start = RegionBoxptr(clip);
 			const BoxRec * const clip_end = clip_start + clip->data->numRects;
 			const BoxRec *c;
 
+			DBG(("%s: multiple fills: (%d, %d) x %d, clip start((%d, %d), (%d,%d)), end((%d, %d), (%d, %d))\n",
+			     __FUNCTION__, b.x1, b.y1, b.x2 - b.x1,
+			     clip_start->x1, clip_start->y1,
+			     clip_start->x2, clip_start->y2,
+			     clip_end[-1].x1, clip_end[-1].y1,
+			     clip_end[-1].x2, clip_end[-1].y2));
+
 			c = find_clip_box_for_y(clip_start, clip_end, b.y1);
 			while (c != clip_end) {
 				int16_t x1, x2;
 
-				if (b.y2 <= c->y1)
-					break;
+				DBG(("%s: clip box? (%d, %d), (%d, %d)\n",
+				     __FUNCTION__,
+				     c->x1, c->y1, c->x2, c->y2));
 
-				if (b.x1 >= c->x2)
+				if (b.y2 <= c->y1 || b.x2 <= c->x1)
 					break;
-				if (b.x2 <= c->x1) {
+
+				if (b.x1 > c->x2) {
 					c++;
 					continue;
 				}
@@ -4203,9 +4212,12 @@ sna_fill_spans__cpu(DrawablePtr drawable,
 					x1 = b.x1;
 				if (x2 > b.x2)
 					x2 = b.x2;
-				if (x2 > x1)
+				if (x2 > x1) {
+					DBG(("%s: fbFill(%d, %d) x %d\n",
+					     __FUNCTION__, x1, b.y1, x2 - x1));
 					fbFill(drawable, gc,
 					       x1, b.y1, x2 - x1, 1);
+				}
 			}
 		}
 	}
@@ -4518,12 +4530,10 @@ sna_fill_spans__fill_clip_boxes(DrawablePtr drawable,
 
 		c = find_clip_box_for_y(clip_start, clip_end, y);
 		while (c != clip_end) {
-			if (y + 1 <= c->y1)
+			if (y + 1 <= c->y1 || X2 <= c->x1)
 				break;
 
-			if (X1 >= c->x2)
-				break;
-			if (X2 <= c->x1) {
+			if (X1 >= c->x2) {
 				c++;
 				continue;
 			}
@@ -4719,12 +4729,10 @@ no_damage_clipped:
 							clip_end,
 							y);
 				while (c != clip_end) {
-					if (y + 1 <= c->y1)
+					if (y + 1 <= c->y1 || X2 <= c->x1)
 						break;
 
-					if (X1 >= c->x2)
-						break;
-					if (X2 <= c->x1) {
+					if (X1 >= c->x2) {
 						c++;
 						continue;
 					}
@@ -4824,12 +4832,10 @@ damage_clipped:
 							clip_end,
 							y);
 				while (c != clip_end) {
-					if (y + 1 <= c->y1)
+					if (y + 1 <= c->y1 || X2 <= c->x1)
 						break;
 
-					if (X1 >= c->x2)
-						break;
-					if (X2 <= c->x1) {
+					if (X1 >= c->x2) {
 						c++;
 						continue;
 					}
@@ -10364,7 +10370,7 @@ fallback:
 							       true)))
 		goto out;
 
-	DBG(("%s: fallback -- miFillPolygon -> sna_fill_spans__cpu\n",
+	DBG(("%s: fallback -- miPolyFillArc -> sna_fill_spans__cpu\n",
 	     __FUNCTION__));
 	sna_gc(gc)->priv = &data.region;
 	assert(gc->ops == (GCOps *)&sna_gc_ops);
commit 0fe150f898120ba9a00e1e6b9d66bec10d7e8a29
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu May 31 20:02:47 2012 +0100

    sna: Fix computation of box for clipped stippled rectangles
    
    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 3a9f325..1ea5074 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -9900,19 +9900,28 @@ sna_poly_fill_rect_stippled_n_blt(DrawablePtr drawable,
 
 		region_set(&clip, extents);
 		region_maybe_clip(&clip, gc->pCompositeClip);
-		if (!RegionNotEmpty(&clip))
+		if (!RegionNotEmpty(&clip)) {
+			DBG(("%s: all clipped\n", __FUNCTION__));
 			return true;
+		}
 
 		if (clip.data == NULL) {
+			DBG(("%s: clipped to extents ((%d, %d), (%d, %d))\n",
+			     __FUNCTION__,
+			     clip.extents.x1, clip.extents.y1,
+			     clip.extents.x2, clip.extents.y2));
 			do {
 				BoxRec box;
 
 				box.x1 = r->x + drawable->x;
-				box.x2 = bound(r->x, r->width);
+				box.x2 = bound(box.x1, r->width);
 				box.y1 = r->y + drawable->y;
-				box.y2 = bound(r->y, r->height);
+				box.y2 = bound(box.y1, r->height);
 				r++;
 
+				DBG(("%s: box (%d, %d), (%d, %d)\n",
+				     __FUNCTION__,
+				     box.x1, box.y1, box.x2, box.y2));
 				if (!box_intersect(&box, &clip.extents))
 					continue;
 
@@ -9928,13 +9937,18 @@ sna_poly_fill_rect_stippled_n_blt(DrawablePtr drawable,
 			const BoxRec * const clip_end = clip_start + clip.data->numRects;
 			const BoxRec *c;
 
+			DBG(("%s: clipped to boxes: start((%d, %d), (%d, %d)); end=((%d, %d), (%d, %d))\n", __FUNCTION__,
+			     clip_start->x1, clip_start->y1,
+			     clip_start->x2, clip_start->y2,
+			     clip_end->x1, clip_end->y1,
+			     clip_end->x2, clip_end->y2));
 			do {
 				BoxRec unclipped;
 
 				unclipped.x1 = r->x + drawable->x;
-				unclipped.x2 = bound(r->x, r->width);
+				unclipped.x2 = bound(unclipped.x1, r->width);
 				unclipped.y1 = r->y + drawable->y;
-				unclipped.y2 = bound(r->y, r->height);
+				unclipped.y2 = bound(unclipped.y1, r->height);
 				r++;
 
 				c = find_clip_box_for_y(clip_start,


More information about the xorg-commit mailing list