xf86-video-intel: src/sna/fb src/sna/sna_accel.c

Chris Wilson ickle at kemper.freedesktop.org
Fri Nov 1 15:34:35 CET 2013


 src/sna/fb/fbline.c     |   14 ++++++++++----
 src/sna/fb/fblinebits.h |   15 +++++++++++----
 src/sna/sna_accel.c     |   26 +++++++++++++++++++++++---
 3 files changed, 44 insertions(+), 11 deletions(-)

New commits:
commit 5da329735ca79517a326aee002685bf33e8db861
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Nov 1 14:30:14 2013 +0000

    sna: Process all clip boxes when rastering segments
    
    The macro still had buried returns which were no longer valid after the
    translation to handle clipping. They needed to be breaks from the inner
    most loops to the outer clip box instead.
    
    Reported-by: Clemens Eisserer <linuxhippy at gmail.com>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70802
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/fb/fbline.c b/src/sna/fb/fbline.c
index 04d5343..e134e23 100644
--- a/src/sna/fb/fbline.c
+++ b/src/sna/fb/fbline.c
@@ -122,8 +122,11 @@ fbPolyLine(DrawablePtr drawable, GCPtr gc, int mode, int n, DDXPointPtr pt)
 {
 	void (*raster)(DrawablePtr, GCPtr, int mode, int n, DDXPointPtr pt);
 
-	DBG(("%s x %d, width=%d, fill=%d, line=%d\n",
-	     __FUNCTION__, n, gc->lineWidth, gc->fillStyle, gc->lineStyle));
+	DBG(("%s x %d, width=%d, fill=%d [solid? %d], line=%d [solid? %d], bpp=%d\n",
+	     __FUNCTION__, n, gc->lineWidth,
+	     gc->fillStyle, gc->fillStyle == FillSolid,
+	     gc->lineStyle, gc->lineStyle == LineSolid,
+	     drawable->bitsPerPixel));
 
 	if (gc->lineWidth == 0) {
 		raster = fbZeroLine;
@@ -154,8 +157,11 @@ fbPolySegment(DrawablePtr drawable, GCPtr gc, int n, xSegment *seg)
 {
 	void (*raster)(DrawablePtr drawable, GCPtr gc, int n, xSegment * seg);
 
-	DBG(("%s x %d, width=%d, fill=%d, line=%d\n",
-	     __FUNCTION__, n, gc->lineWidth, gc->fillStyle, gc->lineStyle));
+	DBG(("%s x %d, width=%d, fill=%d [solid? %d], line=%d [solid? %d], bpp=%d\n",
+	     __FUNCTION__, n, gc->lineWidth,
+	     gc->fillStyle, gc->fillStyle == FillSolid,
+	     gc->lineStyle, gc->lineStyle == LineSolid,
+	     drawable->bitsPerPixel));
 
 	if (gc->lineWidth == 0) {
 		raster = fbZeroSegment;
diff --git a/src/sna/fb/fblinebits.h b/src/sna/fb/fblinebits.h
index db315d8..67e98e5 100644
--- a/src/sna/fb/fblinebits.h
+++ b/src/sna/fb/fblinebits.h
@@ -53,8 +53,9 @@ POLYLINE(DrawablePtr drawable, GCPtr gc, int mode, int n_0, DDXPointPtr pt_0)
 
 	fbGetDrawable(drawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
 	bitsStride = dstStride * (sizeof(FbBits) / sizeof(BITS));
-	bitsBase =
-		((BITS *) dst) + (yoff + dstYoff) * bitsStride + (xoff + dstXoff);
+	bitsBase = ((BITS *) dst) + (yoff + dstYoff) * bitsStride + (xoff + dstXoff);
+
+	DBG(("%s: processing %ld clip boxes\n", __FUNCTION__, (long)(last_clip - clip)));
 	do {
 		INT32 *pt = (INT32 *)pt_0;
 		int n = n_0;
@@ -63,6 +64,8 @@ POLYLINE(DrawablePtr drawable, GCPtr gc, int mode, int n_0, DDXPointPtr pt_0)
 		INT32 ul = coordToInt(clip->x1 - xoff, clip->y1 - yoff);
 		INT32 lr = coordToInt(clip->x2 - xoff - 1, clip->y2 - yoff - 1);
 
+		DBG(("%s: clip box=(%d, %d), (%d, %d)\n", __FUNCTION__, clip->x1, clip->y1, clip->x2, clip->y2));
+
 		pt1 = *pt++; n--;
 		pt2 = *pt++; n--;
 		for (;;) {
@@ -73,7 +76,7 @@ POLYLINE(DrawablePtr drawable, GCPtr gc, int mode, int n_0, DDXPointPtr pt_0)
 					  intToX(pt2) + xoff, intToY(pt2) + yoff,
 					  n == 0 && gc->capStyle != CapNotLast, &dashoffset);
 				if (!n)
-					return;
+					goto next_clip;
 
 				pt1 = pt2;
 				pt2 = *pt++;
@@ -125,7 +128,7 @@ POLYLINE(DrawablePtr drawable, GCPtr gc, int mode, int n_0, DDXPointPtr pt_0)
 						    pt2 != *((INT32 *)pt_0)) {
 							RROP(bits, and, xor);
 						}
-						return;
+						goto next_clip;
 					}
 					pt1 = pt2;
 					pt2 = *pt++;
@@ -135,6 +138,7 @@ POLYLINE(DrawablePtr drawable, GCPtr gc, int mode, int n_0, DDXPointPtr pt_0)
 				}
 			}
 		}
+next_clip: (void)clip;
 	} while (++clip != last_clip);
 }
 
@@ -167,12 +171,15 @@ POLYSEGMENT(DrawablePtr drawable, GCPtr gc, int n_0, xSegment *seg_0)
 	bitsBase =
 		((BITS *) dst) + (yoff + dstYoff) * bitsStride + (xoff + dstXoff);
 
+	DBG(("%s: processing %ld clip boxes\n", __FUNCTION__, (long)(last_clip - clip)));
 	do {
 		INT32 ul = coordToInt(clip->x1 - xoff, clip->y1 - yoff);
 		INT32 lr = coordToInt(clip->x2 - xoff - 1, clip->y2 - yoff - 1);
 		uint64_t *pt = (uint64_t *)seg_0;
 		int n = n_0;
 
+		DBG(("%s: clip box=(%d, %d), (%d, %d)\n", __FUNCTION__, clip->x1, clip->y1, clip->x2, clip->y2));
+
 		while (n--) {
 			union {
 				int32_t pt32[2];
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 93231db..ffb6117 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -9958,10 +9958,14 @@ sna_poly_rectangle_extents(DrawablePtr drawable, GCPtr gc,
 	} else
 		zero = true;
 
+	DBG(("%s: unclipped original extents: (%d, %d), (%d, %d)\n",
+	     __FUNCTION__, box.x1, box.y1, box.x2, box.y2));
 	clipped = box32_trim_and_translate(&box, drawable, gc);
 	if (!box32_to_box16(&box, out))
 		return 0;
 
+	DBG(("%s: extents: (%d, %d), (%d, %d), clipped? %d\n",
+	     __FUNCTION__, out->x1, out->y1, out->x2, out->y2, clipped));
 	return 1 | clipped << 1 | zero << 2;
 }
 
@@ -10476,7 +10480,7 @@ sna_poly_rectangle(DrawablePtr drawable, GCPtr gc, int n, xRectangle *r)
 		goto fallback;
 	}
 
-	DBG(("%s: fill=_%d [%d], line=%d [%d], join=%d [%d], mask=%lu [%d]\n",
+	DBG(("%s: fill=%d [%d], line=%d [%d], join=%d [%d], mask=%lu [%d]\n",
 	     __FUNCTION__,
 	     gc->fillStyle, gc->fillStyle == FillSolid,
 	     gc->lineStyle, gc->lineStyle == LineSolid,
@@ -10506,12 +10510,19 @@ sna_poly_rectangle(DrawablePtr drawable, GCPtr gc, int n, xRectangle *r)
 	}
 
 fallback:
-	DBG(("%s: fallback\n", __FUNCTION__));
+	DBG(("%s: fallback, clip=%ldx[(%d, %d), (%d, %d)]\n", __FUNCTION__,
+	     (long)RegionNumRects(gc->pCompositeClip),
+	     gc->pCompositeClip->extents.x1, gc->pCompositeClip->extents.y1,
+	     gc->pCompositeClip->extents.x2, gc->pCompositeClip->extents.y2));
 
 	region.data = NULL;
 	if (!region_maybe_clip(&region, gc->pCompositeClip))
 		return;
 
+	DBG(("%s: CPU region=%ldx[(%d, %d), (%d, %d)]\n", __FUNCTION__,
+	     (long)RegionNumRects(&region),
+	     region.extents.x1, region.extents.y1,
+	     region.extents.x2, region.extents.y2));
 	if (!sna_gc_move_to_cpu(gc, drawable, &region))
 		goto out;
 	if (!sna_drawable_move_region_to_cpu(drawable, &region,
@@ -14988,8 +14999,17 @@ sna_validate_gc(GCPtr gc, unsigned long changes, DrawablePtr drawable)
 
 	if (changes & (GCClipMask|GCSubwindowMode) ||
 	    drawable->serialNumber != (gc->serialNumber & DRAWABLE_SERIAL_BITS) ||
-	    (gc->clientClipType != CT_NONE && (changes & (GCClipXOrigin | GCClipYOrigin))))
+	    (gc->clientClipType != CT_NONE && (changes & (GCClipXOrigin | GCClipYOrigin)))) {
+		DBG(("%s: recomputing clip\n", __FUNCTION__));
 		miComputeCompositeClip(gc, drawable);
+		DBG(("%s: composite clip=%ldx[(%d, %d), (%d, %d)]\n",
+		     __FUNCTION__,
+		     (long)RegionNumRects(gc->pCompositeClip),
+		     gc->pCompositeClip->extents.x1,
+		     gc->pCompositeClip->extents.y1,
+		     gc->pCompositeClip->extents.x2,
+		     gc->pCompositeClip->extents.y2));
+	}
 
 	sna_gc(gc)->changes |= changes;
 }


More information about the xorg-commit mailing list