[igt-dev] [RFC PATCH v4 3/3] tests: gem_exec_basic: add "exec-ctx" buffer execution demo test

Chris Wilson chris at chris-wilson.co.uk
Tue Jan 15 13:04:18 UTC 2019


Quoting Andi Shyti (2019-01-15 12:35:11)
> The "exec-ctx" is a demo subtest inserted in the gem_exec_basic
> test. The main scope is to demonstrate an alternative way for
> querying engines as implemented in the new API in commit 87079e04
> ("lib: implement new engine discovery interface").
> 
> The "exec-ctx" subtest simply gets the list of engines, binds
> them to a context and executes a buffer. This is done through a
> new "for_each_engine_ctx" loop which iterates through the
> engines.
> 
> Signed-off-by: Andi Shyti <andi.shyti at intel.com>
> ---
>  tests/i915/gem_exec_basic.c | 33 +++++++++++++++++++++++++++++++++
>  1 file changed, 33 insertions(+)
> 
> diff --git a/tests/i915/gem_exec_basic.c b/tests/i915/gem_exec_basic.c
> index dcb83864b1c1..2b09f8cd79b7 100644
> --- a/tests/i915/gem_exec_basic.c
> +++ b/tests/i915/gem_exec_basic.c
> @@ -114,6 +114,22 @@ static void gtt(int fd, unsigned ring)
>         munmap(execbuf, 4096);
>  }
>  
> +static void execbuf_in_ctx(int fd, struct intel_execution_engine2 *engine,
> +                          uint32_t ctx, uint32_t handle)
> +{
> +       struct drm_i915_gem_exec_object2 exec = {
> +               .handle = handle,
> +       };
> +       struct drm_i915_gem_execbuffer2 execbuf = {
> +               .buffers_ptr = to_user_pointer(&exec),
> +               .buffer_count = 1,
> +               .flags = engine->map_index,

No. Do not store engine->map_index in the global array, as that is
per-context and I would like to iterate over different arrays of engines.

> +               .rsvd1 = ctx,
> +       };
> +
> +       gem_execbuf(fd, &execbuf);

This doesn't actually prove anything other than no -EINVAL. How many
different ways might we have accidentally caused success. Could we feed
in a known failure execbuf and then look for specific failures? (Hint,
what happens if handle = 0.)
-Chris


More information about the igt-dev mailing list