From ac11cf2022b44e99ea856b6d6689167684a2a6ba Mon Sep 17 00:00:00 2001 From: Vikash Garodia Date: Wed, 12 Jun 2019 18:53:40 +0530 Subject: [PATCH] msm: vidc: Update bitstream buffer size for secure case Existing logic to calculate buffer size is based on the max bitrate supported during a secure session. Even the peak bitrate calculation is not sufficient to arrive at the required frame size. Going back to earlier logic based on macroblocks per frame. CRs-Fixed: 2467242 Change-Id: I0fe1768036f19ad2f1d08222e3ed239be7a2e27c Signed-off-by: Vikash Garodia --- msm/vidc/msm_vidc_buffer_calculations.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/msm/vidc/msm_vidc_buffer_calculations.c b/msm/vidc/msm_vidc_buffer_calculations.c index c119cf6ba1ac..a94be0a9e2b6 100644 --- a/msm/vidc/msm_vidc_buffer_calculations.c +++ b/msm/vidc/msm_vidc_buffer_calculations.c @@ -782,22 +782,14 @@ u32 msm_vidc_calculate_dec_input_frame_size(struct msm_vidc_inst *inst) frame_size = base_res_mbs * MB_SIZE_IN_PIXEL * 3 / 2 / div_factor; - if (is_secure_session(inst)) { - u32 max_bitrate = inst->capability.cap[CAP_SECURE_BITRATE].max; - - /* - * for secure, calc frame_size based on max bitrate, - * peak bitrate can be 10 times more and - * frame rate assumed to be 30 fps at least - */ - frame_size = (max_bitrate * 10 / 8) / 30; - } - /* multiply by 10/8 (1.25) to get size for 10 bit case */ if ((f->fmt.pix_mp.pixelformat == V4L2_PIX_FMT_VP9) || (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;