diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2013-01-21 04:51:41 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-02-06 06:33:58 -0500 |
commit | 05c79d0d1d0d44c2195d63d1e7c62e358eadeadf (patch) | |
tree | 80bcfd35aec18bb5c7bbb610219f33bc1e3982c9 /drivers/media | |
parent | f23999eccb5f1b6ec858279670307b5b1abe887a (diff) |
[media] uvcvideo: Implement videobuf2 .wait_prepare and .wait_finish operations
Those optional operations are used to release and reacquire the queue
lock when videobuf2 needs to perform operations that sleep for a long
time, such as waiting for a buffer to be complete. Implement them to
avoid blocking qbuf or streamoff calls when a dqbuf is in progress.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/usb/uvc/uvc_queue.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/media/usb/uvc/uvc_queue.c b/drivers/media/usb/uvc/uvc_queue.c index 778addc5caff..6c233a54ce40 100644 --- a/drivers/media/usb/uvc/uvc_queue.c +++ b/drivers/media/usb/uvc/uvc_queue.c | |||
@@ -115,11 +115,27 @@ static int uvc_buffer_finish(struct vb2_buffer *vb) | |||
115 | return 0; | 115 | return 0; |
116 | } | 116 | } |
117 | 117 | ||
118 | static void uvc_wait_prepare(struct vb2_queue *vq) | ||
119 | { | ||
120 | struct uvc_video_queue *queue = vb2_get_drv_priv(vq); | ||
121 | |||
122 | mutex_unlock(&queue->mutex); | ||
123 | } | ||
124 | |||
125 | static void uvc_wait_finish(struct vb2_queue *vq) | ||
126 | { | ||
127 | struct uvc_video_queue *queue = vb2_get_drv_priv(vq); | ||
128 | |||
129 | mutex_lock(&queue->mutex); | ||
130 | } | ||
131 | |||
118 | static struct vb2_ops uvc_queue_qops = { | 132 | static struct vb2_ops uvc_queue_qops = { |
119 | .queue_setup = uvc_queue_setup, | 133 | .queue_setup = uvc_queue_setup, |
120 | .buf_prepare = uvc_buffer_prepare, | 134 | .buf_prepare = uvc_buffer_prepare, |
121 | .buf_queue = uvc_buffer_queue, | 135 | .buf_queue = uvc_buffer_queue, |
122 | .buf_finish = uvc_buffer_finish, | 136 | .buf_finish = uvc_buffer_finish, |
137 | .wait_prepare = uvc_wait_prepare, | ||
138 | .wait_finish = uvc_wait_finish, | ||
123 | }; | 139 | }; |
124 | 140 | ||
125 | int uvc_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type, | 141 | int uvc_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type, |