video: driver: resolve some checker err

Resolve some static checker err.

Change-Id: I0aa1d8c905ac7fd1defa16dd28d4386465f09ff3
Signed-off-by: Ankush Mitra <quic_ankumitr@quicinc.com>
This commit is contained in:
Ankush Mitra
2023-06-06 11:44:28 +05:30
parent 400a782851
commit e1cb32c5de
9 changed files with 98 additions and 119 deletions

View File

@@ -118,7 +118,7 @@ static u32 bitrate_table_kalama_rec_fp[5][10] = {
#endif
};
static u32 input_bitrate_fp = 0;
static u32 input_bitrate_fp;
/* 8KUHD60; UHD240; 1080p960 with B */
static u32 fp_pixel_count_bar0 = 3840 * 2160 * 240;

View File

@@ -122,7 +122,7 @@ static u32 bitrate_table_pineapple_rec_fp[5][10] = {
#endif
};
static u32 input_bitrate_fp = 0;
static u32 input_bitrate_fp;
/* 8KUHD60; UHD240; 1080p960 with B */
static u32 fp_pixel_count_bar0 = 3840 * 2160 * 240;

View File

@@ -225,7 +225,7 @@ typedef HFI_U32 HFI_BOOL;
(buf_height = HFI_ALIGN(frame_height, min_buf_height_multiple))
#define HFI_RGBA8888_CALC_BUF_SIZE(buf_size, stride, buf_height) \
buf_size = (stride) * (buf_height)
(buf_size = (stride) * (buf_height))
#define HFI_RGBA8888_UBWC_CALC_DATA_PLANE_BUF_SIZE(buf_size, stride, \
buf_height) \
@@ -234,39 +234,41 @@ typedef HFI_U32 HFI_BOOL;
#define HFI_RGBA8888_UBWC_BUF_SIZE(buf_size, data_buf_size, \
metadata_buffer_size, stride, buf_height, _metadata_tride, \
_metadata_buf_height) \
do { \
HFI_RGBA8888_UBWC_CALC_DATA_PLANE_BUF_SIZE(data_buf_size, \
stride, buf_height); \
HFI_UBWC_METADATA_PLANE_BUFFER_SIZE(metadata_buffer_size, \
_metadata_tride, _metadata_buf_height); \
buf_size = data_buf_size + metadata_buffer_size
buf_size = data_buf_size + metadata_buffer_size \
} while (0)
#define HFI_UBWC_CALC_METADATA_PLANE_STRIDE(metadata_stride, frame_width,\
metadata_stride_multiple, tile_width_in_pels) \
metadata_stride = HFI_ALIGN(((frame_width + (tile_width_in_pels - 1)) /\
tile_width_in_pels), metadata_stride_multiple)
(metadata_stride = HFI_ALIGN(((frame_width + (tile_width_in_pels - 1)) /\
tile_width_in_pels), metadata_stride_multiple))
#define HFI_UBWC_METADATA_PLANE_BUFHEIGHT(metadata_buf_height, frame_height, \
metadata_height_multiple, tile_height_in_pels) \
metadata_buf_height = HFI_ALIGN(((frame_height + \
(metadata_buf_height = HFI_ALIGN(((frame_height + \
(tile_height_in_pels - 1)) / tile_height_in_pels), \
metadata_height_multiple)
metadata_height_multiple))
#define HFI_UBWC_UV_METADATA_PLANE_STRIDE(metadata_stride, frame_width, \
metadata_stride_multiple, tile_width_in_pels) \
metadata_stride = HFI_ALIGN(((((frame_width + 1) >> 1) +\
(metadata_stride = HFI_ALIGN(((((frame_width + 1) >> 1) +\
(tile_width_in_pels - 1)) / tile_width_in_pels), \
metadata_stride_multiple)
metadata_stride_multiple))
#define HFI_UBWC_UV_METADATA_PLANE_BUFHEIGHT(metadata_buf_height, frame_height,\
metadata_height_multiple, tile_height_in_pels) \
metadata_buf_height = HFI_ALIGN(((((frame_height + 1) >> 1) + \
(metadata_buf_height = HFI_ALIGN(((((frame_height + 1) >> 1) + \
(tile_height_in_pels - 1)) / tile_height_in_pels), \
metadata_height_multiple)
metadata_height_multiple))
#define HFI_UBWC_METADATA_PLANE_BUFFER_SIZE(buffer_size, _metadata_tride, \
_metadata_buf_height) \
buffer_size = HFI_ALIGN(_metadata_tride * _metadata_buf_height, \
HFI_ALIGNMENT_4096)
(buffer_size = HFI_ALIGN(_metadata_tride * _metadata_buf_height, \
HFI_ALIGNMENT_4096))
#define BUFFER_ALIGNMENT_512_BYTES 512
#define BUFFER_ALIGNMENT_256_BYTES 256
@@ -497,8 +499,7 @@ typedef HFI_U32 HFI_BOOL;
if (!is_interlaced) { \
SIZE_H264D_HW_BIN_BUFFER(_size, n_aligned_w, \
n_aligned_h, delay, num_vpp_pipes); \
} \
else { \
} else { \
_size = 0; \
} \
} while (0)
@@ -690,8 +691,7 @@ typedef HFI_U32 HFI_BOOL;
if (!is_interlaced) { \
SIZE_H265D_HW_BIN_BUFFER(_size, n_aligned_w, \
n_aligned_h, delay, num_vpp_pipes); \
} \
else { \
} else { \
_size = 0; \
} \
} while (0)
@@ -874,8 +874,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
} \
else if (bitstream_size > (1280 * 720)) { \
bitstream_size = (bitstream_size >> 2); \
} \
else { \
} else { \
bitstream_size = (bitstream_size << 1);\
} \
if ((rc_type == HFI_RC_CQ) || (rc_type == HFI_RC_OFF)) { \
@@ -1004,8 +1003,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
bitstream_size_eval = (bitstream_size_eval * 5 >> 2); \
} \
} \
} \
else { \
} else { \
bitstream_size_eval = size_aligned_width * \
size_aligned_height * 3; \
} \
@@ -1026,8 +1024,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
} \
else if (num_vpp_pipes > 2) { \
size_single_pipe_eval = bitbin_size / 2; \
} \
else { \
} else { \
size_single_pipe_eval = bitbin_size; \
} \
if (rc_type == HFI_RC_LOSSLESS) { \
@@ -1067,10 +1064,10 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
bitbin_size = size_single_pipe * num_vpp_pipes; \
_size = HFI_ALIGN(bitbin_size, VENUS_DMA_ALIGNMENT) * \
total_bitbin_buffers + 512; \
} \
else \
} else { \
/* Avoid 512 Bytes allocation in case of 1Pipe HEVC Direct Mode*/ \
_size = 0; \
} \
} while (0)
#define HFI_BUFFER_BIN_H264E(_size, rc_type, frame_width, frame_height, \
@@ -1411,8 +1408,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
HFI_UBWC_METADATA_PLANE_BUFFER_SIZE(meta_size_c, \
metadata_stride, metadata_buf_height); \
_size = ref_buf_size + meta_size_y + meta_size_c; \
} \
else { \
} else { \
SIZE_ENC_TEN_BIT_REF_BUFFER(ten_bit_ref_buf_size, \
frame_width, frame_height); \
HFI_UBWC_CALC_METADATA_PLANE_STRIDE(metadata_stride, \
@@ -1451,8 +1447,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
#define HFI_IRIS2_ENC_MIN_INPUT_BUF_COUNT(numInput, TotalHBLayers) \
do { \
numInput = 3; \
if (TotalHBLayers >= 2) \
{ \
if (TotalHBLayers >= 2) { \
numInput = (1 << (TotalHBLayers - 1)) + 2; \
} \
} while (0)

View File

@@ -230,28 +230,30 @@ typedef HFI_U32 HFI_BOOL;
#define HFI_RGBA8888_UBWC_BUF_SIZE(buf_size, data_buf_size, \
metadata_buffer_size, stride, buf_height, _metadata_tride, \
_metadata_buf_height) \
do { \
HFI_RGBA8888_UBWC_CALC_DATA_PLANE_BUF_SIZE(data_buf_size, \
stride, buf_height); \
HFI_UBWC_METADATA_PLANE_BUFFER_SIZE(metadata_buffer_size, \
_metadata_tride, _metadata_buf_height); \
buf_size = data_buf_size + metadata_buffer_size
buf_size = data_buf_size + metadata_buffer_size \
} while (0)
#define HFI_UBWC_CALC_METADATA_PLANE_STRIDE(metadata_stride, frame_width,\
metadata_stride_multiple, tile_width_in_pels) \
(metadata_stride = HFI_ALIGN(((frame_width + (tile_width_in_pels - 1)) /\
tile_width_in_pels), metadata_stride_multiple))
((metadata_stride = HFI_ALIGN(((frame_width + (tile_width_in_pels - 1)) /\
tile_width_in_pels), metadata_stride_multiple)))
#define HFI_UBWC_METADATA_PLANE_BUFHEIGHT(metadata_buf_height, frame_height, \
metadata_height_multiple, tile_height_in_pels) \
(metadata_buf_height = HFI_ALIGN(((frame_height + \
((metadata_buf_height = HFI_ALIGN(((frame_height + \
(tile_height_in_pels - 1)) / tile_height_in_pels), \
metadata_height_multiple))
metadata_height_multiple)))
#define HFI_UBWC_UV_METADATA_PLANE_STRIDE(metadata_stride, frame_width, \
metadata_stride_multiple, tile_width_in_pels) \
(metadata_stride = HFI_ALIGN(((((frame_width + 1) >> 1) +\
((metadata_stride = HFI_ALIGN(((((frame_width + 1) >> 1) +\
(tile_width_in_pels - 1)) / tile_width_in_pels), \
metadata_stride_multiple))
metadata_stride_multiple)))
#define HFI_UBWC_UV_METADATA_PLANE_BUFHEIGHT(metadata_buf_height, frame_height,\
metadata_height_multiple, tile_height_in_pels) \
@@ -261,8 +263,8 @@ typedef HFI_U32 HFI_BOOL;
#define HFI_UBWC_METADATA_PLANE_BUFFER_SIZE(buffer_size, _metadata_tride, \
_metadata_buf_height) \
(buffer_size = HFI_ALIGN(_metadata_tride * _metadata_buf_height, \
HFI_ALIGNMENT_4096))
((buffer_size = HFI_ALIGN(_metadata_tride * _metadata_buf_height, \
HFI_ALIGNMENT_4096)))
#define BUFFER_ALIGNMENT_512_BYTES 512
#define BUFFER_ALIGNMENT_256_BYTES 256
@@ -493,8 +495,7 @@ typedef HFI_U32 HFI_BOOL;
if (!is_interlaced) { \
SIZE_H264D_HW_BIN_BUFFER(_size, n_aligned_w, \
n_aligned_h, delay, num_vpp_pipes); \
} \
else { \
} else { \
_size = 0; \
} \
} while (0)
@@ -686,8 +687,7 @@ typedef HFI_U32 HFI_BOOL;
if (!is_interlaced) { \
SIZE_H265D_HW_BIN_BUFFER(_size, n_aligned_w, \
n_aligned_h, delay, num_vpp_pipes); \
} \
else { \
} else { \
_size = 0; \
} \
} while (0)
@@ -1095,8 +1095,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
if (!isInterlaced) { \
SIZE_AV1D_HW_BIN_BUFFER(_size, nAlignedW, nAlignedH, \
delay, num_vpp_pipes); \
} \
else { \
} else { \
_size = 0; \
} \
} while (0)
@@ -1147,8 +1146,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
else if (aligned_width * aligned_height > (1280 * 720)) { \
/* bitstream_size = 0.5 * yuv_size; */ \
bitstream_size = (bitstream_size >> 2); \
} \
else { \
} else { \
/* bitstream_size = 2 * yuv_size; */ \
} \
if (((rc_type == HFI_RC_CQ) || (rc_type == HFI_RC_OFF)) \
@@ -1177,8 +1175,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
tile_count -= 1; \
last_tile_size = (tile_size + min_tile_size); \
} \
} \
else { \
} else { \
tile_size = frame_width_coded; \
tile_count = 1; \
last_tile_size = 0; \
@@ -1207,8 +1204,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
(mbs_in_last_tile + multi_slice_max_mb_count - 1) / (multi_slice_max_mb_count); \
total_slice_count = \
(slice_count_per_tile * (tile_count - 1)) + slice_count_in_last_tile; \
} \
else { \
} else { \
total_slice_count = (slice_count_per_tile * tile_count); \
} \
} while (0)
@@ -1330,8 +1326,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
bitstream_size_eval = (bitstream_size_eval * 5 >> 2); \
} \
} \
} \
else { \
} else { \
bitstream_size_eval = size_aligned_width * \
size_aligned_height * 3; \
} \
@@ -1352,8 +1347,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
} \
else if (num_vpp_pipes > 2) { \
size_single_pipe_eval = bitbin_size / 2; \
} \
else { \
} else { \
size_single_pipe_eval = bitbin_size; \
} \
if (rc_type == HFI_RC_LOSSLESS) { \
@@ -1737,8 +1731,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
HFI_UBWC_METADATA_PLANE_BUFFER_SIZE(meta_size_c, \
metadata_stride, metadata_buf_height); \
_size = ref_buf_size + meta_size_y + meta_size_c; \
} \
else { \
} else { \
SIZE_ENC_TEN_BIT_REF_BUFFER(ten_bit_ref_buf_size, \
frame_width, frame_height); \
HFI_UBWC_CALC_METADATA_PLANE_STRIDE(metadata_stride, \
@@ -1777,8 +1770,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
#define HFI_IRIS3_ENC_MIN_INPUT_BUF_COUNT(numInput, TotalHBLayers) \
do { \
numInput = 3; \
if (TotalHBLayers >= 2) \
{ \
if (TotalHBLayers >= 2) { \
numInput = (1 << (TotalHBLayers - 1)) + 2; \
} \
} while (0)

View File

@@ -230,28 +230,30 @@ typedef HFI_U32 HFI_BOOL;
#define HFI_RGBA8888_UBWC_BUF_SIZE(buf_size, data_buf_size, \
metadata_buffer_size, stride, buf_height, _metadata_tride, \
_metadata_buf_height) \
do { \
HFI_RGBA8888_UBWC_CALC_DATA_PLANE_BUF_SIZE(data_buf_size, \
stride, buf_height); \
HFI_UBWC_METADATA_PLANE_BUFFER_SIZE(metadata_buffer_size, \
_metadata_tride, _metadata_buf_height); \
buf_size = data_buf_size + metadata_buffer_size
buf_size = data_buf_size + metadata_buffer_size \
} while (0)
#define HFI_UBWC_CALC_METADATA_PLANE_STRIDE(metadata_stride, frame_width,\
metadata_stride_multiple, tile_width_in_pels) \
(metadata_stride = HFI_ALIGN(((frame_width + (tile_width_in_pels - 1)) /\
tile_width_in_pels), metadata_stride_multiple))
((metadata_stride = HFI_ALIGN(((frame_width + (tile_width_in_pels - 1)) /\
tile_width_in_pels), metadata_stride_multiple)))
#define HFI_UBWC_METADATA_PLANE_BUFHEIGHT(metadata_buf_height, frame_height, \
metadata_height_multiple, tile_height_in_pels) \
(metadata_buf_height = HFI_ALIGN(((frame_height + \
((metadata_buf_height = HFI_ALIGN(((frame_height + \
(tile_height_in_pels - 1)) / tile_height_in_pels), \
metadata_height_multiple))
metadata_height_multiple)))
#define HFI_UBWC_UV_METADATA_PLANE_STRIDE(metadata_stride, frame_width, \
metadata_stride_multiple, tile_width_in_pels) \
(metadata_stride = HFI_ALIGN(((((frame_width + 1) >> 1) +\
((metadata_stride = HFI_ALIGN(((((frame_width + 1) >> 1) +\
(tile_width_in_pels - 1)) / tile_width_in_pels), \
metadata_stride_multiple))
metadata_stride_multiple)))
#define HFI_UBWC_UV_METADATA_PLANE_BUFHEIGHT(metadata_buf_height, frame_height,\
metadata_height_multiple, tile_height_in_pels) \
@@ -261,8 +263,8 @@ typedef HFI_U32 HFI_BOOL;
#define HFI_UBWC_METADATA_PLANE_BUFFER_SIZE(buffer_size, _metadata_tride, \
_metadata_buf_height) \
(buffer_size = HFI_ALIGN(_metadata_tride * _metadata_buf_height, \
HFI_ALIGNMENT_4096))
((buffer_size = HFI_ALIGN(_metadata_tride * _metadata_buf_height, \
HFI_ALIGNMENT_4096)))
#define BUFFER_ALIGNMENT_512_BYTES 512
#define BUFFER_ALIGNMENT_256_BYTES 256
@@ -493,8 +495,7 @@ typedef HFI_U32 HFI_BOOL;
if (!is_interlaced) { \
SIZE_H264D_HW_BIN_BUFFER(_size, n_aligned_w, \
n_aligned_h, delay, num_vpp_pipes); \
} \
else { \
} else { \
_size = 0; \
} \
} while (0)
@@ -686,8 +687,7 @@ typedef HFI_U32 HFI_BOOL;
if (!is_interlaced) { \
SIZE_H265D_HW_BIN_BUFFER(_size, n_aligned_w, \
n_aligned_h, delay, num_vpp_pipes); \
} \
else { \
} else { \
_size = 0; \
} \
} while (0)
@@ -1095,8 +1095,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
if (!isInterlaced) { \
SIZE_AV1D_HW_BIN_BUFFER(_size, nAlignedW, nAlignedH, \
delay, num_vpp_pipes); \
} \
else { \
} else { \
_size = 0; \
} \
} while (0)
@@ -1147,8 +1146,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
else if (aligned_width * aligned_height > (1280 * 720)) { \
/* bitstream_size = 0.5 * yuv_size; */ \
bitstream_size = (bitstream_size >> 2); \
} \
else { \
} else { \
/* bitstream_size = 2 * yuv_size; */ \
} \
if (((rc_type == HFI_RC_CQ) || (rc_type == HFI_RC_OFF)) \
@@ -1177,8 +1175,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
tile_count -= 1; \
last_tile_size = (tile_size + min_tile_size); \
} \
} \
else { \
} else { \
tile_size = frame_width_coded; \
tile_count = 1; \
last_tile_size = 0; \
@@ -1207,8 +1204,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
(mbs_in_last_tile + multi_slice_max_mb_count - 1) / (multi_slice_max_mb_count); \
total_slice_count = \
(slice_count_per_tile * (tile_count - 1)) + slice_count_in_last_tile; \
} \
else { \
} else { \
total_slice_count = (slice_count_per_tile * tile_count); \
} \
} while (0)
@@ -1330,8 +1326,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
bitstream_size_eval = (bitstream_size_eval * 5 >> 2); \
} \
} \
} \
else { \
} else { \
bitstream_size_eval = size_aligned_width * \
size_aligned_height * 3; \
} \
@@ -1352,8 +1347,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
} \
else if (num_vpp_pipes > 2) { \
size_single_pipe_eval = bitbin_size / 2; \
} \
else { \
} else { \
size_single_pipe_eval = bitbin_size; \
} \
if (rc_type == HFI_RC_LOSSLESS) { \
@@ -1739,8 +1733,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
HFI_UBWC_METADATA_PLANE_BUFFER_SIZE(meta_size_c, \
metadata_stride, metadata_buf_height); \
_size = ref_buf_size + meta_size_y + meta_size_c; \
} \
else { \
} else { \
SIZE_ENC_TEN_BIT_REF_BUFFER(ten_bit_ref_buf_size, \
frame_width, frame_height); \
HFI_UBWC_CALC_METADATA_PLANE_STRIDE(metadata_stride, \
@@ -1779,8 +1772,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
#define HFI_IRIS3_ENC_MIN_INPUT_BUF_COUNT(numInput, TotalHBLayers) \
do { \
numInput = 3; \
if (TotalHBLayers >= 2) \
{ \
if (TotalHBLayers >= 2) { \
numInput = (1 << (TotalHBLayers - 1)) + 2; \
} \
} while (0)

View File

@@ -940,7 +940,7 @@ struct msm_vidc_mem {
*/
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0))
struct iosys_map dmabuf_map;
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0))
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0))
struct dma_buf_map dmabuf_map;
#endif
void *kvaddr;

View File

@@ -1473,7 +1473,7 @@ int msm_venc_s_selection(struct msm_vidc_inst *inst, struct v4l2_selection *s)
inst->compose.left = s->r.left;
inst->compose.top = s->r.top;
inst->compose.width = s->r.width;
inst->compose.height= s->r.height;
inst->compose.height = s->r.height;
if (is_scaling_enabled(inst)) {
i_vpr_h(inst,

View File

@@ -97,7 +97,7 @@ static int msm_vidc_memory_free_ext(struct msm_vidc_core *core, struct msm_vidc_
buf_name(mem->type), mem->secure, mem->region);
if (mem->kvaddr) {
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0))
#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);
@@ -190,7 +190,7 @@ static int msm_vidc_memory_alloc_ext(struct msm_vidc_core *core, struct msm_vidc
* Kalama uses Kernel Version 5.15.x,
* Pineapple uses Kernel Version 5.18.x
*/
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0))
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
mem->kvaddr = dma_buf_vmap(mem->dmabuf);
if (!mem->kvaddr) {
d_vpr_e("%s: kernel map failed\n", __func__);