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: Wed, 16 Oct 2024 15:49:32 +0530 [thread overview]
Message-ID: <20241016101933.4191790-2-pravalika.gurram@intel.com> (raw)
In-Reply-To: <20241016101933.4191790-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 | 20 ++++++++++++++++++++
lib/xe/xe_query.h | 1 +
2 files changed, 21 insertions(+)
diff --git a/lib/xe/xe_query.c b/lib/xe/xe_query.c
index 8694fa3f9..0c9cff066 100644
--- a/lib/xe/xe_query.c
+++ b/lib/xe/xe_query.c
@@ -731,6 +731,26 @@ 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);
+
+ 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
next prev parent reply other threads:[~2024-10-16 10:20 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-16 10:19 [PATCH i-g-t 0/2] xe_find_engine_by_class helper Pravalika Gurram
2024-10-16 10:19 ` Pravalika Gurram [this message]
2024-10-16 10:36 ` [PATCH i-g-t 1/2] lib/xe/xe_query: " Zbigniew Kempczyński
2024-10-21 12:59 ` Kamil Konieczny
2024-10-22 13:55 ` Zbigniew Kempczyński
2024-10-16 10:19 ` [PATCH i-g-t 2/2] tests/intel/xe_exec_compute_mode: Use xe_find_engine_by_class Pravalika Gurram
2024-10-16 10:37 ` Zbigniew Kempczyński
2024-10-21 15:40 ` Kamil Konieczny
2024-10-22 10:29 ` Zbigniew Kempczyński
2024-10-16 10:39 ` ✗ GitLab.Pipeline: warning for xe_find_engine_by_class helper (rev2) Patchwork
2024-10-16 11:05 ` ✗ Fi.CI.BAT: failure " Patchwork
2024-10-16 11:11 ` ✓ CI.xeBAT: success " Patchwork
2024-10-16 23:24 ` ✗ CI.xeFULL: failure " Patchwork
2024-10-21 10:47 ` Gurram, Pravalika
2024-10-22 10:31 ` Zbigniew Kempczyński
-- strict thread matches above, loose matches on Subject: below --
2024-10-15 14:18 [PATCH i-g-t 0/2] xe_find_engine_by_class helper Pravalika Gurram
2024-10-15 14:18 ` [PATCH i-g-t 1/2] lib/xe/xe_query: " Pravalika Gurram
2024-10-15 15:49 ` 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=20241016101933.4191790-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