summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-12-28 10:56:57 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2011-12-28 10:56:57 +0000
commit337635ab97bbfc9b4455eadb63214783bb90bb2b (patch)
tree88e1ae6090aa780506bc5db9526da9dfdde444c6
parent3bf81241cbc97763e5f3cbc82772437ccbff5a6c (diff)
sna: Add some more debugging to find the source of a read-boxes error
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_io.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/sna/sna_io.c b/src/sna/sna_io.c
index 489c1ccd..0386cef1 100644
--- a/src/sna/sna_io.c
+++ b/src/sna/sna_io.c
@@ -100,6 +100,20 @@ void sna_read_boxes(struct sna *sna,
__FUNCTION__, nbox, src_bo->handle, src_dx, src_dy,
dst->drawable.width, dst->drawable.height, dst_dx, dst_dy));
+#ifndef NDEBUG
+ for (n = 0; n < nbox; n++) {
+ if (box[n].x1 + src_dx < 0 || box[n].y1 + src_dy < 0 ||
+ (box[n].x2 + src_dx) * dst->drawable.bitsPerPixel/8 > src_bo->pitch ||
+ (box[n].y2 + src_dy) * src_bo->pitch > src_bo->size)
+ {
+ FatalError("source out-of-bounds box[%d]=(%d, %d), (%d, %d) + (%d, %d), pitch=%d, size=%d\n",
+ box[n].x1, box[n].y1,
+ box[n].x2, box[n].y2,
+ src_bo->pitch, src_bo->size);
+ }
+ }
+#endif
+
if (DEBUG_NO_IO || kgem->wedged || src_bo->tiling == I915_TILING_Y) {
read_boxes_inplace(kgem,
src_bo, src_dx, src_dy,