summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMatthew Auld <matthew.auld@intel.com>2021-07-30 09:53:44 +0100
committerMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2021-08-06 12:08:46 +0200
commit9956ccf1cb40e8c445ef7b5027598585fc045db8 (patch)
treeb0e7899d06148ac74f0bac92b1ef789dd40b46dd /lib
parent395d36b43f513bfaa027abe3d776c63301bb4291 (diff)
lib/intel_bufops: update mmap_{read, write} for discrete
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.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')
-rw-r--r--lib/intel_bufops.c25
1 files 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)