[igt-dev] [PATCH i-g-t 1/4] Revert "tests/i915/gem_ctx_engines: Fix the invalid subtest for the new rules"
priyanka.dandamudi at intel.com
priyanka.dandamudi at intel.com
Mon Nov 21 06:19:13 UTC 2022
From: Priyanka Dandamudi <priyanka.dandamudi at intel.com>
This reverts commit 99d863de8b7bb687daee9d7edd59c4b17419e8d1.
---
tests/i915/gem_ctx_engines.c | 88 ++++++++++++------------------------
1 file changed, 30 insertions(+), 58 deletions(-)
diff --git a/tests/i915/gem_ctx_engines.c b/tests/i915/gem_ctx_engines.c
index e3f75dce1..97b1a21f4 100644
--- a/tests/i915/gem_ctx_engines.c
+++ b/tests/i915/gem_ctx_engines.c
@@ -47,44 +47,31 @@
#define engine_class(e, n) ((e)->engines[(n)].engine_class)
#define engine_instance(e, n) ((e)->engines[(n)].engine_instance)
-static int
-__set_param_fresh_context(int i915, struct drm_i915_gem_context_param param)
-{
- int err;
-
- igt_assert_eq(param.ctx_id, 0);
- param.ctx_id = gem_context_create(i915);
- err = __gem_context_set_param(i915, ¶m);
- gem_context_destroy(i915, param.ctx_id);
-
- return err;
-}
-
static void invalid_engines(int i915)
{
struct i915_context_param_engines stack = {}, *engines;
struct drm_i915_gem_context_param param = {
+ .ctx_id = gem_context_create(i915),
.param = I915_CONTEXT_PARAM_ENGINES,
.value = to_user_pointer(&stack),
};
uint32_t handle;
- igt_spin_t *spin;
void *ptr;
param.size = 0;
- igt_assert_eq(__set_param_fresh_context(i915, param), -EINVAL);
+ igt_assert_eq(__gem_context_set_param(i915, ¶m), 0);
param.size = 1;
- igt_assert_eq(__set_param_fresh_context(i915, param), -EINVAL);
+ igt_assert_eq(__gem_context_set_param(i915, ¶m), -EINVAL);
param.size = sizeof(stack) - 1;
- igt_assert_eq(__set_param_fresh_context(i915, param), -EINVAL);
+ igt_assert_eq(__gem_context_set_param(i915, ¶m), -EINVAL);
param.size = sizeof(stack) + 1;
- igt_assert_eq(__set_param_fresh_context(i915, param), -EINVAL);
+ 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(__set_param_fresh_context(i915, param), -EINVAL);
+ param.size = 0;
+ igt_assert_eq(__gem_context_set_param(i915, ¶m), 0);
/* Create a single page surrounded by inaccessible nothingness */
ptr = mmap(NULL, 3 * 4096, PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0);
@@ -98,57 +85,57 @@ static void invalid_engines(int i915)
param.value = to_user_pointer(engines);
engines->engines[0].engine_class = -1;
- igt_assert_eq(__set_param_fresh_context(i915, param), -ENOENT);
+ igt_assert_eq(__gem_context_set_param(i915, ¶m), -ENOENT);
mprotect(engines, 4096, PROT_READ);
- igt_assert_eq(__set_param_fresh_context(i915, param), -ENOENT);
+ igt_assert_eq(__gem_context_set_param(i915, ¶m), -ENOENT);
mprotect(engines, 4096, PROT_WRITE);
engines->engines[0].engine_class = 0;
- if (__set_param_fresh_context(i915, param)) /* XXX needs RCS */
+ if (__gem_context_set_param(i915, ¶m)) /* XXX needs RCS */
goto out;
engines->extensions = to_user_pointer(ptr);
- igt_assert_eq(__set_param_fresh_context(i915, param), -EFAULT);
+ igt_assert_eq(__gem_context_set_param(i915, ¶m), -EFAULT);
engines->extensions = 0;
- igt_assert_eq(__set_param_fresh_context(i915, param), 0);
+ igt_assert_eq(__gem_context_set_param(i915, ¶m), 0);
param.value = to_user_pointer(engines - 1);
- igt_assert_eq(__set_param_fresh_context(i915, param), -EFAULT);
+ igt_assert_eq(__gem_context_set_param(i915, ¶m), -EFAULT);
param.value = to_user_pointer(engines) - 1;
- igt_assert_eq(__set_param_fresh_context(i915, param), -EFAULT);
+ igt_assert_eq(__gem_context_set_param(i915, ¶m), -EFAULT);
param.value = to_user_pointer(engines) - param.size + 1;
- igt_assert_eq(__set_param_fresh_context(i915, param), -EFAULT);
+ igt_assert_eq(__gem_context_set_param(i915, ¶m), -EFAULT);
param.value = to_user_pointer(engines) + 4096;
- igt_assert_eq(__set_param_fresh_context(i915, param), -EFAULT);
+ igt_assert_eq(__gem_context_set_param(i915, ¶m), -EFAULT);
param.value = to_user_pointer(engines) - param.size + 4096;
- igt_assert_eq(__set_param_fresh_context(i915, param), 0);
+ igt_assert_eq(__gem_context_set_param(i915, ¶m), 0);
param.value = to_user_pointer(engines) - param.size + 4096 + 1;
- igt_assert_eq(__set_param_fresh_context(i915, param), -EFAULT);
+ igt_assert_eq(__gem_context_set_param(i915, ¶m), -EFAULT);
param.value = to_user_pointer(engines) + 4096;
- igt_assert_eq(__set_param_fresh_context(i915, param), -EFAULT);
+ igt_assert_eq(__gem_context_set_param(i915, ¶m), -EFAULT);
param.value = to_user_pointer(engines) + 4096 - 1;
- igt_assert_eq(__set_param_fresh_context(i915, param), -EFAULT);
+ igt_assert_eq(__gem_context_set_param(i915, ¶m), -EFAULT);
param.value = to_user_pointer(engines) - 1;
- igt_assert_eq(__set_param_fresh_context(i915, param), -EFAULT);
+ igt_assert_eq(__gem_context_set_param(i915, ¶m), -EFAULT);
param.value = to_user_pointer(engines - 1);
- igt_assert_eq(__set_param_fresh_context(i915, param), -EFAULT);
+ igt_assert_eq(__gem_context_set_param(i915, ¶m), -EFAULT);
param.value = to_user_pointer(engines - 1) + 4096;
- igt_assert_eq(__set_param_fresh_context(i915, param), -EFAULT);
+ igt_assert_eq(__gem_context_set_param(i915, ¶m), -EFAULT);
param.value = to_user_pointer(engines - 1) + 4096 - sizeof(*engines->engines) / 2;
- igt_assert_eq(__set_param_fresh_context(i915, param), -EFAULT);
+ igt_assert_eq(__gem_context_set_param(i915, ¶m), -EFAULT);
handle = gem_create(i915, 4096 * 3);
ptr = gem_mmap__device_coherent(i915, handle, 0, 4096 * 3, PROT_READ);
@@ -158,40 +145,25 @@ static void invalid_engines(int i915)
munmap(ptr + 8192, 4096);
param.value = to_user_pointer(ptr + 4096);
- igt_assert_eq(__set_param_fresh_context(i915, param), 0);
+ igt_assert_eq(__gem_context_set_param(i915, ¶m), 0);
param.value = to_user_pointer(ptr);
- igt_assert_eq(__set_param_fresh_context(i915, param), -EFAULT);
+ igt_assert_eq(__gem_context_set_param(i915, ¶m), -EFAULT);
param.value = to_user_pointer(ptr) + 4095;
- igt_assert_eq(__set_param_fresh_context(i915, param), -EFAULT);
+ igt_assert_eq(__gem_context_set_param(i915, ¶m), -EFAULT);
param.value = to_user_pointer(ptr) + 8192;
- igt_assert_eq(__set_param_fresh_context(i915, param), -EFAULT);
+ igt_assert_eq(__gem_context_set_param(i915, ¶m), -EFAULT);
param.value = to_user_pointer(ptr) + 12287;
- igt_assert_eq(__set_param_fresh_context(i915, param), -EFAULT);
+ igt_assert_eq(__gem_context_set_param(i915, ¶m), -EFAULT);
munmap(ptr + 4096, 4096);
- /* Reset back to a known-good param struct */
- param.size = sizeof(*engines) + sizeof(*engines->engines);
- param.value = to_user_pointer(engines);
- igt_assert_eq(__set_param_fresh_context(i915, param), 0);
-
- /* Test that we can't set engines after we've done an execbuf */
- param.ctx_id = gem_context_create(i915);
- spin = igt_spin_new(i915, .ctx_id = param.ctx_id);
- igt_spin_free(i915, spin);
- igt_assert_eq(__gem_context_set_param(i915, ¶m), -EINVAL);
- gem_context_destroy(i915, param.ctx_id);
-
- /* Test that we can't set engines on ctx0 */
- param.ctx_id = 0;
- igt_assert_eq(__gem_context_set_param(i915, ¶m), -EINVAL);
-
out:
munmap(engines, 4096);
+ gem_context_destroy(i915, param.ctx_id);
}
static uint32_t batch_create(int i915)
More information about the igt-dev
mailing list