[PATCH i-g-t] tests/gem_barrier_race: Do use the chosen engine
Janusz Krzysztofik
janusz.krzysztofik at linux.intel.com
Wed Mar 1 08:37:19 UTC 2023
Since engine map is not copied to default context on driver reopen, engine
selection must be done via setting up a new context for that engine
specifically.
Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik at linux.intel.com>
---
tests/i915/gem_barrier_race.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/tests/i915/gem_barrier_race.c b/tests/i915/gem_barrier_race.c
index 053fa2069e..2ee2417dac 100644
--- a/tests/i915/gem_barrier_race.c
+++ b/tests/i915/gem_barrier_race.c
@@ -87,31 +87,35 @@ static int exec(int fd, uint32_t handle, int ring, int ctx_id)
return __gem_execbuf(fd, &execbuf);
}
-static void intel_context_first_pin_last_unpin_loop(int fd, uint64_t engine, int *done)
+static void
+intel_context_first_pin_last_unpin_loop(int fd, struct intel_execution_engine2 *e, int *done)
{
/*
* Use gem_create -> gem_write -> gem_execbuf -> gem_sync -> gem_close
* as intel context first pin / last unpin intensive workload
*/
const uint32_t batch[2] = { 0, MI_BATCH_BUFFER_END };
+ uint32_t ctx_id;
fd = gem_reopen_driver(fd);
+ ctx_id = gem_context_create_for_engine(fd, e->class, e->instance);
do {
uint32_t handle = gem_create(fd, 4096);
gem_write(fd, handle, 0, batch, sizeof(batch));
- igt_assert_eq(exec(fd, handle, engine, 0), 0);
+ igt_assert_eq(exec(fd, handle, 0, ctx_id), 0);
gem_sync(fd, handle);
gem_close(fd, handle);
} while (!READ_ONCE(*done));
+ gem_context_destroy(fd, ctx_id);
close(fd);
}
-static void test_remote_request(int fd, uint64_t engine, unsigned int timeout)
+static void test_remote_request(int fd, struct intel_execution_engine2 *e, unsigned int timeout)
{
int *done = mmap(0, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
@@ -120,7 +124,7 @@ static void test_remote_request(int fd, uint64_t engine, unsigned int timeout)
remote_request_workload(fd, done);
igt_fork(child, sysconf(_SC_NPROCESSORS_ONLN))
- intel_context_first_pin_last_unpin_loop(fd, engine, done);
+ intel_context_first_pin_last_unpin_loop(fd, e, done);
sleep(timeout);
*done = 1;
@@ -147,7 +151,7 @@ igt_main
continue;
igt_dynamic(e->name)
- test_remote_request(fd, e->flags, 5);
+ test_remote_request(fd, e, 5);
/* We assume no need for all physical engines to be tested */
break;
--
2.25.1
More information about the Intel-gfx-trybot
mailing list