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

Commit db0e597b authored by Vikash Garodia's avatar Vikash Garodia
Browse files

msm: vdec: configure latency mode for decode session



Static - Enable latency hint which indicates that the
decode session may go into low latency mode during the
session. With this configuration, video driver disables
DCVS and decode batching.
Dynamic - Enable or disable low latency mode during the
session. Based on it, video driver would decide the work
mode and set the same.

Change-Id: If6e85b7adb1bbe4b4bec9e4a8671db64f240cfe8
Signed-off-by: default avatarVikash Garodia <vgarodia@codeaurora.org>
parent 40e06473
Loading
Loading
Loading
Loading
+37 −0
Original line number Diff line number Diff line
@@ -397,6 +397,15 @@ static struct msm_vidc_ctrl msm_vdec_ctrls[] = {
		.default_value = V4L2_MPEG_MSM_VIDC_DISABLE,
		.step = 1,
	},
	{
		.id = V4L2_CID_MPEG_VIDC_VIDEO_LOWLATENCY_HINT,
		.name = "Low Latency Hint",
		.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",
@@ -928,6 +937,8 @@ int msm_vdec_s_ctrl(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl)
		inst->clk_data.low_latency_mode = !!ctrl->val;
		inst->batch.enable = is_batching_allowed(inst);
		break;
	case V4L2_CID_MPEG_VIDC_VIDEO_LOWLATENCY_HINT:
		break;
	default:
		s_vpr_e(inst->sid, "Unknown control %#x\n", ctrl->id);
		break;
@@ -1304,6 +1315,29 @@ int msm_vdec_set_priority(struct msm_vidc_inst *inst)
	return rc;
}

int msm_vdec_set_seqchng_at_syncframe(struct msm_vidc_inst *inst)
{
	int rc = 0;
	struct hfi_device *hdev;
	struct hfi_enable hfi_property;

	if (!inst || !inst->core) {
		d_vpr_e("%s: invalid params %pK\n", __func__, inst);
		return -EINVAL;
	}
	hdev = inst->core->device;
	hfi_property.enable = is_low_latency_hint(inst);

	s_vpr_h(inst->sid, "%s: %#x\n", __func__, hfi_property.enable);
	rc = call_hfi_op(hdev, session_set_property, inst->session,
		HFI_PROPERTY_PARAM_VDEC_SEQCHNG_AT_SYNCFRM, &hfi_property,
		sizeof(hfi_property));
	if (rc)
		s_vpr_e(inst->sid, "%s: set property failed\n", __func__);

	return rc;
}

int msm_vdec_set_conceal_color(struct msm_vidc_inst *inst)
{
	int rc = 0;
@@ -1439,6 +1473,9 @@ int msm_vdec_set_properties(struct msm_vidc_inst *inst)
		rc = msm_vdec_set_conceal_color(inst);
		if (rc)
			goto exit;
		rc = msm_vdec_set_seqchng_at_syncframe(inst);
		if (rc)
			goto exit;
	}

	rc = msm_vdec_set_color_format(inst);
+1 −0
Original line number Diff line number Diff line
@@ -1081,6 +1081,7 @@ int msm_dcvs_try_enable(struct msm_vidc_inst *inst)
		!(msm_vidc_clock_voting ||
			!inst->core->resources.dcvs ||
			inst->flags & VIDC_THUMBNAIL ||
			is_low_latency_hint(inst) ||
			inst->clk_data.low_latency_mode ||
			inst->batch.enable ||
			is_turbo_session(inst) ||
+10 −0
Original line number Diff line number Diff line
@@ -1701,6 +1701,15 @@ static void handle_event_change(enum hal_command_response cmd, void *data)
		} else {
			inst->entropy_mode = event_notify->entropy_mode;

			/* configure work mode considering low latency*/
			if (is_low_latency_hint(inst)) {
				rc = call_core_op(inst->core, decide_work_mode,
						  inst);
				if (rc)
					s_vpr_e(inst->sid,
						"%s: Failed to decide work mode\n",
						__func__);
			}
			s_vpr_h(inst->sid,
				"seq: No parameter change continue session\n");
			rc = call_hfi_op(hdev, session_continue,
@@ -2860,6 +2869,7 @@ bool is_batching_allowed(struct msm_vidc_inst *inst)
	 */
	return (inst->batch.enable &&
		inst->core->resources.decode_batching &&
		!is_low_latency_hint(inst) &&
		is_single_session(inst, ignore_flags) &&
		is_decode_session(inst) &&
		!is_thumbnail_session(inst) &&
+11 −0
Original line number Diff line number Diff line
@@ -132,6 +132,17 @@ static inline bool is_realtime_session(struct msm_vidc_inst *inst)
	return !!ctrl->val;
}

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

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

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

static inline bool is_secure_session(struct msm_vidc_inst *inst)
{
	return !!(inst->flags & VIDC_SECURE);
+3 −1
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
 */
#ifndef __H_VIDC_HFI_H__
#define __H_VIDC_HFI_H__
@@ -191,6 +191,8 @@ struct hfi_extradata_header {
	(HFI_PROPERTY_PARAM_VDEC_OX_START + 0x0022)
#define HFI_PROPERTY_PARAM_VDEC_HDR10_HIST_EXTRADATA \
	(HFI_PROPERTY_PARAM_VDEC_OX_START + 0x0023)
#define HFI_PROPERTY_PARAM_VDEC_SEQCHNG_AT_SYNCFRM \
	(HFI_PROPERTY_PARAM_VDEC_OX_START + 0x0025)

#define HFI_PROPERTY_CONFIG_VDEC_OX_START				\
	(HFI_DOMAIN_BASE_VDEC + HFI_ARCH_OX_OFFSET + 0x4000)