Commit c35f0b16 authored by Malathi Gottam's avatar Malathi Gottam Committed by Mauro Carvalho Chehab

media: venus: add support for key frame

When client requests for a keyframe, set the property
to hardware to generate the sync frame.
Signed-off-by: default avatarMalathi Gottam <mgottam@codeaurora.org>
Acked-by: default avatarTomasz Figa <tfiga@chromium.org>
Acked-by: default avatarStanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 8d31a499
...@@ -79,6 +79,7 @@ static int venc_op_s_ctrl(struct v4l2_ctrl *ctrl) ...@@ -79,6 +79,7 @@ static int venc_op_s_ctrl(struct v4l2_ctrl *ctrl)
{ {
struct venus_inst *inst = ctrl_to_inst(ctrl); struct venus_inst *inst = ctrl_to_inst(ctrl);
struct venc_controls *ctr = &inst->controls.enc; struct venc_controls *ctr = &inst->controls.enc;
struct hfi_enable en = { .enable = 1 };
struct hfi_bitrate brate; struct hfi_bitrate brate;
u32 bframes; u32 bframes;
u32 ptype; u32 ptype;
...@@ -188,6 +189,19 @@ static int venc_op_s_ctrl(struct v4l2_ctrl *ctrl) ...@@ -188,6 +189,19 @@ static int venc_op_s_ctrl(struct v4l2_ctrl *ctrl)
ctr->num_b_frames = bframes; ctr->num_b_frames = bframes;
break; break;
case V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME:
mutex_lock(&inst->lock);
if (inst->streamon_out && inst->streamon_cap) {
ptype = HFI_PROPERTY_CONFIG_VENC_REQUEST_SYNC_FRAME;
ret = hfi_session_set_property(inst, ptype, &en);
if (ret) {
mutex_unlock(&inst->lock);
return ret;
}
}
mutex_unlock(&inst->lock);
break;
default: default:
return -EINVAL; return -EINVAL;
} }
...@@ -203,7 +217,7 @@ int venc_ctrl_init(struct venus_inst *inst) ...@@ -203,7 +217,7 @@ int venc_ctrl_init(struct venus_inst *inst)
{ {
int ret; int ret;
ret = v4l2_ctrl_handler_init(&inst->ctrl_handler, 27); ret = v4l2_ctrl_handler_init(&inst->ctrl_handler, 28);
if (ret) if (ret)
return ret; return ret;
...@@ -324,6 +338,9 @@ int venc_ctrl_init(struct venus_inst *inst) ...@@ -324,6 +338,9 @@ int venc_ctrl_init(struct venus_inst *inst)
v4l2_ctrl_new_std(&inst->ctrl_handler, &venc_ctrl_ops, v4l2_ctrl_new_std(&inst->ctrl_handler, &venc_ctrl_ops,
V4L2_CID_MPEG_VIDEO_H264_I_PERIOD, 0, (1 << 16) - 1, 1, 0); V4L2_CID_MPEG_VIDEO_H264_I_PERIOD, 0, (1 << 16) - 1, 1, 0);
v4l2_ctrl_new_std(&inst->ctrl_handler, &venc_ctrl_ops,
V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME, 0, 0, 0, 0);
ret = inst->ctrl_handler.error; ret = inst->ctrl_handler.error;
if (ret) if (ret)
goto err; goto err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment