[igt-dev] [PATCH i-g-t 38/77] tests/i915/gem_exec_create: Convert to intel_ctx_t

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Tue Jun 15 06:45:01 UTC 2021


On Mon, Jun 14, 2021 at 11:36:53AM -0500, Jason Ekstrand wrote:
> Signed-off-by: Jason Ekstrand <jason at jlekstrand.net>
> ---
>  tests/i915/gem_exec_create.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/i915/gem_exec_create.c b/tests/i915/gem_exec_create.c
> index 8556cb213..612eb032f 100644
> --- a/tests/i915/gem_exec_create.c
> +++ b/tests/i915/gem_exec_create.c
> @@ -61,16 +61,21 @@ static void all(int fd, unsigned flags, int timeout, int ncpus)
>  	struct drm_i915_gem_execbuffer2 execbuf;
>  	struct drm_i915_gem_exec_object2 obj;
>  	unsigned engines[I915_EXEC_RING_MASK + 1], nengine;
> +	const intel_ctx_t *ctx;
>  
>  	nengine = 0;
>  	if (flags & ENGINES) { /* Modern API to iterate over *all* engines */
>  		const struct intel_execution_engine2 *e;
>  
> -		__for_each_physical_engine(fd, e)
> +		ctx = intel_ctx_create_all_physical(fd);
> +
> +		for_each_ctx_engine(fd, ctx, e)
>  			engines[nengine++] = e->flags;
>  
>  		/* Note: modifies engine map on context 0 */
>  	} else {
> +		ctx = intel_ctx_0(fd);
> +
>  		for_each_physical_ring(e, fd)
>  			engines[nengine++] = eb_ring(e);
>  	}
> @@ -85,6 +90,7 @@ static void all(int fd, unsigned flags, int timeout, int ncpus)
>  	execbuf.buffer_count = 1;
>  	execbuf.flags |= I915_EXEC_HANDLE_LUT;
>  	execbuf.flags |= I915_EXEC_NO_RELOC;
> +	execbuf.rsvd1 = ctx->id;
>  	if (__gem_execbuf(fd, &execbuf)) {
>  		execbuf.flags = 0;
>  		gem_execbuf(fd, &execbuf);
> @@ -132,6 +138,7 @@ static void all(int fd, unsigned flags, int timeout, int ncpus)
>  	}
>  	igt_waitchildren();
>  	igt_assert_eq(intel_detect_and_clear_missed_interrupts(fd), 0);
> +	intel_ctx_destroy(fd, ctx);
>  }

Looks ok.

Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>

--
Zbigniew

>  
>  igt_main
> -- 
> 2.31.1
> 
> _______________________________________________
> igt-dev mailing list
> igt-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev


More information about the igt-dev mailing list