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

Commit a7967f70 authored by Darshana Patil's avatar Darshana Patil
Browse files

msm: venc: Set LTR info only when LTR is enabled



Set LTR use mask and mark index information to
firmware only when LTR count is non zero.

Change-Id: Icdcd0e8e29841e0cf4d2222ad3c2331aed2e3968
Signed-off-by: default avatarDarshana Patil <darshana@codeaurora.org>
parent 5a31d042
Loading
Loading
Loading
Loading
+26 −4
Original line number Diff line number Diff line
@@ -3726,6 +3726,7 @@ int msm_venc_set_nal_stream_format(struct msm_vidc_inst *inst)
int msm_venc_set_ltr_mode(struct msm_vidc_inst *inst)
{
	int rc = 0;
	bool is_ltr = true;
	struct hfi_device *hdev;
	struct v4l2_ctrl *ctrl;
	struct hfi_ltr_mode ltr;
@@ -3738,13 +3739,17 @@ int msm_venc_set_ltr_mode(struct msm_vidc_inst *inst)
	hdev = inst->core->device;

	codec = get_v4l2_codec(inst);
	if (!(codec == V4L2_PIX_FMT_HEVC || codec == V4L2_PIX_FMT_H264))
		return 0;
	if (!(codec == V4L2_PIX_FMT_HEVC || codec == V4L2_PIX_FMT_H264)) {
		is_ltr = false;
		goto disable_ltr;
	}

	if (!(inst->rc_type == RATE_CONTROL_OFF ||
		inst->rc_type == V4L2_MPEG_VIDEO_BITRATE_MODE_CBR ||
		inst->rc_type == V4L2_MPEG_VIDEO_BITRATE_MODE_CBR_VFR))
		return 0;
		inst->rc_type == V4L2_MPEG_VIDEO_BITRATE_MODE_CBR_VFR)) {
			is_ltr = false;
			goto disable_ltr;
		}

	ctrl = get_ctrl(inst, V4L2_CID_MPEG_VIDC_VIDEO_LTRCOUNT);
	if (!ctrl->val)
@@ -3765,6 +3770,15 @@ int msm_venc_set_ltr_mode(struct msm_vidc_inst *inst)
	if (rc)
		dprintk(VIDC_ERR, "%s: set property failed\n", __func__);

disable_ltr:
	/*
	 * Forcefully setting LTR count to zero when
	 * client sets unsupported codec/rate control.
	 */
	if (!is_ltr) {
		ctrl->val = 0;
		dprintk(VIDC_HIGH, "LTR is forcefully disabled!\n");
	}
	return rc;
}

@@ -3782,6 +3796,10 @@ int msm_venc_set_ltr_useframe(struct msm_vidc_inst *inst)
	}
	hdev = inst->core->device;

	ctrl = get_ctrl(inst, V4L2_CID_MPEG_VIDC_VIDEO_LTRCOUNT);
	if (!ctrl->val)
		return 0;

	codec = get_v4l2_codec(inst);
	if (!(codec == V4L2_PIX_FMT_HEVC || codec == V4L2_PIX_FMT_H264))
		return 0;
@@ -3814,6 +3832,10 @@ int msm_venc_set_ltr_markframe(struct msm_vidc_inst *inst)
	}
	hdev = inst->core->device;

	ctrl = get_ctrl(inst, V4L2_CID_MPEG_VIDC_VIDEO_LTRCOUNT);
	if (!ctrl->val)
		return 0;

	codec = get_v4l2_codec(inst);
	if (!(codec == V4L2_PIX_FMT_HEVC || codec == V4L2_PIX_FMT_H264))
		return 0;