1. 22 7月, 2014 1 次提交
    • H
      [media] vb2: fix bytesused == 0 handling · 8a75ffb8
      Hans Verkuil 提交于
      The original report from Nikhil was that if data_offset > 0 and bytesused == 0,
      then the check in __verify_length() would fail, even though the spec says that
      if bytes_used == 0, then it will be replaced by the actual length of the
      buffer.
      
      After digging into it a bit more I realized that there were several other
      things wrong:
      
      - in __verify_length() it would use the application-provided length value
        for USERPTR and the vb2 core length for other memory models, but it
        should have used the application-provided length as well for DMABUF.
      
      - in __fill_vb2_buffer() on the other hand it would replace bytesused == 0
        by the application-provided length, even for MMAP buffers where the
        length is determined by the vb2 core.
      
      - in __fill_vb2_buffer() it tries to figure out if all the planes have
        bytesused == 0 before it will decide to replace bytesused by length.
        However, the spec makes no such provision, and it makes for convoluted
        code. So just replace any bytesused == 0 by the proper length.
        The idea behind this was that you could use bytesused to signal empty
        planes, something that is currently not supported. But that is better
        done in the future by using one of the reserved fields in strucy v4l2_plane.
      
      This patch fixes all these issues.
      
      Regards,
      
      	Hans
      Signed-off-by: NHans Verkuil <hans.verkuil@cisco.com>
      Reported-by: NNikhil Devshatwar <nikhil.nd@ti.com>
      Cc: Nikhil Devshatwar <nikhil.nd@ti.com>
      Acked-by: NMarek Szyprowski <m.szyprowski@samsung.com>
      Signed-off-by: NMauro Carvalho Chehab <m.chehab@samsung.com>
      8a75ffb8
  2. 18 7月, 2014 1 次提交
    • L
      [media] v4l: vb2: Add fatal error condition flag · 4bb7267d
      Laurent Pinchart 提交于
      When a fatal error occurs that render the device unusable, the only
      options for a driver to signal the error condition to userspace is to
      set the V4L2_BUF_FLAG_ERROR flag when dequeuing buffers and to return an
      error from the buffer prepare handler when queuing buffers.
      
      The buffer error flag indicates a transient error and can't be used by
      applications to detect fatal errors. Returning an error from vb2_qbuf()
      is thus the only real indication that a fatal error occurred. However,
      this is difficult to handle for multithreaded applications that requeue
      buffers from a thread other than the control thread. In particular the
      poll() call in the control thread will not notify userspace of the
      error.
      
      This patch adds an explicit mechanism to report fatal errors to
      userspace. Drivers can call the vb2_queue_error() function to signal a
      fatal error. From this moment on, buffer preparation will return -EIO to
      userspace, and vb2_poll() will set the POLLERR flag and return
      immediately. The error flag is cleared when cancelling the queue, either
      at stream off time (through vb2_streamoff) or when releasing the queue
      with vb2_queue_release().
      Signed-off-by: NLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Acked-by: NHans Verkuil <hans.verkuil@cisco.com>
      Signed-off-by: NMauro Carvalho Chehab <m.chehab@samsung.com>
      4bb7267d
  3. 17 7月, 2014 2 次提交
  4. 25 5月, 2014 2 次提交
  5. 24 5月, 2014 2 次提交
  6. 23 4月, 2014 2 次提交
    • H
      [media] vb2: fix compiler warning · ce9c2244
      Hans Verkuil 提交于
      When compiling this for older kernels using the compatibility build
      the compiler complains about uninitialized variables:
      
      In file included from include/linux/kernel.h:20:0,
                       from include/linux/cache.h:4,
                       from include/linux/time.h:7,
                       from include/linux/input.h:13,
                       from /home/hans/work/build/media_build/v4l/compat.h:9,
                       from <command-line>:0:
      /home/hans/work/build/media_build/v4l/videobuf2-core.c: In function 'vb2_mmap':
      include/linux/dynamic_debug.h:60:9: warning: 'plane' may be used uninitialized in this function [-Wmaybe-uninitialized]
         printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__);  \
               ^
      /home/hans/work/build/media_build/v4l/videobuf2-core.c:2381:23: note: 'plane' was declared here
        unsigned int buffer, plane;
                             ^
      In file included from include/linux/kernel.h:20:0,
                       from include/linux/cache.h:4,
                       from include/linux/time.h:7,
                       from include/linux/input.h:13,
                       from /home/hans/work/build/media_build/v4l/compat.h:9,
                       from <command-line>:0:
      include/linux/dynamic_debug.h:60:9: warning: 'buffer' may be used uninitialized in this function [-Wmaybe-uninitialized]
         printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__);  \
               ^
      /home/hans/work/build/media_build/v4l/videobuf2-core.c:2381:15: note: 'buffer' was declared here
        unsigned int buffer, plane;
                     ^
      
      While these warnings are bogus (the call to __find_plane_by_offset will
      set buffer and plane), it doesn't hurt to initialize these variables.
      Signed-off-by: NHans Verkuil <hans.verkuil@cisco.com>
      Signed-off-by: NMauro Carvalho Chehab <m.chehab@samsung.com>
      ce9c2244
    • H
      [media] vb2: stop_streaming should return void · e37559b2
      Hans Verkuil 提交于
      The vb2 core ignores any return code from the stop_streaming op.
      And there really isn't anything it can do anyway in case of an error.
      So change the return type to void and update any drivers that implement it.
      
      The int return gave drivers the idea that this operation could actually
      fail, but that's really not the case.
      
      The pwc amd sdr-msi3101 drivers both had this construction:
      
              if (mutex_lock_interruptible(&s->v4l2_lock))
                      return -ERESTARTSYS;
      
      This has been updated to just call mutex_lock(). The stop_streaming op
      expects this to really stop streaming and I very much doubt this will
      work reliably if stop_streaming just returns without really stopping the
      DMA.
      Signed-off-by: NHans Verkuil <hans.verkuil@cisco.com>
      Acked-by: NPawel Osciak <pawel@osciak.com>
      Acked-by: NSakari Ailus <sakari.ailus@linux.intel.com>
      Signed-off-by: NMauro Carvalho Chehab <m.chehab@samsung.com>
      e37559b2
  7. 17 4月, 2014 12 次提交
  8. 11 3月, 2014 14 次提交
  9. 06 3月, 2014 4 次提交