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

Commit e09d5df9 authored by Maheshwar Ajja's avatar Maheshwar Ajja
Browse files

msm: vidc: Return failure for unsupported codecs



This change will check the codec type with supported codecs
(obtained from SYS_INIT_DONE response) and return failure
if unsupported codec is being set.

Change-Id: I113b4600b8c0152227cff50d5dff8c2da6f74c86
Signed-off-by: default avatarMaheshwar Ajja <majja@codeaurora.org>
parent 84dce0d6
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -1142,6 +1142,14 @@ int msm_vdec_s_fmt(struct msm_vidc_inst *inst, struct v4l2_format *f)
			rc = -EINVAL;
			goto err_invalid_fmt;
		}
		if (!(get_hal_codec_type(fmt->fourcc) &
			inst->core->dec_codec_supported)) {
			dprintk(VIDC_ERR,
				"Codec(0x%x) not supported\n",
				get_hal_codec_type(fmt->fourcc));
			rc = -EINVAL;
			goto err_invalid_fmt;
		}
		inst->fmts[fmt->type] = fmt;
		rc = msm_comm_try_state(inst, MSM_VIDC_OPEN_DONE);
		if (rc) {
+7 −4
Original line number Diff line number Diff line
@@ -282,14 +282,17 @@ static void handle_sys_init_done(enum command_response cmd, void *data)
		dprintk(VIDC_ERR, "Wrong device_id received\n");
		return;
	}
	dprintk(VIDC_DBG, "index = %d\n", index);
	dprintk(VIDC_DBG, "ptr = %p\n", &(core->completions[index]));
	complete(&(core->completions[index]));
	sys_init_msg = response->data;
	if (!sys_init_msg) {
		dprintk(VIDC_ERR, "sys_init_done message not proper\n");
		return;
	}
	core->enc_codec_supported = sys_init_msg->enc_codec_supported;
	core->dec_codec_supported = sys_init_msg->dec_codec_supported;
	dprintk(VIDC_DBG, "supported_codecs: enc = 0x%x, dec = 0x%x\n",
		core->enc_codec_supported, core->dec_codec_supported);
	dprintk(VIDC_DBG, "ptr[%d] = %p\n", index, &(core->completions[index]));
	complete(&(core->completions[index]));
}

static void handle_session_release_buf_done(enum command_response cmd,
@@ -1611,7 +1614,7 @@ static enum hal_domain get_hal_domain(int session_type)
	return domain;
}

static enum hal_video_codec get_hal_codec_type(int fourcc)
enum hal_video_codec get_hal_codec_type(int fourcc)
{
	enum hal_video_codec codec;
	dprintk(VIDC_DBG, "codec is 0x%x", fourcc);
+1 −0
Original line number Diff line number Diff line
@@ -64,4 +64,5 @@ struct msm_smem *msm_comm_smem_user_to_kernel(struct msm_vidc_inst *inst,
int msm_comm_smem_get_domain_partition(struct msm_vidc_inst *inst,
			u32 flags, enum hal_buffer buffer_type,
			int *domain_num, int *partition_num);
enum hal_video_codec get_hal_codec_type(int fourcc);
#endif
+2 −0
Original line number Diff line number Diff line
@@ -205,6 +205,8 @@ struct msm_vidc_core {
	struct completion completions[SYS_MSG_END - SYS_MSG_START + 1];
	enum msm_vidc_hfi_type hfi_type;
	struct msm_vidc_platform_resources resources;
	u32 enc_codec_supported;
	u32 dec_codec_supported;
};

struct msm_vidc_inst {