summaryrefslogtreecommitdiff
path: root/tests/i915/gem_spin_batch.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2021-01-08 14:42:16 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2021-01-08 23:40:22 +0000
commit7332945691550d2d59a33abc84cd594d211e0446 (patch)
tree5bc5b3105de03fe77becd5f3d2f69656003603cb /tests/i915/gem_spin_batch.c
parentfec3b9c7d88357144f0d7a1447b9316a1c81da1a (diff)
i915/gem_spin_batch: Remove redundant outer context for resumbit
Allow resubmit to run on contextless platforms. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Acked-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Diffstat (limited to 'tests/i915/gem_spin_batch.c')
-rw-r--r--tests/i915/gem_spin_batch.c46
1 files changed, 17 insertions, 29 deletions
diff --git a/tests/i915/gem_spin_batch.c b/tests/i915/gem_spin_batch.c
index 2ec27885..e8abfab8 100644
--- a/tests/i915/gem_spin_batch.c
+++ b/tests/i915/gem_spin_batch.c
@@ -77,45 +77,33 @@ static void spin(int fd,
static void spin_resubmit(int fd, unsigned int engine, unsigned int flags)
{
- const uint32_t ctx0 = gem_context_clone_with_engines(fd, 0);
- const uint32_t ctx1 =
- (flags & RESUBMIT_NEW_CTX) ?
- gem_context_clone_with_engines(fd, 0) : ctx0;
- igt_spin_t *spin = __igt_spin_new(fd, .ctx = ctx0, .engine = engine);
- const struct intel_execution_engine2 *other;
-
- struct drm_i915_gem_execbuffer2 eb = {
- .buffer_count = 1,
- .buffers_ptr = to_user_pointer(&spin->obj[IGT_SPIN_BATCH]),
- .rsvd1 = ctx1,
- };
-
- igt_assert(gem_context_has_engine_map(fd, 0) ||
- !(flags & RESUBMIT_ALL_ENGINES));
+ igt_spin_t *spin;
+
+ if (flags & RESUBMIT_NEW_CTX)
+ igt_require(gem_has_contexts(fd));
+
+ spin = __igt_spin_new(fd, .engine = engine);
+ if (flags & RESUBMIT_NEW_CTX)
+ spin->execbuf.rsvd1 = gem_context_clone_with_engines(fd, 0);
if (flags & RESUBMIT_ALL_ENGINES) {
- for_each_context_engine(fd, ctx1, other) {
- if (other->flags == engine)
- continue;
+ const struct intel_execution_engine2 *other;
- eb.flags = other->flags;
- gem_execbuf(fd, &eb);
+ for_each_context_engine(fd, spin->execbuf.rsvd1, other) {
+ spin->execbuf.flags &= 0x3f;
+ spin->execbuf.flags |= other->flags;
+ gem_execbuf(fd, &spin->execbuf);
}
- } else {
- eb.flags = engine;
- gem_execbuf(fd, &eb);
}
+ gem_execbuf(fd, &spin->execbuf);
igt_spin_end(spin);
-
gem_sync(fd, spin->handle);
- igt_spin_free(fd, spin);
-
- if (ctx1 != ctx0)
- gem_context_destroy(fd, ctx1);
+ if (spin->execbuf.rsvd1)
+ gem_context_destroy(fd, spin->execbuf.rsvd1);
- gem_context_destroy(fd, ctx0);
+ igt_spin_free(fd, spin);
}
static void spin_exit_handler(int sig)