summaryrefslogtreecommitdiff
path: root/lib/i915/gem_mman.h
diff options
context:
space:
mode:
authorMatthew Auld <matthew.auld@intel.com>2021-07-30 09:53:47 +0100
committerMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2021-08-06 12:08:46 +0200
commitaa247992dfd6b9ba829c94945cfa3a6373389ae1 (patch)
tree231f06956d30f321adba4d9754426324658b6630 /lib/i915/gem_mman.h
parentcfce573b2e353c582ff20676bc0cede8a2204951 (diff)
lib/i915/gem_mman: add helper query for has_device_coherent
Might be useful in some tests, where we are not explicitly testing WC maps, but rather just require something that is "device coherent", which should also play nice on discrete platforms. Signed-off-by: Matthew Auld <matthew.auld@intel.com> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Ashutosh Dixit <ashutosh.dixit@intel.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Ramalingam C <ramalingam.c@intel.com> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Diffstat (limited to 'lib/i915/gem_mman.h')
-rw-r--r--lib/i915/gem_mman.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/i915/gem_mman.h b/lib/i915/gem_mman.h
index 290c997d..5966ddb5 100644
--- a/lib/i915/gem_mman.h
+++ b/lib/i915/gem_mman.h
@@ -41,6 +41,7 @@ void *gem_mmap_offset__fixed(int fd, uint32_t handle, uint64_t offset,
uint64_t size, unsigned prot);
void *gem_mmap__device_coherent(int fd, uint32_t handle, uint64_t offset,
uint64_t size, unsigned prot);
+bool gem_mmap__has_device_coherent(int fd);
void *gem_mmap__cpu_coherent(int fd, uint32_t handle, uint64_t offset,
uint64_t size, unsigned prot);
@@ -96,6 +97,16 @@ int gem_munmap(void *ptr, uint64_t size);
*/
#define gem_require_mmap_offset_wc(fd) igt_require(gem_mmap_offset__has_wc(fd))
+/**
+ * gem_require_mmap_offset_device_coherent:
+ * @fd: open i915 drm file descriptor
+ *
+ * Feature test macro to query whether direct (i.e. cpu access path, bypassing
+ * the gtt) write-combine memory mappings are available, or fixed mapping for
+ * discrete. Automatically skips through igt_require() if not.
+ */
+#define gem_require_mmap_device_coherent(fd) igt_require(gem_mmap__has_device_coherent(fd))
+
extern const struct mmap_offset {
const char *name;
unsigned int type;