summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2016-03-04 09:40:51 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2016-03-08 09:57:33 +0000
commit60eafc548911d8625d20443a203c5aff3662c39a (patch)
treefca563b1d9d11576097e4d0920a64d867693c67c
parent9ba9af2ea4306796cbb72c76bc0de05a0fb14c6b (diff)
igt/gem_exec_suspend: Do pre/post suspend double checks
Check that the system operates normally before and after the suspend (as well as across the suspend). The goal is to isolate the breakage to the subtest. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--lib/ioctl_wrappers.c20
-rw-r--r--lib/ioctl_wrappers.h3
-rw-r--r--tests/gem_exec_suspend.c20
3 files changed, 32 insertions, 11 deletions
diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
index ffeb44cb..a213a984 100644
--- a/lib/ioctl_wrappers.c
+++ b/lib/ioctl_wrappers.c
@@ -1396,11 +1396,17 @@ void gem_require_caching(int fd)
errno = 0;
}
-static int gem_has_ring(int fd, int ring)
+bool gem_has_ring(int fd, unsigned ring)
{
struct drm_i915_gem_execbuffer2 execbuf;
struct drm_i915_gem_exec_object2 exec;
+ /* silly ABI, the kernel thinks everyone who has BSD also has BSD2 */
+ if ((ring & ~(3<<13)) == I915_EXEC_BSD) {
+ if (ring & (3 << 13) && !gem_has_bsd2(fd))
+ return false;
+ }
+
memset(&exec, 0, sizeof(exec));
memset(&execbuf, 0, sizeof(execbuf));
execbuf.buffers_ptr = (uintptr_t)&exec;
@@ -1412,21 +1418,15 @@ static int gem_has_ring(int fd, int ring)
/**
* gem_require_ring:
* @fd: open i915 drm file descriptor
- * @ring_id: ring flag bit as used in gem_execbuf()
+ * @ring: ring flag bit as used in gem_execbuf()
*
* Feature test macro to query whether a specific ring is available.
* In contrast to gem_has_enable_ring() this automagically skips if the ring
* isn't available by calling igt_require().
*/
-void gem_require_ring(int fd, int ring_id)
+void gem_require_ring(int fd, unsigned ring)
{
- igt_require(gem_has_ring(fd, ring_id));
-
- /* silly ABI, the kernel thinks everyone who has BSD also has BSD2 */
- if ((ring_id & ~(3<<13)) == I915_EXEC_BSD) {
- if (ring_id & (3 << 13))
- igt_require(gem_has_bsd2(fd));
- }
+ igt_require(gem_has_ring(fd, ring));
}
/* prime */
diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h
index f59eafba..3c922057 100644
--- a/lib/ioctl_wrappers.h
+++ b/lib/ioctl_wrappers.h
@@ -152,7 +152,8 @@ bool gem_has_softpin(int fd);
/* check functions which auto-skip tests by calling igt_skip() */
void gem_require_caching(int fd);
-void gem_require_ring(int fd, int ring_id);
+bool gem_has_ring(int fd, unsigned ring);
+void gem_require_ring(int fd, unsigned ring);
/* prime */
struct local_dma_buf_sync {
diff --git a/tests/gem_exec_suspend.c b/tests/gem_exec_suspend.c
index 22e18f57..f468ff4a 100644
--- a/tests/gem_exec_suspend.c
+++ b/tests/gem_exec_suspend.c
@@ -36,6 +36,8 @@ enum mode {
HIBERNATE,
};
+static void run_test(int fd, unsigned ring, enum mode mode);
+
static void check_bo(int fd, uint32_t handle)
{
uint32_t *map;
@@ -49,6 +51,14 @@ static void check_bo(int fd, uint32_t handle)
munmap(map, 4096);
}
+static void test_all(int fd)
+{
+ const struct intel_execution_engine *e;
+ for (e = intel_execution_engines; e->name; e++)
+ if (gem_has_ring(fd, e->exec_id | e->flags))
+ run_test(fd, e->exec_id | e->flags, NOSLEEP);
+}
+
static void run_test(int fd, unsigned ring, enum mode mode)
{
const int gen = intel_gen(intel_get_drm_devid(fd));
@@ -61,6 +71,10 @@ static void run_test(int fd, unsigned ring, enum mode mode)
igt_skip_on_f(gen == 6 && (ring & ~(3<<13)) == I915_EXEC_BSD,
"MI_STORE_DATA broken on gen6 bsd\n");
+ /* Before suspending, check normal operation */
+ if (mode != NOSLEEP)
+ test_all(fd);
+
gem_quiescent_gpu(fd);
memset(&execbuf, 0, sizeof(execbuf));
@@ -135,6 +149,12 @@ static void run_test(int fd, unsigned ring, enum mode mode)
check_bo(fd, obj[0].handle);
gem_close(fd, obj[0].handle);
+
+ gem_quiescent_gpu(fd);
+
+ /* After resume, make sure it still works */
+ if (mode != NOSLEEP)
+ test_all(fd);
}
igt_main