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

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Mon Jun 14 17:32:55 UTC 2021


On Mon, Jun 14, 2021 at 11:36:40AM -0500, Jason Ekstrand wrote:
> Signed-off-by: Jason Ekstrand <jason at jlekstrand.net>
> ---
>  tests/i915/gem_wait.c | 20 +++++++++++++-------
>  1 file changed, 13 insertions(+), 7 deletions(-)
> 
> diff --git a/tests/i915/gem_wait.c b/tests/i915/gem_wait.c
> index 81ac25b59..8ebd610dd 100644
> --- a/tests/i915/gem_wait.c
> +++ b/tests/i915/gem_wait.c
> @@ -75,13 +75,15 @@ static void invalid_buf(int fd)
>  
>  #define timespec_isset(x) ((x)->tv_sec | (x)->tv_nsec)
>  
> -static void basic(int fd, unsigned engine, unsigned flags)
> +static void basic(int fd, const intel_ctx_t *ctx, unsigned engine,
> +		  unsigned flags)
>  {
>  	IGT_CORK_HANDLE(cork);
>  	uint32_t plug =
>  		flags & (WRITE | AWAIT) ? igt_cork_plug(&cork, fd) : 0;
>  	igt_spin_t *spin =
>  		igt_spin_new(fd,
> +			     .ctx = ctx,
>  			     .engine = engine,
>  			     .dependency = plug,
>  			     .flags = (flags & HANG) ? IGT_SPIN_NO_PREEMPTION : 0);
> @@ -147,21 +149,22 @@ static void basic(int fd, unsigned engine, unsigned flags)
>  	igt_spin_free(fd, spin);
>  }
>  
> -static void test_all_engines(const char *name, int i915, unsigned int test)
> +static void test_all_engines(const char *name, int i915, const intel_ctx_t *ctx,
> +			     unsigned int test)
>  {
>  	const struct intel_execution_engine2 *e;
>  
>  	igt_subtest_with_dynamic(name) {
>  		igt_dynamic("all") {
>  			gem_quiescent_gpu(i915);
> -			basic(i915, ALL_ENGINES, test);
> +			basic(i915, ctx, ALL_ENGINES, test);
>  			gem_quiescent_gpu(i915);
>  		}
>  
> -		__for_each_physical_engine(i915, e) {
> +		for_each_ctx_engine(i915, ctx, e) {
>  			igt_dynamic_f("%s", e->name) {
>  				gem_quiescent_gpu(i915);
> -				basic(i915, e->flags, test);
> +				basic(i915, ctx, e->flags, test);
>  				gem_quiescent_gpu(i915);
>  			}
>  		}
> @@ -170,11 +173,13 @@ static void test_all_engines(const char *name, int i915, unsigned int test)
>  
>  igt_main
>  {
> +	const intel_ctx_t *ctx = NULL;

Null not necessary, regardless that:

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

--
Zbigniew

>  	int fd = -1;
>  
>  	igt_fixture {
>  		fd = drm_open_driver_master(DRIVER_INTEL);
>  		igt_require_gem(fd);
> +		ctx = intel_ctx_create_all_physical(fd);
>  	}
>  
>  	igt_subtest("invalid-flags")
> @@ -202,7 +207,7 @@ igt_main
>  		}
>  
>  		for (const typeof(*tests) *t = tests; t->name; t++)
> -			test_all_engines(t->name, fd, t->flags);
> +			test_all_engines(t->name, fd, ctx, t->flags);
>  
>  		igt_fixture {
>  			igt_stop_signal_helper();
> @@ -229,7 +234,7 @@ igt_main
>  		}
>  
>  		for (const typeof(*tests) *t = tests; t->name; t++)
> -			test_all_engines(t->name, fd, t->flags);
> +			test_all_engines(t->name, fd, ctx, t->flags);
>  
>  		igt_fixture {
>  			igt_stop_signal_helper();
> @@ -238,6 +243,7 @@ igt_main
>  	}
>  
>  	igt_fixture {
> +		intel_ctx_destroy(fd, ctx);
>  		close(fd);
>  	}
>  }
> -- 
> 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