summaryrefslogtreecommitdiff
path: root/tests/i915/gem_exec_suspend.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2020-12-30 16:18:02 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2020-12-30 17:41:41 +0000
commit9e7c58151935b098ab271733f1bb98c33da0b175 (patch)
treef6ce8edfb537a85b9dcc321e4eb4135e2a1a5286 /tests/i915/gem_exec_suspend.c
parent97c8f069ccf88e62910dc951886f08965b956ca0 (diff)
i915/gem_exec_suspend: Remove legacy ring abi
Cover all engines with the engine map API. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Acked-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Diffstat (limited to 'tests/i915/gem_exec_suspend.c')
-rw-r--r--tests/i915/gem_exec_suspend.c69
1 files changed, 25 insertions, 44 deletions
diff --git a/tests/i915/gem_exec_suspend.c b/tests/i915/gem_exec_suspend.c
index 42b0ab70..a31dd662 100644
--- a/tests/i915/gem_exec_suspend.c
+++ b/tests/i915/gem_exec_suspend.c
@@ -31,7 +31,6 @@
#include <unistd.h>
#include "i915/gem.h"
-#include "i915/gem_ring.h"
#include "igt.h"
#include "igt_dummyload.h"
#include "igt_gt.h"
@@ -51,7 +50,7 @@
#define CACHED (1<<8)
#define HANG (2<<8)
-static void run_test(int fd, unsigned ring, unsigned flags);
+static void run_test(int fd, unsigned engine, unsigned flags);
static void check_bo(int fd, uint32_t handle)
{
@@ -68,24 +67,7 @@ static void check_bo(int fd, uint32_t handle)
static void test_all(int fd, unsigned flags)
{
- for_each_physical_ring(e, fd)
- if (gem_can_store_dword(fd, eb_ring(e)))
- run_test(fd, eb_ring(e), flags & ~0xff);
-}
-
-static bool has_semaphores(int fd)
-{
- struct drm_i915_getparam gp;
- int val = -1;
-
- memset(&gp, 0, sizeof(gp));
- gp.param = I915_PARAM_HAS_SEMAPHORES;
- gp.value = &val;
-
- drmIoctl(fd, DRM_IOCTL_I915_GETPARAM, &gp);
- errno = 0;
-
- return val > 0;
+ run_test(fd, ALL_ENGINES, flags & ~0xff);
}
static void run_test(int fd, unsigned engine, unsigned flags)
@@ -101,25 +83,13 @@ static void run_test(int fd, unsigned engine, unsigned flags)
nengine = 0;
if (engine == ALL_ENGINES) {
- /* 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
- * the GPU being active across the suspend (because the
- * GPU is then unlikely to be active!)
- */
- if (has_semaphores(fd)) {
- for_each_physical_ring(e, fd) {
- if (gem_can_store_dword(fd, eb_ring(e)))
- engines[nengine++] = eb_ring(e);
- }
- } else {
- igt_require(gem_has_ring(fd, 0));
- igt_require(gem_can_store_dword(fd, 0));
- engines[nengine++] = 0;
+ const struct intel_execution_engine2 *e;
+
+ __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, engine));
- igt_require(gem_can_store_dword(fd, engine));
engines[nengine++] = engine;
}
igt_require(nengine);
@@ -301,7 +271,7 @@ igt_main
{ "-S4", HIBERNATE },
{ NULL, 0 }
}, *m;
- const struct intel_execution_ring *e;
+ const struct intel_execution_engine2 *e;
igt_hang_t hang;
int fd;
@@ -326,12 +296,23 @@ igt_main
igt_subtest("basic-S4")
run_test(fd, ALL_ENGINES, HIBERNATE);
- for (e = intel_execution_rings; e->name; e++) {
- for (m = modes; m->suffix; m++) {
- igt_subtest_f("%s-uncached%s", e->name, m->suffix)
- run_test(fd, eb_ring(e), m->mode | UNCACHED);
- igt_subtest_f("%s-cached%s", e->name, m->suffix)
- run_test(fd, eb_ring(e), m->mode | CACHED);
+ for (m = modes; m->suffix; m++) {
+ igt_subtest_with_dynamic_f("uncached-%s", m->suffix) {
+ __for_each_physical_engine(fd, e) {
+ if (!gem_class_can_store_dword(fd, e->class))
+ continue;
+ igt_dynamic_f("%s", e->name)
+ run_test(fd, e->flags, m->mode | UNCACHED);
+ }
+ }
+
+ igt_subtest_with_dynamic_f("cached-%s", m->suffix) {
+ __for_each_physical_engine(fd, e) {
+ if (!gem_class_can_store_dword(fd, e->class))
+ continue;
+ igt_dynamic_f("%s", e->name)
+ run_test(fd, e->flags, m->mode | CACHED);
+ }
}
}