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

Commit 1f3b5821 authored by Akshata Sahukar's avatar Akshata Sahukar Committed by Gerrit - the friendly Code Review server
Browse files

msm: vidc: Provide default profile type in s_fmt



Set default profile type to avoid error when client
has not set any profile type.

Change-Id: I89b81f5167f65685e47073b5e73d3bd7c4fe81d6
Signed-off-by: default avatarAkshata Sahukar <asahukar@codeaurora.org>
parent 5db23dd1
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
@@ -1248,6 +1248,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");
@@ -1326,6 +1335,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);