1. 17 4月, 2014 9 次提交
    • H
      [media] vb2: add vb2_fileio_is_active and check it more often · 74753cff
      Hans Verkuil 提交于
      Added a vb2_fileio_is_active inline function that returns true if fileio
      is in progress. Check for this too in mmap() (you don't want apps mmap()ing
      buffers used by fileio) and expbuf() (same reason).
      
      In addition drivers should be able to check for this in queue_setup() to
      return an error if an attempt is made to read() or write() with
      V4L2_FIELD_ALTERNATE being configured. This is illegal (there is no way
      to pass the TOP/BOTTOM information around using file I/O).
      
      However, in order to be able to check for this the init_fileio function
      needs to set q->fileio early on, before the buffers are allocated. So switch
      to using internal functions (__reqbufs, vb2_internal_qbuf and
      vb2_internal_streamon) to skip the fileio check. Well, that's why the internal
      functions were created...
      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>
      74753cff
    • H
      [media] vb2: simplify a confusing condition · 57394b72
      Hans Verkuil 提交于
      q->start_streaming_called is always true, so the WARN_ON check against
      it being false can be dropped.
      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>
      57394b72
    • H
      [media] vb2: reject output buffers with V4L2_FIELD_ALTERNATE · e35e41b5
      Hans Verkuil 提交于
      This is not allowed by the spec and does in fact not make any sense.
      Return -EINVAL if this is the case.
      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>
      e35e41b5
    • H
      [media] vb2: set timestamp when using write() · ebd7c505
      Hans Verkuil 提交于
      When using write() to write data to an output video node the vb2 core
      should set timestamps if V4L2_BUF_FLAG_TIMESTAMP_COPY is set. Nobody
      else is able to provide this information with the write() operation.
      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>
      ebd7c505
    • H
      [media] vb2: move __qbuf_mmap before __qbuf_userptr · dcc2428a
      Hans Verkuil 提交于
      __qbuf_mmap was sort of hidden in between the much larger __qbuf_userptr
      and __qbuf_dmabuf functions. Move it before __qbuf_userptr which is
      also conform the usual order these memory models are implemented: first
      mmap, then userptr, then dmabuf.
      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>
      dcc2428a
    • H
      [media] vb2: use correct prefix · fd4354cf
      Hans Verkuil 提交于
      Many dprintk's in vb2 use a hardcoded prefix with the function name. In
      many cases that is now outdated. To keep things consistent the dprintk
      macro has been changed to print the function name in addition to the "vb2:"
      prefix. Superfluous prefixes elsewhere in the code have been removed.
      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>
      fd4354cf
    • H
      [media] vb2: if bytesused is 0, then fill with output buffer length · 61bd8fb3
      Hans Verkuil 提交于
      The application should really always fill in bytesused for output
      buffers, unfortunately the vb2 framework never checked for that.
      
      So for single planar formats replace a bytesused of 0 by the length
      of the buffer, and for multiplanar format do the same if bytesused is
      0 for ALL planes.
      
      This seems to be what the user really intended if v4l2_buffer was
      just memset to 0.
      
      I'm afraid that just checking for this and returning an error would
      break too many applications. Quite a few drivers never check for bytesused
      at all and just use the buffer length instead.
      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>
      61bd8fb3
    • H
      [media] vb2: fix handling of data_offset and v4l2_plane.reserved[] · 412376a1
      Hans Verkuil 提交于
      The videobuf2-core did not zero the 'planes' array in __qbuf_userptr()
      and __qbuf_dmabuf(). That's now memset to 0. Without this the reserved
      array in struct v4l2_plane would be non-zero, causing v4l2-compliance
      errors.
      
      More serious is the fact that data_offset was not handled correctly:
      
      - for capture devices it was never zeroed, which meant that it was
        uninitialized. Unless the driver sets it it was a completely random
        number. With the memset above this is now fixed.
      
      - __qbuf_dmabuf had a completely incorrect length check that included
        data_offset.
      
      - in __fill_vb2_buffer in the DMABUF case the data_offset field was
        unconditionally copied from v4l2_buffer to v4l2_plane when this
        should only happen in the output case.
      
      - in the single-planar case data_offset was never correctly set to 0.
        The single-planar API doesn't support data_offset, so setting it
        to 0 is the right thing to do. This too is now solved by the memset.
      
      All these issues were found with v4l2-compliance.
      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>
      412376a1
    • H
      [media] videobuf2-core: fix sparse errors · a1d36d8c
      Hans Verkuil 提交于
      Sparse generated a bunch of errors like this:
      
      drivers/media/v4l2-core/videobuf2-core.c:2045:25: error: incompatible types in conditional expression (different base types)
      drivers/media/v4l2-core/videobuf2-core.c:136:17: error: incompatible types in conditional expression (different base types)
      drivers/media/v4l2-core/videobuf2-core.c:151:17: error: incompatible types in conditional expression (different base types)
      drivers/media/v4l2-core/videobuf2-core.c:168:25: error: incompatible types in conditional expression (different base types)
      drivers/media/v4l2-core/videobuf2-core.c:183:17: error: incompatible types in conditional expression (different base types)
      drivers/media/v4l2-core/videobuf2-core.c:185:9: error: incompatible types in conditional expression (different base types)
      drivers/media/v4l2-core/videobuf2-core.c:385:25: error: incompatible types in conditional expression (different base types)
      drivers/media/v4l2-core/videobuf2-core.c:1115:17: error: incompatible types in conditional expression (different base types)
      drivers/media/v4l2-core/videobuf2-core.c:1268:33: error: incompatible types in conditional expression (different base types)
      drivers/media/v4l2-core/videobuf2-core.c:1270:25: error: incompatible types in conditional expression (different base types)
      drivers/media/v4l2-core/videobuf2-core.c:1315:17: error: incompatible types in conditional expression (different base types)
      drivers/media/v4l2-core/videobuf2-core.c:1324:25: error: incompatible types in conditional expression (different base types)
      drivers/media/v4l2-core/videobuf2-core.c:1396:25: error: incompatible types in conditional expression (different base types)
      drivers/media/v4l2-core/videobuf2-core.c:1457:17: error: incompatible types in conditional expression (different base types)
      drivers/media/v4l2-core/videobuf2-core.c:1482:17: error: incompatible types in conditional expression (different base types)
      drivers/media/v4l2-core/videobuf2-core.c:1484:9: error: incompatible types in conditional expression (different base types)
      drivers/media/v4l2-core/videobuf2-core.c:1523:17: error: incompatible types in conditional expression (different base types)
      drivers/media/v4l2-core/videobuf2-core.c:1525:17: error: incompatible types in conditional expression (different base types)
      drivers/media/v4l2-core/videobuf2-core.c:1815:17: error: incompatible types in conditional expression (different base types)
      drivers/media/v4l2-core/videobuf2-core.c:1828:17: error: incompatible types in conditional expression (different base types)
      drivers/media/v4l2-core/videobuf2-core.c:1914:25: error: incompatible types in conditional expression (different base types)
      drivers/media/v4l2-core/videobuf2-core.c:1944:9: error: incompatible types in conditional expression (different base types)
      
      These are caused by the call*op defines which do something like this:
      
              (ops->op) ? ops->op(args) : 0
      
      which is OK as long as op is not a void function, because in that case one part
      of the conditional expression returns void, the other an integer. Hence the sparse
      errors.
      
      I've replaced this by introducing three variants of the call_ macros:
      call_*op for int returns, call_void_*op for void returns and call_ptr_*op for
      pointer returns.
      
      That's the bad news. The good news is that the fail_*op macros could be removed
      since the call_*op macros now have enough information to determine if the op
      succeeded or not and can increment the op counter only on success. This at least
      makes it more robust w.r.t. future changes.
      Signed-off-by: NHans Verkuil <hans.verkuil@cisco.com>
      Acked-by: NPawel Osciak <pawel@osciak.com>
      Signed-off-by: NMauro Carvalho Chehab <m.chehab@samsung.com>
      a1d36d8c
  2. 11 3月, 2014 14 次提交
  3. 06 3月, 2014 5 次提交
  4. 04 2月, 2014 1 次提交
  5. 07 1月, 2014 9 次提交
  6. 10 12月, 2013 2 次提交