[PATCH 1/2] lib/igt_sysfs: update igt_sysfs_engines to run dynamic tests with its associated engine class.

Kumar, Janga Rahul janga.rahul.kumar at intel.com
Tue Aug 13 10:12:33 UTC 2024


LGTM
Reviewed-by: Janga Rahul Kumar <janga.rahul.kumar at intel.com>

> -----Original Message-----
> From: igt-dev <igt-dev-bounces at lists.freedesktop.org> On Behalf Of
> sai.gowtham.ch at intel.com
> Sent: Tuesday, August 13, 2024 1:12 AM
> To: igt-dev at lists.freedesktop.org; Ch, Sai Gowtham
> <sai.gowtham.ch at intel.com>
> Subject: [PATCH 1/2] lib/igt_sysfs: update igt_sysfs_engines to run dynamic tests
> with its associated engine class.
> 
> From: Sai Gowtham Ch <sai.gowtham.ch at intel.com>
> 
> Correlate updates in sysfs engines queried and the work load submitted to a
> engine, enhancing igt_sysfs_engines so that each update in sysfs engine will
> corelates to it corresponding engine class.
> 
> Signed-off-by: Sai Gowtham Ch <sai.gowtham.ch at intel.com>
> ---
>  lib/igt_sysfs.c | 39 ++++++++++++++++++++++++++++++++++++---
>  lib/igt_sysfs.h |  4 ++--
>  2 files changed, 38 insertions(+), 5 deletions(-)
> 
> diff --git a/lib/igt_sysfs.c b/lib/igt_sysfs.c index 2863e22b5..aec0bb53d 100644
> --- a/lib/igt_sysfs.c
> +++ b/lib/igt_sysfs.c
> @@ -1210,6 +1210,32 @@ void igt_sysfs_rw_attr_verify(igt_sysfs_rw_attr_t
> *rw)
>  	igt_assert(!ret);
>  }
> 
> +/**
> + * xe_get_engine_class:
> + * @name: de_d_name that we get from igt_sysfs_engine.
> + *
> + * It returns engine class corresponding to the engine dir from
> igt_sysfs_engines.
> + *
> + */
> +static uint16_t xe_get_engine_class(char *name) {
> +	uint16_t class;
> +
> +	if (strcmp(name, "rcs") == 0) {
> +		class = DRM_XE_ENGINE_CLASS_RENDER;
> +	} else if (strcmp(name, "bcs") == 0) {
> +		class = DRM_XE_ENGINE_CLASS_COPY;
> +	} else if (strcmp(name, "vcs") == 0) {
> +		class = DRM_XE_ENGINE_CLASS_VIDEO_DECODE;
> +	} else if (strcmp(name, "vecs") == 0) {
> +		class = DRM_XE_ENGINE_CLASS_VIDEO_ENHANCE;
> +	} else if (strcmp(name, "ccs") == 0) {
> +		class = DRM_XE_ENGINE_CLASS_COMPUTE;
> +	}
> +
> +	return class;
> +}
> +
>  /**
>   * igt_sysfs_engines:
>   * @xe: fd of the device
> @@ -1220,11 +1246,12 @@ void igt_sysfs_rw_attr_verify(igt_sysfs_rw_attr_t
> *rw)
>   * It iterates over sysfs/engines and runs a dynamic engine test.
>   *
>   */
> -void igt_sysfs_engines(int xe, int engines, const char **property,
> -		       void (*test)(int, int, const char **))
> +void igt_sysfs_engines(int xe, int engines, int gt, bool all, const char
> **property,
> +		       void (*test)(int, int, const char **, uint16_t, int))
>  {
>  	struct dirent *de;
>  	DIR *dir;
> +	uint16_t class;
> 
>  	lseek(engines, 0, SEEK_SET);
> 
> @@ -1251,7 +1278,13 @@ void igt_sysfs_engines(int xe, int engines, const char
> **property,
>  				igt_require(fstatat(engine_fd, property[2], &st,
> 0) == 0);
>  			}
>  			errno = 0;
> -			test(xe, engine_fd, property);
> +
> +			if (all) {
> +				class = xe_get_engine_class(de->d_name);
> +				test(xe, engine_fd, property, class, gt);
> +			} else {
> +				test(xe, engine_fd, property, 0, 0);
> +			}
>  		}
>  		close(engine_fd);
>  	}
> diff --git a/lib/igt_sysfs.h b/lib/igt_sysfs.h index 27031a015..2a1e3b1bf 100644
> --- a/lib/igt_sysfs.h
> +++ b/lib/igt_sysfs.h
> @@ -163,8 +163,8 @@ typedef struct igt_sysfs_rw_attr {
> 
>  void igt_sysfs_rw_attr_verify(igt_sysfs_rw_attr_t *rw);
> 
> -void igt_sysfs_engines(int xe, int engines, const char **property,
> -		       void (*test)(int, int, const char **));
> +void igt_sysfs_engines(int xe, int engines, int gt, bool all, const char
> **property,
> +		       void (*test)(int, int, const char **, uint16_t, int));
> 
>  char *xe_sysfs_gt_path(int xe_device, int gt, char *path, int pathlen);  int
> xe_sysfs_gt_open(int xe_device, int gt);
> --
> 2.39.1



More information about the igt-dev mailing list