|
@@ -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,
|