Commit 6f704b2f authored by Jeffrey Kardatzke's avatar Jeffrey Kardatzke Committed by Mauro Carvalho Chehab

media: venus: support frame rate control

Add encoder control for enabling/disabling frame rate control via
V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE. It is enabled by default.
Signed-off-by: default avatarJeffrey Kardatzke <jkardatzke@google.com>
Signed-off-by: default avatarStanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 808431d6
...@@ -198,6 +198,7 @@ struct venc_controls { ...@@ -198,6 +198,7 @@ struct venc_controls {
u32 bitrate_mode; u32 bitrate_mode;
u32 bitrate; u32 bitrate;
u32 bitrate_peak; u32 bitrate_peak;
u32 rc_enable;
u32 h264_i_period; u32 h264_i_period;
u32 h264_entropy_mode; u32 h264_entropy_mode;
......
...@@ -728,7 +728,9 @@ static int venc_set_properties(struct venus_inst *inst) ...@@ -728,7 +728,9 @@ static int venc_set_properties(struct venus_inst *inst)
if (ret) if (ret)
return ret; return ret;
if (ctr->bitrate_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_VBR) if (!ctr->rc_enable)
rate_control = HFI_RATE_CONTROL_OFF;
else if (ctr->bitrate_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_VBR)
rate_control = HFI_RATE_CONTROL_VBR_CFR; rate_control = HFI_RATE_CONTROL_VBR_CFR;
else else
rate_control = HFI_RATE_CONTROL_CBR_CFR; rate_control = HFI_RATE_CONTROL_CBR_CFR;
......
...@@ -199,6 +199,9 @@ static int venc_op_s_ctrl(struct v4l2_ctrl *ctrl) ...@@ -199,6 +199,9 @@ static int venc_op_s_ctrl(struct v4l2_ctrl *ctrl)
} }
mutex_unlock(&inst->lock); mutex_unlock(&inst->lock);
break; break;
case V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE:
ctr->rc_enable = ctrl->val;
break;
default: default:
return -EINVAL; return -EINVAL;
} }
...@@ -214,7 +217,7 @@ int venc_ctrl_init(struct venus_inst *inst) ...@@ -214,7 +217,7 @@ int venc_ctrl_init(struct venus_inst *inst)
{ {
int ret; int ret;
ret = v4l2_ctrl_handler_init(&inst->ctrl_handler, 30); ret = v4l2_ctrl_handler_init(&inst->ctrl_handler, 31);
if (ret) if (ret)
return ret; return ret;
...@@ -351,6 +354,9 @@ int venc_ctrl_init(struct venus_inst *inst) ...@@ -351,6 +354,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_FORCE_KEY_FRAME, 0, 0, 0, 0); V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME, 0, 0, 0, 0);
v4l2_ctrl_new_std(&inst->ctrl_handler, &venc_ctrl_ops,
V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE, 0, 1, 1, 1);
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