[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220815211516.3169470-3-robdclark@gmail.com>
Date: Mon, 15 Aug 2022 14:15:13 -0700
From: Rob Clark <robdclark@...il.com>
To: dri-devel@...ts.freedesktop.org
Cc: freedreno@...ts.freedesktop.org, Daniel Vetter <daniel@...ll.ch>,
Christian König <christian.koenig@....com>,
Rob Clark <robdclark@...omium.org>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>,
Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...ux.ie>,
linux-kernel@...r.kernel.org (open list)
Subject: [PATCH v2 2/3] drm/prime: Wire up mmap_info support
From: Rob Clark <robdclark@...omium.org>
Just plumbing the thing thru an extra layer.
Signed-off-by: Rob Clark <robdclark@...omium.org>
---
drivers/gpu/drm/drm_prime.c | 3 +++
include/drm/drm_gem.h | 11 +++++++++++
2 files changed, 14 insertions(+)
diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
index e3f09f18110c..4457fedde1ec 100644
--- a/drivers/gpu/drm/drm_prime.c
+++ b/drivers/gpu/drm/drm_prime.c
@@ -888,6 +888,9 @@ struct dma_buf *drm_gem_prime_export(struct drm_gem_object *obj,
.resv = obj->resv,
};
+ if (obj->funcs && obj->funcs->map_info)
+ exp_info.map_info = obj->funcs->map_info(obj);
+
return drm_gem_dmabuf_export(dev, &exp_info);
}
EXPORT_SYMBOL(drm_gem_prime_export);
diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h
index f28a48a6f846..a573ebfc529a 100644
--- a/include/drm/drm_gem.h
+++ b/include/drm/drm_gem.h
@@ -172,6 +172,17 @@ struct drm_gem_object_funcs {
* This is optional but necessary for mmap support.
*/
const struct vm_operations_struct *vm_ops;
+
+ /**
+ * @map_info:
+ *
+ * Return dma_buf_map_info indicating the coherency of an exported
+ * dma-buf.
+ *
+ * This callback is optional. If not provided, exported dma-bufs are
+ * assumed to be DMA_BUF_MAP_INCOHERENT.
+ */
+ enum dma_buf_map_info (*map_info)(struct drm_gem_object *obj);
};
/**
--
2.36.1
Powered by blists - more mailing lists