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 #endif
}; };
static u32 input_bitrate_fp = 0; static u32 input_bitrate_fp;
/* 8KUHD60; UHD240; 1080p960 with B */ /* 8KUHD60; UHD240; 1080p960 with B */
static u32 fp_pixel_count_bar0 = 3840 * 2160 * 240; 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 #endif
}; };
static u32 input_bitrate_fp = 0; static u32 input_bitrate_fp;
/* 8KUHD60; UHD240; 1080p960 with B */ /* 8KUHD60; UHD240; 1080p960 with B */
static u32 fp_pixel_count_bar0 = 3840 * 2160 * 240; 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)) (buf_height = HFI_ALIGN(frame_height, min_buf_height_multiple))
#define HFI_RGBA8888_CALC_BUF_SIZE(buf_size, stride, buf_height) \ #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, \ #define HFI_RGBA8888_UBWC_CALC_DATA_PLANE_BUF_SIZE(buf_size, stride, \
buf_height) \ buf_height) \
@@ -234,39 +234,41 @@ typedef HFI_U32 HFI_BOOL;
#define HFI_RGBA8888_UBWC_BUF_SIZE(buf_size, data_buf_size, \ #define HFI_RGBA8888_UBWC_BUF_SIZE(buf_size, data_buf_size, \
metadata_buffer_size, stride, buf_height, _metadata_tride, \ metadata_buffer_size, stride, buf_height, _metadata_tride, \
_metadata_buf_height) \ _metadata_buf_height) \
HFI_RGBA8888_UBWC_CALC_DATA_PLANE_BUF_SIZE(data_buf_size, \ do { \
stride, buf_height); \ HFI_RGBA8888_UBWC_CALC_DATA_PLANE_BUF_SIZE(data_buf_size, \
HFI_UBWC_METADATA_PLANE_BUFFER_SIZE(metadata_buffer_size, \ stride, buf_height); \
_metadata_tride, _metadata_buf_height); \ HFI_UBWC_METADATA_PLANE_BUFFER_SIZE(metadata_buffer_size, \
buf_size = data_buf_size + metadata_buffer_size _metadata_tride, _metadata_buf_height); \
buf_size = data_buf_size + metadata_buffer_size \
} while (0)
#define HFI_UBWC_CALC_METADATA_PLANE_STRIDE(metadata_stride, frame_width,\ #define HFI_UBWC_CALC_METADATA_PLANE_STRIDE(metadata_stride, frame_width,\
metadata_stride_multiple, tile_width_in_pels) \ metadata_stride_multiple, tile_width_in_pels) \
metadata_stride = HFI_ALIGN(((frame_width + (tile_width_in_pels - 1)) /\ (metadata_stride = HFI_ALIGN(((frame_width + (tile_width_in_pels - 1)) /\
tile_width_in_pels), metadata_stride_multiple) tile_width_in_pels), metadata_stride_multiple))
#define HFI_UBWC_METADATA_PLANE_BUFHEIGHT(metadata_buf_height, frame_height, \ #define HFI_UBWC_METADATA_PLANE_BUFHEIGHT(metadata_buf_height, frame_height, \
metadata_height_multiple, tile_height_in_pels) \ 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), \ (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, \ #define HFI_UBWC_UV_METADATA_PLANE_STRIDE(metadata_stride, frame_width, \
metadata_stride_multiple, tile_width_in_pels) \ 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), \ (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,\ #define HFI_UBWC_UV_METADATA_PLANE_BUFHEIGHT(metadata_buf_height, frame_height,\
metadata_height_multiple, tile_height_in_pels) \ 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), \ (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, \ #define HFI_UBWC_METADATA_PLANE_BUFFER_SIZE(buffer_size, _metadata_tride, \
_metadata_buf_height) \ _metadata_buf_height) \
buffer_size = HFI_ALIGN(_metadata_tride * _metadata_buf_height, \ (buffer_size = HFI_ALIGN(_metadata_tride * _metadata_buf_height, \
HFI_ALIGNMENT_4096) HFI_ALIGNMENT_4096))
#define BUFFER_ALIGNMENT_512_BYTES 512 #define BUFFER_ALIGNMENT_512_BYTES 512
#define BUFFER_ALIGNMENT_256_BYTES 256 #define BUFFER_ALIGNMENT_256_BYTES 256
@@ -432,7 +434,7 @@ typedef HFI_U32 HFI_BOOL;
} while (0) } while (0)
#define HFI_BUFFER_LINE_H264D(_size, frame_width, frame_height, \ #define HFI_BUFFER_LINE_H264D(_size, frame_width, frame_height, \
is_opb, num_vpp_pipes) \ is_opb, num_vpp_pipes) \
do { \ do { \
HFI_U32 vpss_lb_size = 0; \ HFI_U32 vpss_lb_size = 0; \
_size = HFI_ALIGN(SIZE_H264D_LB_FE_TOP_DATA(frame_width, \ _size = HFI_ALIGN(SIZE_H264D_LB_FE_TOP_DATA(frame_width, \
@@ -497,8 +499,7 @@ typedef HFI_U32 HFI_BOOL;
if (!is_interlaced) { \ if (!is_interlaced) { \
SIZE_H264D_HW_BIN_BUFFER(_size, n_aligned_w, \ SIZE_H264D_HW_BIN_BUFFER(_size, n_aligned_w, \
n_aligned_h, delay, num_vpp_pipes); \ n_aligned_h, delay, num_vpp_pipes); \
} \ } else { \
else { \
_size = 0; \ _size = 0; \
} \ } \
} while (0) } while (0)
@@ -690,8 +691,7 @@ typedef HFI_U32 HFI_BOOL;
if (!is_interlaced) { \ if (!is_interlaced) { \
SIZE_H265D_HW_BIN_BUFFER(_size, n_aligned_w, \ SIZE_H265D_HW_BIN_BUFFER(_size, n_aligned_w, \
n_aligned_h, delay, num_vpp_pipes); \ n_aligned_h, delay, num_vpp_pipes); \
} \ } else { \
else { \
_size = 0; \ _size = 0; \
} \ } \
} while (0) } while (0)
@@ -874,8 +874,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
} \ } \
else if (bitstream_size > (1280 * 720)) { \ else if (bitstream_size > (1280 * 720)) { \
bitstream_size = (bitstream_size >> 2); \ bitstream_size = (bitstream_size >> 2); \
} \ } else { \
else { \
bitstream_size = (bitstream_size << 1);\ bitstream_size = (bitstream_size << 1);\
} \ } \
if ((rc_type == HFI_RC_CQ) || (rc_type == HFI_RC_OFF)) { \ 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); \ bitstream_size_eval = (bitstream_size_eval * 5 >> 2); \
} \ } \
} \ } \
} \ } else { \
else { \
bitstream_size_eval = size_aligned_width * \ bitstream_size_eval = size_aligned_width * \
size_aligned_height * 3; \ size_aligned_height * 3; \
} \ } \
@@ -1026,8 +1024,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
} \ } \
else if (num_vpp_pipes > 2) { \ else if (num_vpp_pipes > 2) { \
size_single_pipe_eval = bitbin_size / 2; \ size_single_pipe_eval = bitbin_size / 2; \
} \ } else { \
else { \
size_single_pipe_eval = bitbin_size; \ size_single_pipe_eval = bitbin_size; \
} \ } \
if (rc_type == HFI_RC_LOSSLESS) { \ 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; \ bitbin_size = size_single_pipe * num_vpp_pipes; \
_size = HFI_ALIGN(bitbin_size, VENUS_DMA_ALIGNMENT) * \ _size = HFI_ALIGN(bitbin_size, VENUS_DMA_ALIGNMENT) * \
total_bitbin_buffers + 512; \ total_bitbin_buffers + 512; \
} \ } else { \
else \
/* Avoid 512 Bytes allocation in case of 1Pipe HEVC Direct Mode*/ \ /* Avoid 512 Bytes allocation in case of 1Pipe HEVC Direct Mode*/ \
_size = 0; \ _size = 0; \
} \
} while (0) } while (0)
#define HFI_BUFFER_BIN_H264E(_size, rc_type, frame_width, frame_height, \ #define HFI_BUFFER_BIN_H264E(_size, rc_type, frame_width, frame_height, \
@@ -1202,13 +1199,13 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
#define SIZE_OVERRIDE_BUF(num_lcumb) (HFI_ALIGN(((16 * (((num_lcumb) + 7)\ #define SIZE_OVERRIDE_BUF(num_lcumb) (HFI_ALIGN(((16 * (((num_lcumb) + 7)\
>> 3))), VENUS_DMA_ALIGNMENT) * 2) >> 3))), VENUS_DMA_ALIGNMENT) * 2)
#define SIZE_IR_BUF(num_lcu_in_frame) HFI_ALIGN((((((num_lcu_in_frame) << 1) + 7) &\ #define SIZE_IR_BUF(num_lcu_in_frame) HFI_ALIGN((((((num_lcu_in_frame) << 1) + 7) &\
(~7)) * 3), VENUS_DMA_ALIGNMENT) (~7)) * 3), VENUS_DMA_ALIGNMENT)
#define SIZE_VPSS_LINE_BUF(num_vpp_pipes_enc, frame_height_coded, \ #define SIZE_VPSS_LINE_BUF(num_vpp_pipes_enc, frame_height_coded, \
frame_width_coded) \ frame_width_coded) \
(HFI_ALIGN(((((((8192) >> 2) << 5) * (num_vpp_pipes_enc)) + 64) + \ (HFI_ALIGN(((((((8192) >> 2) << 5) * (num_vpp_pipes_enc)) + 64) + \
(((((MAX((frame_width_coded), (frame_height_coded)) + 3) >> 2) << 5) +\ (((((MAX((frame_width_coded), (frame_height_coded)) + 3) >> 2) << 5) +\
256) * 16)), VENUS_DMA_ALIGNMENT)) 256) * 16)), VENUS_DMA_ALIGNMENT))
#define SIZE_TOP_LINE_BUF_FIRST_STG_SAO(frame_width_coded) \ #define SIZE_TOP_LINE_BUF_FIRST_STG_SAO(frame_width_coded) \
HFI_ALIGN((16 * ((frame_width_coded) >> 5)), VENUS_DMA_ALIGNMENT) HFI_ALIGN((16 * ((frame_width_coded) >> 5)), VENUS_DMA_ALIGNMENT)
@@ -1411,8 +1408,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
HFI_UBWC_METADATA_PLANE_BUFFER_SIZE(meta_size_c, \ HFI_UBWC_METADATA_PLANE_BUFFER_SIZE(meta_size_c, \
metadata_stride, metadata_buf_height); \ metadata_stride, metadata_buf_height); \
_size = ref_buf_size + meta_size_y + meta_size_c; \ _size = ref_buf_size + meta_size_y + meta_size_c; \
} \ } else { \
else { \
SIZE_ENC_TEN_BIT_REF_BUFFER(ten_bit_ref_buf_size, \ SIZE_ENC_TEN_BIT_REF_BUFFER(ten_bit_ref_buf_size, \
frame_width, frame_height); \ frame_width, frame_height); \
HFI_UBWC_CALC_METADATA_PLANE_STRIDE(metadata_stride, \ 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) \ #define HFI_IRIS2_ENC_MIN_INPUT_BUF_COUNT(numInput, TotalHBLayers) \
do { \ do { \
numInput = 3; \ numInput = 3; \
if (TotalHBLayers >= 2) \ if (TotalHBLayers >= 2) { \
{ \
numInput = (1 << (TotalHBLayers - 1)) + 2; \ numInput = (1 << (TotalHBLayers - 1)) + 2; \
} \ } \
} while (0) } while (0)

View File

@@ -230,28 +230,30 @@ typedef HFI_U32 HFI_BOOL;
#define HFI_RGBA8888_UBWC_BUF_SIZE(buf_size, data_buf_size, \ #define HFI_RGBA8888_UBWC_BUF_SIZE(buf_size, data_buf_size, \
metadata_buffer_size, stride, buf_height, _metadata_tride, \ metadata_buffer_size, stride, buf_height, _metadata_tride, \
_metadata_buf_height) \ _metadata_buf_height) \
HFI_RGBA8888_UBWC_CALC_DATA_PLANE_BUF_SIZE(data_buf_size, \ do { \
stride, buf_height); \ HFI_RGBA8888_UBWC_CALC_DATA_PLANE_BUF_SIZE(data_buf_size, \
HFI_UBWC_METADATA_PLANE_BUFFER_SIZE(metadata_buffer_size, \ stride, buf_height); \
_metadata_tride, _metadata_buf_height); \ HFI_UBWC_METADATA_PLANE_BUFFER_SIZE(metadata_buffer_size, \
buf_size = data_buf_size + metadata_buffer_size _metadata_tride, _metadata_buf_height); \
buf_size = data_buf_size + metadata_buffer_size \
} while (0)
#define HFI_UBWC_CALC_METADATA_PLANE_STRIDE(metadata_stride, frame_width,\ #define HFI_UBWC_CALC_METADATA_PLANE_STRIDE(metadata_stride, frame_width,\
metadata_stride_multiple, tile_width_in_pels) \ metadata_stride_multiple, tile_width_in_pels) \
(metadata_stride = HFI_ALIGN(((frame_width + (tile_width_in_pels - 1)) /\ ((metadata_stride = HFI_ALIGN(((frame_width + (tile_width_in_pels - 1)) /\
tile_width_in_pels), metadata_stride_multiple)) tile_width_in_pels), metadata_stride_multiple)))
#define HFI_UBWC_METADATA_PLANE_BUFHEIGHT(metadata_buf_height, frame_height, \ #define HFI_UBWC_METADATA_PLANE_BUFHEIGHT(metadata_buf_height, frame_height, \
metadata_height_multiple, tile_height_in_pels) \ 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), \ (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, \ #define HFI_UBWC_UV_METADATA_PLANE_STRIDE(metadata_stride, frame_width, \
metadata_stride_multiple, tile_width_in_pels) \ 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), \ (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,\ #define HFI_UBWC_UV_METADATA_PLANE_BUFHEIGHT(metadata_buf_height, frame_height,\
metadata_height_multiple, tile_height_in_pels) \ 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, \ #define HFI_UBWC_METADATA_PLANE_BUFFER_SIZE(buffer_size, _metadata_tride, \
_metadata_buf_height) \ _metadata_buf_height) \
(buffer_size = HFI_ALIGN(_metadata_tride * _metadata_buf_height, \ ((buffer_size = HFI_ALIGN(_metadata_tride * _metadata_buf_height, \
HFI_ALIGNMENT_4096)) HFI_ALIGNMENT_4096)))
#define BUFFER_ALIGNMENT_512_BYTES 512 #define BUFFER_ALIGNMENT_512_BYTES 512
#define BUFFER_ALIGNMENT_256_BYTES 256 #define BUFFER_ALIGNMENT_256_BYTES 256
@@ -428,7 +430,7 @@ typedef HFI_U32 HFI_BOOL;
} while (0) } while (0)
#define HFI_BUFFER_LINE_H264D(_size, frame_width, frame_height, \ #define HFI_BUFFER_LINE_H264D(_size, frame_width, frame_height, \
is_opb, num_vpp_pipes) \ is_opb, num_vpp_pipes) \
do { \ do { \
HFI_U32 vpss_lb_size = 0; \ HFI_U32 vpss_lb_size = 0; \
_size = HFI_ALIGN(SIZE_H264D_LB_FE_TOP_DATA(frame_width, \ _size = HFI_ALIGN(SIZE_H264D_LB_FE_TOP_DATA(frame_width, \
@@ -493,8 +495,7 @@ typedef HFI_U32 HFI_BOOL;
if (!is_interlaced) { \ if (!is_interlaced) { \
SIZE_H264D_HW_BIN_BUFFER(_size, n_aligned_w, \ SIZE_H264D_HW_BIN_BUFFER(_size, n_aligned_w, \
n_aligned_h, delay, num_vpp_pipes); \ n_aligned_h, delay, num_vpp_pipes); \
} \ } else { \
else { \
_size = 0; \ _size = 0; \
} \ } \
} while (0) } while (0)
@@ -686,8 +687,7 @@ typedef HFI_U32 HFI_BOOL;
if (!is_interlaced) { \ if (!is_interlaced) { \
SIZE_H265D_HW_BIN_BUFFER(_size, n_aligned_w, \ SIZE_H265D_HW_BIN_BUFFER(_size, n_aligned_w, \
n_aligned_h, delay, num_vpp_pipes); \ n_aligned_h, delay, num_vpp_pipes); \
} \ } else { \
else { \
_size = 0; \ _size = 0; \
} \ } \
} while (0) } while (0)
@@ -1095,8 +1095,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
if (!isInterlaced) { \ if (!isInterlaced) { \
SIZE_AV1D_HW_BIN_BUFFER(_size, nAlignedW, nAlignedH, \ SIZE_AV1D_HW_BIN_BUFFER(_size, nAlignedW, nAlignedH, \
delay, num_vpp_pipes); \ delay, num_vpp_pipes); \
} \ } else { \
else { \
_size = 0; \ _size = 0; \
} \ } \
} while (0) } while (0)
@@ -1147,8 +1146,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
else if (aligned_width * aligned_height > (1280 * 720)) { \ else if (aligned_width * aligned_height > (1280 * 720)) { \
/* bitstream_size = 0.5 * yuv_size; */ \ /* bitstream_size = 0.5 * yuv_size; */ \
bitstream_size = (bitstream_size >> 2); \ bitstream_size = (bitstream_size >> 2); \
} \ } else { \
else { \
/* bitstream_size = 2 * yuv_size; */ \ /* bitstream_size = 2 * yuv_size; */ \
} \ } \
if (((rc_type == HFI_RC_CQ) || (rc_type == HFI_RC_OFF)) \ 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; \ tile_count -= 1; \
last_tile_size = (tile_size + min_tile_size); \ last_tile_size = (tile_size + min_tile_size); \
} \ } \
} \ } else { \
else { \
tile_size = frame_width_coded; \ tile_size = frame_width_coded; \
tile_count = 1; \ tile_count = 1; \
last_tile_size = 0; \ 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); \ (mbs_in_last_tile + multi_slice_max_mb_count - 1) / (multi_slice_max_mb_count); \
total_slice_count = \ total_slice_count = \
(slice_count_per_tile * (tile_count - 1)) + slice_count_in_last_tile; \ (slice_count_per_tile * (tile_count - 1)) + slice_count_in_last_tile; \
} \ } else { \
else { \
total_slice_count = (slice_count_per_tile * tile_count); \ total_slice_count = (slice_count_per_tile * tile_count); \
} \ } \
} while (0) } while (0)
@@ -1330,8 +1326,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
bitstream_size_eval = (bitstream_size_eval * 5 >> 2); \ bitstream_size_eval = (bitstream_size_eval * 5 >> 2); \
} \ } \
} \ } \
} \ } else { \
else { \
bitstream_size_eval = size_aligned_width * \ bitstream_size_eval = size_aligned_width * \
size_aligned_height * 3; \ size_aligned_height * 3; \
} \ } \
@@ -1352,8 +1347,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
} \ } \
else if (num_vpp_pipes > 2) { \ else if (num_vpp_pipes > 2) { \
size_single_pipe_eval = bitbin_size / 2; \ size_single_pipe_eval = bitbin_size / 2; \
} \ } else { \
else { \
size_single_pipe_eval = bitbin_size; \ size_single_pipe_eval = bitbin_size; \
} \ } \
if (rc_type == HFI_RC_LOSSLESS) { \ if (rc_type == HFI_RC_LOSSLESS) { \
@@ -1528,13 +1522,13 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
#define SIZE_OVERRIDE_BUF(num_lcumb) (HFI_ALIGN(((16 * (((num_lcumb) + 7)\ #define SIZE_OVERRIDE_BUF(num_lcumb) (HFI_ALIGN(((16 * (((num_lcumb) + 7)\
>> 3))), VENUS_DMA_ALIGNMENT) * 2) >> 3))), VENUS_DMA_ALIGNMENT) * 2)
#define SIZE_IR_BUF(num_lcu_in_frame) HFI_ALIGN((((((num_lcu_in_frame) << 1) + 7) &\ #define SIZE_IR_BUF(num_lcu_in_frame) HFI_ALIGN((((((num_lcu_in_frame) << 1) + 7) &\
(~7)) * 3), VENUS_DMA_ALIGNMENT) (~7)) * 3), VENUS_DMA_ALIGNMENT)
#define SIZE_VPSS_LINE_BUF(num_vpp_pipes_enc, frame_height_coded, \ #define SIZE_VPSS_LINE_BUF(num_vpp_pipes_enc, frame_height_coded, \
frame_width_coded) \ frame_width_coded) \
(HFI_ALIGN(((((((8192) >> 2) << 5) * (num_vpp_pipes_enc)) + 64) + \ (HFI_ALIGN(((((((8192) >> 2) << 5) * (num_vpp_pipes_enc)) + 64) + \
(((((MAX((frame_width_coded), (frame_height_coded)) + 3) >> 2) << 5) +\ (((((MAX((frame_width_coded), (frame_height_coded)) + 3) >> 2) << 5) +\
256) * 16)), VENUS_DMA_ALIGNMENT)) 256) * 16)), VENUS_DMA_ALIGNMENT))
#define SIZE_TOP_LINE_BUF_FIRST_STG_SAO(frame_width_coded) \ #define SIZE_TOP_LINE_BUF_FIRST_STG_SAO(frame_width_coded) \
HFI_ALIGN((16 * ((frame_width_coded) >> 5)), VENUS_DMA_ALIGNMENT) HFI_ALIGN((16 * ((frame_width_coded) >> 5)), VENUS_DMA_ALIGNMENT)
@@ -1737,8 +1731,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
HFI_UBWC_METADATA_PLANE_BUFFER_SIZE(meta_size_c, \ HFI_UBWC_METADATA_PLANE_BUFFER_SIZE(meta_size_c, \
metadata_stride, metadata_buf_height); \ metadata_stride, metadata_buf_height); \
_size = ref_buf_size + meta_size_y + meta_size_c; \ _size = ref_buf_size + meta_size_y + meta_size_c; \
} \ } else { \
else { \
SIZE_ENC_TEN_BIT_REF_BUFFER(ten_bit_ref_buf_size, \ SIZE_ENC_TEN_BIT_REF_BUFFER(ten_bit_ref_buf_size, \
frame_width, frame_height); \ frame_width, frame_height); \
HFI_UBWC_CALC_METADATA_PLANE_STRIDE(metadata_stride, \ 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) \ #define HFI_IRIS3_ENC_MIN_INPUT_BUF_COUNT(numInput, TotalHBLayers) \
do { \ do { \
numInput = 3; \ numInput = 3; \
if (TotalHBLayers >= 2) \ if (TotalHBLayers >= 2) { \
{ \
numInput = (1 << (TotalHBLayers - 1)) + 2; \ numInput = (1 << (TotalHBLayers - 1)) + 2; \
} \ } \
} while (0) } while (0)

View File

@@ -230,28 +230,30 @@ typedef HFI_U32 HFI_BOOL;
#define HFI_RGBA8888_UBWC_BUF_SIZE(buf_size, data_buf_size, \ #define HFI_RGBA8888_UBWC_BUF_SIZE(buf_size, data_buf_size, \
metadata_buffer_size, stride, buf_height, _metadata_tride, \ metadata_buffer_size, stride, buf_height, _metadata_tride, \
_metadata_buf_height) \ _metadata_buf_height) \
HFI_RGBA8888_UBWC_CALC_DATA_PLANE_BUF_SIZE(data_buf_size, \ do { \
stride, buf_height); \ HFI_RGBA8888_UBWC_CALC_DATA_PLANE_BUF_SIZE(data_buf_size, \
HFI_UBWC_METADATA_PLANE_BUFFER_SIZE(metadata_buffer_size, \ stride, buf_height); \
_metadata_tride, _metadata_buf_height); \ HFI_UBWC_METADATA_PLANE_BUFFER_SIZE(metadata_buffer_size, \
buf_size = data_buf_size + metadata_buffer_size _metadata_tride, _metadata_buf_height); \
buf_size = data_buf_size + metadata_buffer_size \
} while (0)
#define HFI_UBWC_CALC_METADATA_PLANE_STRIDE(metadata_stride, frame_width,\ #define HFI_UBWC_CALC_METADATA_PLANE_STRIDE(metadata_stride, frame_width,\
metadata_stride_multiple, tile_width_in_pels) \ metadata_stride_multiple, tile_width_in_pels) \
(metadata_stride = HFI_ALIGN(((frame_width + (tile_width_in_pels - 1)) /\ ((metadata_stride = HFI_ALIGN(((frame_width + (tile_width_in_pels - 1)) /\
tile_width_in_pels), metadata_stride_multiple)) tile_width_in_pels), metadata_stride_multiple)))
#define HFI_UBWC_METADATA_PLANE_BUFHEIGHT(metadata_buf_height, frame_height, \ #define HFI_UBWC_METADATA_PLANE_BUFHEIGHT(metadata_buf_height, frame_height, \
metadata_height_multiple, tile_height_in_pels) \ 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), \ (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, \ #define HFI_UBWC_UV_METADATA_PLANE_STRIDE(metadata_stride, frame_width, \
metadata_stride_multiple, tile_width_in_pels) \ 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), \ (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,\ #define HFI_UBWC_UV_METADATA_PLANE_BUFHEIGHT(metadata_buf_height, frame_height,\
metadata_height_multiple, tile_height_in_pels) \ 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, \ #define HFI_UBWC_METADATA_PLANE_BUFFER_SIZE(buffer_size, _metadata_tride, \
_metadata_buf_height) \ _metadata_buf_height) \
(buffer_size = HFI_ALIGN(_metadata_tride * _metadata_buf_height, \ ((buffer_size = HFI_ALIGN(_metadata_tride * _metadata_buf_height, \
HFI_ALIGNMENT_4096)) HFI_ALIGNMENT_4096)))
#define BUFFER_ALIGNMENT_512_BYTES 512 #define BUFFER_ALIGNMENT_512_BYTES 512
#define BUFFER_ALIGNMENT_256_BYTES 256 #define BUFFER_ALIGNMENT_256_BYTES 256
@@ -428,7 +430,7 @@ typedef HFI_U32 HFI_BOOL;
} while (0) } while (0)
#define HFI_BUFFER_LINE_H264D(_size, frame_width, frame_height, \ #define HFI_BUFFER_LINE_H264D(_size, frame_width, frame_height, \
is_opb, num_vpp_pipes) \ is_opb, num_vpp_pipes) \
do { \ do { \
HFI_U32 vpss_lb_size = 0; \ HFI_U32 vpss_lb_size = 0; \
_size = HFI_ALIGN(SIZE_H264D_LB_FE_TOP_DATA(frame_width, \ _size = HFI_ALIGN(SIZE_H264D_LB_FE_TOP_DATA(frame_width, \
@@ -493,8 +495,7 @@ typedef HFI_U32 HFI_BOOL;
if (!is_interlaced) { \ if (!is_interlaced) { \
SIZE_H264D_HW_BIN_BUFFER(_size, n_aligned_w, \ SIZE_H264D_HW_BIN_BUFFER(_size, n_aligned_w, \
n_aligned_h, delay, num_vpp_pipes); \ n_aligned_h, delay, num_vpp_pipes); \
} \ } else { \
else { \
_size = 0; \ _size = 0; \
} \ } \
} while (0) } while (0)
@@ -686,8 +687,7 @@ typedef HFI_U32 HFI_BOOL;
if (!is_interlaced) { \ if (!is_interlaced) { \
SIZE_H265D_HW_BIN_BUFFER(_size, n_aligned_w, \ SIZE_H265D_HW_BIN_BUFFER(_size, n_aligned_w, \
n_aligned_h, delay, num_vpp_pipes); \ n_aligned_h, delay, num_vpp_pipes); \
} \ } else { \
else { \
_size = 0; \ _size = 0; \
} \ } \
} while (0) } while (0)
@@ -1095,8 +1095,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
if (!isInterlaced) { \ if (!isInterlaced) { \
SIZE_AV1D_HW_BIN_BUFFER(_size, nAlignedW, nAlignedH, \ SIZE_AV1D_HW_BIN_BUFFER(_size, nAlignedW, nAlignedH, \
delay, num_vpp_pipes); \ delay, num_vpp_pipes); \
} \ } else { \
else { \
_size = 0; \ _size = 0; \
} \ } \
} while (0) } while (0)
@@ -1147,8 +1146,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
else if (aligned_width * aligned_height > (1280 * 720)) { \ else if (aligned_width * aligned_height > (1280 * 720)) { \
/* bitstream_size = 0.5 * yuv_size; */ \ /* bitstream_size = 0.5 * yuv_size; */ \
bitstream_size = (bitstream_size >> 2); \ bitstream_size = (bitstream_size >> 2); \
} \ } else { \
else { \
/* bitstream_size = 2 * yuv_size; */ \ /* bitstream_size = 2 * yuv_size; */ \
} \ } \
if (((rc_type == HFI_RC_CQ) || (rc_type == HFI_RC_OFF)) \ 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; \ tile_count -= 1; \
last_tile_size = (tile_size + min_tile_size); \ last_tile_size = (tile_size + min_tile_size); \
} \ } \
} \ } else { \
else { \
tile_size = frame_width_coded; \ tile_size = frame_width_coded; \
tile_count = 1; \ tile_count = 1; \
last_tile_size = 0; \ 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); \ (mbs_in_last_tile + multi_slice_max_mb_count - 1) / (multi_slice_max_mb_count); \
total_slice_count = \ total_slice_count = \
(slice_count_per_tile * (tile_count - 1)) + slice_count_in_last_tile; \ (slice_count_per_tile * (tile_count - 1)) + slice_count_in_last_tile; \
} \ } else { \
else { \
total_slice_count = (slice_count_per_tile * tile_count); \ total_slice_count = (slice_count_per_tile * tile_count); \
} \ } \
} while (0) } while (0)
@@ -1330,8 +1326,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
bitstream_size_eval = (bitstream_size_eval * 5 >> 2); \ bitstream_size_eval = (bitstream_size_eval * 5 >> 2); \
} \ } \
} \ } \
} \ } else { \
else { \
bitstream_size_eval = size_aligned_width * \ bitstream_size_eval = size_aligned_width * \
size_aligned_height * 3; \ size_aligned_height * 3; \
} \ } \
@@ -1352,8 +1347,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
} \ } \
else if (num_vpp_pipes > 2) { \ else if (num_vpp_pipes > 2) { \
size_single_pipe_eval = bitbin_size / 2; \ size_single_pipe_eval = bitbin_size / 2; \
} \ } else { \
else { \
size_single_pipe_eval = bitbin_size; \ size_single_pipe_eval = bitbin_size; \
} \ } \
if (rc_type == HFI_RC_LOSSLESS) { \ if (rc_type == HFI_RC_LOSSLESS) { \
@@ -1528,13 +1522,13 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
#define SIZE_OVERRIDE_BUF(num_lcumb) (HFI_ALIGN(((16 * (((num_lcumb) + 7)\ #define SIZE_OVERRIDE_BUF(num_lcumb) (HFI_ALIGN(((16 * (((num_lcumb) + 7)\
>> 3))), VENUS_DMA_ALIGNMENT) * 2) >> 3))), VENUS_DMA_ALIGNMENT) * 2)
#define SIZE_IR_BUF(num_lcu_in_frame) HFI_ALIGN((((((num_lcu_in_frame) << 1) + 7) &\ #define SIZE_IR_BUF(num_lcu_in_frame) HFI_ALIGN((((((num_lcu_in_frame) << 1) + 7) &\
(~7)) * 3), VENUS_DMA_ALIGNMENT) (~7)) * 3), VENUS_DMA_ALIGNMENT)
#define SIZE_VPSS_LINE_BUF(num_vpp_pipes_enc, frame_height_coded, \ #define SIZE_VPSS_LINE_BUF(num_vpp_pipes_enc, frame_height_coded, \
frame_width_coded) \ frame_width_coded) \
(HFI_ALIGN(((((((8192) >> 2) << 5) * (num_vpp_pipes_enc)) + 64) + \ (HFI_ALIGN(((((((8192) >> 2) << 5) * (num_vpp_pipes_enc)) + 64) + \
(((((MAX((frame_width_coded), (frame_height_coded)) + 3) >> 2) << 5) +\ (((((MAX((frame_width_coded), (frame_height_coded)) + 3) >> 2) << 5) +\
256) * 16)), VENUS_DMA_ALIGNMENT)) 256) * 16)), VENUS_DMA_ALIGNMENT))
#define SIZE_TOP_LINE_BUF_FIRST_STG_SAO(frame_width_coded) \ #define SIZE_TOP_LINE_BUF_FIRST_STG_SAO(frame_width_coded) \
HFI_ALIGN((16 * ((frame_width_coded) >> 5)), VENUS_DMA_ALIGNMENT) HFI_ALIGN((16 * ((frame_width_coded) >> 5)), VENUS_DMA_ALIGNMENT)
@@ -1739,8 +1733,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \
HFI_UBWC_METADATA_PLANE_BUFFER_SIZE(meta_size_c, \ HFI_UBWC_METADATA_PLANE_BUFFER_SIZE(meta_size_c, \
metadata_stride, metadata_buf_height); \ metadata_stride, metadata_buf_height); \
_size = ref_buf_size + meta_size_y + meta_size_c; \ _size = ref_buf_size + meta_size_y + meta_size_c; \
} \ } else { \
else { \
SIZE_ENC_TEN_BIT_REF_BUFFER(ten_bit_ref_buf_size, \ SIZE_ENC_TEN_BIT_REF_BUFFER(ten_bit_ref_buf_size, \
frame_width, frame_height); \ frame_width, frame_height); \
HFI_UBWC_CALC_METADATA_PLANE_STRIDE(metadata_stride, \ 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) \ #define HFI_IRIS3_ENC_MIN_INPUT_BUF_COUNT(numInput, TotalHBLayers) \
do { \ do { \
numInput = 3; \ numInput = 3; \
if (TotalHBLayers >= 2) \ if (TotalHBLayers >= 2) { \
{ \
numInput = (1 << (TotalHBLayers - 1)) + 2; \ numInput = (1 << (TotalHBLayers - 1)) + 2; \
} \ } \
} while (0) } while (0)

View File

@@ -494,8 +494,8 @@ static int __power_off_iris33_controller(struct msm_vidc_core *core)
/* poll AON spare register bit0 to become zero with 50ms timeout */ /* poll AON spare register bit0 to become zero with 50ms timeout */
rc = __read_register_with_poll_timeout(core, AON_WRAPPER_SPARE, rc = __read_register_with_poll_timeout(core, AON_WRAPPER_SPARE,
0x1, 0x0, 1000, 50 * 1000); 0x1, 0x0, 1000, 50 * 1000);
if (rc) if (rc)
d_vpr_e("%s: AON spare register is not zero\n", __func__); d_vpr_e("%s: AON spare register is not zero\n", __func__);
/* enable bit(1) to avoid cvp noc xo reset */ /* enable bit(1) to avoid cvp noc xo reset */
rc = __write_register(core, AON_WRAPPER_SPARE, value|0x2); rc = __write_register(core, AON_WRAPPER_SPARE, value|0x2);
@@ -539,12 +539,12 @@ skip_video_xo_reset:
/* remove retain mem and retain peripheral */ /* remove retain mem and retain peripheral */
rc = call_res_op(core, clk_set_flag, core, rc = call_res_op(core, clk_set_flag, core,
"video_cc_mvs0c_clk", MSM_VIDC_CLKFLAG_NORETAIN_PERIPH); "video_cc_mvs0c_clk", MSM_VIDC_CLKFLAG_NORETAIN_PERIPH);
if (rc) if (rc)
d_vpr_e("%s: set noretain peripheral failed\n", __func__); d_vpr_e("%s: set noretain peripheral failed\n", __func__);
rc = call_res_op(core, clk_set_flag, core, rc = call_res_op(core, clk_set_flag, core,
"video_cc_mvs0c_clk", MSM_VIDC_CLKFLAG_NORETAIN_MEM); "video_cc_mvs0c_clk", MSM_VIDC_CLKFLAG_NORETAIN_MEM);
if (rc) if (rc)
d_vpr_e("%s: set noretain mem failed\n", __func__); d_vpr_e("%s: set noretain mem failed\n", __func__);
/* Turn off MVP MVS0C core clock */ /* Turn off MVP MVS0C core clock */
rc = call_res_op(core, clk_disable, core, "video_cc_mvs0c_clk"); rc = call_res_op(core, clk_disable, core, "video_cc_mvs0c_clk");

View File

@@ -940,7 +940,7 @@ struct msm_vidc_mem {
*/ */
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0)) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0))
struct iosys_map dmabuf_map; 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; struct dma_buf_map dmabuf_map;
#endif #endif
void *kvaddr; 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.left = s->r.left;
inst->compose.top = s->r.top; inst->compose.top = s->r.top;
inst->compose.width = s->r.width; inst->compose.width = s->r.width;
inst->compose.height= s->r.height; inst->compose.height = s->r.height;
if (is_scaling_enabled(inst)) { if (is_scaling_enabled(inst)) {
i_vpr_h(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); buf_name(mem->type), mem->secure, mem->region);
if (mem->kvaddr) { 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); dma_buf_vunmap(mem->dmabuf, mem->kvaddr);
#else #else
dma_buf_vunmap(mem->dmabuf, &mem->dmabuf_map); 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, * Kalama uses Kernel Version 5.15.x,
* Pineapple uses Kernel Version 5.18.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); mem->kvaddr = dma_buf_vmap(mem->dmabuf);
if (!mem->kvaddr) { if (!mem->kvaddr) {
d_vpr_e("%s: kernel map failed\n", __func__); d_vpr_e("%s: kernel map failed\n", __func__);