[PATCH v2 2/3] drm/prime: Wire up mmap_info support

Rob Clark robdclark at gmail.com
Mon Aug 15 21:15:13 UTC 2022


From: Rob Clark <robdclark at chromium.org>

Just plumbing the thing thru an extra layer.

Signed-off-by: Rob Clark <robdclark at chromium.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



More information about the dri-devel mailing list