Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sai.gowtham.ch@intel.com
To: igt-dev@lists.freedesktop.org, sai.gowtham.ch@intel.com
Subject: [PATCH 1/2] lib/igt_sysfs: update igt_sysfs_engines to run dynamic tests with its associated engine class.
Date: Tue, 13 Aug 2024 01:11:35 +0530	[thread overview]
Message-ID: <20240812194136.6352-2-sai.gowtham.ch@intel.com> (raw)
In-Reply-To: <20240812194136.6352-1-sai.gowtham.ch@intel.com>

From: Sai Gowtham Ch <sai.gowtham.ch@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@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


  reply	other threads:[~2024-08-12 19:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-12 19:41 [PATCH 0/2]lib/igt_sysfs: update igt_sysfs_engines to run dynamic tests with its sai.gowtham.ch
2024-08-12 19:41 ` sai.gowtham.ch [this message]
2024-08-13 10:12   ` [PATCH 1/2] lib/igt_sysfs: update igt_sysfs_engines to run dynamic tests with its associated engine class Kumar, Janga Rahul
2024-08-12 19:41 ` [PATCH 2/2] tests/intel: Adopt igt_sysfs_engines dependent tests to use query " sai.gowtham.ch
2024-08-13 10:12   ` Kumar, Janga Rahul
2024-08-12 20:08 ` ✓ CI.xeBAT: success for lib/igt_sysfs: update igt_sysfs_engines to run dynamic tests with its Patchwork
2024-08-12 20:17 ` ✓ Fi.CI.BAT: " Patchwork
2024-08-13  2:26 ` ✗ CI.xeFULL: failure " Patchwork
2024-08-13  6:55 ` ✗ Fi.CI.IGT: " Patchwork
2024-08-13 14:06   ` Ch, Sai Gowtham

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240812194136.6352-2-sai.gowtham.ch@intel.com \
    --to=sai.gowtham.ch@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox