Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Lukasz Laguna <lukasz.laguna@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t 1/1] lib/xe/xe_query: add media GT presence checker
Date: Thu, 23 Nov 2023 09:55:27 +0100	[thread overview]
Message-ID: <20231123085527.8126-2-lukasz.laguna@intel.com> (raw)
In-Reply-To: <20231123085527.8126-1-lukasz.laguna@intel.com>

Add helper checking if platform is equipped with media GT.

v2: add "lib/" prefix to subject (Kamil)

Signed-off-by: Lukasz Laguna <lukasz.laguna@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 afd443be3..1759d1e93 100644
--- a/lib/xe/xe_query.c
+++ b/lib/xe/xe_query.c
@@ -711,6 +711,26 @@ bool xe_has_engine_class(int fd, uint16_t engine_class)
 	return false;
 }
 
+/**
+ * xe_has_media_gt:
+ * @fd: xe device fd
+ *
+ * Returns true if device @fd has media GT otherwise false.
+ */
+bool xe_has_media_gt(int fd)
+{
+	struct xe_device *xe_dev;
+
+	xe_dev = find_in_cache(fd);
+	igt_assert(xe_dev);
+
+	for (int i = 0; i < xe_dev->gt_list->num_gt; i++)
+		if (xe_dev->gt_list->gt_list[i].type == DRM_XE_QUERY_GT_TYPE_MEDIA)
+			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 38e9aa440..66a62eeb8 100644
--- a/lib/xe/xe_query.h
+++ b/lib/xe/xe_query.h
@@ -99,6 +99,7 @@ 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);
+bool xe_has_media_gt(int fd);
 
 struct xe_device *xe_device_get(int fd);
 void xe_device_put(int fd);
-- 
2.40.0

  reply	other threads:[~2023-11-23  8:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-23  8:55 [igt-dev] [PATCH i-g-t 0/1] lib/xe/xe_query: add media GT presence checker Lukasz Laguna
2023-11-23  8:55 ` Lukasz Laguna [this message]
2023-11-23 10:50 ` [igt-dev] ✗ Fi.CI.BAT: failure for " Patchwork
2023-11-23 11:32 ` [igt-dev] ✓ CI.xeBAT: success " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2023-11-23  8:53 [igt-dev] [PATCH i-g-t 0/1] xe/xe_query: " Lukasz Laguna
2023-11-23  8:53 ` [igt-dev] [PATCH i-g-t 1/1] lib/xe/xe_query: " Lukasz Laguna
2023-11-27 17:08   ` Kamil Konieczny

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=20231123085527.8126-2-lukasz.laguna@intel.com \
    --to=lukasz.laguna@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