[igt-dev] [PATCH i-g-t 11/89] lib/i915/gem_engine_topology: Factor out static engine listing

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Tue May 18 07:03:26 UTC 2021


On Fri, Apr 23, 2021 at 04:47:35PM -0500, Jason Ekstrand wrote:
> Signed-off-by: Jason Ekstrand <jason at jlekstrand.net>
> Acked-by: Daniel Vetter <daniel.vetter at ffwll.ch>
> ---
>  lib/i915/gem_engine_topology.c | 51 +++++++++++++++++++---------------
>  1 file changed, 29 insertions(+), 22 deletions(-)
> 
> diff --git a/lib/i915/gem_engine_topology.c b/lib/i915/gem_engine_topology.c
> index ae8d2a33..d1f94761 100644
> --- a/lib/i915/gem_engine_topology.c
> +++ b/lib/i915/gem_engine_topology.c
> @@ -212,6 +212,34 @@ intel_get_current_physical_engine(struct intel_engine_data *ed)
>  	return e;
>  }
>  
> +static struct intel_engine_data intel_engine_list_for_static(int fd)
> +{
> +	const struct intel_execution_engine2 *e2;
> +	struct intel_engine_data engine_data = { };
> +
> +	igt_debug("using pre-allocated engine list\n");
> +
> +	__for_each_static_engine(e2) {
> +		if (igt_only_list_subtests() ||
> +		    (fd < 0) ||
> +		    gem_has_ring(fd, e2->flags)) {
> +			struct intel_execution_engine2 *__e2 =
> +				&engine_data.engines[
> +				engine_data.nengines];
> +
> +			strcpy(__e2->name, e2->name);
> +			__e2->instance   = e2->instance;
> +			__e2->class      = e2->class;
> +			__e2->flags      = e2->flags;
> +			__e2->is_virtual = false;
> +
> +			engine_data.nengines++;
> +                }
> +	}
> +
> +	return engine_data;
> +}
> +

Ok, just a function extraction.

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

--
Zbigniew



>  static int gem_topology_get_param(int fd,
>  				  struct drm_i915_gem_context_param *p)
>  {
> @@ -232,28 +260,7 @@ struct intel_engine_data intel_init_engine_list(int fd, uint32_t ctx_id)
>  
>  	if (gem_topology_get_param(fd, &param)) {
>  		/* if kernel does not support engine/context mapping */
> -		const struct intel_execution_engine2 *e2;
> -
> -		igt_debug("using pre-allocated engine list\n");
> -
> -		__for_each_static_engine(e2) {
> -			if (igt_only_list_subtests() ||
> -			    (fd < 0) ||
> -			    gem_has_ring(fd, e2->flags)) {
> -				struct intel_execution_engine2 *__e2 =
> -					&engine_data.engines[
> -					engine_data.nengines];
> -
> -				strcpy(__e2->name, e2->name);
> -				__e2->instance   = e2->instance;
> -				__e2->class      = e2->class;
> -				__e2->flags      = e2->flags;
> -				__e2->is_virtual = false;
> -
> -				engine_data.nengines++;
> -                        }
> -		}
> -		return engine_data;
> +		return intel_engine_list_for_static(fd);
>  	}
>  
>  	if (!param.size) {
> -- 
> 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