summaryrefslogtreecommitdiff
path: root/tests/i915/gem_exec_params.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2020-05-13 20:37:44 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2020-05-13 20:41:14 +0100
commitecf8476f3102ad6194d9ac05a5fa8d466ddc0b65 (patch)
tree4d7fad99f612bec4bba8b4d9b5c4826a0931b16e /tests/i915/gem_exec_params.c
parent60e8be7ccc72086a88d2eff3bcd02495fad5fa46 (diff)
i915/gem_exec_params: Check that FENCE_IN | FENCE_SUBMIT is rejected
Since both the in-fence and the submit-fence utilise the same slot in execbuf.rsvd2, we can only enable one of the two. If the user accidentally, tries to use both with the same fence, we expect EINVAL. 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_params.c')
-rw-r--r--tests/i915/gem_exec_params.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/i915/gem_exec_params.c b/tests/i915/gem_exec_params.c
index 83194be7..86d50489 100644
--- a/tests/i915/gem_exec_params.c
+++ b/tests/i915/gem_exec_params.c
@@ -41,6 +41,7 @@
#include "i915/gem.h"
#include "igt.h"
#include "igt_device.h"
+#include "sw_sync.h"
static bool has_ring(int fd, unsigned ring_exec_flags)
{
@@ -196,6 +197,20 @@ static int has_secure_batches(const int fd)
return v > 0;
}
+static bool has_submit_fence(int fd)
+{
+ int v = 0;
+ struct drm_i915_getparam gp = {
+ .param = I915_PARAM_HAS_EXEC_SUBMIT_FENCE,
+ .value = &v,
+ };
+
+ ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp, sizeof(gp));
+ errno = 0;
+
+ return v > 0;
+}
+
static uint32_t batch_create(int i915)
{
const uint32_t bbe = MI_BATCH_BUFFER_END;
@@ -535,6 +550,28 @@ igt_main
RUN_FAIL(EINVAL);
}
+ igt_subtest("invalid-fence-in-submit") {
+ int timeline;
+
+ igt_require(gem_has_exec_fence(fd));
+ igt_require(has_submit_fence(fd));
+
+ timeline = sw_sync_timeline_create();
+ execbuf.rsvd2 = sw_sync_timeline_create_fence(timeline, 1);
+
+ execbuf.flags = I915_EXEC_FENCE_IN;
+ gem_execbuf(fd, &execbuf);
+
+ execbuf.flags = I915_EXEC_FENCE_SUBMIT;
+ gem_execbuf(fd, &execbuf);
+
+ execbuf.flags = I915_EXEC_FENCE_IN | I915_EXEC_FENCE_SUBMIT;
+ RUN_FAIL(EINVAL);
+
+ close(execbuf.rsvd2);
+ close(timeline);
+ }
+
igt_subtest("rsvd2-dirt") {
igt_require(!gem_has_exec_fence(fd));
execbuf.flags = 0;