Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Auld <matthew.auld@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>
Subject: [PATCH i-g-t v2 5/6] lib/intel_mocs: add defer-to-pat-index
Date: Tue,  5 Mar 2024 12:17:53 +0000	[thread overview]
Message-ID: <20240305121754.182425-5-matthew.auld@intel.com> (raw)
In-Reply-To: <20240305121754.182425-1-matthew.auld@intel.com>

At least on Xe2 it looks like we can just use MOCS index zero to defer
the selected caching mode to that of the PAT index. This will be useful
in an upcoming patch.

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
---
 lib/intel_mocs.c | 14 ++++++++++++++
 lib/intel_mocs.h |  1 +
 2 files changed, 15 insertions(+)

diff --git a/lib/intel_mocs.c b/lib/intel_mocs.c
index 4a9c305dc..bf6ee1958 100644
--- a/lib/intel_mocs.c
+++ b/lib/intel_mocs.c
@@ -9,6 +9,7 @@
 struct drm_intel_mocs_index {
 	uint8_t uc_index;
 	uint8_t wb_index;
+	uint8_t deferred_index;
 };
 
 static void get_mocs_index(int fd, struct drm_intel_mocs_index *mocs)
@@ -25,6 +26,7 @@ static void get_mocs_index(int fd, struct drm_intel_mocs_index *mocs)
 	if (intel_graphics_ver(devid) >= IP_VER(20, 0)) {
 		mocs->uc_index = 3;
 		mocs->wb_index = 4;
+		mocs->deferred_index = 0;
 	} else if (IS_METEORLAKE(devid)) {
 		mocs->uc_index = 5;
 		mocs->wb_index = 10;
@@ -60,3 +62,15 @@ uint8_t intel_get_uc_mocs_index(int fd)
 
 	return mocs.uc_index;
 }
+
+uint8_t intel_get_deferred_mocs_index(int fd)
+{
+	struct drm_intel_mocs_index mocs;
+	uint16_t dev_id = intel_get_drm_devid(fd);
+
+	igt_assert(AT_LEAST_GEN(dev_id, 20));
+
+	get_mocs_index(fd, &mocs);
+
+	return mocs.deferred_index;
+}
diff --git a/lib/intel_mocs.h b/lib/intel_mocs.h
index b5c79b0e1..bfdc23210 100644
--- a/lib/intel_mocs.h
+++ b/lib/intel_mocs.h
@@ -12,5 +12,6 @@
 
 uint8_t intel_get_wb_mocs_index(int fd);
 uint8_t intel_get_uc_mocs_index(int fd);
+uint8_t intel_get_deferred_mocs_index(int fd);
 
 #endif /* _INTEL_MOCS_H */
-- 
2.43.2


  parent reply	other threads:[~2024-03-05 12:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-05 12:17 [PATCH i-g-t v2 1/6] lib/rendercopy_gen9: use MOCS index helper Matthew Auld
2024-03-05 12:17 ` [PATCH i-g-t v2 2/6] lib/gpu_cmds: default to uc MOCS index Matthew Auld
2024-03-06  6:01   ` Zbigniew Kempczyński
2024-03-05 12:17 ` [PATCH i-g-t v2 3/6] lib/intel_buf: revamp MOCS usage Matthew Auld
2024-03-06  6:29   ` Zbigniew Kempczyński
2024-03-05 12:17 ` [PATCH i-g-t v2 4/6] lib/intel_buf: expose mocs_index Matthew Auld
2024-03-06  6:32   ` Zbigniew Kempczyński
2024-03-05 12:17 ` Matthew Auld [this message]
2024-03-06 14:11   ` [PATCH i-g-t v2 5/6] lib/intel_mocs: add defer-to-pat-index Zbigniew Kempczyński
2024-03-05 12:17 ` [PATCH i-g-t v2 6/6] tests/intel/xe_pat: verify wb-transient with pipe crc Matthew Auld
2024-03-05 13:40 ` ✓ CI.xeBAT: success for series starting with [i-g-t,v2,1/6] lib/rendercopy_gen9: use MOCS index helper Patchwork
2024-03-05 14:04 ` ✗ Fi.CI.BAT: 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=20240305121754.182425-5-matthew.auld@intel.com \
    --to=matthew.auld@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --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