[PATCH v2 3/3] drm/msm/prime: Add mmap_info support
Rob Clark
robdclark at gmail.com
Mon Aug 15 21:15:14 UTC 2022
From: Rob Clark <robdclark at chromium.org>
Signed-off-by: Rob Clark <robdclark at chromium.org>
---
drivers/gpu/drm/msm/msm_gem.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c
index 1dee0d18abbb..1db53545ac40 100644
--- a/drivers/gpu/drm/msm/msm_gem.c
+++ b/drivers/gpu/drm/msm/msm_gem.c
@@ -1048,6 +1048,17 @@ static const struct vm_operations_struct vm_ops = {
.close = drm_gem_vm_close,
};
+static enum dma_buf_map_info msm_gem_map_info(struct drm_gem_object *obj)
+{
+ struct msm_gem_object *msm_obj = to_msm_bo(obj);
+
+ switch (msm_obj->flags & MSM_BO_CACHE_MASK) {
+ case MSM_BO_WC: return DMA_BUF_COHERENT_WC;
+ case MSM_BO_CACHED_COHERENT: return DMA_BUF_COHERENT_CACHED;
+ default: return DMA_BUF_MAP_INCOHERENT;
+ }
+}
+
static const struct drm_gem_object_funcs msm_gem_object_funcs = {
.free = msm_gem_free_object,
.pin = msm_gem_prime_pin,
@@ -1057,6 +1068,7 @@ static const struct drm_gem_object_funcs msm_gem_object_funcs = {
.vunmap = msm_gem_prime_vunmap,
.mmap = msm_gem_object_mmap,
.vm_ops = &vm_ops,
+ .map_info = msm_gem_map_info,
};
static int msm_gem_new_impl(struct drm_device *dev,
--
2.36.1
More information about the dri-devel
mailing list