summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2016-04-14 10:15:26 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2016-04-14 10:25:59 +0100
commite609955067b628c85297665e233b56da2c64c48d (patch)
tree1eea178e490d3953d5aacb71494a1a69435639e9
parent30769516984f404a54a60e7815a20de2a88b8d2a (diff)
igt/gem_ctx_create: Broaden per-engine testing
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--tests/gem_ctx_create.c36
1 files changed, 33 insertions, 3 deletions
diff --git a/tests/gem_ctx_create.c b/tests/gem_ctx_create.c
index 930b30f79bdb..36e128c50c25 100644
--- a/tests/gem_ctx_create.c
+++ b/tests/gem_ctx_create.c
@@ -31,6 +31,14 @@
#include <errno.h>
#include <time.h>
+#define LOCAL_I915_EXEC_BSD_SHIFT (13)
+#define LOCAL_I915_EXEC_BSD_MASK (3 << LOCAL_I915_EXEC_BSD_SHIFT)
+
+#define ENGINE_FLAGS (I915_EXEC_RING_MASK | LOCAL_I915_EXEC_BSD_MASK)
+
+static unsigned ppgtt_engines[16];
+static unsigned ppgtt_nengine;
+
static int __gem_context_create(int fd, struct drm_i915_gem_context_create *arg)
{
int ret = 0;
@@ -68,6 +76,8 @@ static void files(int core, int timeout)
do {
int fd = drm_open_driver(DRIVER_INTEL);
obj.handle = gem_open(fd, name);
+ execbuf.flags &= ~ENGINE_FLAGS;
+ execbuf.flags |= ppgtt_engines[count % ppgtt_nengine];
gem_execbuf(fd, &execbuf);
close(fd);
} while (++count & 1023);
@@ -82,7 +92,7 @@ static void files(int core, int timeout)
gem_close(core, batch);
}
-static void active(int fd, int timeout)
+static void active(int fd, unsigned engine, int timeout)
{
const uint32_t bbe = MI_BATCH_BUFFER_END;
struct drm_i915_gem_execbuffer2 execbuf;
@@ -90,6 +100,8 @@ static void active(int fd, int timeout)
struct timespec start, end;
unsigned count = 0;
+ gem_require_ring(fd, engine);
+
memset(&obj, 0, sizeof(obj));
obj.handle = gem_create(fd, 4096);
gem_write(fd, obj.handle, 0, &bbe, sizeof(bbe));
@@ -97,6 +109,7 @@ static void active(int fd, int timeout)
memset(&execbuf, 0, sizeof(execbuf));
execbuf.buffers_ptr = (uintptr_t)&obj;
execbuf.buffer_count = 1;
+ execbuf.flags = engine;
clock_gettime(CLOCK_MONOTONIC, &start);
do {
@@ -127,8 +140,21 @@ igt_main
memset(&create, 0, sizeof(create));
igt_require(__gem_context_create(fd, &create) == 0);
gem_context_destroy(fd, create.ctx_id);
+
+ if (gem_uses_full_ppgtt(fd)) {
+ unsigned engine;
+
+ for_each_engine(fd, engine) {
+ if (engine == 0)
+ continue;
+ ppgtt_engines[ppgtt_nengine++] = engine;
+ }
+ } else
+ ppgtt_engines[ppgtt_nengine++] = 0;
}
+ igt_fork_hang_detector(fd);
+
igt_subtest("basic") {
memset(&create, 0, sizeof(create));
create.ctx_id = rand();
@@ -148,8 +174,12 @@ igt_main
igt_subtest("files")
files(fd, 20);
- igt_subtest("active")
- active(fd, 20);
+ for (const struct intel_execution_engine *e = intel_execution_engines;
+ e->name; e++)
+ igt_subtest_f("active-%s", e->name)
+ active(fd, e->exec_id | e->flags, 20);
+
+ igt_stop_hang_detector();
igt_fixture
close(fd);