[media] s5p-mfc: support MIN_BUFFERS query for encoder
Add V4L2_CID_MIN_BUFFERS_FOR_OUTPUT query for encoder. Once mfc encoder state is HEAD_PARSED, which is sequence header produced, dpb_count is avaialable. Let user space query this value. Signed-off-by: Kiran AVND <avnd.kiran@samsung.com> Signed-off-by: Arun Kumar K <arun.kk@samsung.com> Signed-off-by: Kamil Debski <k.debski@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
This commit is contained in:
parent
edc16cb115
commit
c4b1ce051e
|
@ -690,6 +690,16 @@ static struct mfc_control controls[] = {
|
|||
.step = 1,
|
||||
.default_value = 0,
|
||||
},
|
||||
{
|
||||
.id = V4L2_CID_MIN_BUFFERS_FOR_OUTPUT,
|
||||
.type = V4L2_CTRL_TYPE_INTEGER,
|
||||
.name = "Minimum number of output bufs",
|
||||
.minimum = 1,
|
||||
.maximum = 32,
|
||||
.step = 1,
|
||||
.default_value = 1,
|
||||
.is_volatile = 1,
|
||||
},
|
||||
};
|
||||
|
||||
#define NUM_CTRLS ARRAY_SIZE(controls)
|
||||
|
@ -1624,8 +1634,40 @@ static int s5p_mfc_enc_s_ctrl(struct v4l2_ctrl *ctrl)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int s5p_mfc_enc_g_v_ctrl(struct v4l2_ctrl *ctrl)
|
||||
{
|
||||
struct s5p_mfc_ctx *ctx = ctrl_to_ctx(ctrl);
|
||||
struct s5p_mfc_dev *dev = ctx->dev;
|
||||
|
||||
switch (ctrl->id) {
|
||||
case V4L2_CID_MIN_BUFFERS_FOR_OUTPUT:
|
||||
if (ctx->state >= MFCINST_HEAD_PARSED &&
|
||||
ctx->state < MFCINST_ABORT) {
|
||||
ctrl->val = ctx->pb_count;
|
||||
break;
|
||||
} else if (ctx->state != MFCINST_INIT) {
|
||||
v4l2_err(&dev->v4l2_dev, "Encoding not initialised\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
/* Should wait for the header to be produced */
|
||||
s5p_mfc_clean_ctx_int_flags(ctx);
|
||||
s5p_mfc_wait_for_done_ctx(ctx,
|
||||
S5P_MFC_R2H_CMD_SEQ_DONE_RET, 0);
|
||||
if (ctx->state >= MFCINST_HEAD_PARSED &&
|
||||
ctx->state < MFCINST_ABORT) {
|
||||
ctrl->val = ctx->pb_count;
|
||||
} else {
|
||||
v4l2_err(&dev->v4l2_dev, "Encoding not initialised\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct v4l2_ctrl_ops s5p_mfc_enc_ctrl_ops = {
|
||||
.s_ctrl = s5p_mfc_enc_s_ctrl,
|
||||
.g_volatile_ctrl = s5p_mfc_enc_g_v_ctrl,
|
||||
};
|
||||
|
||||
static int vidioc_s_parm(struct file *file, void *priv,
|
||||
|
|
Loading…
Reference in New Issue