summaryrefslogtreecommitdiff
path: root/lib/ioctl_wrappers.c
diff options
context:
space:
mode:
authorMatthew Auld <matthew.auld@intel.com>2021-07-30 09:53:43 +0100
committerMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2021-08-06 12:08:46 +0200
commit395d36b43f513bfaa027abe3d776c63301bb4291 (patch)
tree2ae153f4dffc0e1593af7509b34b9feb3691a33a /lib/ioctl_wrappers.c
parent9139a16f07c27cb436cda55cfa6d172b14ca672e (diff)
lib/ioctl_wrappers: update mmap_{read, write} for discrete
We can no longer just call get_caching or set_domain, and the mmap mode must be FIXED. This should bring back gem_exec_basic and a few others in CI on DG1. 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/ioctl_wrappers.c')
-rw-r--r--lib/ioctl_wrappers.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
index 25c5e495..7e27a1b3 100644
--- a/lib/ioctl_wrappers.c
+++ b/lib/ioctl_wrappers.c
@@ -339,7 +339,18 @@ static void mmap_write(int fd, uint32_t handle, uint64_t offset,
if (!length)
return;
- if (is_cache_coherent(fd, handle)) {
+ if (gem_has_lmem(fd)) {
+ /*
+ * set/get_caching and set_domain are no longer supported on
+ * discrete, also the only mmap mode supportd is FIXED.
+ */
+ map = gem_mmap_offset__fixed(fd, handle, 0,
+ offset + length,
+ PROT_READ | PROT_WRITE);
+ igt_assert_eq(gem_wait(fd, handle, 0), 0);
+ }
+
+ if (!map && is_cache_coherent(fd, handle)) {
/* offset arg for mmap functions must be 0 */
map = __gem_mmap__cpu_coherent(fd, handle, 0, offset + length,
PROT_READ | PROT_WRITE);
@@ -369,7 +380,17 @@ static void mmap_read(int fd, uint32_t handle, uint64_t offset, void *buf, uint6
if (!length)
return;
- if (gem_has_llc(fd) || is_cache_coherent(fd, handle)) {
+ if (gem_has_lmem(fd)) {
+ /*
+ * set/get_caching and set_domain are no longer supported on
+ * discrete, also the only supported mmap mode is FIXED.
+ */
+ map = gem_mmap_offset__fixed(fd, handle, 0,
+ offset + length, PROT_READ);
+ igt_assert_eq(gem_wait(fd, handle, 0), 0);
+ }
+
+ if (!map && (gem_has_llc(fd) || is_cache_coherent(fd, handle))) {
/* offset arg for mmap functions must be 0 */
map = __gem_mmap__cpu_coherent(fd, handle, 0,
offset + length, PROT_READ);