From 7997c3fdb84d9ead71bbdfc3a03fe9bc6ac9681e Mon Sep 17 00:00:00 2001 From: Ding Wei Date: Thu, 23 Apr 2020 09:31:04 +0800 Subject: [PATCH] video: rockchip: mpp: fix issue for fd find dmabuf Multiple fd may point to the same dmmabuf, which means the same buffer. Therefore, fd cannot be added as a judgment. Change-Id: I459a3350a692299932e58f3e274d2509a5b9a48e Signed-off-by: Ding Wei --- drivers/video/rockchip/mpp/mpp_iommu.c | 8 +++----- drivers/video/rockchip/mpp/mpp_iommu.h | 1 - 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/video/rockchip/mpp/mpp_iommu.c b/drivers/video/rockchip/mpp/mpp_iommu.c index 3df57083de75..833079ff8f90 100644 --- a/drivers/video/rockchip/mpp/mpp_iommu.c +++ b/drivers/video/rockchip/mpp/mpp_iommu.c @@ -38,11 +38,10 @@ mpp_dma_find_buffer_fd(struct mpp_dma_session *dma, int fd) list_for_each_entry_safe(buffer, n, &dma->buffer_list, link) { /* - * As long as the last reference is hold by the buffer pool, - * the same fd won't be assigned to the other application. + * fd may dup several and point the same dambuf. + * thus, here should be distinguish with the dmabuf. */ - if (buffer->fd == fd && - buffer->dmabuf == dmabuf) { + if (buffer->dmabuf == dmabuf) { out = buffer; break; } @@ -205,7 +204,6 @@ struct mpp_dma_buffer *mpp_dma_import_fd(struct mpp_iommu_info *iommu_info, } buffer->dmabuf = dmabuf; - buffer->fd = fd; buffer->dir = DMA_BIDIRECTIONAL; buffer->last_used = ktime_get(); diff --git a/drivers/video/rockchip/mpp/mpp_iommu.h b/drivers/video/rockchip/mpp/mpp_iommu.h index a8ba6b9f5f1d..767ada326897 100644 --- a/drivers/video/rockchip/mpp/mpp_iommu.h +++ b/drivers/video/rockchip/mpp/mpp_iommu.h @@ -27,7 +27,6 @@ struct mpp_dma_buffer { struct sg_table *copy_sgt; enum dma_data_direction dir; - int fd; dma_addr_t iova; unsigned long size; void *vaddr;