All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC/PATCH 0/2] Convert uvcvideo to videobuf2
@ 2011-02-27 18:12 Laurent Pinchart
  2011-02-27 18:12 ` [RFC/PATCH 1/2] v4l: videobuf2: Handle buf_queue errors Laurent Pinchart
  2011-02-27 18:12 ` [RFC/PATCH 2/2] uvcvideo: Use videobuf2 Laurent Pinchart
  0 siblings, 2 replies; 15+ messages in thread
From: Laurent Pinchart @ 2011-02-27 18:12 UTC (permalink / raw)
  To: linux-media; +Cc: pawel, m.szyprowski, hverkuil

Hi everybody,

Those two RFC patches convert the uvcvideo driver to videobuf2.

The transition was pretty smooth, except for an issue with videobuf2 and
hot-pluggable devices. When a hot-pluggable device is disconnected, all pending
video buffers must be marked as erroneous and waiters must be woken up. Drivers
(and/or videobuf2) must then not allow new buffers to be queued, otherwise
applications would wait forever on VIDIOC_DQBUF (side note: maybe it's time for
V4L2 to explictly state what should happen in that case, and what error codes
must be returned).

This isn't a big issue in itself, except that handling the disconnection event
in QBUF introduces a race condition. Fixing it can only be done with the help
of a spinlock which must be held across the disconnection check and the
list_add_tail call in buf_queue. Unfortunately, buf_queue returns void, which
prevents checking for the disconnection event there.

There are multiple ways to solve this problem. the one I've implemented in this
RFC modifies buf_queue to return an error code, and lets drivers implement
buffers queue cancellation on disconnect. As this could be a tricky problem, a
better solution might be to move disconnection handling inside videobuf2. The
downside is that a new spinlock will be needed in videobuf2.

Yet another solution would be to let QBUF succeed, but marking the buffer as
erroneous and waking up userspace immediately. I don't like this though, as the
error flag on buffers is meant to indicate transcient errors, and device
disconnection is more on the fatal error side :-)

Laurent Pinchart (2):
  v4l: videobuf2: Handle buf_queue errors
  uvcvideo: Use videobuf2

 drivers/media/video/uvc/Kconfig      |    1 +
 drivers/media/video/uvc/uvc_isight.c |   10 +-
 drivers/media/video/uvc/uvc_queue.c  |  494 ++++++++++------------------------
 drivers/media/video/uvc/uvc_v4l2.c   |   19 +--
 drivers/media/video/uvc/uvc_video.c  |   30 +-
 drivers/media/video/videobuf2-core.c |   32 ++-
 drivers/usb/gadget/uvc.h             |    2 +-
 include/linux/uvcvideo.h             |   37 ++--
 include/media/videobuf2-core.h       |    2 +-
 9 files changed, 203 insertions(+), 424 deletions(-)

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2011-04-08 21:08 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-27 18:12 [RFC/PATCH 0/2] Convert uvcvideo to videobuf2 Laurent Pinchart
2011-02-27 18:12 ` [RFC/PATCH 1/2] v4l: videobuf2: Handle buf_queue errors Laurent Pinchart
2011-02-28 10:25   ` Marek Szyprowski
2011-02-28 15:44   ` Pawel Osciak
2011-03-01 10:54     ` Laurent Pinchart
2011-03-06 23:20       ` Pawel Osciak
2011-03-07  1:52         ` Andy Walls
2011-03-08 10:09         ` Laurent Pinchart
2011-04-06 20:05         ` Sylwester Nawrocki
2011-04-06 22:04           ` Sylwester Nawrocki
2011-04-08 12:53             ` Laurent Pinchart
2011-04-08 13:09               ` Marek Szyprowski
2011-04-08 14:32                 ` Laurent Pinchart
2011-04-08 21:08               ` Sylwester Nawrocki
2011-02-27 18:12 ` [RFC/PATCH 2/2] uvcvideo: Use videobuf2 Laurent Pinchart

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.