msm: vidc: vdec: recalculate input buffer count for HFR

Default buffer count will not be sufficient for HFR(fps > 480).
So recalculate buffer count, if fps is updated before calling
vidioc_reqbuf.

Change-Id: Iec792892d283072f064c4148c65560b6a7e31d45
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
This commit is contained in:
Govindaraj Rajagopal 2019-10-11 21:25:05 +05:30 • committed by Mihir Ganu
commit 16c8cdbaaf
2 changed files with 23 additions and 2 deletions

View file

@ -890,6 +890,16 @@ int msm_vdec_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)
break;
/* Only recalculate buffer counts before buffers allocated */
rc = msm_vidc_calculate_buffer_counts(inst);
if (rc) {
s_vpr_e(inst->sid,
"%s failed to calculate buffer count after set fps\n",
__func__);
return rc;
}
break;
case V4L2_CID_MPEG_VIDC_VIDEO_EXTRADATA:
if (ctrl->val == EXTRADATA_NONE)

View file

@ -19,6 +19,9 @@
/* total input buffers in case of decoder batch */
#define BATCH_DEC_TOTAL_INPUT_BUFFERS 6
/* total input buffers for decoder HFR usecase (fps > 480) */
#define HFR_DEC_TOTAL_MAX_INPUT_BUFFERS 24
/* total input buffers for decoder HFR usecase */
#define HFR_DEC_TOTAL_INPUT_BUFFERS 12
@ -745,6 +748,7 @@ static int msm_vidc_get_extra_input_buff_count(struct msm_vidc_inst *inst)
unsigned int extra_input_count = 0;
struct msm_vidc_core *core;
struct v4l2_format *f;
int fps;
if (!inst || !inst->core) {
d_vpr_e("%s: invalid params %pK\n", __func__, inst);
@ -793,9 +797,16 @@ static int msm_vidc_get_extra_input_buff_count(struct msm_vidc_inst *inst)
if (!is_secure_session(inst) &&
msm_comm_get_num_perf_sessions(inst) <
MAX_PERF_ELIGIBLE_SESSIONS) {
fps = inst->clk_data.frame_rate >> 16;
inst->is_perf_eligible_session = true;
extra_input_count = (HFR_DEC_TOTAL_INPUT_BUFFERS -
MIN_INPUT_BUFFERS);
if (fps > 480)
extra_input_count =
(HFR_DEC_TOTAL_MAX_INPUT_BUFFERS -
MIN_INPUT_BUFFERS);
else
extra_input_count =
(HFR_DEC_TOTAL_INPUT_BUFFERS -
MIN_INPUT_BUFFERS);
}
} else if (is_encode_session(inst)) {
/*