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

Commit d62ced20 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: vidc: Limit the session QP for HEVC encoder"

parents 0971cb96 ac598c37
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
@@ -3239,6 +3239,8 @@ int msm_venc_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)

	if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
		struct hal_frame_size frame_sz = {0};
		struct hal_quantization_range qp_range;
		void *pdata = NULL;

		rc = msm_comm_try_state(inst, MSM_VIDC_OPEN_DONE);
		if (rc) {
@@ -3257,6 +3259,33 @@ int msm_venc_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
					"Failed to set OUTPUT framesize\n");
			goto exit;
		}

		if (inst->fmts[CAPTURE_PORT]->fourcc == V4L2_PIX_FMT_HEVC) {

			/*
			* Currently Venus HW has a limitation on minimum
			* value of QP for HEVC encoder. Hence restricting
			* the QP in the range of 2 - 51. This workaround
			* will be removed once FW able to handle the full
			* QP range.
			*/

			qp_range.layer_id = 0;
			qp_range.max_qp = 51;
			qp_range.min_qp = 2;

			pdata = &qp_range;

			rc = call_hfi_op(hdev, session_set_property,
					(void *)inst->session,
					HAL_PARAM_VENC_SESSION_QP_RANGE, pdata);
			if (rc) {
				dprintk(VIDC_ERR,
						"Failed to set QP range\n");
				goto exit;
			}
		}

	} else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
		struct hal_buffer_requirements *bufreq = NULL;
		int extra_idx = 0;