]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[media] vb2: fix vb2_poll for output streams
authorHans Verkuil <hverkuil@xs4all.nl>
Thu, 24 Jul 2014 12:19:37 +0000 (09:19 -0300)
committerMauro Carvalho Chehab <m.chehab@samsung.com>
Fri, 25 Jul 2014 22:20:04 +0000 (19:20 -0300)
vb2_poll should always return POLLOUT | POLLWRNORM as long as there
are fewer buffers queued than there are buffers available. Poll for
an output stream should only wait if all buffers are queued and nobody
is dequeuing them.

Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
drivers/media/v4l2-core/videobuf2-core.c

index f33508f854a4cf3a19c4e12365fe690bb2bad2a6..c359006074a8ccafeb3a7c4150873f1c13b0d2b9 100644 (file)
@@ -2596,6 +2596,13 @@ unsigned int vb2_poll(struct vb2_queue *q, struct file *file, poll_table *wait)
        if ((list_empty(&q->queued_list) && !vb2_is_streaming(q)) || q->error)
                return res | POLLERR;
 
+       /*
+        * For output streams you can write as long as there are fewer buffers
+        * queued than there are buffers available.
+        */
+       if (V4L2_TYPE_IS_OUTPUT(q->type) && q->queued_count < q->num_buffers)
+               return res | POLLOUT | POLLWRNORM;
+
        if (list_empty(&q->done_list))
                poll_wait(file, &q->done_wq, wait);