Commit 6e9179e2 authored by Philipp Zabel's avatar Philipp Zabel Committed by Mauro Carvalho Chehab

[media] uvcvideo: Enable VIDIOC_CREATE_BUFS

This patch enables the ioctl to create additional buffers on the
videobuf2 capture queue.

[laurent.pinchart@ideasonboard.com: Acquire privileges instead of just
checking them in VIDIOC_CREATE_BUFS implementation]
Signed-off-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent bddb9d0e
...@@ -198,6 +198,18 @@ int uvc_query_buffer(struct uvc_video_queue *queue, struct v4l2_buffer *buf) ...@@ -198,6 +198,18 @@ int uvc_query_buffer(struct uvc_video_queue *queue, struct v4l2_buffer *buf)
return ret; return ret;
} }
int uvc_create_buffers(struct uvc_video_queue *queue,
struct v4l2_create_buffers *cb)
{
int ret;
mutex_lock(&queue->mutex);
ret = vb2_create_bufs(&queue->queue, cb);
mutex_unlock(&queue->mutex);
return ret;
}
int uvc_queue_buffer(struct uvc_video_queue *queue, struct v4l2_buffer *buf) int uvc_queue_buffer(struct uvc_video_queue *queue, struct v4l2_buffer *buf)
{ {
int ret; int ret;
......
...@@ -1000,6 +1000,17 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) ...@@ -1000,6 +1000,17 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
return uvc_query_buffer(&stream->queue, buf); return uvc_query_buffer(&stream->queue, buf);
} }
case VIDIOC_CREATE_BUFS:
{
struct v4l2_create_buffers *cb = arg;
ret = uvc_acquire_privileges(handle);
if (ret < 0)
return ret;
return uvc_create_buffers(&stream->queue, cb);
}
case VIDIOC_QBUF: case VIDIOC_QBUF:
if (!uvc_has_privileges(handle)) if (!uvc_has_privileges(handle))
return -EBUSY; return -EBUSY;
......
...@@ -614,6 +614,8 @@ extern int uvc_alloc_buffers(struct uvc_video_queue *queue, ...@@ -614,6 +614,8 @@ extern int uvc_alloc_buffers(struct uvc_video_queue *queue,
extern void uvc_free_buffers(struct uvc_video_queue *queue); extern void uvc_free_buffers(struct uvc_video_queue *queue);
extern int uvc_query_buffer(struct uvc_video_queue *queue, extern int uvc_query_buffer(struct uvc_video_queue *queue,
struct v4l2_buffer *v4l2_buf); struct v4l2_buffer *v4l2_buf);
extern int uvc_create_buffers(struct uvc_video_queue *queue,
struct v4l2_create_buffers *v4l2_cb);
extern int uvc_queue_buffer(struct uvc_video_queue *queue, extern int uvc_queue_buffer(struct uvc_video_queue *queue,
struct v4l2_buffer *v4l2_buf); struct v4l2_buffer *v4l2_buf);
extern int uvc_dequeue_buffer(struct uvc_video_queue *queue, extern int uvc_dequeue_buffer(struct uvc_video_queue *queue,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment