[igt-dev] [PATCH i-g-t 92/93] tests/i915/gem_ctx_engines: Add more invalid SET_CONTEXT_PARAM cases
Jason Ekstrand
jason at jlekstrand.net
Wed Jun 9 04:32:58 UTC 2021
---
tests/i915/gem_ctx_engines.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/tests/i915/gem_ctx_engines.c b/tests/i915/gem_ctx_engines.c
index 7957e07a..85e60d56 100644
--- a/tests/i915/gem_ctx_engines.c
+++ b/tests/i915/gem_ctx_engines.c
@@ -49,12 +49,14 @@
static void invalid_engines(int i915)
{
struct i915_context_param_engines stack = {}, *engines;
+ uint32_t ctx_id = gem_context_create(i915);
struct drm_i915_gem_context_param param = {
- .ctx_id = gem_context_create(i915),
+ .ctx_id = ctx_id,
.param = I915_CONTEXT_PARAM_ENGINES,
.value = to_user_pointer(&stack),
};
uint32_t handle;
+ igt_spin_t *spin;
void *ptr;
param.size = 0;
@@ -69,6 +71,9 @@ static void invalid_engines(int i915)
param.size = sizeof(stack) + 1;
igt_assert_eq(__gem_context_set_param(i915, ¶m), -EINVAL);
+ param.size = sizeof(*engines) + (I915_EXEC_RING_MASK + 2) * sizeof(*engines->engines);
+ igt_assert_eq(__gem_context_set_param(i915, ¶m), -EINVAL);
+
param.size = 0;
igt_assert_eq(__gem_context_set_param(i915, ¶m), 0);
@@ -160,9 +165,20 @@ static void invalid_engines(int i915)
munmap(ptr + 4096, 4096);
+ /* Test that we can't set engines after we've done an execbuf */
+ spin = igt_spin_new(i915, .ctx_id = ctx_id);
+ igt_spin_free(i915, spin);
+ param.size = 0;
+ igt_assert_eq(__gem_context_set_param(i915, ¶m), -EINVAL);
+
+ /* Test that we can't set engines on ctx0 */
+ param.ctx_id = 0;
+ param.size = 0;
+ igt_assert_eq(__gem_context_set_param(i915, ¶m), -ENOENT);
+
out:
munmap(engines, 4096);
- gem_context_destroy(i915, param.ctx_id);
+ gem_context_destroy(i915, ctx_id);
}
static uint32_t batch_create(int i915)
--
2.31.1
More information about the igt-dev
mailing list