mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-16 14:30:06 -04:00
[media] videobuf2: return -EPIPE from DQBUF after the last buffer
If the last buffer was dequeued from a capture queue, let poll return immediately and let DQBUF return -EPIPE to signal there will no more buffers to dequeue until STREAMOFF. The driver signals the last buffer by setting the V4L2_BUF_FLAG_LAST. To reenable dequeuing on the capture queue, the driver must explicitly call vb2_clear_last_buffer_queued. The last buffer queued flag is cleared automatically during STREAMOFF. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Kamil Debski <k.debski@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
This commit is contained in:
committed by
Mauro Carvalho Chehab
parent
dc19924162
commit
c16218402a
@@ -381,6 +381,9 @@ struct v4l2_fh;
|
||||
* @waiting_for_buffers: used in poll() to check if vb2 is still waiting for
|
||||
* buffers. Only set for capture queues if qbuf has not yet been
|
||||
* called since poll() needs to return POLLERR in that situation.
|
||||
* @last_buffer_dequeued: used in poll() and DQBUF to immediately return if the
|
||||
* last decoded buffer was already dequeued. Set for capture queues
|
||||
* when a buffer with the V4L2_BUF_FLAG_LAST is dequeued.
|
||||
* @fileio: file io emulator internal data, used only if emulator is active
|
||||
* @threadio: thread io internal data, used only if thread is active
|
||||
*/
|
||||
@@ -423,6 +426,7 @@ struct vb2_queue {
|
||||
unsigned int start_streaming_called:1;
|
||||
unsigned int error:1;
|
||||
unsigned int waiting_for_buffers:1;
|
||||
unsigned int last_buffer_dequeued:1;
|
||||
|
||||
struct vb2_fileio_data *fileio;
|
||||
struct vb2_threadio_data *threadio;
|
||||
@@ -603,6 +607,15 @@ static inline bool vb2_start_streaming_called(struct vb2_queue *q)
|
||||
return q->start_streaming_called;
|
||||
}
|
||||
|
||||
/**
|
||||
* vb2_clear_last_buffer_dequeued() - clear last buffer dequeued flag of queue
|
||||
* @q: videobuf queue
|
||||
*/
|
||||
static inline void vb2_clear_last_buffer_dequeued(struct vb2_queue *q)
|
||||
{
|
||||
q->last_buffer_dequeued = false;
|
||||
}
|
||||
|
||||
/*
|
||||
* The following functions are not part of the vb2 core API, but are simple
|
||||
* helper functions that you can use in your struct v4l2_file_operations,
|
||||
|
||||
Reference in New Issue
Block a user