lib/batch: Fix range checks for blits

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2015-03-18 08:33:22 +00:00
parent 233808a58d
commit d3e9316b44

View File

@ -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: