[PATCH i-g-t 3/3] lib/xe/xe_query: Add helper to check if given gt id point to media gt

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Tue Mar 5 04:20:09 UTC 2024


On Fri, Mar 01, 2024 at 04:15:41PM +0100, Piórkowski, Piotr wrote:
> From: Piotr Piórkowski <piotr.piorkowski at intel.com>
> 
> Let's add a helper that can easily verify that the gt id points to
> the media gt.
> 
> Signed-off-by: Piotr Piórkowski <piotr.piorkowski at intel.com>
> ---
>  lib/xe/xe_query.c | 21 +++++++++++++++++++++
>  lib/xe/xe_query.h |  1 +
>  2 files changed, 22 insertions(+)
> 
> diff --git a/lib/xe/xe_query.c b/lib/xe/xe_query.c
> index 729fba6b1..53a2b4386 100644
> --- a/lib/xe/xe_query.c
> +++ b/lib/xe/xe_query.c
> @@ -710,6 +710,27 @@ bool xe_has_media_gt(int fd)
>  	return false;
>  }
>  
> +/**
> + * xe_is_media_gt:
> + * @fd: xe device fd
> + * @gt: gt id
> + *
> + * Returns true if @gt for device @fd is media GT, otherwise false.
> + */
> +bool xe_is_media_gt(int fd, int gt)
> +{
> +	struct xe_device *xe_dev;
> +
> +	xe_dev = find_in_cache(fd);
> +	igt_assert(xe_dev);
> +	igt_assert(gt < xe_number_gt(fd));
> +
> +	if (xe_dev->gt_list->gt_list[gt].type == DRM_XE_QUERY_GT_TYPE_MEDIA)
> +		return true;
> +
> +	return false;
> +}
> +
>  igt_constructor
>  {
>  	xe_device_cache_init();
> diff --git a/lib/xe/xe_query.h b/lib/xe/xe_query.h
> index 2460384c9..82af2706d 100644
> --- a/lib/xe/xe_query.h
> +++ b/lib/xe/xe_query.h
> @@ -98,6 +98,7 @@ bool xe_supports_faults(int fd);
>  const char *xe_engine_class_string(uint32_t engine_class);
>  bool xe_has_engine_class(int fd, uint16_t engine_class);
>  bool xe_has_media_gt(int fd);
> +bool xe_is_media_gt(int fd, int gt);
>  
>  struct xe_device *xe_device_get(int fd);
>  void xe_device_put(int fd);
> -- 
> 2.34.1
>

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

--
Zbigniew



More information about the igt-dev mailing list