Skip to content

Commit b377c2b

Browse files
committed
[media] vb2: fix a regression in poll() behavior for output,streams
[ Upstream commit 4623e59 ] In the 3.17 kernel the poll() behavior changed for output streams: as long as not all buffers were queued up poll() would return that userspace can write. This is fine for the write() call, but when using stream I/O this changed the behavior since the expectation was that it would wait for buffers to become available for dequeuing. This patch only enables the check whether you can queue buffers for file I/O only, and skips it for stream I/O. Signed-off-by: Hans Verkuil <[email protected]> Acked-by: Laurent Pinchart <[email protected]> Cc: <[email protected]> # for v3.17 and up Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 3c0a63d commit b377c2b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/media/v4l2-core/videobuf2-core.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2662,10 +2662,10 @@ unsigned int vb2_poll(struct vb2_queue *q, struct file *file, poll_table *wait)
26622662
return res | POLLERR;
26632663

26642664
/*
2665-
* For output streams you can write as long as there are fewer buffers
2666-
* queued than there are buffers available.
2665+
* For output streams you can call write() as long as there are fewer
2666+
* buffers queued than there are buffers available.
26672667
*/
2668-
if (V4L2_TYPE_IS_OUTPUT(q->type) && q->queued_count < q->num_buffers)
2668+
if (V4L2_TYPE_IS_OUTPUT(q->type) && q->fileio && q->queued_count < q->num_buffers)
26692669
return res | POLLOUT | POLLWRNORM;
26702670

26712671
if (list_empty(&q->done_list))

0 commit comments

Comments
 (0)