Merge "msm: venc: Set LTR info only when LTR is enabled"

This commit is contained in:
qctecmdr 2019-07-29 21:26:34 -07:00 committed by Gerrit - the friendly Code Review server
commit e8df88c30b

View File

@ -3730,6 +3730,7 @@ int msm_venc_set_nal_stream_format(struct msm_vidc_inst *inst)
int msm_venc_set_ltr_mode(struct msm_vidc_inst *inst)
{
int rc = 0;
bool is_ltr = true;
struct hfi_device *hdev;
struct v4l2_ctrl *ctrl;
struct hfi_ltr_mode ltr;
@ -3742,13 +3743,17 @@ int msm_venc_set_ltr_mode(struct msm_vidc_inst *inst)
hdev = inst->core->device;
codec = get_v4l2_codec(inst);
if (!(codec == V4L2_PIX_FMT_HEVC || codec == V4L2_PIX_FMT_H264))
return 0;
if (!(codec == V4L2_PIX_FMT_HEVC || codec == V4L2_PIX_FMT_H264)) {
is_ltr = false;
goto disable_ltr;
}
if (!(inst->rc_type == RATE_CONTROL_OFF ||
inst->rc_type == V4L2_MPEG_VIDEO_BITRATE_MODE_CBR ||
inst->rc_type == V4L2_MPEG_VIDEO_BITRATE_MODE_CBR_VFR))
return 0;
inst->rc_type == V4L2_MPEG_VIDEO_BITRATE_MODE_CBR_VFR)) {
is_ltr = false;
goto disable_ltr;
}
ctrl = get_ctrl(inst, V4L2_CID_MPEG_VIDC_VIDEO_LTRCOUNT);
if (!ctrl->val)
@ -3769,6 +3774,15 @@ int msm_venc_set_ltr_mode(struct msm_vidc_inst *inst)
if (rc)
dprintk(VIDC_ERR, "%s: set property failed\n", __func__);
disable_ltr:
/*
* Forcefully setting LTR count to zero when
* client sets unsupported codec/rate control.
*/
if (!is_ltr) {
ctrl->val = 0;
dprintk(VIDC_HIGH, "LTR is forcefully disabled!\n");
}
return rc;
}
@ -3786,6 +3800,10 @@ int msm_venc_set_ltr_useframe(struct msm_vidc_inst *inst)
}
hdev = inst->core->device;
ctrl = get_ctrl(inst, V4L2_CID_MPEG_VIDC_VIDEO_LTRCOUNT);
if (!ctrl->val)
return 0;
codec = get_v4l2_codec(inst);
if (!(codec == V4L2_PIX_FMT_HEVC || codec == V4L2_PIX_FMT_H264))
return 0;
@ -3818,6 +3836,10 @@ int msm_venc_set_ltr_markframe(struct msm_vidc_inst *inst)
}
hdev = inst->core->device;
ctrl = get_ctrl(inst, V4L2_CID_MPEG_VIDC_VIDEO_LTRCOUNT);
if (!ctrl->val)
return 0;
codec = get_v4l2_codec(inst);
if (!(codec == V4L2_PIX_FMT_HEVC || codec == V4L2_PIX_FMT_H264))
return 0;