From: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t 1/2] xe/xe_query: Add engine class checker
Date: Thu, 25 May 2023 21:34:10 +0200 [thread overview]
Message-ID: <20230525193411.174802-2-zbigniew.kempczynski@intel.com> (raw)
In-Reply-To: <20230525193411.174802-1-zbigniew.kempczynski@intel.com>
Some platforms might be not equipped with some engine classes so check
before execution is reasonable choice. Add simple engine check to use
in igt_require() constructs.
Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Cc: Kamil Konieczny <kamil.konieczny@linux.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 bd5eb1d189..47be8f301a 100644
--- a/lib/xe/xe_query.c
+++ b/lib/xe/xe_query.c
@@ -536,6 +536,27 @@ xe_dev_FN(xe_va_bits, va_bits, uint32_t);
*/
xe_dev_FN(xe_dev_id, dev_id, uint16_t);
+/**
+ * xe_has_engine_class:
+ * @fd: xe device fd
+ * @engine_class: engine class
+ *
+ * Returns true if device @fd has hardware engine @class otherwise false.
+ */
+bool xe_has_engine_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->number_hw_engines; i++)
+ if (xe_dev->hw_engines[i].engine_class == engine_class)
+ 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 cc6e7cefdc..943ca558a5 100644
--- a/lib/xe/xe_query.h
+++ b/lib/xe/xe_query.h
@@ -94,6 +94,7 @@ uint32_t xe_va_bits(int fd);
uint16_t xe_dev_id(int fd);
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);
struct xe_device *xe_device_get(int fd);
void xe_device_put(int fd);
--
2.34.1
next prev parent reply other threads:[~2023-05-25 19:34 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-25 19:34 [igt-dev] [PATCH i-g-t 0/2] Skip render test on PVC Zbigniew Kempczyński
2023-05-25 19:34 ` Zbigniew Kempczyński [this message]
2023-05-26 5:59 ` [igt-dev] [PATCH i-g-t 1/2] xe/xe_query: Add engine class checker Dandamudi, Priyanka
2023-05-25 19:34 ` [igt-dev] [PATCH i-g-t 2/2] tests/xe_intel_bb: Skip on platforms without render engine Zbigniew Kempczyński
2023-05-26 5:41 ` Dandamudi, Priyanka
2023-05-25 20:33 ` [igt-dev] ✓ Fi.CI.BAT: success for Skip render test on PVC Patchwork
2023-05-26 10:12 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2023-05-26 10:39 ` Zbigniew Kempczyński
2023-05-26 12:29 ` Yedireswarapu, SaiX Nandan
2023-05-26 12:00 ` Patchwork
2023-05-26 12:10 ` Patchwork
2023-05-26 12:23 ` [igt-dev] ✓ Fi.CI.IGT: success " Patchwork
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=20230525193411.174802-2-zbigniew.kempczynski@intel.com \
--to=zbigniew.kempczynski@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