Przeglądaj źródła

video: driver: Fix dma_buf_vmap arguments

New dma_buf_vmap api takes dma_buf_map struct as argument,
instead of kvaddr.

Change-Id: I2843a28b2c0c2de2d9cd1bfa96fb1a86ffba6059
Signed-off-by: Chinmay Sawarkar <[email protected]>
Chinmay Sawarkar 3 lat temu
rodzic
commit
1068661f6d

+ 4 - 0
driver/vidc/inc/msm_vidc_internal.h

@@ -6,6 +6,7 @@
 #ifndef _MSM_VIDC_INTERNAL_H_
 #define _MSM_VIDC_INTERNAL_H_
 
+#include <linux/version.h>
 #include <linux/bits.h>
 #include <linux/workqueue.h>
 #include <media/v4l2-dev.h>
@@ -785,6 +786,9 @@ struct msm_vidc_alloc {
 	u8                          secure:1;
 	u8                          map_kernel:1;
 	struct dma_buf             *dmabuf;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0))
+	struct dma_buf_map          dmabuf_map;
+#endif
 	void                       *kvaddr;
 };
 

+ 6 - 2
driver/vidc/src/msm_vidc_memory.c

@@ -3,7 +3,6 @@
  * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
  */
 
-#include <linux/version.h>
 #include <linux/dma-buf.h>
 #include <linux/dma-heap.h>
 #include <linux/dma-mapping.h>
@@ -387,12 +386,13 @@ int msm_vidc_memory_alloc(struct msm_vidc_core *core, struct msm_vidc_alloc *mem
 			goto error;
 		}
 #else
-		rc = dma_buf_vmap(mem->dmabuf, mem->kvaddr);
+		rc = dma_buf_vmap(mem->dmabuf, &mem->dmabuf_map);
 		if (rc) {
 			d_vpr_e("%s: kernel map failed\n", __func__);
 			rc = -EIO;
 			goto error;
 		}
+		mem->kvaddr = mem->dmabuf_map.vaddr;
 #endif
 	}
 
@@ -428,7 +428,11 @@ int msm_vidc_memory_free(struct msm_vidc_core *core, struct msm_vidc_alloc *mem)
 		buf_name(mem->type), mem->secure, mem->region);
 
 	if (mem->kvaddr) {
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0))
 		dma_buf_vunmap(mem->dmabuf, mem->kvaddr);
+#else
+		dma_buf_vunmap(mem->dmabuf, &mem->dmabuf_map);
+#endif
 		mem->kvaddr = NULL;
 		dma_buf_end_cpu_access(mem->dmabuf, DMA_BIDIRECTIONAL);
 	}