[igt-dev] [RFC v2 14/43] tests/i915/gem_ctx_switch: use the gem_engine_topology library

Ramalingam C
2019-06-21T10:01:24Z

tests/i915/gem_ctx_switch.c | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/tests/i915/gem_ctx_switch.c b/tests/i915/gem_ctx_switch.c
index 647911d4c42e..8d6740148b22 100644
--- a/tests/i915/gem_ctx_switch.c
+++ b/tests/i915/gem_ctx_switch.c
@@ -107,7 +107,7 @@ static int measure_qlen(int fd,
}

static void single(int fd, uint32_t handle,
- const struct intel_execution_engine *e,
+ const struct intel_execution_engine2 *e,
unsigned flags,
const int ncpus,
int timeout)
@@ -125,8 +125,6 @@ static void single(int fd, uint32_t handle,
shared = mmap(NULL, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
igt_assert(shared != MAP_FAILED);

- gem_require_ring(fd, e->exec_id | e->flags);
-
for (n = 0; n < 64; n++) {
if (flags & QUEUE)
contexts[n] = gem_queue_create(fd);
@@ -152,12 +150,12 @@ static void single(int fd, uint32_t handle,
execbuf.buffers_ptr = to_user_pointer(&obj);
execbuf.buffer_count = 1;
execbuf.rsvd1 = contexts[0];
- execbuf.flags = e->exec_id | e->flags;
+ execbuf.flags = e->flags;
execbuf.flags |= LOCAL_I915_EXEC_HANDLE_LUT;
execbuf.flags |= LOCAL_I915_EXEC_NO_RELOC;
igt_require(__gem_execbuf(fd, &execbuf) == 0);
if (__gem_execbuf(fd, &execbuf)) {
- execbuf.flags = e->exec_id | e->flags;
+ execbuf.flags = e->flags;
reloc.target_handle = obj.handle;
gem_execbuf(fd, &execbuf);
}
@@ -223,16 +221,17 @@ static void all(int fd, uint32_t handle, unsigned flags, int timeout)
{
struct drm_i915_gem_execbuffer2 execbuf;
struct drm_i915_gem_exec_object2 obj[2];
- unsigned int engine[16], e;
+ const struct intel_execution_engine2 *e;
+ unsigned int engine[16];
const char *name[16];
uint32_t contexts[65];
unsigned int nengine;
int n, qlen;

nengine = 0;
- for_each_physical_engine(fd, e) {
- engine[nengine] = e;
- name[nengine] = e__->name;
+ __for_each_physical_engine(fd, e) {
+ engine[nengine] = e->flags;
+ name[nengine] = e->name;
nengine++;
}
igt_require(nengine);
@@ -306,7 +305,7 @@ static void all(int fd, uint32_t handle, unsigned flags, int timeout)
igt_main
{
const int ncpus = sysconf(_SC_NPROCESSORS_ONLN);
- const struct intel_execution_engine *e;
+ const struct intel_execution_engine2 *e;
static const struct {
const char *name;
unsigned int flags;
@@ -338,7 +337,7 @@ igt_main
igt_fork_hang_detector(fd);
}

- for (e = intel_execution_engines; e->name; e++) {
+ __for_each_physical_engine(fd, e) {
for (typeof(*phases) *p = phases; p->name; p++) {
igt_subtest_group {
igt_fixture {
@@ -346,12 +345,15 @@ igt_main
igt_require(p->require(fd));
}

- igt_subtest_f("%s%s%s", e->exec_id == 0 ? "basic-" : "", e->name, p->name)
+ igt_subtest_f("%s%s%s", e->class ==
+ I915_ENGINE_CLASS_RENDER ?
+ "basic-" : "", e->name, p->name)
single(fd, light, e, p->flags, 1, 5);

igt_skip_on_simulation();

- igt_subtest_f("%s%s-heavy%s", e->exec_id == 0 ? "basic-" : "", e->name, p->name)
+ igt_subtest_f("%s%s-heavy%s", e->class ==
+ I915_ENGINE_CLASS_RENDER ? "basic-" : "", e->name, p->name)
single(fd, heavy, e, p->flags, 1, 5);
igt_subtest_f("forked-%s%s", e->name, p->name)
single(fd, light, e, p->flags, ncpus, 150);