From ec7ac2c5f2fd5c338159eb891bc349d7fd81ad3b Mon Sep 17 00:00:00 2001 From: Manikanta Kanamarlapudi Date: Thu, 9 Apr 2020 23:07:42 +0530 Subject: [PATCH] msm:vidc: Modify input buffer size calculation calculate buffer size as per the max resolution for the targets that does not support 4k and also ensure the size is equal to YUV size by overriding the div factor to 1. Change-Id: Ia63676d30d1ee1e697518780a03a48010380555d Signed-off-by: Manikanta Kanamarlapudi --- msm/vidc/msm_vidc_buffer_calculations.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/msm/vidc/msm_vidc_buffer_calculations.c b/msm/vidc/msm_vidc_buffer_calculations.c index 54769c46afeb..b17c8a1ebb0f 100644 --- a/msm/vidc/msm_vidc_buffer_calculations.c +++ b/msm/vidc/msm_vidc_buffer_calculations.c @@ -845,6 +845,18 @@ u32 msm_vidc_calculate_dec_input_frame_size(struct msm_vidc_inst *inst) div_factor = 2; } + if (is_secure_session(inst)) + div_factor = div_factor << 1; + + /* + * For targets that doesn't support 4k, consider max mb's for that + * target and allocate max input buffer size for the same + */ + if (base_res_mbs > inst->capability.cap[CAP_MBS_PER_FRAME].max) { + base_res_mbs = inst->capability.cap[CAP_MBS_PER_FRAME].max; + div_factor = 1; + } + frame_size = base_res_mbs * MB_SIZE_IN_PIXEL * 3 / 2 / div_factor; /* multiply by 10/8 (1.25) to get size for 10 bit case */ @@ -852,9 +864,6 @@ u32 msm_vidc_calculate_dec_input_frame_size(struct msm_vidc_inst *inst) (f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_HEVC)) frame_size = frame_size + (frame_size >> 2); - if (is_secure_session(inst)) - frame_size /= 2; - if (inst->buffer_size_limit && (inst->buffer_size_limit < frame_size)) { frame_size = inst->buffer_size_limit;