Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3e2e6a2e authored by Govindaraj Rajagopal's avatar Govindaraj Rajagopal
Browse files

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: default avatarGovindaraj Rajagopal <grajagop@codeaurora.org>
parent d37ffdd1
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -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)
+13 −2
Original line number Diff line number Diff line
@@ -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

@@ -744,6 +747,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);
@@ -792,8 +796,15 @@ 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 -
			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)) {