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

Commit cc97f61b authored by Vikash Garodia's avatar Vikash Garodia
Browse files

msm: venc: add support for boost for holi



For holi, boost is set as 15%. With the change,
a level of 15% can be set to video firmware.
Also ensure that the boost is set only when client
has set the boost control.

CRs-Fixed: 2810440
Change-Id: Ib4e4c5511c57daa78b405f8a92c2ee924b1cc1bd
Signed-off-by: default avatarVikash Garodia <vgarodia@codeaurora.org>
parent af733855
Loading
Loading
Loading
Loading
+16 −3
Original line number Diff line number Diff line
@@ -1970,6 +1970,9 @@ int msm_venc_s_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl)
	case V4L2_CID_MPEG_VIDC_VIDEO_FULL_RANGE:
		inst->full_range = ctrl->val;
		break;
	case V4L2_CID_MPEG_VIDC_VENC_BITRATE_BOOST:
		inst->boost_enabled = true;
		break;
	case V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE:
		inst->entropy_mode = msm_comm_v4l2_to_hfi(
			V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE,
@@ -2010,7 +2013,6 @@ int msm_venc_s_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl)
	case V4L2_CID_MPEG_VIDEO_VBV_DELAY:
	case V4L2_CID_MPEG_VIDEO_H264_CHROMA_QP_INDEX_OFFSET:
	case V4L2_CID_MPEG_VIDC_VENC_BITRATE_SAVINGS:
	case V4L2_CID_MPEG_VIDC_VENC_BITRATE_BOOST:
	case V4L2_CID_MPEG_VIDC_VENC_QPRANGE_BOOST:
	case V4L2_CID_MPEG_VIDC_SUPERFRAME:
		s_vpr_h(sid, "Control set: ID : 0x%x Val : %d\n",
@@ -3493,12 +3495,14 @@ int msm_venc_set_bitrate_boost_margin(struct msm_vidc_inst *inst, u32 enable)
	struct v4l2_ctrl *ctrl = NULL;
	struct hfi_bitrate_boost_margin boost_margin;
	int minqp, maxqp;
	uint32_t vpu;

	if (!inst || !inst->core) {
		d_vpr_e("%s: invalid params %pK\n", __func__, inst);
		return -EINVAL;
	}
	hdev = inst->core->device;
	vpu = inst->core->platform_data->vpu_ver;

	if (!enable) {
		boost_margin.margin = 0;
@@ -3507,11 +3511,20 @@ int msm_venc_set_bitrate_boost_margin(struct msm_vidc_inst *inst, u32 enable)

	ctrl = get_ctrl(inst, V4L2_CID_MPEG_VIDC_VENC_BITRATE_BOOST);

	/* Mapped value to 0, 25 or 50*/
	/*
	 * For certain SOC, default value should be 0 unless client enabled
	 */
	if (!inst->boost_enabled && vpu == VPU_VERSION_AR50_LITE) {
		ctrl->val = 0;
		update_ctrl(ctrl, 0, inst->sid);
	}
	/* Mapped value to 0, 15, 25 or 50*/
	if (ctrl->val >= 50)
		boost_margin.margin = 50;
	else
	else if (ctrl->val >= 25)
		boost_margin.margin = (u32)(ctrl->val/25) * 25;
	else
		boost_margin.margin = (u32)(ctrl->val/15) * 15;

setprop:
	s_vpr_h(inst->sid, "%s: %d\n", __func__, boost_margin.margin);
+1 −0
Original line number Diff line number Diff line
@@ -589,6 +589,7 @@ struct msm_vidc_inst {
	u64 last_qbuf_time_ns;
	bool active;
	bool has_bframe;
	bool boost_enabled;
	bool boost_qp_enabled;
	u32 boost_min_qp;
	u32 boost_max_qp;