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 control during
the session. Based on it, video driver would decide the
work mode and set the same.

Change-Id: If6e85b7adb1bbe4b4bec9e4a8671db64f240cfe8
Signed-off-by: Vikash Garodia <vgarodia@codeaurora.org>
This commit is contained in:
Vikash Garodia 2020-04-27 12:38:36 +05:30 committed by Gerrit - the friendly Code Review server
parent 6ec572de63
commit e55786492d
5 changed files with 64 additions and 0 deletions

View File

@ -416,6 +416,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",
@ -937,6 +946,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;
@ -1313,6 +1324,32 @@ 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);
if (!hfi_property.enable)
return 0;
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;
@ -1447,6 +1484,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);

View File

@ -995,6 +995,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) ||

View File

@ -1656,6 +1656,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,
@ -2805,6 +2814,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) &&

View File

@ -127,6 +127,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);

View File

@ -193,6 +193,8 @@ struct hfi_extradata_header {
(HFI_PROPERTY_PARAM_VDEC_OX_START + 0x0023)
#define HFI_PROPERTY_PARAM_VDEC_VSP_VPP_DELAY \
(HFI_PROPERTY_PARAM_VDEC_OX_START + 0x0024)
#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)