1. 17 4月, 2014 8 次提交
    • 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 次提交
  7. 09 12月, 2013 1 次提交
    • R
      [media] videobuf2: Add missing lock held on vb2_fop_release · 1380f575
      Ricardo Ribalda 提交于
      vb2_fop_release does not hold the lock although it is modifying the
      queue->owner field.
      This could lead to race conditions on the vb2_perform_io function
      when multiple applications are accessing the video device via
      read/write API:
      [ 308.297741] BUG: unable to handle kernel NULL pointer dereference at
      0000000000000260
      [ 308.297759] IP: [<ffffffffa07a9fd2>] vb2_perform_fileio+0x372/0x610
      [videobuf2_core]
      [ 308.297794] PGD 159719067 PUD 158119067 PMD 0
      [ 308.297812] Oops: 0000 #1 SMP
      [ 308.297826] Modules linked in: qt5023_video videobuf2_dma_sg
      qtec_xform videobuf2_vmalloc videobuf2_memops videobuf2_core
      qtec_white qtec_mem gpio_xilinx qtec_cmosis qtec_pcie fglrx(PO)
      spi_xilinx spi_bitbang qt5023
      [ 308.297888] CPU: 1 PID: 2189 Comm: java Tainted: P O 3.11.0-qtec-standard #1
      [ 308.297919] Hardware name: QTechnology QT5022/QT5022, BIOS
      PM_2.1.0.309 X64 05/23/2013
      [ 308.297952] task: ffff8801564e1690 ti: ffff88014dc02000 task.ti:
      ffff88014dc02000
      [ 308.297962] RIP: 0010:[<ffffffffa07a9fd2>] [<ffffffffa07a9fd2>]
      vb2_perform_fileio+0x372/0x610 [videobuf2_core]
      [ 308.297985] RSP: 0018:ffff88014dc03df8 EFLAGS: 00010202
      [ 308.297995] RAX: 0000000000000000 RBX: ffff880158a23000 RCX: dead000000100100
      [ 308.298003] RDX: 0000000000000000 RSI: dead000000200200 RDI: 0000000000000000
      [ 308.298012] RBP: ffff88014dc03e58 R08: 0000000000000000 R09: 0000000000000001
      [ 308.298020] R10: ffffea00051e8380 R11: ffff88014dc03fd8 R12: ffff880158a23070
      [ 308.298029] R13: ffff8801549040b8 R14: 0000000000198000 R15: 0000000001887e60
      [ 308.298040] FS: 00007f65130d5700(0000) GS:ffff88015ed00000(0000)
      knlGS:0000000000000000
      [ 308.298049] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [ 308.298057] CR2: 0000000000000260 CR3: 0000000159630000 CR4: 00000000000007e0
      [ 308.298064] Stack:
      [ 308.298071] ffff880156416c00 0000000000198000 0000000000000000
      ffff880100000001
      [ 308.298087] ffff88014dc03f50 00000000810a79ca 0002000000000001
      ffff880154904718
      [ 308.298101] ffff880156416c00 0000000000198000 ffff880154904338
      ffff88014dc03f50
      [ 308.298116] Call Trace:
      [ 308.298143] [<ffffffffa07aa3c4>] vb2_read+0x14/0x20 [videobuf2_core]
      [ 308.298198] [<ffffffffa07aa494>] vb2_fop_read+0xc4/0x120 [videobuf2_core]
      [ 308.298252] [<ffffffff8154ee9e>] v4l2_read+0x7e/0xc0
      [ 308.298296] [<ffffffff8116e639>] vfs_read+0xa9/0x160
      [ 308.298312] [<ffffffff8116e882>] SyS_read+0x52/0xb0
      [ 308.298328] [<ffffffff81784179>] tracesys+0xd0/0xd5
      [ 308.298335] Code: e5 d6 ff ff 83 3d be 24 00 00 04 89 c2 4c 8b 45 b0
      44 8b 4d b8 0f 8f 20 02 00 00 85 d2 75 32 83 83 78 03 00 00 01 4b 8b
      44 c5 48 <8b> 88 60 02 00 00 85 c9 0f 84 b0 00 00 00 8b 40 58 89 c2 41
      89
      [ 308.298487] RIP [<ffffffffa07a9fd2>] vb2_perform_fileio+0x372/0x610
      [videobuf2_core]
      [ 308.298507] RSP <ffff88014dc03df8>
      [ 308.298514] CR2: 0000000000000260
      [ 308.298526] ---[ end trace e8f01717c96d1e41 ]---
      Signed-off-by: NRicardo Ribalda <ricardo.ribalda@gmail.com>
      Acked-by: NHans Verkuil <hans.verkuil@cisco.com>
      Acked-by: NSylwester Nawrocki <s.nawrocki@samsung.com>
      Signed-off-by: NHans Verkuil <hans.verkuil@cisco.com>
      Signed-off-by: NMauro Carvalho Chehab <m.chehab@samsung.com>
      1380f575