From 34d3f0fe996f0a9293fa50528fbfc5f3d8b36865 Mon Sep 17 00:00:00 2001 From: Maheshwar Ajja Date: Wed, 26 Jun 2019 15:42:30 -0700 Subject: [PATCH] msm: vidc: recalculate buffer counts based on frame rate Encoder buffer requirement changes based on frame rate or operating rate (HFR/HSR usecase) and hence recalculate buffer counts when client set frame rate or operating rate. Change-Id: I7b421524f319a4fde8b153dcd5c3bde123c5ccf9 Signed-off-by: Maheshwar Ajja --- msm/vidc/msm_venc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/msm/vidc/msm_venc.c b/msm/vidc/msm_venc.c index c5c9cd4adc86..1feffb06620c 100644 --- a/msm/vidc/msm_venc.c +++ b/msm/vidc/msm_venc.c @@ -1517,6 +1517,8 @@ int msm_venc_s_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl) break; case V4L2_CID_MPEG_VIDC_VIDEO_FRAME_RATE: inst->clk_data.frame_rate = ctrl->val; + if (inst->state < MSM_VIDC_LOAD_RESOURCES) + msm_vidc_calculate_buffer_counts(inst); if (inst->state == MSM_VIDC_START_DONE) { rc = msm_venc_set_frame_rate(inst); if (rc) @@ -1560,6 +1562,8 @@ int msm_venc_s_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl) break; case V4L2_CID_MPEG_VIDC_VIDEO_OPERATING_RATE: inst->clk_data.operating_rate = ctrl->val; + if (inst->state < MSM_VIDC_LOAD_RESOURCES) + msm_vidc_calculate_buffer_counts(inst); if (inst->state == MSM_VIDC_START_DONE) { rc = msm_venc_set_operating_rate(inst); if (rc)