[PATCH i-g-t 23/52] tests/gem_spin_batch: Adopt to use no-reloc
Zbigniew Kempczyński
zbigniew.kempczynski at intel.com
Thu Jul 1 12:37:03 UTC 2021
Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
---
tests/i915/gem_spin_batch.c | 35 +++++++++++++++++++++++++++--------
1 file changed, 27 insertions(+), 8 deletions(-)
diff --git a/tests/i915/gem_spin_batch.c b/tests/i915/gem_spin_batch.c
index db0af018e..ec4ea4623 100644
--- a/tests/i915/gem_spin_batch.c
+++ b/tests/i915/gem_spin_batch.c
@@ -24,6 +24,7 @@
#include "i915/gem.h"
#include "i915/gem_ring.h"
+#include "i915/gem_create.h"
#include "igt.h"
#define MAX_ERROR 5 /* % */
@@ -45,11 +46,13 @@ static void spin(int fd,
struct timespec tv = { };
struct timespec itv = { };
uint64_t elapsed;
+ uint64_t ahnd = get_reloc_ahnd(fd, 0);
- spin = __igt_spin_new(fd, .engine = engine, .flags = flags);
+ spin = __igt_spin_new(fd, .ahnd = ahnd, .engine = engine, .flags = flags);
while ((elapsed = igt_nsec_elapsed(&tv)) >> 30 < timeout_sec) {
igt_spin_t *next =
- __igt_spin_new(fd, .engine = engine, .flags = flags);
+ __igt_spin_new(fd, .ahnd = ahnd,
+ .engine = engine, .flags = flags);
igt_spin_set_timeout(spin,
timeout_100ms - igt_nsec_elapsed(&itv));
@@ -65,6 +68,7 @@ static void spin(int fd,
loops++;
}
igt_spin_free(fd, spin);
+ put_ahnd(ahnd);
igt_info("Completed %ld loops in %lld ns, target %ld\n",
loops, (long long)elapsed, (long)(elapsed / timeout_100ms));
@@ -78,11 +82,12 @@ static void spin(int fd,
static void spin_resubmit(int fd, unsigned int engine, unsigned int flags)
{
igt_spin_t *spin;
+ uint64_t ahnd = get_reloc_ahnd(fd, 0);
if (flags & RESUBMIT_NEW_CTX)
igt_require(gem_has_contexts(fd));
- spin = __igt_spin_new(fd, .engine = engine);
+ spin = __igt_spin_new(fd, .ahnd = ahnd, .engine = engine);
if (flags & RESUBMIT_NEW_CTX)
spin->execbuf.rsvd1 = gem_context_clone_with_engines(fd, 0);
@@ -104,6 +109,7 @@ static void spin_resubmit(int fd, unsigned int engine, unsigned int flags)
gem_context_destroy(fd, spin->execbuf.rsvd1);
igt_spin_free(fd, spin);
+ put_ahnd(ahnd);
}
static void spin_exit_handler(int sig)
@@ -131,6 +137,7 @@ static void spin_all(int i915, unsigned int flags)
{
const struct intel_execution_engine2 *e;
struct igt_spin *spin, *n;
+ uint64_t ahnd;
IGT_LIST_HEAD(list);
__for_each_physical_engine(i915, e) {
@@ -142,9 +149,11 @@ static void spin_all(int i915, unsigned int flags)
ctx = 0;
if (flags & PARALLEL_SPIN_NEW_CTX)
ctx = gem_context_clone_with_engines(i915, 0);
+ ahnd = get_reloc_ahnd(i915, ctx);
/* Prevent preemption so only one is allowed on each engine */
spin = igt_spin_new(i915,
+ .ahnd = ahnd,
.ctx_id = ctx,
.engine = e->flags,
.flags = (IGT_SPIN_POLL_RUN |
@@ -158,9 +167,11 @@ static void spin_all(int i915, unsigned int flags)
igt_list_for_each_entry_safe(spin, n, &list, link) {
igt_assert(gem_bo_busy(i915, spin->handle));
+ ahnd = spin->ahnd;
igt_spin_end(spin);
gem_sync(i915, spin->handle);
igt_spin_free(i915, spin);
+ put_ahnd(ahnd);
}
}
@@ -239,12 +250,20 @@ igt_main
#undef test_each_engine
- igt_subtest("spin-each")
- spin_on_all_engines(fd, 0, 3);
+ igt_subtest_group {
+ igt_fixture
+ intel_allocator_multiprocess_start();
- igt_subtest("user-each") {
- igt_require(has_userptr(fd));
- spin_on_all_engines(fd, IGT_SPIN_USERPTR, 3);
+ igt_subtest("spin-each")
+ spin_on_all_engines(fd, 0, 3);
+
+ igt_subtest("user-each") {
+ igt_require(has_userptr(fd));
+ spin_on_all_engines(fd, IGT_SPIN_USERPTR, 3);
+ }
+
+ igt_fixture
+ intel_allocator_multiprocess_stop();
}
igt_fixture {
--
2.26.0
More information about the Intel-gfx-trybot
mailing list