]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commit
V4L/DVB (7493): videobuf: Avoid deadlock with QBUF and bring up to spec for empty...
authorBrandon Philips <brandon@ifup.org>
Wed, 2 Apr 2008 21:10:59 +0000 (18:10 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Thu, 24 Apr 2008 17:07:57 +0000 (14:07 -0300)
commit137d1cb19d9da163ce6cb57a6fa1e6a3468af6a4
tree197f2548c82390d9c0a730c26d548752fdca12ad
parent78718e5d44cd450431d5b16ee36d3a7de1db6dfa
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>
drivers/media/video/videobuf-core.c
include/media/videobuf-core.h