aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorTomasz Stanislawski <t.stanislaws@samsung.com>2012-06-14 10:32:23 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-11-25 14:20:47 -0500
commitb799d09a157da71566e8013a62073435550cab6d (patch)
tree54222407a12429a93ca5c2bff69c7b96bea493f0 /drivers/media
parentc60520fa50cd86d64bc8ebb34300ddc4ca91393d (diff)
[media] v4l: add buffer exporting via dmabuf
This patch adds extension to V4L2 api. A new ioctl VIDIOC_EXPBUF is added. The ioctl is used to export an mmap buffer as a DMABUF file descriptor. 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/v4l2-core/v4l2-compat-ioctl32.c1
-rw-r--r--drivers/media/v4l2-core/v4l2-dev.c1
-rw-r--r--drivers/media/v4l2-core/v4l2-ioctl.c10
3 files changed, 12 insertions, 0 deletions
diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
index cc5998b31463..7157af301b14 100644
--- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
+++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
@@ -1018,6 +1018,7 @@ long v4l2_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
1018 case VIDIOC_S_FBUF32: 1018 case VIDIOC_S_FBUF32:
1019 case VIDIOC_OVERLAY32: 1019 case VIDIOC_OVERLAY32:
1020 case VIDIOC_QBUF32: 1020 case VIDIOC_QBUF32:
1021 case VIDIOC_EXPBUF:
1021 case VIDIOC_DQBUF32: 1022 case VIDIOC_DQBUF32:
1022 case VIDIOC_STREAMON32: 1023 case VIDIOC_STREAMON32:
1023 case VIDIOC_STREAMOFF32: 1024 case VIDIOC_STREAMOFF32:
diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c
index a2df842e5100..98dcad9c8a3b 100644
--- a/drivers/media/v4l2-core/v4l2-dev.c
+++ b/drivers/media/v4l2-core/v4l2-dev.c
@@ -571,6 +571,7 @@ static void determine_valid_ioctls(struct video_device *vdev)
571 SET_VALID_IOCTL(ops, VIDIOC_REQBUFS, vidioc_reqbufs); 571 SET_VALID_IOCTL(ops, VIDIOC_REQBUFS, vidioc_reqbufs);
572 SET_VALID_IOCTL(ops, VIDIOC_QUERYBUF, vidioc_querybuf); 572 SET_VALID_IOCTL(ops, VIDIOC_QUERYBUF, vidioc_querybuf);
573 SET_VALID_IOCTL(ops, VIDIOC_QBUF, vidioc_qbuf); 573 SET_VALID_IOCTL(ops, VIDIOC_QBUF, vidioc_qbuf);
574 SET_VALID_IOCTL(ops, VIDIOC_EXPBUF, vidioc_expbuf);
574 SET_VALID_IOCTL(ops, VIDIOC_DQBUF, vidioc_dqbuf); 575 SET_VALID_IOCTL(ops, VIDIOC_DQBUF, vidioc_dqbuf);
575 SET_VALID_IOCTL(ops, VIDIOC_STREAMON, vidioc_streamon); 576 SET_VALID_IOCTL(ops, VIDIOC_STREAMON, vidioc_streamon);
576 SET_VALID_IOCTL(ops, VIDIOC_STREAMOFF, vidioc_streamoff); 577 SET_VALID_IOCTL(ops, VIDIOC_STREAMOFF, vidioc_streamoff);
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
index 530a67e3fe0e..aa6e7c788db2 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -454,6 +454,15 @@ static void v4l_print_buffer(const void *arg, bool write_only)
454 tc->type, tc->flags, tc->frames, *(__u32 *)tc->userbits); 454 tc->type, tc->flags, tc->frames, *(__u32 *)tc->userbits);
455} 455}
456 456
457static void v4l_print_exportbuffer(const void *arg, bool write_only)
458{
459 const struct v4l2_exportbuffer *p = arg;
460
461 pr_cont("fd=%d, type=%s, index=%u, plane=%u, flags=0x%08x\n",
462 p->fd, prt_names(p->type, v4l2_type_names),
463 p->index, p->plane, p->flags);
464}
465
457static void v4l_print_create_buffers(const void *arg, bool write_only) 466static void v4l_print_create_buffers(const void *arg, bool write_only)
458{ 467{
459 const struct v4l2_create_buffers *p = arg; 468 const struct v4l2_create_buffers *p = arg;
@@ -1961,6 +1970,7 @@ static struct v4l2_ioctl_info v4l2_ioctls[] = {
1961 IOCTL_INFO_STD(VIDIOC_S_FBUF, vidioc_s_fbuf, v4l_print_framebuffer, INFO_FL_PRIO), 1970 IOCTL_INFO_STD(VIDIOC_S_FBUF, vidioc_s_fbuf, v4l_print_framebuffer, INFO_FL_PRIO),
1962 IOCTL_INFO_FNC(VIDIOC_OVERLAY, v4l_overlay, v4l_print_u32, INFO_FL_PRIO), 1971 IOCTL_INFO_FNC(VIDIOC_OVERLAY, v4l_overlay, v4l_print_u32, INFO_FL_PRIO),
1963 IOCTL_INFO_FNC(VIDIOC_QBUF, v4l_qbuf, v4l_print_buffer, INFO_FL_QUEUE), 1972 IOCTL_INFO_FNC(VIDIOC_QBUF, v4l_qbuf, v4l_print_buffer, INFO_FL_QUEUE),
1973 IOCTL_INFO_STD(VIDIOC_EXPBUF, vidioc_expbuf, v4l_print_exportbuffer, INFO_FL_QUEUE | INFO_FL_CLEAR(v4l2_exportbuffer, flags)),
1964 IOCTL_INFO_FNC(VIDIOC_DQBUF, v4l_dqbuf, v4l_print_buffer, INFO_FL_QUEUE), 1974 IOCTL_INFO_FNC(VIDIOC_DQBUF, v4l_dqbuf, v4l_print_buffer, INFO_FL_QUEUE),
1965 IOCTL_INFO_FNC(VIDIOC_STREAMON, v4l_streamon, v4l_print_buftype, INFO_FL_PRIO | INFO_FL_QUEUE), 1975 IOCTL_INFO_FNC(VIDIOC_STREAMON, v4l_streamon, v4l_print_buftype, INFO_FL_PRIO | INFO_FL_QUEUE),
1966 IOCTL_INFO_FNC(VIDIOC_STREAMOFF, v4l_streamoff, v4l_print_buftype, INFO_FL_PRIO | INFO_FL_QUEUE), 1976 IOCTL_INFO_FNC(VIDIOC_STREAMOFF, v4l_streamoff, v4l_print_buftype, INFO_FL_PRIO | INFO_FL_QUEUE),