summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMatthew Auld <matthew.auld@intel.com>2024-03-06 15:04:51 +0000
committerMatthew Auld <matthew.auld@intel.com>2024-03-08 12:20:38 +0000
commit7fb13b4c00d25ce8d554b2b79289c9ec49cb1e85 (patch)
treed0f99130a62f3d17d9896c398f26e9f127b2e357 /lib
parentfcc9dc6d10a76078fa77f3446baac9cd23cf491e (diff)
lib/intel_mocs: add defer-to-pat MOCS index
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. v2: (Zbigniew) - Let's go with intel_get_defer_to_pat_mocs_index() Signed-off-by: Matthew Auld <matthew.auld@intel.com> Cc: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/intel_mocs.c14
-rw-r--r--lib/intel_mocs.h1
2 files changed, 15 insertions, 0 deletions
diff --git a/lib/intel_mocs.c b/lib/intel_mocs.c
index 4a9c305dc..b0559e0a5 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 defer_to_pat_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->defer_to_pat_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_defer_to_pat_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.defer_to_pat_index;
+}
diff --git a/lib/intel_mocs.h b/lib/intel_mocs.h
index b5c79b0e1..8597286d2 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_defer_to_pat_mocs_index(int fd);
#endif /* _INTEL_MOCS_H */