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 <quic_ashpat@quicinc.com>
This commit is contained in:
Ashish Patil
2022-08-26 15:42:05 -07:00
committed by Gerrit - the friendly Code Review server
parent e072a88b28
commit 03606a7c77
2 changed files with 24 additions and 1 deletions

View File

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

View File

@@ -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) {