On discrete we can no longer call get_caching or set_domain, and the
mmap mode must be FIXED.

Signed-off-by: Matthew Auld <matthew.a...@intel.com>
Cc: Maarten Lankhorst <maarten.lankho...@linux.intel.com>
Cc: Ashutosh Dixit <ashutosh.di...@intel.com>
Cc: Daniel Vetter <daniel.vet...@ffwll.ch>
Cc: Ramalingam C <ramalinga...@intel.com>
---
 lib/intel_bufops.c | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/lib/intel_bufops.c b/lib/intel_bufops.c
index 3ce68663..faca4406 100644
--- a/lib/intel_bufops.c
+++ b/lib/intel_bufops.c
@@ -424,7 +424,18 @@ static void *mmap_write(int fd, struct intel_buf *buf)
 {
        void *map = NULL;
 
-       if (is_cache_coherent(fd, buf->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, buf->handle, 0,
+                                            buf->surface[0].size,
+                                            PROT_READ | PROT_WRITE);
+               igt_assert_eq(gem_wait(fd, buf->handle, 0), 0);
+       }
+
+       if (!map && is_cache_coherent(fd, buf->handle)) {
                map = __gem_mmap_offset__cpu(fd, buf->handle, 0, 
buf->surface[0].size,
                                             PROT_READ | PROT_WRITE);
                if (!map)
@@ -455,7 +466,17 @@ static void *mmap_read(int fd, struct intel_buf *buf)
 {
        void *map = NULL;
 
-       if (gem_has_llc(fd) || is_cache_coherent(fd, buf->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, buf->handle, 0,
+                                            buf->surface[0].size, PROT_READ);
+               igt_assert_eq(gem_wait(fd, buf->handle, 0), 0);
+       }
+
+       if (!map && (gem_has_llc(fd) || is_cache_coherent(fd, buf->handle))) {
                map = __gem_mmap_offset__cpu(fd, buf->handle, 0,
                                             buf->surface[0].size, PROT_READ);
                if (!map)
-- 
2.26.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to