diff --git a/driver/variant/iris2/inc/hfi_buffer_iris2.h b/driver/variant/iris2/inc/hfi_buffer_iris2.h index a6765bd014..701455e839 100644 --- a/driver/variant/iris2/inc/hfi_buffer_iris2.h +++ b/driver/variant/iris2/inc/hfi_buffer_iris2.h @@ -1238,13 +1238,13 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \ * Here: _total_hp_layers = HFI_PROPERTY_PARAM_VENC_HIER_P_MAX_NUM_ENH_LAYER + 1 * Here: _total_hb_layers = HFI_PROPERTY_PARAM_VENC_HIER_B_MAX_NUM_ENH_LAYER + 1 */ -#define HFI_IRIS2_ENC_RECON_BUF_COUNT(num_ref, n_bframe, ltr_count, \ +#define HFI_IRIS2_ENC_RECON_BUF_COUNT(num_recon, n_bframe, ltr_count, \ _total_hp_layers, _total_hb_layers, hybrid_hp, codec_standard) \ do \ { \ - num_ref = 1; \ + HFI_U32 num_ref = 1; \ if (n_bframe) \ - num_ref = n_bframe + 1; \ + num_ref = 2; \ if (ltr_count) \ /* B and LTR can't be at same time */\ num_ref = num_ref + ltr_count; \ @@ -1270,6 +1270,7 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \ { \ num_ref = (2 ^ (_total_hb_layers - 1)) / 2 + 1; \ } \ + num_recon = num_ref + 1; \ } while (0) #define SIZE_BIN_BITSTREAM_ENC(_size, frame_width, frame_height, \ @@ -1521,14 +1522,14 @@ _yuv_bufcount_min, is_opb, num_vpp_pipes) \ #define SIZE_LAMBDA_LUT (256 * 11) #define SIZE_OVERRIDE_BUF(num_lcumb) (HFI_ALIGN(((16 * (((num_lcumb) + 7)\ >> 3))), VENUS_DMA_ALIGNMENT) * 2) -#define SIZE_IR_BUF(num_lcu_in_frame) (((((num_lcu_in_frame) << 1) + 7) &\ - (~7)) * 3) +#define SIZE_IR_BUF(num_lcu_in_frame) HFI_ALIGN((((((num_lcu_in_frame) << 1) + 7) &\ + (~7)) * 3), VENUS_DMA_ALIGNMENT) #define SIZE_VPSS_LINE_BUF(num_vpp_pipes_enc, frame_height_coded, \ frame_width_coded) \ - ((((((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) +\ - 256) * 16)) + 256) * 16)), VENUS_DMA_ALIGNMENT)) #define SIZE_TOP_LINE_BUF_FIRST_STG_SAO(frame_width_coded) \ HFI_ALIGN((16 * ((frame_width_coded) >> 5)), VENUS_DMA_ALIGNMENT) diff --git a/driver/variant/iris2/src/msm_vidc_buffer_iris2.c b/driver/variant/iris2/src/msm_vidc_buffer_iris2.c index 0cc1b33332..2d74363d84 100644 --- a/driver/variant/iris2/src/msm_vidc_buffer_iris2.c +++ b/driver/variant/iris2/src/msm_vidc_buffer_iris2.c @@ -270,7 +270,7 @@ static u32 msm_vidc_encoder_bin_size_iris2(struct msm_vidc_inst *inst) static u32 msm_vidc_encoder_comv_size_iris2(struct msm_vidc_inst* inst) { u32 size = 0; - u32 width, height, num_ref; + u32 width, height, num_ref = 0, num_recon = 0; struct v4l2_format* f; if (!inst || !inst->core) { @@ -284,13 +284,15 @@ static u32 msm_vidc_encoder_comv_size_iris2(struct msm_vidc_inst* inst) if (inst->codec == MSM_VIDC_H264) { // TODO: replace zeros with appropriate variables - HFI_IRIS2_ENC_RECON_BUF_COUNT(num_ref, 0, 0, 0, 0, 0, + HFI_IRIS2_ENC_RECON_BUF_COUNT(num_recon, 0, 0, 0, 0, 0, HFI_CODEC_ENCODE_AVC); + num_ref = num_recon - 1; HFI_BUFFER_COMV_H264E(size, width, height, num_ref); } else if (inst->codec == MSM_VIDC_HEVC) { // TODO: replace zeros with appropriate variables - HFI_IRIS2_ENC_RECON_BUF_COUNT(num_ref, 0, 0, 0, 0, 0, + HFI_IRIS2_ENC_RECON_BUF_COUNT(num_recon, 0, 0, 0, 0, 0, HFI_CODEC_ENCODE_HEVC); + num_ref = num_recon - 1; HFI_BUFFER_COMV_H265E(size, width, height, num_ref); } diff --git a/driver/vidc/src/msm_vidc_driver.c b/driver/vidc/src/msm_vidc_driver.c index e91a146402..7dae2c3dd0 100644 --- a/driver/vidc/src/msm_vidc_driver.c +++ b/driver/vidc/src/msm_vidc_driver.c @@ -1579,10 +1579,6 @@ int msm_vidc_get_internal_buffers(struct msm_vidc_inst *inst, buf_size = call_session_op(core, buffer_size, inst, buffer_type); - /* TODO: remove below hack to increase enc inter buf size by 100MB */ - if (is_encode_session(inst)) - buf_size += 100000000; - buf_count = call_session_op(core, min_count, inst, buffer_type);