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

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

Merge "msm: vidc: Provide default profile type in s_fmt"

parents 635c29dc 1f3b5821
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
@@ -1249,6 +1249,15 @@ int msm_venc_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
		mplane->width = f->fmt.pix_mp.width;
		mplane->height = f->fmt.pix_mp.height;
		mplane->pixelformat = f->fmt.pix_mp.pixelformat;

		if (!inst->profile) {
			rc = msm_venc_set_default_profile(inst);
			if (rc) {
				dprintk(VIDC_ERR, "%s: Failed to set default profile type\n", __func__);
				goto exit;
			}
		}

		rc = msm_comm_try_state(inst, MSM_VIDC_OPEN_DONE);
		if (rc) {
			dprintk(VIDC_ERR, "Failed to open instance\n");
@@ -1327,6 +1336,26 @@ int msm_venc_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
	return rc;
}

int msm_venc_set_default_profile(struct msm_vidc_inst *inst)
{
	if (!inst) {
		dprintk(VIDC_ERR,
			"%s: invalid params\n", __func__);
		return -EINVAL;
	}

	if (get_v4l2_codec(inst) == V4L2_PIX_FMT_HEVC)
		inst->profile = HFI_HEVC_PROFILE_MAIN;
	else if (get_v4l2_codec(inst) == V4L2_PIX_FMT_VP8)
		inst->profile = HFI_VP8_PROFILE_MAIN;
	else if (get_v4l2_codec(inst) == V4L2_PIX_FMT_H264)
		inst->profile = HFI_H264_PROFILE_HIGH;
	else
		dprintk(VIDC_ERR,
			"%s: Invalid codec type %#x\n", __func__, get_v4l2_codec(inst));
	return 0;
}

int msm_venc_g_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
{
	struct v4l2_format *fmt;
+1 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ int msm_venc_s_fmt(struct msm_vidc_inst *inst,
		struct v4l2_format *f);
int msm_venc_g_fmt(struct msm_vidc_inst *inst,
		struct v4l2_format *f);
int msm_venc_set_default_profile(struct msm_vidc_inst *inst);
int msm_venc_s_ctrl(struct msm_vidc_inst *inst,
		struct v4l2_ctrl *ctrl);
int msm_venc_set_properties(struct msm_vidc_inst *inst);