summaryrefslogtreecommitdiffstats
path: root/drivers/media/v4l2-core
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2014-07-24 09:19:37 -0300
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-07-25 19:20:04 -0300
commit1612f20ea025f55741b2d6e8b9c91047a7324a76 (patch)
treee63809b5b71c44fcf2d8df9ec48c9ae715078145 /drivers/media/v4l2-core
parentccf58cb4eac050ebe777cfcb209bc53d58f5fd79 (diff)
downloadblackbird-op-linux-1612f20ea025f55741b2d6e8b9c91047a7324a76.tar.gz
blackbird-op-linux-1612f20ea025f55741b2d6e8b9c91047a7324a76.zip
[media] vb2: fix vb2_poll for output streams
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>
Diffstat (limited to 'drivers/media/v4l2-core')
-rw-r--r--drivers/media/v4l2-core/videobuf2-core.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c
index f33508f854a4..c359006074a8 100644
--- a/drivers/media/v4l2-core/videobuf2-core.c
+++ b/drivers/media/v4l2-core/videobuf2-core.c
@@ -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);
OpenPOWER on IntegriCloud