Skip to content

Commit

Permalink
media: venus: add support for key frame
Browse files Browse the repository at this point in the history
When client requests for a keyframe, set the property
to hardware to generate the sync frame.

Signed-off-by: Malathi Gottam <[email protected]>
Acked-by: Tomasz Figa <[email protected]>
Acked-by: Stanimir Varbanov <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
Malathi Gottam authored and mchehab committed Dec 7, 2018
1 parent 8d31a49 commit c35f0b1
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion drivers/media/platform/qcom/venus/venc_ctrls.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ static int venc_op_s_ctrl(struct v4l2_ctrl *ctrl)
{
struct venus_inst *inst = ctrl_to_inst(ctrl);
struct venc_controls *ctr = &inst->controls.enc;
struct hfi_enable en = { .enable = 1 };
struct hfi_bitrate brate;
u32 bframes;
u32 ptype;
Expand Down Expand Up @@ -188,6 +189,19 @@ static int venc_op_s_ctrl(struct v4l2_ctrl *ctrl)

ctr->num_b_frames = bframes;
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:
return -EINVAL;
}
Expand All @@ -203,7 +217,7 @@ int venc_ctrl_init(struct venus_inst *inst)
{
int ret;

ret = v4l2_ctrl_handler_init(&inst->ctrl_handler, 27);
ret = v4l2_ctrl_handler_init(&inst->ctrl_handler, 28);
if (ret)
return ret;

Expand Down Expand Up @@ -324,6 +338,9 @@ int venc_ctrl_init(struct venus_inst *inst)
v4l2_ctrl_new_std(&inst->ctrl_handler, &venc_ctrl_ops,
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;
if (ret)
goto err;
Expand Down

0 comments on commit c35f0b1

Please sign in to comment.