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

Commit 70a2ee6e authored by Chandrakant I Viraktamath's avatar Chandrakant I Viraktamath
Browse files

msm: vidc: Add control to handle timestamp reorder



Add control to enable/disable timestamp reordering
in driver.

Change-Id: I50c3f60bb8af053881073b40c6df0c74f3f0aafb
Signed-off-by: default avatarChandrakant I Viraktamath <civirakt@codeaurora.org>
parent 3de9db96
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -258,6 +258,8 @@ enum v4l2_mpeg_vidc_video_bitrate_savings_type {
		(V4L2_CID_MPEG_MSM_VIDC_BASE + 134)
#define V4L2_CID_MPEG_VIDC_VENC_QPRANGE_BOOST \
		(V4L2_CID_MPEG_MSM_VIDC_BASE + 135)
#define V4L2_CID_MPEG_VIDC_VIDEO_DISABLE_TIMESTAMP_REORDER \
		(V4L2_CID_MPEG_MSM_VIDC_BASE + 136)

#define V4L2_CID_MPEG_VIDC_VIDEO_UNKNOWN \
		(V4L2_CID_MPEG_MSM_VIDC_BASE + 0xFFF)
+11 −0
Original line number Diff line number Diff line
@@ -420,6 +420,15 @@ static struct msm_vidc_ctrl msm_vdec_ctrls[] = {
		.default_value = V4L2_MPEG_MSM_VIDC_DISABLE,
		.step = 1,
	},
	{
		.id = V4L2_CID_MPEG_VIDC_VIDEO_DISABLE_TIMESTAMP_REORDER,
		.name = "Disable TimeStamp Reorder",
		.type = V4L2_CTRL_TYPE_BOOLEAN,
		.minimum = V4L2_MPEG_MSM_VIDC_DISABLE,
		.maximum = V4L2_MPEG_MSM_VIDC_ENABLE,
		.default_value = V4L2_MPEG_MSM_VIDC_DISABLE,
		.step = 1,
	},
	{
		.id = V4L2_CID_MPEG_VIDC_SUPERFRAME,
		.name = "Superframe",
@@ -952,6 +961,8 @@ int msm_vdec_s_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl)
		break;
	case V4L2_CID_MPEG_VIDC_VIDEO_LOWLATENCY_HINT:
		break;
	case V4L2_CID_MPEG_VIDC_VIDEO_DISABLE_TIMESTAMP_REORDER:
		break;
	case V4L2_CID_MPEG_VIDC_VDEC_HEIF_MODE:
		if(get_v4l2_codec(inst) != V4L2_PIX_FMT_HEVC)
			break;
+2 −3
Original line number Diff line number Diff line
@@ -433,7 +433,7 @@ int msm_vidc_qbuf(void *instance, struct media_device *mdev,
	timestamp_us = (s64)((b->timestamp.tv_sec * 1000000) +
		b->timestamp.tv_usec);
	if (is_decode_session(inst) && b->type == INPUT_MPLANE &&
		!is_heif_decoder(inst) && !is_secure_session(inst)) {
		is_ts_reorder_allowed(inst)) {
		if (inst->flush_timestamps)
			msm_comm_release_timestamps(inst);
		inst->flush_timestamps = false;
@@ -515,8 +515,7 @@ int msm_vidc_dqbuf(void *instance, struct v4l2_buffer *b)
	if (is_decode_session(inst) &&
		b->type == OUTPUT_MPLANE &&
		!(b->flags & V4L2_BUF_FLAG_CODECCONFIG) &&
		!is_heif_decoder(inst) &&
		!is_secure_session(inst))
		is_ts_reorder_allowed(inst))
		msm_comm_fetch_ts_framerate(inst, b);

	return rc;
+18 −0
Original line number Diff line number Diff line
@@ -159,6 +159,24 @@ static inline bool is_secure_session(struct msm_vidc_inst *inst)
	return !!(inst->flags & VIDC_SECURE);
}

static inline bool is_ts_reorder_allowed(struct msm_vidc_inst *inst)
{
	struct v4l2_ctrl *ctrl;

	if (is_secure_session(inst))
		return false;

	if (inst->session_type != MSM_VIDC_DECODER)
		return true;

	if (!is_heif_decoder(inst))
		return true;

	ctrl = get_ctrl(inst,
		V4L2_CID_MPEG_VIDC_VIDEO_DISABLE_TIMESTAMP_REORDER);
	return !ctrl->val;
}

static inline bool is_decode_session(struct msm_vidc_inst *inst)
{
	return inst->session_type == MSM_VIDC_DECODER;