[igt-dev] [PATCH i-g-t 85/89] igt/dummyload: Require an intel_ctx_t for POLL_RUN and !ALL_ENGINES

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


On Fri, Apr 23, 2021 at 04:52:48PM -0500, Jason Ekstrand wrote:
> This lets us drop gem_context_lookup_engines
> 
> Signed-off-by: Jason Ekstrand <jason at jlekstrand.net>
> ---
>  lib/i915/gem_engine_topology.c | 29 -----------------------------
>  lib/i915/gem_engine_topology.h |  3 ---
>  lib/igt_dummyload.c            | 20 +++++---------------
>  3 files changed, 5 insertions(+), 47 deletions(-)
> 
> diff --git a/lib/i915/gem_engine_topology.c b/lib/i915/gem_engine_topology.c
> index 1b6ac6d2..612519ec 100644
> --- a/lib/i915/gem_engine_topology.c
> +++ b/lib/i915/gem_engine_topology.c
> @@ -316,35 +316,6 @@ intel_engine_list_for_ctx_cfg(int fd, const intel_ctx_cfg_t *cfg)
>  	}
>  }
>  
> -static int gem_topology_get_param(int fd,
> -				  struct drm_i915_gem_context_param *p)
> -{
> -	if (igt_only_list_subtests())
> -		return -ENODEV;
> -
> -	if (__gem_context_get_param(fd, p))
> -		return -1; /* using default engine map */
> -
> -	return 0;
> -}
> -
> -int gem_context_lookup_engine(int fd, uint64_t engine, uint32_t ctx_id,
> -			      struct intel_execution_engine2 *e)
> -{
> -	DEFINE_CONTEXT_ENGINES_PARAM(engines, param, ctx_id, GEM_MAX_ENGINES);
> -
> -	/* a bit paranoic */
> -	igt_assert(e);
> -
> -	if (gem_topology_get_param(fd, &param) || !param.size)
> -		return -EINVAL;
> -
> -	e->class = engines.engines[engine].engine_class;
> -	e->instance = engines.engines[engine].engine_instance;
> -
> -	return 0;
> -}
> -
>  /**
>   * gem_has_engine_topology:
>   * @fd: open i915 drm file descriptor
> diff --git a/lib/i915/gem_engine_topology.h b/lib/i915/gem_engine_topology.h
> index 8f5987f6..991d0ff8 100644
> --- a/lib/i915/gem_engine_topology.h
> +++ b/lib/i915/gem_engine_topology.h
> @@ -61,9 +61,6 @@ intel_get_current_physical_engine(struct intel_engine_data *ed);
>  
>  void intel_next_engine(struct intel_engine_data *ed);
>  
> -int gem_context_lookup_engine(int fd, uint64_t engine, uint32_t ctx_id,
> -			      struct intel_execution_engine2 *e);
> -
>  bool gem_context_has_engine_map(int fd, uint32_t ctx);
>  
>  bool gem_engine_is_equal(const struct intel_execution_engine2 *e1,
> diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c
> index ae6c9542..baa2ac55 100644
> --- a/lib/igt_dummyload.c
> +++ b/lib/igt_dummyload.c
> @@ -421,22 +421,12 @@ igt_spin_factory(int fd, const struct igt_spin_factory *opts)
>  {
>  	igt_spin_t *spin;
>  
> -	if (opts->engine != ALL_ENGINES) {
> -		struct intel_execution_engine2 e;
> -		int class;
> -
> -		if (opts->ctx) {
> -			class = opts->ctx->cfg.engines[opts->engine].engine_class;
> -		} else if (!gem_context_lookup_engine(fd, opts->engine,
> -						      opts->ctx_id, &e)) {
> -			class = e.class;
> -		} else {
> -			gem_require_ring(fd, opts->engine);
> -			class = gem_execbuf_flags_to_engine_class(opts->engine);
> -		}
> +	if ((opts->flags & IGT_SPIN_POLL_RUN) && opts->engine != ALL_ENGINES) {
> +		unsigned int class;
>  
> -		if (opts->flags & IGT_SPIN_POLL_RUN)
> -			igt_require(gem_class_can_store_dword(fd, class));
> +		igt_assert(opts->ctx);
> +		class = intel_ctx_engine_class(opts->ctx, opts->engine);
> +		igt_require(gem_class_can_store_dword(fd, class));
>  	}
>  
>  	if (opts->flags & IGT_SPIN_INVALID_CS)
> -- 
> 2.31.1

LGTM.

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

--
Zbigniew


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