瀏覽代碼

video-driver: dma_buf_vmap() usage changes

Earlier Kernel Version were using struct dma_buf_map 
and latest Kernel using struct iosys_map and 
MODULE_IMPORT_NS(DMA_BUF) to import dma buf namespace

Change-Id: Ida6535fb2e3426b10264efe01e3a343fd3a1e127
Signed-off-by: Ashish Patil <[email protected]>
Ashish Patil 2 年之前
父節點
當前提交
03606a7c77
共有 2 個文件被更改,包括 24 次插入1 次删除
  1. 7 1
      driver/vidc/inc/msm_vidc_internal.h
  2. 17 0
      driver/vidc/src/msm_vidc_memory.c

+ 7 - 1
driver/vidc/inc/msm_vidc_internal.h

@@ -825,7 +825,13 @@ struct msm_vidc_alloc {
 	u8                          secure:1;
 	u8                          map_kernel:1;
 	struct dma_buf             *dmabuf;
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0))
+	/*
+	 * Kalama uses Kernel Version 5.15.x,
+	 * Pineapple uses Kernel version 5.18.x
+	 */
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,16,0))
+	struct iosys_map            dmabuf_map;
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0))
 	struct dma_buf_map          dmabuf_map;
 #endif
 	void                       *kvaddr;

+ 17 - 0
driver/vidc/src/msm_vidc_memory.c

@@ -19,6 +19,10 @@
 #include "msm_vidc_events.h"
 #include "venus_hfi.h"
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,16,0))
+	MODULE_IMPORT_NS(DMA_BUF);
+#endif
+
 struct msm_vidc_buf_region_name {
 	enum msm_vidc_buffer_region region;
 	char *name;
@@ -404,6 +408,11 @@ int msm_vidc_memory_alloc(struct msm_vidc_core *core, struct msm_vidc_alloc *mem
 	if (mem->map_kernel) {
 		dma_buf_begin_cpu_access(mem->dmabuf, DMA_BIDIRECTIONAL);
 
+	/*
+	 * Waipio uses Kernel version 5.10.x,
+	 * Kalama uses Kernel Version 5.15.x,
+	 * Pineapple uses Kernel Version 5.18.x
+	 */
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0))
 		mem->kvaddr = dma_buf_vmap(mem->dmabuf);
 		if (!mem->kvaddr) {
@@ -411,6 +420,14 @@ int msm_vidc_memory_alloc(struct msm_vidc_core *core, struct msm_vidc_alloc *mem
 			rc = -EIO;
 			goto error;
 		}
+#elif (LINUX_VERSION_CODE < KERNEL_VERSION(5,16,0))
+		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;
 #else
 		rc = dma_buf_vmap(mem->dmabuf, &mem->dmabuf_map);
 		if (rc) {