Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Pravalika Gurram <pravalika.gurram@intel.com>
To: igt-dev@lists.freedesktop.org, zbigniew.kempczynski@intel.com,
	sai.gowtham.ch@intel.com, katarzyna.piecielska@intel.com
Cc: Pravalika Gurram <pravalika.gurram@intel.com>
Subject: [PATCH i-g-t 1/2] lib/xe/xe_query: xe_find_engine_by_class helper
Date: Tue, 15 Oct 2024 19:48:25 +0530	[thread overview]
Message-ID: <20241015141826.4186247-2-pravalika.gurram@intel.com> (raw)
In-Reply-To: <20241015141826.4186247-1-pravalika.gurram@intel.com>

Added "xe_find_engine_by_class" helper function
to query with the required engine class
and get the engine info.

Cc: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Signed-off-by: Pravalika Gurram <pravalika.gurram@intel.com>
---
 lib/xe/xe_query.c | 22 ++++++++++++++++++++++
 lib/xe/xe_query.h |  1 +
 2 files changed, 23 insertions(+)

diff --git a/lib/xe/xe_query.c b/lib/xe/xe_query.c
index 8694fa3f9..ddb9d4065 100644
--- a/lib/xe/xe_query.c
+++ b/lib/xe/xe_query.c
@@ -731,6 +731,28 @@ bool xe_has_engine_class(int fd, uint16_t engine_class)
 	return false;
 }
 
+/**
+ * xe_find_engine_by_class
+ * @fd: xe device fd
+ * @engine_class: engine class
+ *
+ * Returns engine info of xe device @fd and @engine_class otherwise NULL.
+ */
+struct drm_xe_engine *xe_find_engine_by_class(int fd, uint16_t engine_class)
+{
+	struct xe_device *xe_dev;
+
+	xe_dev = find_in_cache(fd);
+	igt_assert(xe_dev);
+
+	igt_assert(engine_class >= 0 && engine_class < xe_dev->engines->num_engines);
+	for (int i = 0; i < xe_dev->engines->num_engines; i++)
+		if (xe_dev->engines->engines[i].instance.engine_class == engine_class)
+			return &xe_dev->engines->engines[i];
+
+	return NULL;
+
+}
 /**
  * xe_has_media_gt:
  * @fd: xe device fd
diff --git a/lib/xe/xe_query.h b/lib/xe/xe_query.h
index fd1155f7f..cabb8078c 100644
--- a/lib/xe/xe_query.h
+++ b/lib/xe/xe_query.h
@@ -108,6 +108,7 @@ uint16_t xe_dev_id(int fd);
 int 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);
+struct drm_xe_engine *xe_find_engine_by_class(int fd, uint16_t engine_class);
 bool xe_has_media_gt(int fd);
 bool xe_is_media_gt(int fd, int gt);
 uint16_t xe_gt_get_tile_id(int fd, int gt);
-- 
2.34.1


  reply	other threads:[~2024-10-15 14:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-15 14:18 [PATCH i-g-t 0/2] xe_find_engine_by_class helper Pravalika Gurram
2024-10-15 14:18 ` Pravalika Gurram [this message]
2024-10-15 15:49   ` [PATCH i-g-t 1/2] lib/xe/xe_query: " Zbigniew Kempczyński
2024-10-15 14:18 ` [PATCH i-g-t 2/2] tests/intel/xe_exec_compute_mode: LR mode should use command or render Pravalika Gurram
2024-10-15 15:54   ` Zbigniew Kempczyński
2024-10-16  6:24   ` Zbigniew Kempczyński
2024-10-15 18:52 ` ✓ CI.xeBAT: success for xe_find_engine_by_class helper Patchwork
2024-10-15 18:59 ` ✓ Fi.CI.BAT: " Patchwork
2024-10-15 19:52 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-10-16  4:14 ` ✗ CI.xeFULL: " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2024-10-16 10:19 [PATCH i-g-t 0/2] " Pravalika Gurram
2024-10-16 10:19 ` [PATCH i-g-t 1/2] lib/xe/xe_query: " Pravalika Gurram
2024-10-16 10:36   ` Zbigniew Kempczyński
2024-10-21 12:59   ` Kamil Konieczny
2024-10-22 13:55     ` Zbigniew Kempczyński

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=20241015141826.4186247-2-pravalika.gurram@intel.com \
    --to=pravalika.gurram@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=katarzyna.piecielska@intel.com \
    --cc=sai.gowtham.ch@intel.com \
    --cc=zbigniew.kempczynski@intel.com \
    /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