diff options
| author | Olav Haugan <ohaugan@codeaurora.org> | 2015-05-29 16:52:16 -0700 |
|---|---|---|
| committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-23 20:43:15 -0700 |
| commit | 06dfea5c32d7e00ce57da54ccd6247741e92131e (patch) | |
| tree | 48153a60a76a46da8468122189bd829aab616c4b | |
| parent | f7de3df39b3b80205ea65d410e4439e5ca0472d6 (diff) | |
msm: mdss: use delayed unmap for smmu mappings
Replace dma_map_sg/unmap_sg with msm_dma_map_sg_lazy
/msm_dma_unmpa_sg to avoid buffer unmapping till
the time it is free.
Change-Id: I0559238301882a89d25f3cf99a60140c9e9c1bdf
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
Signed-off-by: Dhaval Patel <pdhaval@codeaurora.org>
| -rw-r--r-- | drivers/video/fbdev/msm/mdss.h | 2 | ||||
| -rw-r--r-- | drivers/video/fbdev/msm/mdss_fb.c | 2 | ||||
| -rw-r--r-- | drivers/video/fbdev/msm/mdss_mdp_splash_logo.c | 5 | ||||
| -rw-r--r-- | drivers/video/fbdev/msm/mdss_mdp_util.c | 3 | ||||
| -rw-r--r-- | drivers/video/fbdev/msm/mdss_smmu.c | 9 | ||||
| -rw-r--r-- | drivers/video/fbdev/msm/mdss_smmu.h | 4 |
6 files changed, 15 insertions, 10 deletions
diff --git a/drivers/video/fbdev/msm/mdss.h b/drivers/video/fbdev/msm/mdss.h index 69ad70883802..81c2d1f7f12c 100644 --- a/drivers/video/fbdev/msm/mdss.h +++ b/drivers/video/fbdev/msm/mdss.h @@ -192,7 +192,7 @@ struct mdss_smmu_ops { struct sg_table *table, int domain, dma_addr_t *iova, unsigned long *size, int dir); void (*smmu_unmap_dma_buf)(struct sg_table *table, int domain, - int dir); + int dir, struct dma_buf *dma_buf); int (*smmu_dma_alloc_coherent)(struct device *dev, size_t size, dma_addr_t *phys, dma_addr_t *iova, void *cpu_addr, gfp_t gfp, int domain); diff --git a/drivers/video/fbdev/msm/mdss_fb.c b/drivers/video/fbdev/msm/mdss_fb.c index 5650f88b0ddd..42a66dd77cbd 100644 --- a/drivers/video/fbdev/msm/mdss_fb.c +++ b/drivers/video/fbdev/msm/mdss_fb.c @@ -1670,7 +1670,7 @@ void mdss_fb_free_fb_ion_memory(struct msm_fb_data_type *mfd) if (mfd->mdp.fb_mem_get_iommu_domain) { mdss_smmu_unmap_dma_buf(mfd->fb_table, mfd->mdp.fb_mem_get_iommu_domain(), - DMA_BIDIRECTIONAL); + DMA_BIDIRECTIONAL, mfd->fbmem_buf); dma_buf_unmap_attachment(mfd->fb_attachment, mfd->fb_table, DMA_BIDIRECTIONAL); dma_buf_detach(mfd->fbmem_buf, mfd->fb_attachment); diff --git a/drivers/video/fbdev/msm/mdss_mdp_splash_logo.c b/drivers/video/fbdev/msm/mdss_mdp_splash_logo.c index 541d50250eb9..3b44f362091c 100644 --- a/drivers/video/fbdev/msm/mdss_mdp_splash_logo.c +++ b/drivers/video/fbdev/msm/mdss_mdp_splash_logo.c @@ -104,7 +104,7 @@ static int mdss_mdp_splash_alloc_memory(struct msm_fb_data_type *mfd, return rc; kmap_err: mdss_smmu_unmap_dma_buf(sinfo->table, MDSS_IOMMU_DOMAIN_UNSECURE, - DMA_BIDIRECTIONAL); + DMA_BIDIRECTIONAL, sinfo->dma_buf); err_unmap: dma_buf_unmap_attachment(sinfo->attachment, sinfo->table, DMA_BIDIRECTIONAL); @@ -135,7 +135,8 @@ static void mdss_mdp_splash_free_memory(struct msm_fb_data_type *mfd) dma_buf_end_cpu_access(sinfo->dma_buf, 0, sinfo->size, DMA_FROM_DEVICE); dma_buf_kunmap(sinfo->dma_buf, 0, sinfo->splash_buffer); - mdss_smmu_unmap_dma_buf(sinfo->table, MDSS_IOMMU_DOMAIN_UNSECURE, 0); + mdss_smmu_unmap_dma_buf(sinfo->table, MDSS_IOMMU_DOMAIN_UNSECURE, 0, + sinfo->dma_buf); dma_buf_unmap_attachment(sinfo->attachment, sinfo->table, DMA_BIDIRECTIONAL); dma_buf_detach(sinfo->dma_buf, sinfo->attachment); diff --git a/drivers/video/fbdev/msm/mdss_mdp_util.c b/drivers/video/fbdev/msm/mdss_mdp_util.c index d3d9e82a8567..6012053c9818 100644 --- a/drivers/video/fbdev/msm/mdss_mdp_util.c +++ b/drivers/video/fbdev/msm/mdss_mdp_util.c @@ -832,7 +832,8 @@ static int mdss_mdp_put_img(struct mdss_mdp_img_data *data, bool rotator, domain = mdss_smmu_get_domain_type(data->flags, rotator); mdss_smmu_unmap_dma_buf(data->srcp_table, - domain, dir); + domain, dir, + data->srcp_dma_buf); data->mapped = false; } dma_buf_unmap_attachment(data->srcp_attachment, diff --git a/drivers/video/fbdev/msm/mdss_smmu.c b/drivers/video/fbdev/msm/mdss_smmu.c index 51afa03c8bbf..1423e426593f 100644 --- a/drivers/video/fbdev/msm/mdss_smmu.c +++ b/drivers/video/fbdev/msm/mdss_smmu.c @@ -24,6 +24,7 @@ #include <linux/dma-mapping.h> #include <linux/dma-buf.h> #include <linux/of_platform.h> +#include <linux/msm_dma_iommu_mapping.h> #include <asm/dma-iommu.h> #include "soc/qcom/secure_buffer.h" @@ -260,7 +261,8 @@ static int mdss_smmu_map_dma_buf_v2(struct dma_buf *dma_buf, return -EINVAL; } ATRACE_BEGIN("map_buffer"); - rc = dma_map_sg(mdss_smmu->dev, table->sgl, table->nents, dir); + rc = msm_dma_map_sg_lazy(mdss_smmu->dev, table->sgl, table->nents, dir, + dma_buf); if (!rc) { pr_err("dma map sg failed\n"); return -ENOMEM; @@ -272,7 +274,7 @@ static int mdss_smmu_map_dma_buf_v2(struct dma_buf *dma_buf, } static void mdss_smmu_unmap_dma_buf_v2(struct sg_table *table, int domain, - int dir) + int dir, struct dma_buf *dma_buf) { struct mdss_smmu_client *mdss_smmu = mdss_smmu_get_cb(domain); if (!mdss_smmu) { @@ -281,7 +283,8 @@ static void mdss_smmu_unmap_dma_buf_v2(struct sg_table *table, int domain, } ATRACE_BEGIN("unmap_buffer"); - dma_unmap_sg(mdss_smmu->dev, table->sgl, table->nents, dir); + msm_dma_unmap_sg(mdss_smmu->dev, table->sgl, table->nents, dir, + dma_buf); ATRACE_END("unmap_buffer"); } diff --git a/drivers/video/fbdev/msm/mdss_smmu.h b/drivers/video/fbdev/msm/mdss_smmu.h index 635995a269a1..4751b3424e50 100644 --- a/drivers/video/fbdev/msm/mdss_smmu.h +++ b/drivers/video/fbdev/msm/mdss_smmu.h @@ -164,11 +164,11 @@ static inline int mdss_smmu_map_dma_buf(struct dma_buf *dma_buf, } static inline void mdss_smmu_unmap_dma_buf(struct sg_table *table, int domain, - int dir) + int dir, struct dma_buf *dma_buf) { struct mdss_data_type *mdata = mdss_mdp_get_mdata(); if (mdata->smmu_ops.smmu_unmap_dma_buf) - mdata->smmu_ops.smmu_unmap_dma_buf(table, domain, dir); + mdata->smmu_ops.smmu_unmap_dma_buf(table, domain, dir, dma_buf); } static inline int mdss_smmu_dma_alloc_coherent(struct device *dev, size_t size, |
