History log of /drivers/media/video/uvc/uvc_queue.c
Revision Date Author Comments
ab86e9e03d322396907dc8eb9215b136c728773e 02-Jan-2012 Javier Martin <javier.martin@vista-silicon.com> [media] uvcvideo: Allow userptr IO mode

Userptr can be very useful if a UVC camera is requested to use video
buffers allocated by another processing device. So that buffers don't
need to be copied.

Signed-off-by: Javier Martin <javier.martin@vista-silicon.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
66847ef013cc4ed3ae519360e7e4cbf531465ae8 24-Sep-2011 Laurent Pinchart <laurent.pinchart@ideasonboard.com> [media] uvcvideo: Add UVC timestamps support

UVC devices transmit a device timestamp along with video frames. Convert
the timestamp to a host timestamp and use it to fill the V4L2 buffer
timestamp field.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
6998b6fb4b1c8f320adeee938d399c4d8dcc90e2 24-Oct-2011 Laurent Pinchart <laurent.pinchart@ideasonboard.com> [media] uvcvideo: Use videobuf2-vmalloc

Replace the current video buffers queue implementation with
videobuf2-vmalloc.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
3d95e932573c316ad56b8e2f283e26de0b9c891c 24-Oct-2011 Laurent Pinchart <laurent.pinchart@ideasonboard.com> [media] uvcvideo: Move fields from uvc_buffer::buf to uvc_buffer

Add mem, length and bytesused fields to the uvc_buffer structure and use
them instead of accessing the uvc_buffer::buf m.offset, length and
bytesused fields directly. This prepares the driver to the conversion to
videobuf2.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
60063497a95e716c9a689af3be2687d261f115b4 27-Jul-2011 Arun Sharma <asharma@fb.com> atomic: use <linux/atomic.h>

This allows us to move duplicated code in <asm/atomic.h>
(atomic_inc_not_zero() for now) to <linux/atomic.h>

Signed-off-by: Arun Sharma <asharma@fb.com>
Reviewed-by: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: David Miller <davem@davemloft.net>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
8ca2c80b170c47eeb55f0c2a0f2b8edf85f35d49 24-May-2011 Sjoerd Simons <sjoerd.simons@collabora.co.uk> [media] uvcvideo: Remove buffers from the queues when freeing

When freeing memory for the video buffers also remove them from the
irq & main queues.

This fixes an oops when doing the following:

open ("/dev/video", ..)
VIDIOC_REQBUFS
VIDIOC_QBUF
VIDIOC_REQBUFS
close ()

As the second VIDIOC_REQBUFS will cause the list entries of the buffers
to be cleared while they still hang around on the main and irc queues

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: stable@kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
7296944759c41001122fc95110468a1a572352cd 29-Apr-2011 Bob Liu <lliubbo@gmail.com> [media] uvcvideo: Add support for NOMMU arch

Add support to uvc driver for NOMMU arch including add function
uvc_queue_get_unmapped_area() and make some changes in uvc_queue_mmap().
So that uvc camera can be used on nommu arch like blackfin.

Signed-off-by: Bob Liu <lliubbo@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
4aa275975beee41fd542a0f6df8cd0fee06089bf 21-Nov-2010 Laurent Pinchart <laurent.pinchart@ideasonboard.com> [media] uvcvideo: Move mmap() handler to uvc_queue.c

The mmap() implementation belongs to the video buffers queue, move it
there.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
8e815e1763b8d4e5adf0dc14bde8c55329cf95a8 21-Nov-2010 Laurent Pinchart <laurent.pinchart@ideasonboard.com> [media] uvcvideo: Move mutex lock/unlock inside uvc_free_buffers

Callers outside uvc_queue.c should not be forced to lock/unlock the
queue mutex manually. Move the mutex operations inside
uvc_free_buffers().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
650b95feee353305203724cb2e8b2bc50f6d130a 02-Oct-2010 Laurent Pinchart <laurent.pinchart@ideasonboard.com> [media] uvcvideo: Generate discontinuous sequence numbers when frames are lost

Increase the sequence number of the v4l2_buffer structure regardless of
any buffer states, so that discontinuous sequence numbers allow
applications to detect lost video frames.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
11fc5baf1dab2d30f03a391cabc5fd1808cfbe29 20-Sep-2010 Laurent Pinchart <laurent.pinchart@ideasonboard.com> [media] uvcvideo: Update e-mail address and copyright notices

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
9bde9f263e958b0d588aada03854fcc0f0c88b86 17-Jun-2010 Laurent Pinchart <laurent.pinchart@ideasonboard.com> V4L/DVB: uvcvideo: Drop corrupted compressed frames

Corrupted video frames are dropped by default by the driver for
uncompressed formats. Data corruption is not less problematic for
compressed formats, so frame drop should be enabled by default for those
formats as well.

Mark buffers as faulty when an isochronous packet loss is detected for
any format, or when the buffer length doesn't match the image size for
uncompressed formats. Drop erroneous buffers regardless of whether the
format is compressed or uncompressed.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
ed3de6015a920c131fbcc770fb95097fde592d86 31-Mar-2010 Laurent Pinchart <laurent.pinchart@ideasonboard.com> V4L/DVB: uvcvideo: Use POLLOUT and POLLWRNORM for output devices

The V4L2 specification requires drivers to use the write events in the
file operations poll handler for output devices. The uvcvideo driver
erroneously used read events for all devices. Fix this.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
310fe52461e6244b01a04b011c2e886d6b69de16 10-Dec-2009 Laurent Pinchart <laurent.pinchart@ideasonboard.com> V4L/DVB (13827): uvcvideo: Switch to a monotonic clock for V4L2 buffers timestamps

The realtime clock provided by do_gettimeofday() is affected by time
jumps caused by NTP or DST. Furthermore, preliminary investigation
showed that SMP systems the realtime clock is based on the CPU TSC,
and those could get slightly out of sync, resulting in jitter in the
timestamps depending on which processor handles the USB interrupts.

Instead of the realtime clock, use a monotonic high resolution clock to
timestamp the buffer. As this could in theory introduce a regression
with some userspace applications expecting a realtime clock timestamp,
add a module parameter to switch back to the realtime clock.

Thanks to Paulo Assis for pointing out and investigating the issue.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
d7c0d43997cf716617d724554d19b3b8dd465833 17-Dec-2009 Laurent Pinchart <laurent.pinchart@ideasonboard.com> V4L/DVB (13831): uvcvideo: Fix oops caused by a race condition in buffer dequeuing

Buffers were marked as done before being removed from the IRQ queue. If
a userspace application dequeued and requeued the buffer fast enough
during that time window, the buffer could end up being deleted twice,
generating an oops in interrupt context.

Add a new state, UVC_BUF_STATE_READY, to mark buffers as ready for reuse
but not yet removed from the queue, and transition to UVC_BUF_STATE_DONE
only when the buffer is removed from the queue.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
23ff6043add670713bbf2f6ee5d520459cfdfae9 04-Jun-2009 Laurent Pinchart <laurent.pinchart@skynet.be> V4L/DVB (11945): uvcvideo: Don't accept to change the format when buffers are allocated.

Setting a new frame format or size will likely change the buffer size required
to store a complete video frame. To avoid a buffer overflow, don't allow
VIDIOC_S_FMT calls when video buffers are already allocated.

Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2c2d264bb951c1a846b86431d3e784edfb79ab39 03-Jan-2009 Laurent Pinchart <laurent.pinchart@skynet.be> V4L/DVB (10197): uvcvideo: Whitespace and comments cleanup, copyright updates.

Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
16e68d7cb8eb1c671867d2a0ecd4aa2e17124364 07-Jan-2009 Huang Weiyi <weiyi.huang@gmail.com> V4L/DVB (10193): removed unused #include <version.h>'s

Removed unused #include <version.h>'s in files below,
drivers/media/video/cs5345.c
drivers/media/video/pwc/pwc-if.c
drivers/media/video/saa717x.c
drivers/media/video/upd64031a.c
drivers/media/video/upd64083.c
drivers/media/video/uvc/uvc_ctrl.c
drivers/media/video/uvc/uvc_driver.c
drivers/media/video/uvc/uvc_queue.c
drivers/media/video/uvc/uvc_video.c
drivers/media/video/uvc/uvc_status.c

Signed-off-by: Huang Weiyi <weiyi.huang@gmail.com>
Acked-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
ff924203c9e4a5bc218143bc37182851185f4e5f 29-Dec-2008 Laurent Pinchart <laurent.pinchart@skynet.be> V4L/DVB (10104): uvcvideo: Add support for video output devices

Extend the range of supported UVC devices by allowing video output devices
matching the following structure:

TT_STREAMING -> VC_PROCESSING_UNIT -> VC_EXTENSION_UNIT{0,n} -> OTT_*

Video output devices are reported with the V4L2_CAP_VIDEO_OUTPUT capability
flag and are subject to the same restrictions as video input devices.

Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
27ac792ca0b0a1e7e65f20342260650516c95864 24-Jul-2008 Andrea Righi <righi.andrea@gmail.com> PAGE_ALIGN(): correctly handle 64-bit values on 32-bit architectures

On 32-bit architectures PAGE_ALIGN() truncates 64-bit values to the 32-bit
boundary. For example:

u64 val = PAGE_ALIGN(size);

always returns a value < 4GB even if size is greater than 4GB.

The problem resides in PAGE_MASK definition (from include/asm-x86/page.h for
example):

#define PAGE_SHIFT 12
#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
#define PAGE_MASK (~(PAGE_SIZE-1))
...
#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)

The "~" is performed on a 32-bit value, so everything in "and" with
PAGE_MASK greater than 4GB will be truncated to the 32-bit boundary.
Using the ALIGN() macro seems to be the right way, because it uses
typeof(addr) for the mask.

Also move the PAGE_ALIGN() definitions out of include/asm-*/page.h in
include/linux/mm.h.

See also lkml discussion: http://lkml.org/lkml/2008/6/11/237

[akpm@linux-foundation.org: fix drivers/media/video/uvc/uvc_queue.c]
[akpm@linux-foundation.org: fix v850]
[akpm@linux-foundation.org: fix powerpc]
[akpm@linux-foundation.org: fix arm]
[akpm@linux-foundation.org: fix mips]
[akpm@linux-foundation.org: fix drivers/media/video/pvrusb2/pvrusb2-dvb.c]
[akpm@linux-foundation.org: fix drivers/mtd/maps/uclinux.c]
[akpm@linux-foundation.org: fix powerpc]
Signed-off-by: Andrea Righi <righi.andrea@gmail.com>
Cc: <linux-arch@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
f87086e302300fdff1bd32049deb7a7f3e3de7da 18-Jul-2008 Hans Verkuil <hverkuil@xs4all.nl> v4l-dvb: remove legacy checks to allow support for kernels < 2.6.10

Also remove some blank lines that were used to split compat code at -devel
tree.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
c0efd232929c2cd87238de2cccdaf4e845be5b0c 30-Jun-2008 Laurent Pinchart <laurent.pinchart@skynet.be> V4L/DVB (8145a): USB Video Class driver

This driver supports video input devices compliant with the USB Video Class
specification. This means lots of currently manufactured webcams, and probably
most of the future ones.

Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>