diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2015-03-18 08:33:22 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2015-03-18 08:37:33 +0000 |
commit | d3e9316b441bc172f5936e787879d1d13f1f7a01 (patch) | |
tree | 5fcf515b3ef54fdba344958ad6fd40c41be36878 /lib/intel_batchbuffer.c | |
parent | 233808a58db1f62d773b03f9dad599924170aca6 (diff) |
lib/batch: Fix range checks for blits
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib/intel_batchbuffer.c')
-rw-r--r-- | lib/intel_batchbuffer.c | 21 |
1 files changed, 12 insertions, 9 deletions
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: |