diff options
author | Tomasz Stanislawski <t.stanislaws@samsung.com> | 2012-06-14 10:32:28 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-11-25 14:21:58 -0500 |
commit | 6fa9dd069e62864d990ff9c7726f16b34018e718 (patch) | |
tree | 23b4869c5ba2cd6083aa97a266d40443a686a070 /drivers/media | |
parent | 3c44efd3b2af20c50769998e496d744a6d490e66 (diff) |
[media] v4l: s5p-mfc: support for dmabuf exporting
This patch enhances s5p-mfc with support for DMABUF exporting via
VIDIOC_EXPBUF ioctl.
Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 14 | ||||
-rw-r--r-- | drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | 14 |
2 files changed, 28 insertions, 0 deletions
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c index eb6a70b0f821..6dad9a74f61c 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | |||
@@ -636,6 +636,19 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *buf) | |||
636 | return -EINVAL; | 636 | return -EINVAL; |
637 | } | 637 | } |
638 | 638 | ||
639 | /* Export DMA buffer */ | ||
640 | static int vidioc_expbuf(struct file *file, void *priv, | ||
641 | struct v4l2_exportbuffer *eb) | ||
642 | { | ||
643 | struct s5p_mfc_ctx *ctx = fh_to_ctx(priv); | ||
644 | |||
645 | if (eb->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) | ||
646 | return vb2_expbuf(&ctx->vq_src, eb); | ||
647 | if (eb->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) | ||
648 | return vb2_expbuf(&ctx->vq_dst, eb); | ||
649 | return -EINVAL; | ||
650 | } | ||
651 | |||
639 | /* Stream on */ | 652 | /* Stream on */ |
640 | static int vidioc_streamon(struct file *file, void *priv, | 653 | static int vidioc_streamon(struct file *file, void *priv, |
641 | enum v4l2_buf_type type) | 654 | enum v4l2_buf_type type) |
@@ -813,6 +826,7 @@ static const struct v4l2_ioctl_ops s5p_mfc_dec_ioctl_ops = { | |||
813 | .vidioc_querybuf = vidioc_querybuf, | 826 | .vidioc_querybuf = vidioc_querybuf, |
814 | .vidioc_qbuf = vidioc_qbuf, | 827 | .vidioc_qbuf = vidioc_qbuf, |
815 | .vidioc_dqbuf = vidioc_dqbuf, | 828 | .vidioc_dqbuf = vidioc_dqbuf, |
829 | .vidioc_expbuf = vidioc_expbuf, | ||
816 | .vidioc_streamon = vidioc_streamon, | 830 | .vidioc_streamon = vidioc_streamon, |
817 | .vidioc_streamoff = vidioc_streamoff, | 831 | .vidioc_streamoff = vidioc_streamoff, |
818 | .vidioc_g_crop = vidioc_g_crop, | 832 | .vidioc_g_crop = vidioc_g_crop, |
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c index 5c1d727268be..f92f6ddd739f 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | |||
@@ -1165,6 +1165,19 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *buf) | |||
1165 | return ret; | 1165 | return ret; |
1166 | } | 1166 | } |
1167 | 1167 | ||
1168 | /* Export DMA buffer */ | ||
1169 | static int vidioc_expbuf(struct file *file, void *priv, | ||
1170 | struct v4l2_exportbuffer *eb) | ||
1171 | { | ||
1172 | struct s5p_mfc_ctx *ctx = fh_to_ctx(priv); | ||
1173 | |||
1174 | if (eb->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) | ||
1175 | return vb2_expbuf(&ctx->vq_src, eb); | ||
1176 | if (eb->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) | ||
1177 | return vb2_expbuf(&ctx->vq_dst, eb); | ||
1178 | return -EINVAL; | ||
1179 | } | ||
1180 | |||
1168 | /* Stream on */ | 1181 | /* Stream on */ |
1169 | static int vidioc_streamon(struct file *file, void *priv, | 1182 | static int vidioc_streamon(struct file *file, void *priv, |
1170 | enum v4l2_buf_type type) | 1183 | enum v4l2_buf_type type) |
@@ -1568,6 +1581,7 @@ static const struct v4l2_ioctl_ops s5p_mfc_enc_ioctl_ops = { | |||
1568 | .vidioc_querybuf = vidioc_querybuf, | 1581 | .vidioc_querybuf = vidioc_querybuf, |
1569 | .vidioc_qbuf = vidioc_qbuf, | 1582 | .vidioc_qbuf = vidioc_qbuf, |
1570 | .vidioc_dqbuf = vidioc_dqbuf, | 1583 | .vidioc_dqbuf = vidioc_dqbuf, |
1584 | .vidioc_expbuf = vidioc_expbuf, | ||
1571 | .vidioc_streamon = vidioc_streamon, | 1585 | .vidioc_streamon = vidioc_streamon, |
1572 | .vidioc_streamoff = vidioc_streamoff, | 1586 | .vidioc_streamoff = vidioc_streamoff, |
1573 | .vidioc_s_parm = vidioc_s_parm, | 1587 | .vidioc_s_parm = vidioc_s_parm, |