Commit f3c54d0c authored by Daniel Vetter's avatar Daniel Vetter

tests: use igt_assert/igt_require more

With the new _f variants we can replace almost all of them.

Also remove a ton of checks for argc != 1, they're a bit useless ...
Signed-off-by: Daniel Vetter's avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 88ad6d7b
......@@ -159,11 +159,9 @@ int main(int argc, char **argv)
drm_intel_bo_map(scratch_bo, false);
cpu_ptr = scratch_bo->virtual;
for (j = 0; j < len; j++) {
if (cpu_ptr[j] != val0) {
printf("mismatch at %i, got: %i, expected: %i\n",
j, cpu_ptr[j], val0);
igt_fail(1);
}
igt_assert_f(cpu_ptr[j] == val0,
"mismatch at %i, got: %i, expected: %i\n",
j, cpu_ptr[j], val0);
}
drm_intel_bo_unmap(scratch_bo);
......@@ -196,25 +194,19 @@ int main(int argc, char **argv)
gtt_ptr = staging_bo->virtual;
for (j = 0; j < start; j++) {
if (gtt_ptr[j] != val0) {
printf("mismatch at %i, partial=[%d+%d] got: %i, expected: %i\n",
j, start, len, gtt_ptr[j], val0);
igt_fail(1);
}
igt_assert_f(gtt_ptr[j] == val0,
"mismatch at %i, partial=[%d+%d] got: %i, expected: %i\n",
j, start, len, gtt_ptr[j], val0);
}
for (; j < start + len; j++) {
if (gtt_ptr[j] != val1) {
printf("mismatch at %i, partial=[%d+%d] got: %i, expected: %i\n",
j, start, len, gtt_ptr[j], val1);
igt_fail(1);
}
igt_assert_f(gtt_ptr[j] == val1,
"mismatch at %i, partial=[%d+%d] got: %i, expected: %i\n",
j, start, len, gtt_ptr[j], val1);
}
for (; j < BO_SIZE; j++) {
if (gtt_ptr[j] != val0) {
printf("mismatch at %i, partial=[%d+%d] got: %i, expected: %i\n",
j, start, len, gtt_ptr[j], val0);
igt_fail(1);
}
igt_assert_f(gtt_ptr[j] == val0,
"mismatch at %i, partial=[%d+%d] got: %i, expected: %i\n",
j, start, len, gtt_ptr[j], val0);
}
drm_intel_gem_bo_unmap_gtt(staging_bo);
......@@ -240,11 +232,9 @@ int main(int argc, char **argv)
do_or_die(drm_intel_bo_map(scratch_bo, false));
cpu_ptr = scratch_bo->virtual;
for (j = 0; j < len; j++) {
if (cpu_ptr[j] != val0) {
printf("mismatch in read at %i, got: %i, expected: %i\n",
j, cpu_ptr[j], val0);
igt_fail(1);
}
igt_assert_f(cpu_ptr[j] == val0,
"mismatch in read at %i, got: %i, expected: %i\n",
j, cpu_ptr[j], val0);
}
drm_intel_bo_unmap(scratch_bo);
......@@ -267,25 +257,19 @@ int main(int argc, char **argv)
gtt_ptr = staging_bo->virtual;
for (j = 0; j < start; j++) {
if (gtt_ptr[j] != val1) {
printf("mismatch at %i, partial=[%d+%d] got: %i, expected: %i\n",
j, start, len, gtt_ptr[j], val1);
igt_fail(1);
}
igt_assert_f(gtt_ptr[j] == val1,
"mismatch at %i, partial=[%d+%d] got: %i, expected: %i\n",
j, start, len, gtt_ptr[j], val1);
}
for (; j < start + len; j++) {
if (gtt_ptr[j] != val2) {
printf("mismatch at %i, partial=[%d+%d] got: %i, expected: %i\n",
j, start, len, gtt_ptr[j], val2);
igt_fail(1);
}
igt_assert_f(gtt_ptr[j] == val2,
"mismatch at %i, partial=[%d+%d] got: %i, expected: %i\n",
j, start, len, gtt_ptr[j], val2);
}
for (; j < BO_SIZE; j++) {
if (gtt_ptr[j] != val1) {
printf("mismatch at %i, partial=[%d+%d] got: %i, expected: %i\n",
j, start, len, gtt_ptr[j], val1);
igt_fail(1);
}
igt_assert_f(gtt_ptr[j] == val1,
"mismatch at %i, partial=[%d+%d] got: %i, expected: %i\n",
j, start, len, gtt_ptr[j], val1);
}
drm_intel_gem_bo_unmap_gtt(staging_bo);
drm_intel_bo_unmap(scratch_bo);
......
......@@ -100,10 +100,7 @@ int main(int argc, char **argv)
fd = drm_open_any();
bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
if (!bufmgr) {
fprintf(stderr, "failed to init libdrm\n");
igt_fail(-1);
}
igt_assert(bufmgr);
drm_intel_bufmgr_gem_enable_reuse(bufmgr);
......
......@@ -125,8 +125,7 @@ static void run_on_ring(int fd, unsigned ring_id, const char *ring_name)
gem_close(fd, handle);
}
if (exec(fd, handle_new, split, &gtt_offset_new, 0))
igt_fail(1);
igt_assert(exec(fd, handle_new, split, &gtt_offset_new, 0) == 0);
if (split > 0) {
/* Check that we've managed to collide in the tlb. */
......
......@@ -99,11 +99,6 @@ int main(int argc, char **argv)
igt_skip_on_simulation();
if (argc != 1) {
fprintf(stderr, "usage: %s\n", argv[0]);
igt_fail(-1);
}
fd = drm_open_any();
devid = intel_get_drm_devid(fd);
if (!HAS_BLT_RING(devid)) {
......@@ -112,29 +107,17 @@ int main(int argc, char **argv)
}
bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
if (!bufmgr) {
fprintf(stderr, "failed to init libdrm\n");
igt_fail(-1);
}
igt_assert(bufmgr);
drm_intel_bufmgr_gem_enable_reuse(bufmgr);
batch = intel_batchbuffer_alloc(bufmgr, devid);
if (!batch) {
fprintf(stderr, "failed to create batch buffer\n");
igt_fail(-1);
}
igt_assert(batch);
target_buffer = drm_intel_bo_alloc(bufmgr, "target bo", 4096, 4096);
if (!target_buffer) {
fprintf(stderr, "failed to alloc target buffer\n");
igt_fail(-1);
}
igt_assert(target_buffer);
blt_bo = drm_intel_bo_alloc(bufmgr, "target bo", 4*4096*4096, 4096);
if (!blt_bo) {
fprintf(stderr, "failed to alloc blt buffer\n");
igt_fail(-1);
}
igt_assert(blt_bo);
dummy_reloc_loop();
......
......@@ -144,10 +144,7 @@ static void multi_write_domain(int fd)
gem_close(fd, handle);
gem_close(fd, handle_target);
if (ret == 0 || errno != EINVAL) {
fprintf(stderr, "multiple write domains not rejected\n");
igt_fail(1);
}
igt_assert(ret != 0 && errno == EINVAL);
}
int fd;
......
......@@ -114,8 +114,7 @@ int main(int argc, char **argv)
gem_write(fd, handle, 0, batch, sizeof(batch));
for (reloc_ofs = 4096; reloc_ofs < batch_size; reloc_ofs += 4096)
if (exec(fd, handle, reloc_ofs))
igt_fail(1);
igt_assert(exec(fd, handle, reloc_ofs) == 0);
}
gem_close(fd, handle);
......
......@@ -97,8 +97,7 @@ static void loop(int fd, uint32_t handle, unsigned ring_id, const char *ring_nam
struct timeval start, end;
gettimeofday(&start, NULL);
if (exec(fd, handle, count, ring_id))
igt_fail(1);
igt_assert(exec(fd, handle, count, ring_id) == 0);
gettimeofday(&end, NULL);
printf("Time to exec x %d: %7.3fµs (ring=%s)\n",
count, elapsed(&start, &end, count), ring_name);
......
......@@ -128,20 +128,16 @@ _bo_write_verify(struct test *t)
for (i = 0; i < dwords; i++) {
a[i] = i;
v = a[i];
if (v != i) {
printf("tiling %s: write failed at %d (%x)\n",
tile_str[t->tiling], i, v);
igt_fail(-1);
}
igt_assert_f(v == i,
"tiling %s: write failed at %d (%x)\n",
tile_str[t->tiling], i, v);
}
for (i = 0; i < dwords; i++) {
v = a[i];
if (v != i) {
printf("tiling %s: verify failed at %d (%x)\n",
tile_str[t->tiling], i, v);
igt_fail(-2);
}
igt_assert_f(v == i,
"tiling %s: verify failed at %d (%x)\n",
tile_str[t->tiling], i, v);
}
}
......
......@@ -48,7 +48,6 @@ test_large_object(int fd)
struct drm_i915_gem_create create;
struct drm_i915_gem_pin pin;
uint32_t obj_size;
int ret;
memset(&create, 0, sizeof(create));
memset(&pin, 0, sizeof(pin));
......@@ -62,20 +61,10 @@ test_large_object(int fd)
create.size = obj_size;
printf("obj size %i\n", obj_size);
ret = ioctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create);
if (ret) {
fprintf(stderr, "object creation failed: %s\n",
strerror(errno));
igt_fail(ret);
}
igt_assert(ioctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create) == 0);
pin.handle = create.handle;
ret = ioctl(fd, DRM_IOCTL_I915_GEM_PIN, &pin);
if (ret) {
fprintf(stderr, "pin failed: %s\n",
strerror(errno));
igt_fail(ret);
}
igt_assert(ioctl(fd, DRM_IOCTL_I915_GEM_PIN, &pin) == 0);
gem_write(fd, create.handle, 0, data, obj_size);
......
......@@ -81,11 +81,6 @@ int main(int argc, char **argv)
int fd;
int devid;
if (argc != 1) {
fprintf(stderr, "usage: %s\n", argv[0]);
igt_fail(-1);
}
fd = drm_open_any();
devid = intel_get_drm_devid(fd);
......@@ -99,17 +94,11 @@ int main(int argc, char **argv)
printf("num rings detected: %i\n", num_rings);
bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
if (!bufmgr) {
fprintf(stderr, "failed to init libdrm\n");
igt_fail(-1);
}
igt_assert(bufmgr);
drm_intel_bufmgr_gem_enable_reuse(bufmgr);
batch = intel_batchbuffer_alloc(bufmgr, devid);
if (!batch) {
fprintf(stderr, "failed to create batch buffer\n");
igt_fail(-1);
}
igt_assert(batch);
mi_lri_loop();
gem_quiescent_gpu(fd);
......
......@@ -120,11 +120,9 @@ static void test_partial_reads(void)
drm_intel_bo_get_subdata(scratch_bo, start, len, tmp);
for (j = 0; j < len; j++) {
if (tmp[j] != val) {
printf("mismatch at %i, got: %i, expected: %i\n",
j, tmp[j], val);
igt_fail(1);
}
igt_assert_f(tmp[j] == val,
"mismatch at %i, got: %i, expected: %i\n",
j, tmp[j], val);
}
igt_progress("partial reads test: ", i, ROUNDS);
......@@ -156,25 +154,19 @@ static void test_partial_writes(void)
gtt_ptr = staging_bo->virtual;
for (j = 0; j < start; j++) {
if (gtt_ptr[j] != val) {
printf("mismatch at %i, got: %i, expected: %i\n",
j, tmp[j], val);
igt_fail(1);
}
igt_assert_f(gtt_ptr[j] == val,
"mismatch at %i, got: %i, expected: %i\n",
j, tmp[j], val);
}
for (; j < start + len; j++) {
if (gtt_ptr[j] != tmp[0]) {
printf("mismatch at %i, got: %i, expected: %i\n",
j, tmp[j], i);
igt_fail(1);
}
igt_assert_f(gtt_ptr[j] == tmp[0],
"mismatch at %i, got: %i, expected: %i\n",
j, tmp[j], i);
}
for (; j < BO_SIZE; j++) {
if (gtt_ptr[j] != val) {
printf("mismatch at %i, got: %i, expected: %i\n",
j, tmp[j], val);
igt_fail(1);
}
igt_assert_f(gtt_ptr[j] == val,
"mismatch at %i, got: %i, expected: %i\n",
j, tmp[j], val);
}
drm_intel_gem_bo_unmap_gtt(staging_bo);
......@@ -201,11 +193,9 @@ static void test_partial_read_writes(void)
drm_intel_bo_get_subdata(scratch_bo, start, len, tmp);
for (j = 0; j < len; j++) {
if (tmp[j] != val) {
printf("mismatch in read at %i, got: %i, expected: %i\n",
j, tmp[j], val);
igt_fail(1);
}
igt_assert_f(tmp[j] == val,
"mismatch in read at %i, got: %i, expected: %i\n",
j, tmp[j], val);
}
/* Change contents through gtt to make the pread cachelines
......@@ -226,25 +216,19 @@ static void test_partial_read_writes(void)
gtt_ptr = staging_bo->virtual;
for (j = 0; j < start; j++) {
if (gtt_ptr[j] != val) {
printf("mismatch at %i, got: %i, expected: %i\n",
j, tmp[j], val);
igt_fail(1);
}
igt_assert_f(gtt_ptr[j] == val,
"mismatch at %i, got: %i, expected: %i\n",
j, tmp[j], val);
}
for (; j < start + len; j++) {
if (gtt_ptr[j] != tmp[0]) {
printf("mismatch at %i, got: %i, expected: %i\n",
j, tmp[j], tmp[0]);
igt_fail(1);
}
igt_assert_f(gtt_ptr[j] == tmp[0],
"mismatch at %i, got: %i, expected: %i\n",
j, tmp[j], tmp[0]);
}
for (; j < BO_SIZE; j++) {
if (gtt_ptr[j] != val) {
printf("mismatch at %i, got: %i, expected: %i\n",
j, tmp[j], val);
igt_fail(1);
}
igt_assert_f(gtt_ptr[j] == val,
"mismatch at %i, got: %i, expected: %i\n",
j, tmp[j], val);
}
drm_intel_gem_bo_unmap_gtt(staging_bo);
......
......@@ -257,11 +257,9 @@ static void do_test(int fd, bool faulting_reloc)
for (repeat = 0; repeat < 8; repeat++) {
drm_intel_bo_get_subdata(pc_target_bo[i],
repeat*small_pitch, 4, &test);
if (test != 0xdeadbeef) {
fprintf(stderr, "mismatch in buffer %i: 0x%08x instead of 0xdeadbeef at offset %i\n",
i, test, repeat*small_pitch);
igt_fail(1);
}
igt_assert_f(test == 0xdeadbeef,
"mismatch in buffer %i: 0x%08x instead of 0xdeadbeef at offset %i\n",
i, test, repeat*small_pitch);
}
drm_intel_bo_unreference(pc_target_bo[i]);
drm_intel_bo_unreference(special_bos[i]);
......
......@@ -73,10 +73,7 @@ store_pipe_control_loop(bool preuse_buffer)
/* we want to check tlb consistency of the pipe_control target,
* so get a new buffer every time around */
target_bo = drm_intel_bo_alloc(bufmgr, "target bo", 4096, 4096);
if (!target_bo) {
fprintf(stderr, "failed to alloc target buffer\n");
igt_fail(-1);
}
igt_assert(target_bo);
if (preuse_buffer) {
BEGIN_BATCH(6);
......
......@@ -256,10 +256,8 @@ static void do_test(int fd, bool faulting_reloc)
/* Only check at the end to avoid unnecessary synchronous behaviour. */
for (i = 0; i < NUM_TARGET_BOS; i++) {
drm_intel_bo_get_subdata(pc_target_bo[i], 0, 4, &test);
if (test != 0xdeadbeef) {
fprintf(stderr, "mismatch in buffer %i: 0x%08x instead of 0xdeadbeef\n", i, test);
igt_fail(1);
}
igt_assert_f(test == 0xdeadbeef,
"mismatch in buffer %i: 0x%08x instead of 0xdeadbeef\n", i, test);
drm_intel_bo_unreference(pc_target_bo[i]);
}
......
......@@ -95,11 +95,6 @@ int main(int argc, char **argv)
int fd;
int devid;
if (argc != 1) {
fprintf(stderr, "usage: %s\n", argv[0]);
igt_fail(-1);
}
fd = drm_open_any();
devid = intel_get_drm_devid(fd);
if (!HAS_BLT_RING(devid)) {
......@@ -109,23 +104,14 @@ int main(int argc, char **argv)
bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
if (!bufmgr) {
fprintf(stderr, "failed to init libdrm\n");
igt_fail(-1);
}
igt_assert(bufmgr);
drm_intel_bufmgr_gem_enable_reuse(bufmgr);
batch = intel_batchbuffer_alloc(bufmgr, devid);
if (!batch) {
fprintf(stderr, "failed to create batch buffer\n");
igt_fail(-1);
}
igt_assert(batch);
target_buffer = drm_intel_bo_alloc(bufmgr, "target bo", 4096, 4096);
if (!target_buffer) {
fprintf(stderr, "failed to alloc target buffer\n");
igt_fail(-1);
}
igt_assert(target_buffer);
store_dword_loop(fd);
......
......@@ -79,12 +79,9 @@ store_dword_loop(int divider)
drm_intel_bo_map(target_buffer, 0);
buf = target_buffer->virtual;
if (buf[0] != val) {
fprintf(stderr,
"value mismatch: cur 0x%08x, stored 0x%08x\n",
buf[0], val);
igt_fail(-1);
}
igt_assert_f(buf[0] == val,
"value mismatch: cur 0x%08x, stored 0x%08x\n",
buf[0], val);
drm_intel_bo_unmap(target_buffer);
......@@ -105,47 +102,27 @@ int main(int argc, char **argv)
int fd;
int devid;
if (argc != 1) {
fprintf(stderr, "usage: %s\n", argv[0]);
igt_fail(-1);
}
fd = drm_open_any();
devid = intel_get_drm_devid(fd);
has_ppgtt = gem_uses_aliasing_ppgtt(fd);
if (IS_GEN2(devid) || IS_GEN3(devid) || IS_GEN4(devid) || IS_GEN5(devid)) {
fprintf(stderr, "MI_STORE_DATA can only use GTT address on gen4+/g33 and "
"needs snoopable mem on pre-gen6\n");
return 77;
}
igt_skip_on_f(intel_gen(devid) < 6,
"MI_STORE_DATA can only use GTT address on gen4+/g33 and "
"needs snoopable mem on pre-gen6\n");
/* This only works with ppgtt */
if (!has_ppgtt) {
fprintf(stderr, "no ppgtt detected, which is required\n");
return 77;
}
igt_require(has_ppgtt);
bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
if (!bufmgr) {
fprintf(stderr, "failed to init libdrm\n");
igt_fail(-1);
}
igt_assert(bufmgr);
drm_intel_bufmgr_gem_enable_reuse(bufmgr);
batch = intel_batchbuffer_alloc(bufmgr, devid);
if (!batch) {
fprintf(stderr, "failed to create batch buffer\n");
igt_fail(-1);
}
igt_assert(batch);
target_buffer = drm_intel_bo_alloc(bufmgr, "target bo", 4096, 4096);
if (!target_buffer) {
fprintf(stderr, "failed to alloc target buffer\n");
igt_fail(-1);
}
igt_assert(target_buffer);
store_dword_loop(1);
store_dword_loop(2);
......
......@@ -79,12 +79,9 @@ store_dword_loop(int divider)
drm_intel_bo_map(target_buffer, 0);
buf = target_buffer->virtual;
if (buf[0] != val) {
fprintf(stderr,
"value mismatch: cur 0x%08x, stored 0x%08x\n",
buf[0], val);
igt_fail(-1);
}
igt_assert_f(buf[0] == val,
"value mismatch: cur 0x%08x, stored 0x%08x\n",
buf[0], val);
drm_intel_bo_unmap(target_buffer);
......@@ -105,53 +102,30 @@ int main(int argc, char **argv)
int fd;
int devid;
if (argc != 1) {
fprintf(stderr, "usage: %s\n", argv[0]);
igt_fail(-1);
}
fd = drm_open_any();
devid = intel_get_drm_devid(fd);
has_ppgtt = gem_uses_aliasing_ppgtt(fd);
if (IS_GEN2(devid) || IS_GEN3(devid) || IS_GEN4(devid) || IS_GEN5(devid)) {
fprintf(stderr, "MI_STORE_DATA can only use GTT address on gen4+/g33 and "
"needs snoopable mem on pre-gen6\n");
return 77;
}
if (IS_GEN6(devid)) {
igt_skip_on_f(intel_gen(devid) < 6,
"MI_STORE_DATA can only use GTT address on gen4+/g33 and "
"needs snoopable mem on pre-gen6\n");
fprintf(stderr, "MI_STORE_DATA broken on gen6 bsd\n");
return 77;
}
igt_skip_on_f(intel_gen(devid) == 6,
"MI_STORE_DATA broken on gen6 bsd\n");
/* This only works with ppgtt */
if (!has_ppgtt) {
fprintf(stderr, "no ppgtt detected, which is required\n");
return 77;
}
igt_require(has_ppgtt);
bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
if (!bufmgr) {
fprintf(stderr, "failed to init libdrm\n");
igt_fail(-1);
}
igt_assert(bufmgr);
drm_intel_bufmgr_gem_enable_reuse(bufmgr);
batch = intel_batchbuffer_alloc(bufmgr, devid);
if (!batch) {
fprintf(stderr, "failed to create batch buffer\n");
igt_fail(-1);
}
igt_assert(batch);
target_buffer = drm_intel_bo_alloc(bufmgr, "target bo", 4096, 4096);
if (!target_buffer) {
fprintf(stderr, "failed to alloc target buffer\n");
igt_fail(-1);
}
igt_assert(target_buffer);
store_dword_loop(1);
store_dword_loop(2);
......
......@@ -79,12 +79,9 @@ store_dword_loop(int divider)
drm_intel_bo_map(target_buffer, 0);
buf = target_buffer->virtual;
if (buf[0] != val) {
fprintf(stderr,
"value mismatch: cur 0x%08x, stored 0x%08x\n",
buf[0], val);
igt_fail(-1);
}
igt_assert_f(buf[0] == val,
"value mismatch: cur 0x%08x, stored 0x%08x\n",
buf[0], val);
drm_intel_bo_unmap(target_buffer);
......@@ -105,41 +102,24 @@ int main(int argc, char **argv)
int fd;
int devid;
if (argc != 1) {
fprintf(stderr, "usage: %s\n", argv[0]);
igt_fail(-1);
}
fd = drm_open_any();
devid = intel_get_drm_devid(fd);
has_ppgtt = gem_uses_aliasing_ppgtt(fd);
if (IS_GEN2(devid) || IS_GEN3(devid) || IS_GEN4(devid) || IS_GEN5(devid)) {
fprintf(stderr, "MI_STORE_DATA can only use GTT address on gen4+/g33 and "
"needs snoopable mem on pre-gen6\n");
return 77;
}
igt_skip_on_f(intel_gen(devid) < 6,
"MI_STORE_DATA can only use GTT address on gen4+/g33 and "
"needs snoopable mem on pre-gen6\n");
bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
if (!bufmgr) {
fprintf(stderr, "failed to init libdrm\n");
igt_fail(-1);
}
igt_assert(bufmgr);
drm_intel_bufmgr_gem_enable_reuse(bufmgr);
batch = intel_batchbuffer_alloc(bufmgr, devid);
if (!batch) {
fprintf(stderr, "failed to create batch buffer\n");
igt_fail(-1);
}
igt_assert(batch);
target_buffer = drm_intel_bo_alloc(bufmgr, "target bo", 4096, 4096);
if (!target_buffer) {
fprintf(stderr, "failed to alloc target buffer\n");
igt_fail(-1);
}
igt_assert(target_buffer);
store_dword_loop(1);
store_dword_loop(2);
......
......@@ -102,28 +102,18 @@ int main(int argc, char **argv)
fd = drm_open_any();
/* This only works with ppgtt */
if (!gem_has_vebox(fd) || !gem_uses_aliasing_ppgtt(fd))
return 77;
igt_require(gem_has_vebox(fd));
igt_require(gem_uses_aliasing_ppgtt(fd));
bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
if (!bufmgr) {
fprintf(stderr, "failed to init libdrm\n");
igt_fail(-1);
}
igt_assert(bufmgr);
drm_intel_bufmgr_gem_enable_reuse(bufmgr);
batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
if (!batch) {
fprintf(stderr, "failed to create batch buffer\n");
igt_fail(-1);
}
igt_require(batch);
target_buffer = drm_intel_bo_alloc(bufmgr, "target bo", 4096, 4096);
if (!target_buffer) {
fprintf(stderr, "failed to alloc target buffer\n");
igt_fail(-1);
}
igt_require(target_buffer);
store_dword_loop(1);