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 <yandong.lin@rock-chips.com>
Change-Id: I8b46c8f6a6f69ebe9854858e198d1c312a808a2f
This commit is contained in:
Yandong Lin
2021-07-12 11:47:02 +08:00
committed by Tao Huang
parent 180d0b6980
commit 5a9e481dce

View File

@@ -9,6 +9,9 @@
*
*/
#include <linux/delay.h>
#ifdef CONFIG_DMABUF_CACHE
#include <linux/dma-cache.h>
#endif
#include <linux/dma-buf.h>
#include <linux/dma-iommu.h>
#include <linux/iommu.h>
@@ -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++;