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

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Tue Jun 15 07:56:19 UTC 2021


On Mon, Jun 14, 2021 at 11:37:00AM -0500, Jason Ekstrand wrote:
> Signed-off-by: Jason Ekstrand <jason at jlekstrand.net>
> ---
>  tests/i915/gem_cs_tlb.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/i915/gem_cs_tlb.c b/tests/i915/gem_cs_tlb.c
> index dec9c107e..7682dae69 100644
> --- a/tests/i915/gem_cs_tlb.c
> +++ b/tests/i915/gem_cs_tlb.c
> @@ -91,7 +91,8 @@ mmap_coherent(int fd, uint32_t handle, int size)
>  	return ptr;
>  }
>  
> -static void run_on_ring(int fd, unsigned ring_id, const char *ring_name)
> +static void run_on_ring(int fd, const intel_ctx_t *ctx,
> +			unsigned ring_id, const char *ring_name)
>  {
>  	struct drm_i915_gem_execbuffer2 execbuf;
>  	struct drm_i915_gem_exec_object2 execobj;
> @@ -117,6 +118,7 @@ static void run_on_ring(int fd, unsigned ring_id, const char *ring_name)
>  	memset(&execbuf, 0, sizeof(execbuf));
>  	execbuf.buffers_ptr = to_user_pointer(&execobj);
>  	execbuf.buffer_count = 1;
> +	execbuf.rsvd1 = ctx->id;
>  	execbuf.flags = ring_id;
>  
>  	/* Execute once to allocate a gtt-offset */
> @@ -144,17 +146,19 @@ static void run_on_ring(int fd, unsigned ring_id, const char *ring_name)
>  igt_main
>  {
>  	const struct intel_execution_engine2 *e;
> +	const intel_ctx_t *ctx = NULL;

Initialization not necessary.

>  	int fd = -1;
>  
>  	igt_fixture {
>  		fd = drm_open_driver(DRIVER_INTEL);
>  		igt_require_gem(fd);
> +		ctx = intel_ctx_create_all_physical(fd);
>  	}
>  
>  	igt_subtest_with_dynamic("engines") {
> -		__for_each_physical_engine(fd, e) {
> +		for_each_ctx_engine(fd, ctx, e) {
>  			igt_dynamic_f("%s", e->name)
> -				run_on_ring(fd, e->flags, e->name);
> +				run_on_ring(fd, ctx, e->flags, e->name);
>  		}
>  	}

intel_ctx_destroy() for completeness.

With above:

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

--
Zbigniew

>  
> -- 
> 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