15 #include <linux/kernel.h>
17 #include <linux/list.h>
18 #include <linux/module.h>
20 #include <linux/videodev2.h>
22 #include <linux/wait.h>
44 unsigned int *nbuffers,
unsigned int *nplanes,
45 unsigned int sizes[],
void *alloc_ctxs[])
56 sizes[0] = stream->
ctrl.dwMaxVideoFrameSize;
61 static int uvc_buffer_prepare(
struct vb2_buffer *vb)
67 vb2_get_plane_payload(vb, 0) > vb2_plane_size(vb, 0)) {
78 buf->
length = vb2_plane_size(vb, 0);
82 buf->
bytesused = vb2_get_plane_payload(vb, 0);
87 static void uvc_buffer_queue(
struct vb2_buffer *vb)
104 spin_unlock_irqrestore(&queue->
irqlock, flags);
107 static int uvc_buffer_finish(
struct vb2_buffer *vb)
118 static struct vb2_ops uvc_queue_qops = {
119 .queue_setup = uvc_queue_setup,
120 .buf_prepare = uvc_buffer_prepare,
121 .buf_queue = uvc_buffer_queue,
122 .buf_finish = uvc_buffer_finish,
132 queue->
queue.drv_priv = queue;
134 queue->
queue.ops = &uvc_queue_qops;
161 return ret ? ret : rb->
count;
253 allocated = vb2_is_busy(&queue->
queue);
294 spin_unlock_irqrestore(&queue->
irqlock, flags);
320 while (!list_empty(&queue->
irqqueue)) {
335 spin_unlock_irqrestore(&queue->
irqlock, flags);
348 vb2_set_plane_payload(&buf->
buf, 0, 0);
359 spin_unlock_irqrestore(&queue->
irqlock, flags);