From d873c816178d7a1bdefb3c0483b10769c903e4e6 Mon Sep 17 00:00:00 2001 From: Veera Sundaram Sankaran Date: Wed, 22 Mar 2023 15:15:19 -0700 Subject: [PATCH] disp: msm: sde: use drm device for sec camera preview buffers Attach the S2-only secure camera preview buffers with dummy drm device during dma_buf_attach. This will ensure when sg_dma_address will return the phys address for this buffer as its not backed by a context-bank. Change-Id: Iafd40352b92b842d19194976fa4b58e1e07e6f0d Signed-off-by: Veera Sundaram Sankaran --- msm/msm_gem_prime.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/msm/msm_gem_prime.c b/msm/msm_gem_prime.c index 8a5c027bdf..3e48bf4e56 100644 --- a/msm/msm_gem_prime.c +++ b/msm/msm_gem_prime.c @@ -117,7 +117,8 @@ struct drm_gem_object *msm_gem_prime_import(struct drm_device *dev, struct device *attach_dev = NULL; struct msm_drm_private *priv; struct msm_kms *kms; - bool lazy_unmap = true, is_vmid_tvm = false, is_vmid_cp_pixel = false; + bool lazy_unmap = true; + bool is_vmid_tvm = false, is_vmid_cp_pixel = false, is_vmid_cam_preview = false; int *vmid_list, *perms_list; int nelems = 0, i, ret; unsigned long dma_map_attrs = 0; @@ -173,6 +174,9 @@ struct drm_gem_object *msm_gem_prime_import(struct drm_device *dev, is_vmid_tvm = false; dma_map_attrs = 0; break; + } else if (vmid_list[i] == VMID_CP_CAMERA_PREVIEW) { + is_vmid_cam_preview = true; + break; } } @@ -186,7 +190,7 @@ struct drm_gem_object *msm_gem_prime_import(struct drm_device *dev, */ if (is_vmid_cp_pixel) { attach_dev = kms->funcs->get_address_space_device(kms, MSM_SMMU_DOMAIN_SECURE); - } else if (!iommu_present(&platform_bus_type) || is_vmid_tvm) { + } else if (!iommu_present(&platform_bus_type) || is_vmid_tvm || is_vmid_cam_preview) { attach_dev = dev->dev; lazy_unmap = false; } else {