[igt-dev] [RFC v2 26/43] tests/i915/gem_exec_suspend: use the gem_engine_topology library
Ramalingam C
ramalingam.c at intel.com
Fri Jun 21 10:03:28 UTC 2019
Replace the legacy for_each_engine* defines with the ones
implemented in the gem_engine_topology library.
Signed-off-by: Ramalingam C <ramalingam.c at intel.com>
---
tests/i915/gem_exec_suspend.c | 54 +++++++++++++++++------------------
1 file changed, 27 insertions(+), 27 deletions(-)
diff --git a/tests/i915/gem_exec_suspend.c b/tests/i915/gem_exec_suspend.c
index e43a16e9ec5e..3238e307e217 100644
--- a/tests/i915/gem_exec_suspend.c
+++ b/tests/i915/gem_exec_suspend.c
@@ -47,7 +47,8 @@
#define CACHED (1<<8)
#define HANG (2<<8)
-static void run_test(int fd, unsigned ring, unsigned flags);
+static void run_test(int fd, const struct intel_execution_engine2 *e,
+ unsigned flags);
static void check_bo(int fd, uint32_t handle)
{
@@ -64,10 +65,10 @@ static void check_bo(int fd, uint32_t handle)
static void test_all(int fd, unsigned flags)
{
- unsigned engine;
+ const struct intel_execution_engine2 *engine;
- for_each_physical_engine(fd, engine)
- if (gem_can_store_dword(fd, engine))
+ __for_each_physical_engine(fd, engine)
+ if (gem_class_can_store_dword(fd, engine->class))
run_test(fd, engine, flags & ~0xff);
}
@@ -86,7 +87,8 @@ static bool has_semaphores(int fd)
return val > 0;
}
-static void run_test(int fd, unsigned engine, unsigned flags)
+static void run_test(int fd, const struct intel_execution_engine2 *e,
+ unsigned flags)
{
const int gen = intel_gen(intel_get_drm_devid(fd));
const uint32_t bbe = MI_BATCH_BUFFER_END;
@@ -98,7 +100,7 @@ static void run_test(int fd, unsigned engine, unsigned flags)
igt_spin_t *spin = NULL;
nengine = 0;
- if (engine == ALL_ENGINES) {
+ if (!e) {
/* If we don't have semaphores, then every ring switch
* will result in a CPU stall until the previous write
* has finished. This is likely to hide any issue with
@@ -106,19 +108,19 @@ static void run_test(int fd, unsigned engine, unsigned flags)
* GPU is then unlikely to be active!)
*/
if (has_semaphores(fd)) {
- for_each_physical_engine(fd, engine) {
- if (gem_can_store_dword(fd, engine))
- engines[nengine++] = engine;
+ __for_each_physical_engine(fd, e) {
+ if (gem_class_can_store_dword(fd, e->class))
+ engines[nengine++] = e->flags;
}
} else {
igt_require(gem_has_ring(fd, 0));
- igt_require(gem_can_store_dword(fd, 0));
+ igt_require(gem_class_can_store_dword(fd, I915_ENGINE_CLASS_RENDER));
engines[nengine++] = 0;
}
} else {
- igt_require(gem_has_ring(fd, engine));
- igt_require(gem_can_store_dword(fd, engine));
- engines[nengine++] = engine;
+ igt_require(gem_has_ring(fd, e->flags));
+ igt_require(gem_class_can_store_dword(fd, e->class));
+ engines[nengine++] = e->flags;
}
igt_require(nengine);
@@ -189,7 +191,7 @@ static void run_test(int fd, unsigned engine, unsigned flags)
}
if (flags & HANG)
- spin = igt_spin_new(fd, .engine = engine);
+ spin = igt_spin_new(fd, .engine = e->flags);
switch (mode(flags)) {
case NOSLEEP:
@@ -239,7 +241,7 @@ igt_main
{ "-S4", HIBERNATE },
{ NULL, 0 }
}, *m;
- const struct intel_execution_engine *e;
+ const struct intel_execution_engine2 *e;
igt_hang_t hang;
int fd;
@@ -254,24 +256,22 @@ igt_main
}
igt_subtest("basic")
- run_test(fd, ALL_ENGINES, NOSLEEP);
+ run_test(fd, NULL, NOSLEEP);
igt_subtest("basic-S3-devices")
- run_test(fd, ALL_ENGINES, SUSPEND_DEVICES);
+ run_test(fd, NULL, SUSPEND_DEVICES);
igt_subtest("basic-S3")
- run_test(fd, ALL_ENGINES, SUSPEND);
+ run_test(fd, NULL, SUSPEND);
igt_subtest("basic-S4-devices")
- run_test(fd, ALL_ENGINES, HIBERNATE_DEVICES);
+ run_test(fd, NULL, HIBERNATE_DEVICES);
igt_subtest("basic-S4")
- run_test(fd, ALL_ENGINES, HIBERNATE);
+ run_test(fd, NULL, HIBERNATE);
- for (e = intel_execution_engines; e->name; e++) {
+ __for_each_physical_engine(fd, e) {
for (m = modes; m->suffix; m++) {
igt_subtest_f("%s-uncached%s", e->name, m->suffix)
- run_test(fd, e->exec_id | e->flags,
- m->mode | UNCACHED);
+ run_test(fd, e, m->mode | UNCACHED);
igt_subtest_f("%s-cached%s", e->name, m->suffix)
- run_test(fd, e->exec_id | e->flags,
- m->mode | CACHED);
+ run_test(fd, e, m->mode | CACHED);
}
}
@@ -281,9 +281,9 @@ igt_main
}
igt_subtest("hang-S3")
- run_test(fd, 0, SUSPEND | HANG);
+ run_test(fd, NULL, SUSPEND | HANG);
igt_subtest("hang-S4")
- run_test(fd, 0, HIBERNATE | HANG);
+ run_test(fd, NULL, HIBERNATE | HANG);
igt_fixture {
igt_disallow_hang(fd, hang);
--
2.19.1
More information about the igt-dev
mailing list