From 5a9e481dceec028534cb392f98ea80f0536777d1 Mon Sep 17 00:00:00 2001 From: Yandong Lin Date: Mon, 12 Jul 2021 11:47:02 +0800 Subject: [PATCH] video: rockchip: mpp: use dma-buf-cache func The attachment and sg_table will be store in dma-buf-cache. So use dma-buf-cache api instead of dma-buf api to reduce the actual operation of attach/map. Signed-off-by: Yandong Lin Change-Id: I8b46c8f6a6f69ebe9854858e198d1c312a808a2f --- drivers/video/rockchip/mpp/mpp_iommu.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/video/rockchip/mpp/mpp_iommu.c b/drivers/video/rockchip/mpp/mpp_iommu.c index 9fd8196123ac..e279f4f43489 100644 --- a/drivers/video/rockchip/mpp/mpp_iommu.c +++ b/drivers/video/rockchip/mpp/mpp_iommu.c @@ -9,6 +9,9 @@ * */ #include +#ifdef CONFIG_DMABUF_CACHE +#include +#endif #include #include #include @@ -234,8 +237,10 @@ struct mpp_dma_buffer *mpp_dma_import_fd(struct mpp_iommu_info *iommu_info, buffer->dma = dma; kref_init(&buffer->ref); - /* Increase the reference for used outside the buffer pool */ - kref_get(&buffer->ref); + + if (!IS_ENABLED(CONFIG_DMABUF_CACHE)) + /* Increase the reference for used outside the buffer pool */ + kref_get(&buffer->ref); mutex_lock(&dma->list_mutex); dma->buffer_count++;