xf86-video-intel: 8 commits - src/sna/sna_accel.c src/sna/sna_blt.c src/sna/sna_display.c src/sna/sna_driver.c src/sna/sna.h src/sna/sna_threads.c src/sna/sna_tiling.c src/sna/sna_trapezoids_boxes.c src/sna/sna_trapezoids_imprecise.c src/sna/sna_trapezoids_mono.c src/sna/sna_trapezoids_precise.c

Chris Wilson ickle at kemper.freedesktop.org
Sat Feb 22 02:07:09 PST 2014


 src/sna/sna.h                      |    1 
 src/sna/sna_accel.c                |    9 -
 src/sna/sna_blt.c                  |   75 +++++++++--
 src/sna/sna_display.c              |    3 
 src/sna/sna_driver.c               |    6 
 src/sna/sna_threads.c              |   16 ++
 src/sna/sna_tiling.c               |    3 
 src/sna/sna_trapezoids_boxes.c     |  248 +++++++++++++++++++------------------
 src/sna/sna_trapezoids_imprecise.c |   80 +++++++----
 src/sna/sna_trapezoids_mono.c      |    5 
 src/sna/sna_trapezoids_precise.c   |   80 +++++++----
 11 files changed, 328 insertions(+), 198 deletions(-)

New commits:
commit 75cff26ebad33aca7ade7aa5a650235a7d42e47c
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Feb 22 10:05:41 2014 +0000

    sna: Apply the dst offset for pixman fills
    
    Along one of the sw blt paths we failed to apply the offset for
    Composite redirection.
    
    Reported-by: Jiri Slaby <jirislaby at gmail.com>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73811
    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 c02f8c7..4bbcdbc 100644
--- a/src/sna/sna_blt.c
+++ b/src/sna/sna_blt.c
@@ -940,9 +940,9 @@ static void blt_composite_fill__cpu(struct sna *sna,
 }
 
 fastcall static void
-blt_composite_fill_box__cpu(struct sna *sna,
-			    const struct sna_composite_op *op,
-			    const BoxRec *box)
+blt_composite_fill_box_no_offset__cpu(struct sna *sna,
+				      const struct sna_composite_op *op,
+				      const BoxRec *box)
 {
 	assert(box->x1 >= 0);
 	assert(box->y1 >= 0);
@@ -957,9 +957,9 @@ blt_composite_fill_box__cpu(struct sna *sna,
 }
 
 static void
-blt_composite_fill_boxes__cpu(struct sna *sna,
-			      const struct sna_composite_op *op,
-			      const BoxRec *box, int n)
+blt_composite_fill_boxes_no_offset__cpu(struct sna *sna,
+					const struct sna_composite_op *op,
+					const BoxRec *box, int n)
 {
 	do {
 		assert(box->x1 >= 0);
@@ -976,6 +976,45 @@ blt_composite_fill_boxes__cpu(struct sna *sna,
 	} while (--n);
 }
 
+fastcall static void
+blt_composite_fill_box__cpu(struct sna *sna,
+			    const struct sna_composite_op *op,
+			    const BoxRec *box)
+{
+	assert(box->x1 + op->dst.x >= 0);
+	assert(box->y1 + op->dst.y >= 0);
+	assert(box->x2 + op->dst.x <= op->dst.pixmap->drawable.width);
+	assert(box->y2 + op->dst.y <= op->dst.pixmap->drawable.height);
+
+	pixman_fill(op->dst.pixmap->devPrivate.ptr,
+		    op->dst.pixmap->devKind / sizeof(uint32_t),
+		    op->dst.pixmap->drawable.bitsPerPixel,
+		    box->x1 + op->dst.x, box->y1 + op->dst.y,
+		    box->x2 - box->x1, box->y2 - box->y1,
+		    op->u.blt.pixel);
+}
+
+static void
+blt_composite_fill_boxes__cpu(struct sna *sna,
+			      const struct sna_composite_op *op,
+			      const BoxRec *box, int n)
+{
+	do {
+		assert(box->x1 + op->dst.x >= 0);
+		assert(box->y1 + op->dst.y >= 0);
+		assert(box->x2 + op->dst.x <= op->dst.pixmap->drawable.width);
+		assert(box->y2 + op->dst.y <= op->dst.pixmap->drawable.height);
+
+		pixman_fill(op->dst.pixmap->devPrivate.ptr,
+			    op->dst.pixmap->devKind / sizeof(uint32_t),
+			    op->dst.pixmap->drawable.bitsPerPixel,
+			    box->x1 + op->dst.x, box->y1 + op->dst.y,
+			    box->x2 - box->x1, box->y2 - box->y1,
+			    op->u.blt.pixel);
+		box++;
+	} while (--n);
+}
+
 inline static void _sna_blt_fill_box(struct sna *sna,
 				     const struct sna_blt_state *blt,
 				     const BoxRec *box)
@@ -1316,9 +1355,15 @@ prepare_blt_clear(struct sna *sna,
 
 	if (op->dst.bo == NULL) {
 		op->blt   = blt_composite_fill__cpu;
-		op->box   = blt_composite_fill_box__cpu;
-		op->boxes = blt_composite_fill_boxes__cpu;
-		op->thread_boxes = blt_composite_fill_boxes__cpu;
+		if (op->dst.x|op->dst.y) {
+			op->box   = blt_composite_fill_box__cpu;
+			op->boxes = blt_composite_fill_boxes__cpu;
+			op->thread_boxes = blt_composite_fill_boxes__cpu;
+		} else {
+			op->box   = blt_composite_fill_box_no_offset__cpu;
+			op->boxes = blt_composite_fill_boxes_no_offset__cpu;
+			op->thread_boxes = blt_composite_fill_boxes_no_offset__cpu;
+		}
 		op->done  = nop_done;
 		op->u.blt.pixel = 0;
 		return true;
@@ -1355,9 +1400,15 @@ prepare_blt_fill(struct sna *sna,
 	if (op->dst.bo == NULL) {
 		op->u.blt.pixel = pixel;
 		op->blt = blt_composite_fill__cpu;
-		op->box   = blt_composite_fill_box__cpu;
-		op->boxes = blt_composite_fill_boxes__cpu;
-		op->thread_boxes = blt_composite_fill_boxes__cpu;
+		if (op->dst.x|op->dst.y) {
+			op->box   = blt_composite_fill_box__cpu;
+			op->boxes = blt_composite_fill_boxes__cpu;
+			op->thread_boxes = blt_composite_fill_boxes__cpu;
+		} else {
+			op->box   = blt_composite_fill_box_no_offset__cpu;
+			op->boxes = blt_composite_fill_boxes_no_offset__cpu;
+			op->thread_boxes = blt_composite_fill_boxes_no_offset__cpu;
+		}
 		op->done = nop_done;
 		return true;
 	}
commit 59d471de7fc7581b112f37a68714d0e1f8728dfd
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Feb 22 08:35:50 2014 +0000

    sna: Handle asynchronous signals from threads
    
    By killing the threads and leaking their allocations - marginally
    preferrable to losing the entire Xserver.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna.h b/src/sna/sna.h
index 1b0a4e5..0b5de8e 100644
--- a/src/sna/sna.h
+++ b/src/sna/sna.h
@@ -1017,6 +1017,7 @@ void sna_threads_init(void);
 int sna_use_threads (int width, int height, int threshold);
 void sna_threads_run(void (*func)(void *arg), void *arg);
 void sna_threads_wait(void);
+void sna_threads_kill(void);
 
 void sna_image_composite(pixman_op_t        op,
 			 pixman_image_t    *src,
diff --git a/src/sna/sna_threads.c b/src/sna/sna_threads.c
index 6627cbd..8f55496 100644
--- a/src/sna/sna_threads.c
+++ b/src/sna/sna_threads.c
@@ -205,6 +205,22 @@ void sna_threads_wait(void)
 	}
 }
 
+void sna_threads_kill(void)
+{
+	int n;
+
+	ERR(("kill %d threads\n", max_threads));
+	assert(max_threads > 0);
+
+	for (n = 0; n < max_threads; n++)
+		pthread_cancel(threads[n].thread);
+
+	for (n = 0; n < max_threads; n++)
+		pthread_join(threads[n].thread, NULL);
+
+	max_threads = 0;
+}
+
 int sna_use_threads(int width, int height, int threshold)
 {
 	int num_threads;
diff --git a/src/sna/sna_trapezoids_boxes.c b/src/sna/sna_trapezoids_boxes.c
index 6d81da6..d6f0c37 100644
--- a/src/sna/sna_trapezoids_boxes.c
+++ b/src/sna/sna_trapezoids_boxes.c
@@ -1181,19 +1181,23 @@ composite_unaligned_boxes_inplace(struct sna *sna,
 			dy = (clip.extents.y2 - clip.extents.y1 + num_threads - 1) / num_threads;
 			num_threads = (clip.extents.y2 - clip.extents.y1 + dy - 1) / dy;
 
-			for (i = 1; i < num_threads; i++) {
-				thread[i] = thread[0];
-				thread[i].y1 = y;
-				thread[i].y2 = y += dy;
-				sna_threads_run(rectilinear_inplace_thread, &thread[i]);
-			}
+			if (sigtrap_get() == 0) {
+				for (i = 1; i < num_threads; i++) {
+					thread[i] = thread[0];
+					thread[i].y1 = y;
+					thread[i].y2 = y += dy;
+					sna_threads_run(rectilinear_inplace_thread, &thread[i]);
+				}
 
-			assert(y < clip.extents.y2);
-			thread[0].y1 = y;
-			thread[0].y2 = clip.extents.y2;
-			rectilinear_inplace_thread(&thread[0]);
+				assert(y < clip.extents.y2);
+				thread[0].y1 = y;
+				thread[0].y2 = clip.extents.y2;
+				rectilinear_inplace_thread(&thread[0]);
 
-			sna_threads_wait();
+				sna_threads_wait();
+				sigtrap_put();
+			} else
+				sna_threads_kill();
 
 			pixman_image_unref(thread[0].dst);
 			pixman_image_unref(thread[0].src);
diff --git a/src/sna/sna_trapezoids_imprecise.c b/src/sna/sna_trapezoids_imprecise.c
index ddf52c2..93823bb 100644
--- a/src/sna/sna_trapezoids_imprecise.c
+++ b/src/sna/sna_trapezoids_imprecise.c
@@ -2851,19 +2851,23 @@ trapezoid_span_inplace__x8r8g8b8(CARD8 op,
 		h = (h + num_threads - 1) / num_threads;
 		num_threads -= (num_threads-1) * h >= region.extents.y2 - region.extents.y1;
 
-		for (n = 1; n < num_threads; n++) {
-			threads[n] = threads[0];
-			threads[n].extents.y1 = y;
-			threads[n].extents.y2 = y += h;
+		if (sigtrap_get() == 0) {
+			for (n = 1; n < num_threads; n++) {
+				threads[n] = threads[0];
+				threads[n].extents.y1 = y;
+				threads[n].extents.y2 = y += h;
 
-			sna_threads_run(inplace_x8r8g8b8_thread, &threads[n]);
-		}
+				sna_threads_run(inplace_x8r8g8b8_thread, &threads[n]);
+			}
 
-		assert(y < threads[0].extents.y2);
-		threads[0].extents.y1 = y;
-		inplace_x8r8g8b8_thread(&threads[0]);
+			assert(y < threads[0].extents.y2);
+			threads[0].extents.y1 = y;
+			inplace_x8r8g8b8_thread(&threads[0]);
 
-		sna_threads_wait();
+			sna_threads_wait();
+			sigtrap_put();
+		} else
+			sna_threads_kill(); /* leaks thread allocations */
 	}
 
 	return true;
@@ -3125,19 +3129,23 @@ imprecise_trapezoid_span_inplace(struct sna *sna,
 		h = (h + num_threads - 1) / num_threads;
 		num_threads -= (num_threads-1) * h >= region.extents.y2 - region.extents.y1;
 
-		for (n = 1; n < num_threads; n++) {
-			threads[n] = threads[0];
-			threads[n].extents.y1 = y;
-			threads[n].extents.y2 = y += h;
+		if (sigtrap_get() == 0) {
+			for (n = 1; n < num_threads; n++) {
+				threads[n] = threads[0];
+				threads[n].extents.y1 = y;
+				threads[n].extents.y2 = y += h;
 
-			sna_threads_run(inplace_thread, &threads[n]);
-		}
+				sna_threads_run(inplace_thread, &threads[n]);
+			}
 
-		assert(y < threads[0].extents.y2);
-		threads[0].extents.y1 = y;
-		inplace_thread(&threads[0]);
+			assert(y < threads[0].extents.y2);
+			threads[0].extents.y1 = y;
+			inplace_thread(&threads[0]);
 
-		sna_threads_wait();
+			sna_threads_wait();
+			sigtrap_put();
+		} else
+			sna_threads_kill(); /* leaks thread allocations */
 	}
 
 	return true;
diff --git a/src/sna/sna_trapezoids_precise.c b/src/sna/sna_trapezoids_precise.c
index e5bab16..bc0a7e7 100644
--- a/src/sna/sna_trapezoids_precise.c
+++ b/src/sna/sna_trapezoids_precise.c
@@ -2849,19 +2849,23 @@ trapezoid_span_inplace__x8r8g8b8(CARD8 op,
 		h = (h + num_threads - 1) / num_threads;
 		num_threads -= (num_threads-1) * h >= region.extents.y2 - region.extents.y1;
 
-		for (n = 1; n < num_threads; n++) {
-			threads[n] = threads[0];
-			threads[n].extents.y1 = y;
-			threads[n].extents.y2 = y += h;
+		if (sigtrap_get() == 0) {
+			for (n = 1; n < num_threads; n++) {
+				threads[n] = threads[0];
+				threads[n].extents.y1 = y;
+				threads[n].extents.y2 = y += h;
 
-			sna_threads_run(inplace_x8r8g8b8_thread, &threads[n]);
-		}
+				sna_threads_run(inplace_x8r8g8b8_thread, &threads[n]);
+			}
 
-		assert(y < threads[0].extents.y2);
-		threads[0].extents.y1 = y;
-		inplace_x8r8g8b8_thread(&threads[0]);
+			assert(y < threads[0].extents.y2);
+			threads[0].extents.y1 = y;
+			inplace_x8r8g8b8_thread(&threads[0]);
 
-		sna_threads_wait();
+			sna_threads_wait();
+			sigtrap_put();
+		} else
+			sna_threads_kill(); /* leaks thread allocations */
 	}
 
 	return true;
@@ -3124,19 +3128,23 @@ precise_trapezoid_span_inplace(struct sna *sna,
 		h = (h + num_threads - 1) / num_threads;
 		num_threads -= (num_threads-1) * h >= region.extents.y2 - region.extents.y1;
 
-		for (n = 1; n < num_threads; n++) {
-			threads[n] = threads[0];
-			threads[n].extents.y1 = y;
-			threads[n].extents.y2 = y += h;
+		if (sigtrap_get() == 0) {
+			for (n = 1; n < num_threads; n++) {
+				threads[n] = threads[0];
+				threads[n].extents.y1 = y;
+				threads[n].extents.y2 = y += h;
 
-			sna_threads_run(inplace_thread, &threads[n]);
-		}
+				sna_threads_run(inplace_thread, &threads[n]);
+			}
 
-		assert(y < threads[0].extents.y2);
-		threads[0].extents.y1 = y;
-		inplace_thread(&threads[0]);
+			assert(y < threads[0].extents.y2);
+			threads[0].extents.y1 = y;
+			inplace_thread(&threads[0]);
 
-		sna_threads_wait();
+			sna_threads_wait();
+			sigtrap_put();
+		} else
+			sna_threads_kill(); /* leaks thread allocations */
 	}
 
 	return true;
commit 1de1104064b5898cbed37e836901694a381c1266
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Feb 21 22:43:04 2014 +0000

    sna: Use a hint to do whole image uploads inplace
    
    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 6d97814..0dac561 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -4540,6 +4540,7 @@ sna_put_zpixmap_blt(DrawablePtr drawable, GCPtr gc, RegionPtr region,
 		    int x, int y, int w, int  h, char *bits, int stride)
 {
 	PixmapPtr pixmap = get_drawable_pixmap(drawable);
+	unsigned int hint;
 	BoxRec *box;
 	int16_t dx, dy;
 	int n;
@@ -4562,8 +4563,11 @@ sna_put_zpixmap_blt(DrawablePtr drawable, GCPtr gc, RegionPtr region,
 	if (try_upload_tiled_x(pixmap, region, x, y, w, h, bits, stride))
 		return true;
 
-	if (!sna_drawable_move_region_to_cpu(&pixmap->drawable,
-					     region, MOVE_WRITE))
+	hint = MOVE_WRITE;
+	if (w == pixmap->drawable.width)
+		hint |= MOVE_WHOLE_HINT;
+
+	if (!sna_drawable_move_region_to_cpu(&pixmap->drawable, region, hint))
 		return false;
 
 	if (sigtrap_get())
commit 2c0aacb869bea34620a2b0029ddfa7f2a9513dc7
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Feb 21 21:48:36 2014 +0000

    sna: Allow allocation to fail even when debugging
    
    Let the malloc failure propagate rather than assert.
    
    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 d79eb8a..6d97814 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -516,7 +516,6 @@ sna_pixmap_alloc_cpu(struct sna *sna,
 		priv->ptr = malloc(priv->stride * pixmap->drawable.height);
 	}
 
-	assert(priv->ptr);
 done:
 	assert(priv->stride);
 	assert(!priv->mapped);
commit cb87b179532a9b533df458f3367fde7fc3d64d0c
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Feb 21 21:41:52 2014 +0000

    sna: Wrap inplace trapezoid operators with SIGBUS protection
    
    For the moment, this still leaves open the vexing question of how to
    protect the multi-threaded variants, but it should provide more shelter
    for extreme OOM.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_trapezoids_boxes.c b/src/sna/sna_trapezoids_boxes.c
index b462de5..6d81da6 100644
--- a/src/sna/sna_trapezoids_boxes.c
+++ b/src/sna/sna_trapezoids_boxes.c
@@ -253,13 +253,16 @@ composite_aligned_boxes(struct sna *sna,
 				RegionIntersect(&region, &region, &clip);
 				b = REGION_RECTS(&region);
 				count = REGION_NUM_RECTS(&region);
-				for (i = 0; i < count; i++) {
-					fbComposite(op, src, NULL, dst,
-						    src_x + b[i].x1 - boxes[0].x1,
-						    src_y + b[i].y1 - boxes[0].y1,
-						    0, 0,
-						    b[i].x1, b[i].y1,
-						    b[i].x2 - b[i].x1, b[i].y2 - b[i].y1);
+				if (sigtrap_get() == 0) {
+					for (i = 0; i < count; i++) {
+						fbComposite(op, src, NULL, dst,
+							    src_x + b[i].x1 - boxes[0].x1,
+							    src_y + b[i].y1 - boxes[0].y1,
+							    0, 0,
+							    b[i].x1, b[i].y1,
+							    b[i].x2 - b[i].x1, b[i].y2 - b[i].y1);
+					}
+					sigtrap_put();
 				}
 				pixman_region_fini(&region);
 				pixman_region_fini(&region);
@@ -789,52 +792,55 @@ composite_unaligned_boxes_inplace__solid(struct sna *sna,
 			continue;
 		}
 
-		RegionTranslate(&clip, dx, dy);
-		count = REGION_NUM_RECTS(&clip);
-		extents = REGION_RECTS(&clip);
-		while (count--) {
-			int16_t y1 = dy + pixman_fixed_to_int(t->top);
-			uint16_t fy1 = pixman_fixed_frac(t->top);
-			int16_t y2 = dy + pixman_fixed_to_int(t->bottom);
-			uint16_t fy2 = pixman_fixed_frac(t->bottom);
-
-			DBG(("%s: t=(%d, %d), (%d, %d), extents (%d, %d), (%d, %d)\n",
-			     __FUNCTION__,
-			     pixman_fixed_to_int(t->left.p1.x),
-			     pixman_fixed_to_int(t->top),
-			     pixman_fixed_to_int(t->right.p2.x),
-			     pixman_fixed_to_int(t->bottom),
-			     extents->x1, extents->y1,
-			     extents->x2, extents->y2));
-
-			if (y1 < extents->y1)
-				y1 = extents->y1, fy1 = 0;
-			if (y2 >= extents->y2)
-				y2 = extents->y2, fy2 = 0;
-
-			if (y1 < y2) {
-				if (fy1) {
+		if (sigtrap_get() == 0) {
+			RegionTranslate(&clip, dx, dy);
+			count = REGION_NUM_RECTS(&clip);
+			extents = REGION_RECTS(&clip);
+			while (count--) {
+				int16_t y1 = dy + pixman_fixed_to_int(t->top);
+				uint16_t fy1 = pixman_fixed_frac(t->top);
+				int16_t y2 = dy + pixman_fixed_to_int(t->bottom);
+				uint16_t fy2 = pixman_fixed_frac(t->bottom);
+
+				DBG(("%s: t=(%d, %d), (%d, %d), extents (%d, %d), (%d, %d)\n",
+				     __FUNCTION__,
+				     pixman_fixed_to_int(t->left.p1.x),
+				     pixman_fixed_to_int(t->top),
+				     pixman_fixed_to_int(t->right.p2.x),
+				     pixman_fixed_to_int(t->bottom),
+				     extents->x1, extents->y1,
+				     extents->x2, extents->y2));
+
+				if (y1 < extents->y1)
+					y1 = extents->y1, fy1 = 0;
+				if (y2 >= extents->y2)
+					y2 = extents->y2, fy2 = 0;
+
+				if (y1 < y2) {
+					if (fy1) {
+						lerp32_unaligned_box_row(pixmap, color, extents,
+									 t, dx, y1, 1,
+									 SAMPLES_Y - grid_coverage(SAMPLES_Y, fy1));
+						y1++;
+					}
+
+					if (y2 > y1)
+						lerp32_unaligned_box_row(pixmap, color, extents,
+									 t, dx, y1, y2 - y1,
+									 SAMPLES_Y);
+
+					if (fy2)
+						lerp32_unaligned_box_row(pixmap, color,  extents,
+									 t, dx, y2, 1,
+									 grid_coverage(SAMPLES_Y, fy2));
+				} else if (y1 == y2 && fy2 > fy1) {
 					lerp32_unaligned_box_row(pixmap, color, extents,
 								 t, dx, y1, 1,
-								 SAMPLES_Y - grid_coverage(SAMPLES_Y, fy1));
-					y1++;
+								 grid_coverage(SAMPLES_Y, fy2) - grid_coverage(SAMPLES_Y, fy1));
 				}
-
-				if (y2 > y1)
-					lerp32_unaligned_box_row(pixmap, color, extents,
-								 t, dx, y1, y2 - y1,
-								 SAMPLES_Y);
-
-				if (fy2)
-					lerp32_unaligned_box_row(pixmap, color,  extents,
-								 t, dx, y2, 1,
-								 grid_coverage(SAMPLES_Y, fy2));
-			} else if (y1 == y2 && fy2 > fy1) {
-				lerp32_unaligned_box_row(pixmap, color, extents,
-							 t, dx, y1, 1,
-							 grid_coverage(SAMPLES_Y, fy2) - grid_coverage(SAMPLES_Y, fy1));
+				extents++;
 			}
-			extents++;
+			sigtrap_put();
 		}
 
 		RegionUninit(&clip);
@@ -877,37 +883,40 @@ pixman:
 		pi.color = color;
 		pi.op = op;
 
-		count = REGION_NUM_RECTS(&clip);
-		extents = REGION_RECTS(&clip);
-		while (count--) {
-			int16_t y1 = pixman_fixed_to_int(t->top);
-			uint16_t fy1 = pixman_fixed_frac(t->top);
-			int16_t y2 = pixman_fixed_to_int(t->bottom);
-			uint16_t fy2 = pixman_fixed_frac(t->bottom);
-
-			if (y1 < extents->y1)
-				y1 = extents->y1, fy1 = 0;
-			if (y2 >= extents->y2)
-				y2 = extents->y2, fy2 = 0;
-			if (y1 < y2) {
-				if (fy1) {
-					pixsolid_unaligned_box_row(&pi, extents, t, y1, 1,
-								   SAMPLES_Y - grid_coverage(SAMPLES_Y, fy1));
-					y1++;
-				}
+		if (sigtrap_get() == 0) {
+			count = REGION_NUM_RECTS(&clip);
+			extents = REGION_RECTS(&clip);
+			while (count--) {
+				int16_t y1 = pixman_fixed_to_int(t->top);
+				uint16_t fy1 = pixman_fixed_frac(t->top);
+				int16_t y2 = pixman_fixed_to_int(t->bottom);
+				uint16_t fy2 = pixman_fixed_frac(t->bottom);
 
-				if (y2 > y1)
-					pixsolid_unaligned_box_row(&pi, extents, t, y1, y2 - y1,
-								   SAMPLES_Y);
+				if (y1 < extents->y1)
+					y1 = extents->y1, fy1 = 0;
+				if (y2 >= extents->y2)
+					y2 = extents->y2, fy2 = 0;
+				if (y1 < y2) {
+					if (fy1) {
+						pixsolid_unaligned_box_row(&pi, extents, t, y1, 1,
+									   SAMPLES_Y - grid_coverage(SAMPLES_Y, fy1));
+						y1++;
+					}
 
-				if (fy2)
-					pixsolid_unaligned_box_row(&pi, extents, t, y2, 1,
-								   grid_coverage(SAMPLES_Y, fy2));
-			} else if (y1 == y2 && fy2 > fy1) {
-				pixsolid_unaligned_box_row(&pi, extents, t, y1, 1,
-							   grid_coverage(SAMPLES_Y, fy2) - grid_coverage(SAMPLES_Y, fy1));
+					if (y2 > y1)
+						pixsolid_unaligned_box_row(&pi, extents, t, y1, y2 - y1,
+									   SAMPLES_Y);
+
+					if (fy2)
+						pixsolid_unaligned_box_row(&pi, extents, t, y2, 1,
+									   grid_coverage(SAMPLES_Y, fy2));
+				} else if (y1 == y2 && fy2 > fy1) {
+					pixsolid_unaligned_box_row(&pi, extents, t, y1, 1,
+								   grid_coverage(SAMPLES_Y, fy2) - grid_coverage(SAMPLES_Y, fy1));
+				}
+				extents++;
 			}
-			extents++;
+			sigtrap_put();
 		}
 
 		RegionUninit(&clip);
@@ -1115,37 +1124,40 @@ composite_unaligned_boxes_inplace(struct sna *sna,
 			pi.bits = pixman_image_get_data(pi.mask);
 			pi.op = op;
 
-			count = REGION_NUM_RECTS(&clip);
-			extents = REGION_RECTS(&clip);
-			while (count--) {
-				int16_t y1 = pixman_fixed_to_int(t->top);
-				uint16_t fy1 = pixman_fixed_frac(t->top);
-				int16_t y2 = pixman_fixed_to_int(t->bottom);
-				uint16_t fy2 = pixman_fixed_frac(t->bottom);
-
-				if (y1 < extents->y1)
-					y1 = extents->y1, fy1 = 0;
-				if (y2 > extents->y2)
-					y2 = extents->y2, fy2 = 0;
-				if (y1 < y2) {
-					if (fy1) {
+			if (sigtrap_get() == 0) {
+				count = REGION_NUM_RECTS(&clip);
+				extents = REGION_RECTS(&clip);
+				while (count--) {
+					int16_t y1 = pixman_fixed_to_int(t->top);
+					uint16_t fy1 = pixman_fixed_frac(t->top);
+					int16_t y2 = pixman_fixed_to_int(t->bottom);
+					uint16_t fy2 = pixman_fixed_frac(t->bottom);
+
+					if (y1 < extents->y1)
+						y1 = extents->y1, fy1 = 0;
+					if (y2 > extents->y2)
+						y2 = extents->y2, fy2 = 0;
+					if (y1 < y2) {
+						if (fy1) {
+							pixmask_unaligned_box_row(&pi, extents, t, y1, 1,
+										  SAMPLES_Y - grid_coverage(SAMPLES_Y, fy1));
+							y1++;
+						}
+
+						if (y2 > y1)
+							pixmask_unaligned_box_row(&pi, extents, t, y1, y2 - y1,
+										  SAMPLES_Y);
+
+						if (fy2)
+							pixmask_unaligned_box_row(&pi, extents, t, y2, 1,
+										  grid_coverage(SAMPLES_Y, fy2));
+					} else if (y1 == y2 && fy2 > fy1) {
 						pixmask_unaligned_box_row(&pi, extents, t, y1, 1,
-									  SAMPLES_Y - grid_coverage(SAMPLES_Y, fy1));
-						y1++;
+									  grid_coverage(SAMPLES_Y, fy2) - grid_coverage(SAMPLES_Y, fy1));
 					}
-
-					if (y2 > y1)
-						pixmask_unaligned_box_row(&pi, extents, t, y1, y2 - y1,
-									  SAMPLES_Y);
-
-					if (fy2)
-						pixmask_unaligned_box_row(&pi, extents, t, y2, 1,
-									  grid_coverage(SAMPLES_Y, fy2));
-				} else if (y1 == y2 && fy2 > fy1) {
-					pixmask_unaligned_box_row(&pi, extents, t, y1, 1,
-								  grid_coverage(SAMPLES_Y, fy2) - grid_coverage(SAMPLES_Y, fy1));
+					extents++;
 				}
-				extents++;
+				sigtrap_put();
 			}
 
 			pixman_image_unref(pi.image);
diff --git a/src/sna/sna_trapezoids_imprecise.c b/src/sna/sna_trapezoids_imprecise.c
index a354f28..ddf52c2 100644
--- a/src/sna/sna_trapezoids_imprecise.c
+++ b/src/sna/sna_trapezoids_imprecise.c
@@ -2759,8 +2759,11 @@ trapezoid_span_inplace__x8r8g8b8(CARD8 op,
 			DBG(("%s: render inplace op=%d, color=%08x\n",
 			     __FUNCTION__, op, color));
 
-			tor_render(NULL, &tor, (void*)&inplace,
-				   dst->pCompositeClip, span, false);
+			if (sigtrap_get() == 0) {
+				tor_render(NULL, &tor, (void*)&inplace,
+					   dst->pCompositeClip, span, false);
+				sigtrap_put();
+			}
 		} else if (is_solid) {
 			struct pixman_inplace pi;
 
@@ -2778,9 +2781,12 @@ trapezoid_span_inplace__x8r8g8b8(CARD8 op,
 			else
 				span = pixmask_span_solid;
 
-			tor_render(NULL, &tor, (void*)&pi,
-				   dst->pCompositeClip, span,
-				   false);
+			if (sigtrap_get() == 0) {
+				tor_render(NULL, &tor, (void*)&pi,
+					   dst->pCompositeClip, span,
+					   false);
+				sigtrap_put();
+			}
 
 			pixman_image_unref(pi.source);
 			pixman_image_unref(pi.image);
@@ -2804,9 +2810,12 @@ trapezoid_span_inplace__x8r8g8b8(CARD8 op,
 			else
 				span = pixmask_span;
 
-			tor_render(NULL, &tor, (void*)&pi,
-				   dst->pCompositeClip, span,
-				   false);
+			if (sigtrap_get() == 0) {
+				tor_render(NULL, &tor, (void*)&pi,
+					   dst->pCompositeClip, span,
+					   false);
+				sigtrap_put();
+			}
 
 			pixman_image_unref(pi.mask);
 			pixman_image_unref(pi.source);
@@ -3083,8 +3092,11 @@ imprecise_trapezoid_span_inplace(struct sna *sna,
 			tor_add_edge(&tor, &t, &t.right, -1);
 		}
 
-		tor_render(NULL, &tor, (void*)&inplace,
-			   dst->pCompositeClip, span, unbounded);
+		if (sigtrap_get() == 0) {
+			tor_render(NULL, &tor, (void*)&inplace,
+				   dst->pCompositeClip, span, unbounded);
+			sigtrap_put();
+		}
 
 		tor_fini(&tor);
 	} else {
diff --git a/src/sna/sna_trapezoids_mono.c b/src/sna/sna_trapezoids_mono.c
index 49296a3..ca316d7 100644
--- a/src/sna/sna_trapezoids_mono.c
+++ b/src/sna/sna_trapezoids_mono.c
@@ -1168,7 +1168,10 @@ unbounded_pass:
 		mono.span = mono_span__fast;
 	else
 		mono.span = mono_span;
-	mono_render(&mono);
+	if (sigtrap_get() == 0) {
+		mono_render(&mono);
+		sigtrap_put();
+	}
 	mono_fini(&mono);
 
 	if (op) {
diff --git a/src/sna/sna_trapezoids_precise.c b/src/sna/sna_trapezoids_precise.c
index de95dfd..e5bab16 100644
--- a/src/sna/sna_trapezoids_precise.c
+++ b/src/sna/sna_trapezoids_precise.c
@@ -2757,8 +2757,11 @@ trapezoid_span_inplace__x8r8g8b8(CARD8 op,
 			DBG(("%s: render inplace op=%d, color=%08x\n",
 			     __FUNCTION__, op, color));
 
-			tor_render(NULL, &tor, (void*)&inplace,
-				   dst->pCompositeClip, span, false);
+			if (sigtrap_get() == 0) {
+				tor_render(NULL, &tor, (void*)&inplace,
+					   dst->pCompositeClip, span, false);
+				sigtrap_put();
+			}
 		} else if (is_solid) {
 			struct pixman_inplace pi;
 
@@ -2776,9 +2779,12 @@ trapezoid_span_inplace__x8r8g8b8(CARD8 op,
 			else
 				span = pixmask_span_solid;
 
-			tor_render(NULL, &tor, (void*)&pi,
-				   dst->pCompositeClip, span,
-				   false);
+			if (sigtrap_get() == 0) {
+				tor_render(NULL, &tor, (void*)&pi,
+					   dst->pCompositeClip, span,
+					   false);
+				sigtrap_put();
+			}
 
 			pixman_image_unref(pi.source);
 			pixman_image_unref(pi.image);
@@ -2802,9 +2808,12 @@ trapezoid_span_inplace__x8r8g8b8(CARD8 op,
 			else
 				span = pixmask_span;
 
-			tor_render(NULL, &tor, (void*)&pi,
-				   dst->pCompositeClip, span,
-				   false);
+			if (sigtrap_get() == 0) {
+				tor_render(NULL, &tor, (void*)&pi,
+					   dst->pCompositeClip, span,
+					   false);
+				sigtrap_put();
+			}
 
 			pixman_image_unref(pi.mask);
 			pixman_image_unref(pi.source);
@@ -3082,8 +3091,11 @@ precise_trapezoid_span_inplace(struct sna *sna,
 			tor_add_edge(&tor, &t, &t.right, -1);
 		}
 
-		tor_render(NULL, &tor, (void*)&inplace,
-			   dst->pCompositeClip, span, unbounded);
+		if (sigtrap_get() == 0) {
+			tor_render(NULL, &tor, (void*)&inplace,
+				   dst->pCompositeClip, span, unbounded);
+			sigtrap_put();
+		}
 
 		tor_fini(&tor);
 	} else {
commit b6fc46d63c5b7bc1347d4e03e71df9e6fdbcaaab
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Feb 21 21:21:46 2014 +0000

    sna: Tighten assertion for tiling blt fallbacks
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_tiling.c b/src/sna/sna_tiling.c
index 8bb4fbc..e21ede1 100644
--- a/src/sna/sna_tiling.c
+++ b/src/sna/sna_tiling.c
@@ -1084,8 +1084,7 @@ bool sna_tiling_blt_copy_boxes(struct sna *sna, uint8_t alu,
 				int16_t dx = this.extents.x1;
 				int16_t dy = this.extents.y1;
 
-				assert(bo->pitch <= 8192);
-				assert(bo->tiling != I915_TILING_Y);
+				assert(kgem_bo_can_blt(&sna->kgem, bo));
 
 				if (!sna_blt_copy_boxes(sna, GXcopy,
 							src_bo, src_dx, src_dy,
commit be6d218c6888bce41e15a8e4899618b5e6eacd99
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Feb 21 19:43:30 2014 +0000

    sna: Do not attempt fallback configuration without any CRTCs
    
    The fallback xf86InitialConfiguration() is another function that may
    explode if called without any CRTCs attached.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 496a300..de08cb9 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -3539,7 +3539,8 @@ bool sna_mode_pre_init(ScrnInfoPtr scrn, struct sna *sna)
 
 	if (!sna_probe_initial_configuration(sna)) {
 		sanitize_outputs(sna);
-		xf86InitialConfiguration(scrn, TRUE);
+		if (XF86_CRTC_CONFIG_PTR(scrn)->num_crtc)
+			xf86InitialConfiguration(scrn, TRUE);
 	}
 
 	sna_setup_provider(scrn);
commit 769a959d84d7e573b11cc1a7d85c122f17dfeea0
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Feb 21 13:43:09 2014 +0000

    sna: Do not register colormaps without any CRTCs
    
    The xserver may crash if we try to setup colormap handling without any
    CRTCs, so don't.
    
    Suggested-by: Dave Airlie <airlied at gmail.com>
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c
index 01d34f8..ef30149 100644
--- a/src/sna/sna_driver.c
+++ b/src/sna/sna_driver.c
@@ -1038,11 +1038,11 @@ sna_screen_init(SCREEN_INIT_ARGS_DECL)
 	if (!miCreateDefColormap(screen))
 		return FALSE;
 
-	if (!xf86HandleColormaps(screen, 256, 8, sna_load_palette, NULL,
+	if (sna->mode.kmode->count_crtcs &&
+	    !xf86HandleColormaps(screen, 256, 8, sna_load_palette, NULL,
 				 CMAP_RELOAD_ON_MODE_SWITCH |
-				 CMAP_PALETTED_TRUECOLOR)) {
+				 CMAP_PALETTED_TRUECOLOR))
 		return FALSE;
-	}
 
 	xf86DPMSInit(screen, xf86DPMSSet, 0);
 


More information about the xorg-commit mailing list