Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] uvcvideo: Implement DMABUF exporter role

Now that videobuf2-vmalloc supports exporting buffers, add support for
the DMABUF exporter role by plugging in the videobuf2 ioctl helper.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

authored by

Laurent Pinchart and committed by
Mauro Carvalho Chehab
7195f61b baf06b51

+27
+12
drivers/media/usb/uvc/uvc_queue.c
··· 270 270 return ret; 271 271 } 272 272 273 + int uvc_export_buffer(struct uvc_video_queue *queue, 274 + struct v4l2_exportbuffer *exp) 275 + { 276 + int ret; 277 + 278 + mutex_lock(&queue->mutex); 279 + ret = vb2_expbuf(&queue->queue, exp); 280 + mutex_unlock(&queue->mutex); 281 + 282 + return ret; 283 + } 284 + 273 285 int uvc_dequeue_buffer(struct uvc_video_queue *queue, struct v4l2_buffer *buf, 274 286 int nonblocking) 275 287 {
+13
drivers/media/usb/uvc/uvc_v4l2.c
··· 723 723 return uvc_queue_buffer(&stream->queue, buf); 724 724 } 725 725 726 + static int uvc_ioctl_expbuf(struct file *file, void *fh, 727 + struct v4l2_exportbuffer *exp) 728 + { 729 + struct uvc_fh *handle = fh; 730 + struct uvc_streaming *stream = handle->stream; 731 + 732 + if (!uvc_has_privileges(handle)) 733 + return -EBUSY; 734 + 735 + return uvc_export_buffer(&stream->queue, exp); 736 + } 737 + 726 738 static int uvc_ioctl_dqbuf(struct file *file, void *fh, struct v4l2_buffer *buf) 727 739 { 728 740 struct uvc_fh *handle = fh; ··· 1490 1478 .vidioc_reqbufs = uvc_ioctl_reqbufs, 1491 1479 .vidioc_querybuf = uvc_ioctl_querybuf, 1492 1480 .vidioc_qbuf = uvc_ioctl_qbuf, 1481 + .vidioc_expbuf = uvc_ioctl_expbuf, 1493 1482 .vidioc_dqbuf = uvc_ioctl_dqbuf, 1494 1483 .vidioc_create_bufs = uvc_ioctl_create_bufs, 1495 1484 .vidioc_streamon = uvc_ioctl_streamon,
+2
drivers/media/usb/uvc/uvcvideo.h
··· 635 635 struct v4l2_create_buffers *v4l2_cb); 636 636 extern int uvc_queue_buffer(struct uvc_video_queue *queue, 637 637 struct v4l2_buffer *v4l2_buf); 638 + extern int uvc_export_buffer(struct uvc_video_queue *queue, 639 + struct v4l2_exportbuffer *exp); 638 640 extern int uvc_dequeue_buffer(struct uvc_video_queue *queue, 639 641 struct v4l2_buffer *v4l2_buf, int nonblocking); 640 642 extern int uvc_queue_streamon(struct uvc_video_queue *queue,