summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorBrandon Philips <brandon@ifup.org>2008-04-02 18:10:59 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-04-24 14:07:57 -0300
commit137d1cb19d9da163ce6cb57a6fa1e6a3468af6a4 (patch)
tree197f2548c82390d9c0a730c26d548752fdca12ad /include
parent78718e5d44cd450431d5b16ee36d3a7de1db6dfa (diff)
downloadlinux-3.10-137d1cb19d9da163ce6cb57a6fa1e6a3468af6a4.tar.gz
linux-3.10-137d1cb19d9da163ce6cb57a6fa1e6a3468af6a4.tar.bz2
linux-3.10-137d1cb19d9da163ce6cb57a6fa1e6a3468af6a4.zip
V4L/DVB (7493): 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 Signed-off-by: Brandon Philips <bphilips@suse.de> CC: Trent Piepho <xyzzy@speakeasy.org> CC: Carl Karsten <carl@personnelware.com> CC: Jonathan Corbet <corbet@lwn.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'include')
-rw-r--r--include/media/videobuf-core.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/media/videobuf-core.h b/include/media/videobuf-core.h
index fcdffdd6330..377a6c6e931 100644
--- a/include/media/videobuf-core.h
+++ b/include/media/videobuf-core.h
@@ -153,6 +153,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;