29 Dec, 2010

1 commit


21 Oct, 2010

3 commits

  • videobuf_waiton() must unlock and relock ext_lock if it has to wait.
    For that to happen it needs the videobuf_queue pointer.

    Don't attempt to unlock/relock q->ext_lock unless it was locked in the
    first place.

    vb->state has to be protected by a spinlock to be safe.

    This patch is based on code from Mauro Carvalho Chehab .

    [mchehab@redhat.com: add extra argument to a few missing places]
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     
  • Add an ext_lock argument to the videobuf init functions. This allows
    drivers to pass the vdev->lock pointer (or any other externally held lock)
    to videobuf. For now all drivers just pass NULL.

    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     
  • Currently videobuf uses the vb_lock mutex to lock its data structures.
    But this locking will (optionally) move into the v4l2 core, which means
    that in that case vb_lock shouldn't be used since the external lock is already
    held.

    Prepare for this by adding a pointer to such an external mutex and
    don't lock if that pointer is set.

    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Hans Verkuil
     

03 Aug, 2010

2 commits


19 May, 2010

8 commits


18 May, 2010

1 commit


06 Dec, 2009

1 commit


30 Mar, 2009

1 commit


21 May, 2008

1 commit

  • vidiocgmbuf() does this:
    mutex_lock(&fh->cap.vb_lock);
    retval = videobuf_mmap_setup(&fh->cap, gbuffers, gbufsize,
    V4L2_MEMORY_MMAP);

    and videobuf_mmap_setup() then just does
    mutex_lock(&q->vb_lock);
    ret = __videobuf_mmap_setup(q, bcount, bsize, memory);
    mutex_unlock(&q->vb_lock);

    which is an obvious double-take deadlock.

    This patch fixes this by having vidiocgmbuf() just call the
    __videobuf_mmap_setup function instead.

    Acked-by: Mauro Carvalho Chehab
    Reported-by: Koos Vriezen
    Signed-off-by: Arjan van de Ven
    Signed-off-by: Linus Torvalds

    Arjan van de Ven
     

25 Apr, 2008

3 commits

  • videobuf-dvb were still using a function that were videobuf-dma-sg
    dependent. This patch creates a generic handler for this function. This
    way, videobuf-dvb can now work with all videobuf implementations.

    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     
  • 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
    CC: Trent Piepho
    CC: Carl Karsten
    CC: Jonathan Corbet
    Signed-off-by: Mauro Carvalho Chehab

    Brandon Philips
     
  • Make the dev member of the struct videobuf_queue of type "struct device *"
    to avoid future problems. Also change the prototype of the
    videobuf_queue_core_init() function.

    Signed-off-by: Guennadi Liakhovetski
    Signed-off-by: Mauro Carvalho Chehab

    Guennadi Liakhovetski
     

18 Feb, 2008

1 commit


26 Jan, 2008

3 commits


12 Dec, 2007

1 commit

  • - Add comments to functions that require that caller hold q->lock
    - Add __videobuf_mmap_free that doesn't hold q->lock for use within videobuf
    - Add locking to videobuf_mmap_free
    - Fix linux/drivers/media/common/saa7146_video.c which was holding lock around
    videobuf_read_stop
    - Add locking to functions that operate on a queue
    - Add videobuf_stop to take care of stopping in both the read and stream case

    TODO: bttv still has an unsafe call to videobuf_queue_is_busy

    Signed-off-by: Brandon Philips
    Signed-off-by: Mauro Carvalho Chehab

    Brandon Philips
     

14 Oct, 2007

1 commit


10 Oct, 2007

4 commits

  • In the past, videobuf_queue_init were used to initialize PCI DMA videobuffers.
    This patch renames it, to avoid confusion with the previous kernel API, doing:
    s/videobuf_queue_init/void videobuf_queue_core_init/

    Also, the operations is now part of the function parameter. The function will
    also add a test if this is defined, otherwise producing BUG.

    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     
  • Before the videobuf redesign, a procedure for re-using videobuf without PCI
    scatter/gather where provided by changing the pci-dependent operations by
    other operations.

    With the newer approach, those methods are obsolete and can safelly be removed.

    Signed-off-by: Mauro Carvalho Chehab

    Mauro Carvalho Chehab
     
  • Signed-off-by: Mauro Carvalho Chehab
    http://thread.gmane.org/gmane.comp.video.video4linux/34978/focus=34981
    Reviewed-by: Ricardo Cerqueira

    Mauro Carvalho Chehab
     
  • video-buf currently does two different tasks:

    - Manages video buffers with a common code that allows
    implementing all the V4L2 different modes of buffering;

    - Controls memory allocations

    While the first task is generic, the second were written to support PCI DMA
    Scatter/Gather needs. The original approach can't even work for those
    video capture hardware that don't support scatter/gather.

    I did one approach to make it more generic. While the approach worked
    fine for vivi driver, it were not generic enough to handle USB needs.

    This patch creates two different modules, one containing the generic
    video buffer handling (videobuf-core) and another with PCI DMA S/G.
    After this patch, it would be simpler to write an USB video-buf and a
    non-SG DMA module.

    Signed-off-by: Mauro Carvalho Chehab
    http://thread.gmane.org/gmane.comp.video.video4linux/34978/focus=34981
    Reviewed-by: Ricardo Cerqueira

    Mauro Carvalho Chehab