diff options
author | Kiran AVND <avnd.kiran@samsung.com> | 2014-10-21 07:06:55 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2014-10-28 13:41:47 -0400 |
commit | c4b1ce051e1f5c1e82cf25f35e24460a9ece993c (patch) | |
tree | d887b68304b1f6ae23de10772fcc366fc0968ce9 | |
parent | edc16cb1159c03864c74fd0411ec5d0bcce845be (diff) |
[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>
-rw-r--r-- | drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c index a904a1c7bb21..4816f31acf68 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | |||
@@ -690,6 +690,16 @@ static struct mfc_control controls[] = { | |||
690 | .step = 1, | 690 | .step = 1, |
691 | .default_value = 0, | 691 | .default_value = 0, |
692 | }, | 692 | }, |
693 | { | ||
694 | .id = V4L2_CID_MIN_BUFFERS_FOR_OUTPUT, | ||
695 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
696 | .name = "Minimum number of output bufs", | ||
697 | .minimum = 1, | ||
698 | .maximum = 32, | ||
699 | .step = 1, | ||
700 | .default_value = 1, | ||
701 | .is_volatile = 1, | ||
702 | }, | ||
693 | }; | 703 | }; |
694 | 704 | ||
695 | #define NUM_CTRLS ARRAY_SIZE(controls) | 705 | #define NUM_CTRLS ARRAY_SIZE(controls) |
@@ -1624,8 +1634,40 @@ static int s5p_mfc_enc_s_ctrl(struct v4l2_ctrl *ctrl) | |||
1624 | return ret; | 1634 | return ret; |
1625 | } | 1635 | } |
1626 | 1636 | ||
1637 | static int s5p_mfc_enc_g_v_ctrl(struct v4l2_ctrl *ctrl) | ||
1638 | { | ||
1639 | struct s5p_mfc_ctx *ctx = ctrl_to_ctx(ctrl); | ||
1640 | struct s5p_mfc_dev *dev = ctx->dev; | ||
1641 | |||
1642 | switch (ctrl->id) { | ||
1643 | case V4L2_CID_MIN_BUFFERS_FOR_OUTPUT: | ||
1644 | if (ctx->state >= MFCINST_HEAD_PARSED && | ||
1645 | ctx->state < MFCINST_ABORT) { | ||
1646 | ctrl->val = ctx->pb_count; | ||
1647 | break; | ||
1648 | } else if (ctx->state != MFCINST_INIT) { | ||
1649 | v4l2_err(&dev->v4l2_dev, "Encoding not initialised\n"); | ||
1650 | return -EINVAL; | ||
1651 | } | ||
1652 | /* Should wait for the header to be produced */ | ||
1653 | s5p_mfc_clean_ctx_int_flags(ctx); | ||
1654 | s5p_mfc_wait_for_done_ctx(ctx, | ||
1655 | S5P_MFC_R2H_CMD_SEQ_DONE_RET, 0); | ||
1656 | if (ctx->state >= MFCINST_HEAD_PARSED && | ||
1657 | ctx->state < MFCINST_ABORT) { | ||
1658 | ctrl->val = ctx->pb_count; | ||
1659 | } else { | ||
1660 | v4l2_err(&dev->v4l2_dev, "Encoding not initialised\n"); | ||
1661 | return -EINVAL; | ||
1662 | } | ||
1663 | break; | ||
1664 | } | ||
1665 | return 0; | ||
1666 | } | ||
1667 | |||
1627 | static const struct v4l2_ctrl_ops s5p_mfc_enc_ctrl_ops = { | 1668 | static const struct v4l2_ctrl_ops s5p_mfc_enc_ctrl_ops = { |
1628 | .s_ctrl = s5p_mfc_enc_s_ctrl, | 1669 | .s_ctrl = s5p_mfc_enc_s_ctrl, |
1670 | .g_volatile_ctrl = s5p_mfc_enc_g_v_ctrl, | ||
1629 | }; | 1671 | }; |
1630 | 1672 | ||
1631 | static int vidioc_s_parm(struct file *file, void *priv, | 1673 | static int vidioc_s_parm(struct file *file, void *priv, |