From: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t v2 02/10] lib/xe_query: Add region helpers and missing doc
Date: Tue, 18 Apr 2023 09:25:27 +0200 [thread overview]
Message-ID: <20230418072535.14946-3-zbigniew.kempczynski@intel.com> (raw)
In-Reply-To: <20230418072535.14946-1-zbigniew.kempczynski@intel.com>
For easier iterate over memory regions and produce dynamic subtests
add xe_region_name() helper.
As Xe requires buffer size alignment during creating bo add
xe_min_page_size() helper.
Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
---
lib/xe/xe_query.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
lib/xe/xe_query.h | 2 ++
2 files changed, 47 insertions(+)
diff --git a/lib/xe/xe_query.c b/lib/xe/xe_query.c
index 2b627a78ac..bd5eb1d189 100644
--- a/lib/xe/xe_query.c
+++ b/lib/xe/xe_query.c
@@ -422,6 +422,13 @@ struct drm_xe_engine_class_instance *xe_hw_engine(int fd, int idx)
return &xe_dev->hw_engines[idx];
}
+/**
+ * xe_mem_region:
+ * @fd: xe device fd
+ * @region: region mask
+ *
+ * Returns memory region structure for @region mask.
+ */
struct drm_xe_query_mem_region *xe_mem_region(int fd, uint64_t region)
{
struct xe_device *xe_dev;
@@ -434,6 +441,44 @@ struct drm_xe_query_mem_region *xe_mem_region(int fd, uint64_t region)
return &xe_dev->mem_usage->regions[region_idx];
}
+/**
+ * xe_region_name:
+ * @region: region mask
+ *
+ * Returns region string like "system" or "vram-n" where n=0...62.
+ */
+const char *xe_region_name(uint64_t region)
+{
+ static char **vrams;
+ int region_idx = ffs(region) - 1;
+
+ /* Populate the array */
+ if (!vrams) {
+ vrams = calloc(64, sizeof(char *));
+ for (int i = 0; i < 64; i++) {
+ if (i != 0)
+ asprintf(&vrams[i], "vram-%d", i - 1);
+ else
+ asprintf(&vrams[i], "system");
+ igt_assert(vrams[i]);
+ }
+ }
+
+ return vrams[region_idx];
+}
+
+/**
+ * xe_min_page_size:
+ * @fd: xe device fd
+ * @region: region mask
+ *
+ * Returns minimum page size for @region.
+ */
+uint32_t xe_min_page_size(int fd, uint64_t region)
+{
+ return xe_mem_region(fd, region)->min_page_size;
+}
+
/**
* xe_number_hw_engine:
* @fd: xe device fd
diff --git a/lib/xe/xe_query.h b/lib/xe/xe_query.h
index 0d4b810a10..f49acb1d7b 100644
--- a/lib/xe/xe_query.h
+++ b/lib/xe/xe_query.h
@@ -84,6 +84,8 @@ uint64_t vram_if_possible(int fd, int gt);
struct drm_xe_engine_class_instance *xe_hw_engines(int fd);
struct drm_xe_engine_class_instance *xe_hw_engine(int fd, int idx);
struct drm_xe_query_mem_region *xe_mem_region(int fd, uint64_t region);
+const char *xe_region_name(uint64_t region);
+uint32_t xe_min_page_size(int fd, uint64_t region);
unsigned int xe_number_hw_engines(int fd);
bool xe_has_vram(int fd);
//uint64_t xe_vram_size(int fd);
--
2.34.1
next prev parent reply other threads:[~2023-04-18 7:25 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-18 7:25 [igt-dev] [PATCH i-g-t v2 00/10] Integrate intel-bb with Xe Zbigniew Kempczyński
2023-04-18 7:25 ` [igt-dev] [PATCH i-g-t v2 01/10] lib/xe_ioctl: Add missing header for direct resolving Zbigniew Kempczyński
2023-04-19 14:10 ` Kamil Konieczny
2023-04-18 7:25 ` Zbigniew Kempczyński [this message]
2023-04-19 14:15 ` [igt-dev] [PATCH i-g-t v2 02/10] lib/xe_query: Add region helpers and missing doc Kamil Konieczny
2023-04-18 7:25 ` [igt-dev] [PATCH i-g-t v2 03/10] lib/xe_query: Remove commented out function prototype Zbigniew Kempczyński
2023-04-19 14:15 ` Kamil Konieczny
2023-04-18 7:25 ` [igt-dev] [PATCH i-g-t v2 04/10] lib/intel_allocator: Add allocator support for Xe Zbigniew Kempczyński
2023-04-19 14:28 ` Kamil Konieczny
2023-04-19 19:34 ` Zbigniew Kempczyński
2023-04-18 7:25 ` [igt-dev] [PATCH i-g-t v2 05/10] lib/intel_bufops: Add Xe support in bufops Zbigniew Kempczyński
2023-04-18 7:25 ` [igt-dev] [PATCH i-g-t v2 06/10] lib/intel_batchbuffer: Add Xe support in intel-bb Zbigniew Kempczyński
2023-04-18 7:25 ` [igt-dev] [PATCH i-g-t v2 07/10] tests/xe_intel_bb: Check if intel-bb Xe support correctness Zbigniew Kempczyński
2023-04-18 7:25 ` [igt-dev] [PATCH i-g-t v2 08/10] tests/xe-fast-feedback: Add xe_intel_bb test to BAT Zbigniew Kempczyński
2023-04-19 14:04 ` Kamil Konieczny
2023-04-19 19:54 ` Zbigniew Kempczyński
2023-04-18 7:25 ` [igt-dev] [PATCH i-g-t v2 09/10] lib/gpgpu_fill: Use RENDER engine flag to work on Xe Zbigniew Kempczyński
2023-04-18 7:25 ` [igt-dev] [PATCH i-g-t v2 10/10] tests/xe_gpgpu_fill: Exercise gpgpu fill " Zbigniew Kempczyński
2023-04-18 9:19 ` [igt-dev] ✗ GitLab.Pipeline: warning for Integrate intel-bb with Xe (rev2) Patchwork
2023-04-18 9:43 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2023-04-18 13:19 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2023-04-19 12:04 ` [igt-dev] ✓ Fi.CI.BAT: success for Integrate intel-bb with Xe (rev3) Patchwork
2023-04-19 13:39 ` [igt-dev] ✗ Fi.CI.IGT: failure " 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=20230418072535.14946-3-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