summaryrefslogtreecommitdiff
path: root/tests/i915/gem_wait.c
diff options
context:
space:
mode:
authorJason Ekstrand <jason@jlekstrand.net>2021-03-31 20:44:29 -0500
committerJason Ekstrand <jason@jlekstrand.net>2021-07-08 12:45:33 -0500
commit73aae64c813b3c6d901a94891cb691c50ad35e9e (patch)
treec45f9e151f3a71c73d7470fe406e5887d8cd4ee6 /tests/i915/gem_wait.c
parent2e303c4bd10153b451159f7103bdf708ca011f8d (diff)
tests/i915/gem_wait: Convert to intel_ctx_t (v2)
v2 (Zbigniew Kempczyński): - Don't NULL-init ctx Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> Acked-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Diffstat (limited to 'tests/i915/gem_wait.c')
-rw-r--r--tests/i915/gem_wait.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/tests/i915/gem_wait.c b/tests/i915/gem_wait.c
index 81ac25b5..d56707ed 100644
--- a/tests/i915/gem_wait.c
+++ b/tests/i915/gem_wait.c
@@ -75,13 +75,15 @@ static void invalid_buf(int fd)
#define timespec_isset(x) ((x)->tv_sec | (x)->tv_nsec)
-static void basic(int fd, unsigned engine, unsigned flags)
+static void basic(int fd, const intel_ctx_t *ctx, unsigned engine,
+ unsigned flags)
{
IGT_CORK_HANDLE(cork);
uint32_t plug =
flags & (WRITE | AWAIT) ? igt_cork_plug(&cork, fd) : 0;
igt_spin_t *spin =
igt_spin_new(fd,
+ .ctx = ctx,
.engine = engine,
.dependency = plug,
.flags = (flags & HANG) ? IGT_SPIN_NO_PREEMPTION : 0);
@@ -147,21 +149,22 @@ static void basic(int fd, unsigned engine, unsigned flags)
igt_spin_free(fd, spin);
}
-static void test_all_engines(const char *name, int i915, unsigned int test)
+static void test_all_engines(const char *name, int i915, const intel_ctx_t *ctx,
+ unsigned int test)
{
const struct intel_execution_engine2 *e;
igt_subtest_with_dynamic(name) {
igt_dynamic("all") {
gem_quiescent_gpu(i915);
- basic(i915, ALL_ENGINES, test);
+ basic(i915, ctx, ALL_ENGINES, test);
gem_quiescent_gpu(i915);
}
- __for_each_physical_engine(i915, e) {
+ for_each_ctx_engine(i915, ctx, e) {
igt_dynamic_f("%s", e->name) {
gem_quiescent_gpu(i915);
- basic(i915, e->flags, test);
+ basic(i915, ctx, e->flags, test);
gem_quiescent_gpu(i915);
}
}
@@ -170,11 +173,13 @@ static void test_all_engines(const char *name, int i915, unsigned int test)
igt_main
{
+ const intel_ctx_t *ctx;
int fd = -1;
igt_fixture {
fd = drm_open_driver_master(DRIVER_INTEL);
igt_require_gem(fd);
+ ctx = intel_ctx_create_all_physical(fd);
}
igt_subtest("invalid-flags")
@@ -202,7 +207,7 @@ igt_main
}
for (const typeof(*tests) *t = tests; t->name; t++)
- test_all_engines(t->name, fd, t->flags);
+ test_all_engines(t->name, fd, ctx, t->flags);
igt_fixture {
igt_stop_signal_helper();
@@ -229,7 +234,7 @@ igt_main
}
for (const typeof(*tests) *t = tests; t->name; t++)
- test_all_engines(t->name, fd, t->flags);
+ test_all_engines(t->name, fd, ctx, t->flags);
igt_fixture {
igt_stop_signal_helper();
@@ -238,6 +243,7 @@ igt_main
}
igt_fixture {
+ intel_ctx_destroy(fd, ctx);
close(fd);
}
}