From d3e9316b441bc172f5936e787879d1d13f1f7a01 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 18 Mar 2015 08:33:22 +0000 Subject: lib/batch: Fix range checks for blits Signed-off-by: Chris Wilson --- lib/intel_batchbuffer.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'lib/intel_batchbuffer.c') diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c index c1c27a6d..1aa4ec34 100644 --- a/lib/intel_batchbuffer.c +++ b/lib/intel_batchbuffer.c @@ -333,15 +333,6 @@ intel_blt_copy(struct intel_batchbuffer *batch, uint32_t cmd_bits = 0; uint32_t br13_bits; -#define CHECK_RANGE(x) ((x) >= 0 && (x) < (1 << 15)) - igt_assert(CHECK_RANGE(src_x1) && CHECK_RANGE(src_y1) && - CHECK_RANGE(dst_x1) && CHECK_RANGE(dst_y1) && - CHECK_RANGE(width) && CHECK_RANGE(height) && - CHECK_RANGE(src_x1 + width) && CHECK_RANGE(src_y1 + height) - && CHECK_RANGE(dst_x1 + width) && CHECK_RANGE(dst_y1 + - height) && - CHECK_RANGE(src_pitch) && CHECK_RANGE(dst_pitch)); -#undef CHECK_RANGE igt_assert(bpp*(src_x1 + width) <= 8*src_pitch); igt_assert(bpp*(dst_x1 + width) <= 8*dst_pitch); igt_assert(src_pitch * (src_y1 + height) <= src_bo->size); @@ -360,6 +351,18 @@ intel_blt_copy(struct intel_batchbuffer *batch, cmd_bits |= XY_SRC_COPY_BLT_DST_TILED; } +#define CHECK_RANGE(x) ((x) >= 0 && (x) < (1 << 15)) + igt_assert(CHECK_RANGE(src_x1) && CHECK_RANGE(src_y1) && + CHECK_RANGE(dst_x1) && CHECK_RANGE(dst_y1) && + CHECK_RANGE(width) && CHECK_RANGE(height) && + CHECK_RANGE(src_x1 + width) && + CHECK_RANGE(src_y1 + height) && + CHECK_RANGE(dst_x1 + width) && + CHECK_RANGE(dst_y1 + height) && + CHECK_RANGE(src_pitch) && + CHECK_RANGE(dst_pitch)); +#undef CHECK_RANGE + br13_bits = 0; switch (bpp) { case 8: -- cgit v1.2.3