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 <leo.ding@rock-chips.com>
This commit is contained in:
Ding Wei
2020-04-23 09:31:04 +08:00
parent a5a513a1bf
commit 7997c3fdb8
2 changed files with 3 additions and 6 deletions

View File

@@ -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();

View File

@@ -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;