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

Commit 2283a494 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: vidc: Update cvp extradata control settings"

parents 75f52712 b2734023
Loading
Loading
Loading
Loading
+2 −8
Original line number Diff line number Diff line
@@ -4142,7 +4142,6 @@ int msm_venc_set_hdr_info(struct msm_vidc_inst *inst)
int msm_venc_set_extradata(struct msm_vidc_inst *inst)
{
	int rc = 0;
	u32 value = 0x0;
	u32 codec;

	codec = get_v4l2_codec(inst);
@@ -4178,13 +4177,8 @@ int msm_venc_set_extradata(struct msm_vidc_inst *inst)
		}
	}

	if (inst->prop.extradata_ctrls & EXTRADATA_ENC_INPUT_CVP)
		value = 0x1;
	dprintk(VIDC_HIGH, "%s: CVP extradata %d\n", __func__, value);
	rc = msm_comm_set_extradata(inst,
		HFI_PROPERTY_PARAM_VENC_CVP_METADATA_EXTRADATA, value);
	if (rc)
		dprintk(VIDC_ERR, "%s: set CVP extradata failed\n", __func__);
	/* CVP extradata is common between user space and external CVP kernel to kernel.
	   Hence, skipping here and will be set after msm_vidc_prepare_preprocess in start_streaming*/

	return rc;
}
+34 −10
Original line number Diff line number Diff line
@@ -717,6 +717,7 @@ bool is_vidc_cvp_allowed(struct msm_vidc_inst *inst)
	bool allowed = false;
	struct msm_vidc_core *core;
	struct v4l2_ctrl *cvp_disable;
	struct v4l2_ctrl *superframe_enable;

	if (!inst || !inst->core) {
		dprintk(VIDC_ERR, "%s: invalid params\n", __func__);
@@ -736,15 +737,18 @@ bool is_vidc_cvp_allowed(struct msm_vidc_inst *inst)
	 *      - V4L2_MPEG_VIDEO_BITRATE_MODE_CQ
	 *      - V4L2_MPEG_VIDEO_BITRATE_MODE_CBR
	 * - not secure session
	 * - not superframe enabled
	 */
	cvp_disable = get_ctrl(inst, V4L2_CID_MPEG_VIDC_VENC_CVP_DISABLE);
	superframe_enable = get_ctrl(inst, V4L2_CID_MPEG_VIDC_SUPERFRAME);

	if (core->resources.cvp_external && !cvp_disable->val &&
		!(inst->prop.extradata_ctrls & EXTRADATA_ENC_INPUT_CVP) &&
		inst->rc_type != RATE_CONTROL_OFF &&
		inst->rc_type != V4L2_MPEG_VIDEO_BITRATE_MODE_CQ &&
		!inst->clk_data.is_legacy_cbr &&
		!is_secure_session(inst)) {
		!is_secure_session(inst) &&
		!superframe_enable->val) {
		dprintk(VIDC_HIGH, "%s: cvp allowed\n", __func__);
		allowed = true;
	} else {
@@ -784,15 +788,8 @@ static int msm_vidc_prepare_preprocess(struct msm_vidc_inst *inst)
		dprintk(VIDC_ERR, "%s: no cvp preprocessing\n", __func__);
		goto exit;
	}
	dprintk(VIDC_HIGH, "%s: cvp enabled\n", __func__);

	dprintk(VIDC_HIGH, "%s: set CVP extradata\n", __func__);
	rc = msm_comm_set_extradata(inst,
		HFI_PROPERTY_PARAM_VENC_CVP_METADATA_EXTRADATA, 1);
	if (rc) {
		dprintk(VIDC_ERR, "%s: set CVP extradata failed\n", __func__);
		goto exit;
	}
	dprintk(VIDC_HIGH, "%s: kernel to kernel cvp enabled\n", __func__);
	inst->prop.extradata_ctrls |= EXTRADATA_ENC_INPUT_KK_CVP;

exit:
	if (rc)
@@ -800,6 +797,31 @@ static int msm_vidc_prepare_preprocess(struct msm_vidc_inst *inst)
	return rc;
}

static bool msm_vidc_set_cvp_metadata(struct msm_vidc_inst *inst) {

	int rc = 0;
	u32 value = 0x0;

	if (!inst) {
		dprintk(VIDC_ERR, "%s: invalid params\n", __func__);
		return false;
	}

	if ((inst->prop.extradata_ctrls & EXTRADATA_ENC_INPUT_CVP) ||
	    (inst->prop.extradata_ctrls & EXTRADATA_ENC_INPUT_KK_CVP))
	    value = 0x1;

	dprintk(VIDC_HIGH, "%s: CVP extradata %d\n", __func__, value);
	rc = msm_comm_set_extradata(inst,
		HFI_PROPERTY_PARAM_VENC_CVP_METADATA_EXTRADATA, value);
	if (rc) {
		dprintk(VIDC_ERR,
			"%s: set CVP extradata failed\n", __func__);
		return false;
	}
	return true;
}

static inline int start_streaming(struct msm_vidc_inst *inst)
{
	int rc = 0;
@@ -825,6 +847,8 @@ static inline int start_streaming(struct msm_vidc_inst *inst)
			/* ignore error */
			rc = 0;
		}
		if (!(msm_vidc_set_cvp_metadata(inst)))
			goto fail_start;
	}

	b.buffer_type = HFI_BUFFER_OUTPUT;
+4 −0
Original line number Diff line number Diff line
@@ -58,6 +58,10 @@
#define INPUT_MPLANE V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE
#define OUTPUT_MPLANE V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE

/* EXTRADATA_ENC_INPUT_KK_CVP is an extension of
   v4l2_mpeg_vidc_extradata for internal usage.
   This is needed to indicate internal kernel to kernel CVP usage. */
#define EXTRADATA_ENC_INPUT_KK_CVP (1UL << 31)
#define RATE_CONTROL_OFF (V4L2_MPEG_VIDEO_BITRATE_MODE_CQ + 1)
#define RATE_CONTROL_LOSSLESS (V4L2_MPEG_VIDEO_BITRATE_MODE_CQ + 2)
#define SYS_MSG_START HAL_SYS_INIT_DONE