summaryrefslogtreecommitdiff
path: root/linux/include/media
diff options
context:
space:
mode:
authorBrandon Philips <brandon@ifup.org>2008-04-02 11:10:59 -0700
committerBrandon Philips <brandon@ifup.org>2008-04-02 11:10:59 -0700
commite385e87fd1da4f48a906ba73fb5dc17f39de479c (patch)
treea1c086f49f733714875d36ebaede5d9aaf7d6de5 /linux/include/media
parentc42776d2207482af2672ee15320059527cbc779d (diff)
downloadmediapointer-dvb-s2-e385e87fd1da4f48a906ba73fb5dc17f39de479c.tar.gz
mediapointer-dvb-s2-e385e87fd1da4f48a906ba73fb5dc17f39de479c.tar.bz2
videobuf: Avoid deadlock with QBUF and bring up to spec for empty queue
Add a waitqueue to wait on when there are no buffers in the buffer queue. DQBUF waits on this queue without holding vb_lock to allow a QBUF to happen. Once a buffer has been queued we recheck that the queue is still streaming and wait on the new buffer's waitqueue while holding the vb_lock. The driver should come along in a timely manner and put the buffer into its next state finishing the DQBUF. By implementing this waitqueue it also brings the videobuf DQBUF up to spec and it now blocks on O_NONBLOCK even when no buffers have been queued via QBUF: "By default VIDIOC_DQBUF blocks when no buffer is in the outgoing queue." - V4L2 spec CC: Trent Piepho <xyzzy@speakeasy.org> CC: Carl Karsten <carl@personnelware.com> CC: Jonathan Corbet <corbet@lwn.net> Signed-off-by: Brandon Philips <bphilips@suse.de> --- linux/drivers/media/video/videobuf-core.c | 96 +++++++++++++++++++++++------- linux/include/media/videobuf-core.h | 2 2 files changed, 78 insertions(+), 20 deletions(-)
Diffstat (limited to 'linux/include/media')
-rw-r--r--linux/include/media/videobuf-core.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/linux/include/media/videobuf-core.h b/linux/include/media/videobuf-core.h
index 7c80e8adf..18b0ba615 100644
--- a/linux/include/media/videobuf-core.h
+++ b/linux/include/media/videobuf-core.h
@@ -159,6 +159,8 @@ struct videobuf_queue {
spinlock_t *irqlock;
struct device *dev;
+ wait_queue_head_t wait; /* wait if queue is empty */
+
enum v4l2_buf_type type;
unsigned int inputs; /* for V4L2_BUF_FLAG_INPUT */
unsigned int msize;