Re: [Intel-gfx] [PATCH i-g-t 1/2] i915/query: Cross-check engine list against execbuf interface

2020-12-08 Thread Andi Shyti
Hi Chris,

> - /* Check results match the legacy GET_PARAM (where we can). */
> + /* Confirm the individual engines exist with EXECBUFFER2 */
>   for (i = 0; i < engines->num_engines; i++) {
>   struct drm_i915_engine_info *engine =
>   (struct drm_i915_engine_info *)>engines[i];
> + I915_DEFINE_CONTEXT_PARAM_ENGINES(p_engines, 1) = {
> + .engines = { engine->engine }
> + };
> + struct drm_i915_gem_context_param param = {
> + .param = I915_CONTEXT_PARAM_ENGINES,
> + .value = to_user_pointer(_engines),
> + .size = sizeof(p_engines),
> + };
> +
> + struct drm_i915_gem_exec_object2 obj = {};
> + struct drm_i915_gem_execbuffer2 execbuf = {
> + .buffers_ptr = to_user_pointer(),
> + .buffer_count = 1,
> + };
>  
>   igt_debug("%u: class=%u instance=%u flags=%llx 
> capabilities=%llx\n",
> i,
> @@ -689,6 +713,15 @@ static void engines(int fd)
> engine->engine.engine_instance,
> engine->flags,
> engine->capabilities);
> + gem_context_set_param(fd, );
> + igt_assert_eq(__gem_execbuf(fd, ), -ENOENT);
> + }
> + gem_context_reset_engines(fd, 0);
> +
> + /* Check results match the legacy GET_PARAM (where we can). */
> + for (i = 0; i < engines->num_engines; i++) {
> + struct drm_i915_engine_info *engine =
> + (struct drm_i915_engine_info *)>engines[i];

I would have liked it with one single for loop, perhaps resetting
engines individually.

But this works, as well and I'm not strong with this:

Reviewed-by: Andi Shyti 

Andi
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH i-g-t 1/2] i915/query: Cross-check engine list against execbuf interface

2020-12-07 Thread Chris Wilson
Check that every engine listed can be used in execbuf.

Signed-off-by: Chris Wilson 
Cc: Andi Shyti 
Cc: Tvrtko Ursulin 
---
 tests/i915/i915_query.c | 35 ++-
 1 file changed, 34 insertions(+), 1 deletion(-)

diff --git a/tests/i915/i915_query.c b/tests/i915/i915_query.c
index e7c6fc91e..cdf2d3403 100644
--- a/tests/i915/i915_query.c
+++ b/tests/i915/i915_query.c
@@ -633,6 +633,16 @@ has_engine(struct drm_i915_query_engine_info *engines,
return false;
 }
 
+static void gem_context_reset_engines(int i915, uint32_t ctx)
+{
+   struct drm_i915_gem_context_param param = {
+   .ctx_id = ctx,
+   .param = I915_CONTEXT_PARAM_ENGINES,
+   };
+
+   gem_context_set_param(i915, );
+}
+
 static void engines(int fd)
 {
struct drm_i915_query_engine_info *engines;
@@ -678,10 +688,24 @@ static void engines(int fd)
igt_assert_eq(engines->rsvd[1], 0);
igt_assert_eq(engines->rsvd[2], 0);
 
-   /* Check results match the legacy GET_PARAM (where we can). */
+   /* Confirm the individual engines exist with EXECBUFFER2 */
for (i = 0; i < engines->num_engines; i++) {
struct drm_i915_engine_info *engine =
(struct drm_i915_engine_info *)>engines[i];
+   I915_DEFINE_CONTEXT_PARAM_ENGINES(p_engines, 1) = {
+   .engines = { engine->engine }
+   };
+   struct drm_i915_gem_context_param param = {
+   .param = I915_CONTEXT_PARAM_ENGINES,
+   .value = to_user_pointer(_engines),
+   .size = sizeof(p_engines),
+   };
+
+   struct drm_i915_gem_exec_object2 obj = {};
+   struct drm_i915_gem_execbuffer2 execbuf = {
+   .buffers_ptr = to_user_pointer(),
+   .buffer_count = 1,
+   };
 
igt_debug("%u: class=%u instance=%u flags=%llx 
capabilities=%llx\n",
  i,
@@ -689,6 +713,15 @@ static void engines(int fd)
  engine->engine.engine_instance,
  engine->flags,
  engine->capabilities);
+   gem_context_set_param(fd, );
+   igt_assert_eq(__gem_execbuf(fd, ), -ENOENT);
+   }
+   gem_context_reset_engines(fd, 0);
+
+   /* Check results match the legacy GET_PARAM (where we can). */
+   for (i = 0; i < engines->num_engines; i++) {
+   struct drm_i915_engine_info *engine =
+   (struct drm_i915_engine_info *)>engines[i];
 
switch (engine->engine.engine_class) {
case I915_ENGINE_CLASS_RENDER:
-- 
2.29.2

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx