summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2018-08-08 12:30:21 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2018-08-08 17:01:52 +0100
commit9ec3471f6e4f5e51880713d4c03e801167d34d00 (patch)
tree401b1378580a3081d2f92c387a80ded6c0855fea
parent779d2d42f9db6a2797d1ef50036af6fac4e62e73 (diff)
igt/gem_eio: Preserve batch between reset-stress iterations
We can keep the original batch around and avoid recreating it between reset iterations to focus on the impact of resets. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
-rw-r--r--tests/gem_eio.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/tests/gem_eio.c b/tests/gem_eio.c
index de161332..5250a414 100644
--- a/tests/gem_eio.c
+++ b/tests/gem_eio.c
@@ -650,35 +650,38 @@ static void reset_stress(int fd,
uint32_t ctx0, unsigned int engine,
unsigned int flags)
{
+ const uint32_t bbe = MI_BATCH_BUFFER_END;
+ struct drm_i915_gem_exec_object2 obj = {
+ .handle = gem_create(fd, 4096)
+ };
+ struct drm_i915_gem_execbuffer2 execbuf = {
+ .buffers_ptr = to_user_pointer(&obj),
+ .buffer_count = 1,
+ .flags = engine,
+ };
+ gem_write(fd, obj.handle, 0, &bbe, sizeof(bbe));
+
igt_until_timeout(5) {
- struct drm_i915_gem_execbuffer2 execbuf = { };
- struct drm_i915_gem_exec_object2 obj = { };
- uint32_t bbe = MI_BATCH_BUFFER_END;
+ uint32_t ctx = context_create_safe(fd);
igt_spin_t *hang;
unsigned int i;
- uint32_t ctx;
gem_quiescent_gpu(fd);
igt_require(i915_reset_control(flags & TEST_WEDGE ?
false : true));
- ctx = context_create_safe(fd);
-
/*
* Start executing a spin batch with some queued batches
* against a different context after it.
*/
hang = spin_sync(fd, ctx0, engine);
- obj.handle = gem_create(fd, 4096);
- gem_write(fd, obj.handle, 0, &bbe, sizeof(bbe));
+ execbuf.rsvd1 = ctx;
+ for (i = 0; i < 10; i++)
+ gem_execbuf(fd, &execbuf);
- execbuf.buffers_ptr = to_user_pointer(&obj);
- execbuf.buffer_count = 1;
execbuf.rsvd1 = ctx0;
- execbuf.flags = engine;
-
for (i = 0; i < 10; i++)
gem_execbuf(fd, &execbuf);
@@ -706,8 +709,9 @@ static void reset_stress(int fd,
gem_sync(fd, obj.handle);
igt_spin_batch_free(fd, hang);
gem_context_destroy(fd, ctx);
- gem_close(fd, obj.handle);
}
+
+ gem_close(fd, obj.handle);
}
/*