From 767c8ad13d72821e00f710b96d8805f6dbb4d2af Mon Sep 17 00:00:00 2001 From: Mahesh Kumar Sharma Date: Fri, 22 Oct 2021 17:57:17 -0700 Subject: [PATCH] video: driver: Fix dlkm compilation 1.) New dma_buf_vmap() returns SUCCESS or FAIL unlike legacy dma_buf_vmap() which return type is vmap address. dma_buf_vmap() takes two arguments now. Now it returns vmap address in pointer passed as second argument. 2.) If defined, use V4L2_CTRL_CLASS_CODEC else use V4L2_CTRL_CLASS_MPEG. 3.) iommu_dma_enable_best_fit_algo is commented temporary. 4.) remove subsystem_resart.h Change-Id: I73c6a840fa6028f021debff33b88178ac74dcef9 Signed-off-by: Mahesh Kumar Sharma --- driver/vidc/inc/msm_vidc_internal.h | 6 ++++++ driver/vidc/src/msm_vidc_dt.c | 9 ++++++++- driver/vidc/src/msm_vidc_memory.c | 4 ++-- driver/vidc/src/venus_hfi.c | 1 - include/uapi/vidc/media/v4l2_vidc_extensions.h | 6 +++++- 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/driver/vidc/inc/msm_vidc_internal.h b/driver/vidc/inc/msm_vidc_internal.h index 8f7c700b39..634ec38845 100644 --- a/driver/vidc/inc/msm_vidc_internal.h +++ b/driver/vidc/inc/msm_vidc_internal.h @@ -97,9 +97,15 @@ #define NUM_MBS_PER_FRAME(__height, __width) \ ((ALIGN(__height, 16) / 16) * (ALIGN(__width, 16) / 16)) +#ifdef V4L2_CTRL_CLASS_CODEC +#define IS_PRIV_CTRL(idx) ( \ + (V4L2_CTRL_ID2WHICH(idx) == V4L2_CTRL_CLASS_CODEC) && \ + V4L2_CTRL_DRIVER_PRIV(idx)) +#else #define IS_PRIV_CTRL(idx) ( \ (V4L2_CTRL_ID2WHICH(idx) == V4L2_CTRL_CLASS_MPEG) && \ V4L2_CTRL_DRIVER_PRIV(idx)) +#endif #define BUFFER_ALIGNMENT_SIZE(x) x #define NUM_MBS_720P (((1280 + 15) >> 4) * ((720 + 15) >> 4)) diff --git a/driver/vidc/src/msm_vidc_dt.c b/driver/vidc/src/msm_vidc_dt.c index fe615a44d8..bf6950fe39 100644 --- a/driver/vidc/src/msm_vidc_dt.c +++ b/driver/vidc/src/msm_vidc_dt.c @@ -823,7 +823,14 @@ static int msm_vidc_setup_context_bank(struct msm_vidc_core *core, * When memory is fragmented, below configuration increases the * possibility to get a mapping for buffer in the configured CB. */ - iommu_dma_enable_best_fit_algo(cb->dev); + + /* + * TBD: iommu_dma_enable_best_fit_algo is commented temoprarily to enable dlkm + * compilation once headers are availbale when the GKI branch for Kailua (android13-5.next) + * branches out + */ + + /*iommu_dma_enable_best_fit_algo(cb->dev);*/ /* * configure device segment size and segment boundary to ensure diff --git a/driver/vidc/src/msm_vidc_memory.c b/driver/vidc/src/msm_vidc_memory.c index f33cb36f86..7b4bec9f1f 100644 --- a/driver/vidc/src/msm_vidc_memory.c +++ b/driver/vidc/src/msm_vidc_memory.c @@ -377,8 +377,8 @@ 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); - mem->kvaddr = dma_buf_vmap(mem->dmabuf); - if (!mem->kvaddr) { + rc = dma_buf_vmap(mem->dmabuf, mem->kvaddr); + if (rc) { d_vpr_e("%s: kernel map failed\n", __func__); rc = -EIO; goto error; diff --git a/driver/vidc/src/venus_hfi.c b/driver/vidc/src/venus_hfi.c index e35e6aef52..8776c0ae64 100644 --- a/driver/vidc/src/venus_hfi.c +++ b/driver/vidc/src/venus_hfi.c @@ -9,7 +9,6 @@ #include #include #include -#include #include #include #include diff --git a/include/uapi/vidc/media/v4l2_vidc_extensions.h b/include/uapi/vidc/media/v4l2_vidc_extensions.h index 5268b22d4a..93c9271eed 100644 --- a/include/uapi/vidc/media/v4l2_vidc_extensions.h +++ b/include/uapi/vidc/media/v4l2_vidc_extensions.h @@ -52,7 +52,11 @@ #endif /* vendor controls start */ -#define V4L2_CID_MPEG_VIDC_BASE (V4L2_CTRL_CLASS_MPEG | 0x2000) +#ifdef V4L2_CTRL_CLASS_CODEC +#define V4L2_CID_MPEG_VIDC_BASE (V4L2_CTRL_CLASS_CODEC | 0x2000) +#else +#define V4L2_CID_MPEG_VIDC_BASE (V4L2_CTRL_CLASS_MPEG | 0x2000) +#endif #define V4L2_MPEG_MSM_VIDC_DISABLE 0 #define V4L2_MPEG_MSM_VIDC_ENABLE 1