video: driver: fix line and dpb buffers for enc

- Removed internal bufsize hack to increase bufsize by
  100MB.
- update enc internal buf size adn count macros to align
  with video fw macro definitions.
  P4 cl: 28472789 and 28496178

Change-Id: I30a4d043a07c6e890d58f4138590f112d192080a
Signed-off-by: Akshata Sahukar <asahukar@codeaurora.org>
This commit is contained in:
Akshata Sahukar
2021-01-27 10:30:36 -08:00
parent aa46dbf712
commit c0b11f6482
3 changed files with 13 additions and 14 deletions

View File

@@ -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_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 * 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) \ _total_hp_layers, _total_hb_layers, hybrid_hp, codec_standard) \
do \ do \
{ \ { \
num_ref = 1; \ HFI_U32 num_ref = 1; \
if (n_bframe) \ if (n_bframe) \
num_ref = n_bframe + 1; \ num_ref = 2; \
if (ltr_count) \ if (ltr_count) \
/* B and LTR can't be at same time */\ /* B and LTR can't be at same time */\
num_ref = num_ref + ltr_count; \ 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_ref = (2 ^ (_total_hb_layers - 1)) / 2 + 1; \
} \ } \
num_recon = num_ref + 1; \
} while (0) } while (0)
#define SIZE_BIN_BITSTREAM_ENC(_size, frame_width, frame_height, \ #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_LAMBDA_LUT (256 * 11)
#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) (((((num_lcu_in_frame) << 1) + 7) &\ #define SIZE_IR_BUF(num_lcu_in_frame) HFI_ALIGN((((((num_lcu_in_frame) << 1) + 7) &\
(~7)) * 3) (~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) \
((((((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)) 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)

View File

@@ -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) static u32 msm_vidc_encoder_comv_size_iris2(struct msm_vidc_inst* inst)
{ {
u32 size = 0; u32 size = 0;
u32 width, height, num_ref; u32 width, height, num_ref = 0, num_recon = 0;
struct v4l2_format* f; struct v4l2_format* f;
if (!inst || !inst->core) { 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) { if (inst->codec == MSM_VIDC_H264) {
// TODO: replace zeros with appropriate variables // 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); HFI_CODEC_ENCODE_AVC);
num_ref = num_recon - 1;
HFI_BUFFER_COMV_H264E(size, width, height, num_ref); HFI_BUFFER_COMV_H264E(size, width, height, num_ref);
} else if (inst->codec == MSM_VIDC_HEVC) { } else if (inst->codec == MSM_VIDC_HEVC) {
// TODO: replace zeros with appropriate variables // 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); HFI_CODEC_ENCODE_HEVC);
num_ref = num_recon - 1;
HFI_BUFFER_COMV_H265E(size, width, height, num_ref); HFI_BUFFER_COMV_H265E(size, width, height, num_ref);
} }

View File

@@ -1579,10 +1579,6 @@ int msm_vidc_get_internal_buffers(struct msm_vidc_inst *inst,
buf_size = call_session_op(core, buffer_size, buf_size = call_session_op(core, buffer_size,
inst, buffer_type); 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, buf_count = call_session_op(core, min_count,
inst, buffer_type); inst, buffer_type);