Skip to content

V4L2 Explicit Synchronization

Ezequiel Garcia linux-media lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v10 Latest16 patches 16 repliesIn review
  2. v915 patches 23 repliesSuperseded

Changes in v10 from the cover letter

* Move fence callback to workqueue, and call vb2_start_streaming if needed.
* Refcount vb2_buffer.
* Check return of get_unused_fd.
* Increase seqno for out-fences that reuse the context.
* Go back to is_unordered callback.
* Mark unordered formats in cobalt driver.
* Improve CAP_FENCES check.
* Minor documentation changes.

Patches in v10 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/16videobuf2: Make struct vb2_buffer refcounteddrivers/media/common/videobuf2/videobuf2-core.c include/media/videobuf2-core.h+29 -53 replies
2/16xilinx: regroup caps on querycapdrivers/media/platform/xilinx/xilinx-dma.c+6 -40 replies
3/16hackrf: group device capabilitiesdrivers/media/usb/hackrf/hackrf.c+4 -70 replies
4/16omap3isp: group device capabilitiesdrivers/media/platform/omap3isp/ispvideo.c+6 -40 replies
5/16vb2: move vb2_ops functions to videobuf2-core.[ch]drivers/media/common/videobuf2/videobuf2-core.c drivers/media/common/videobuf2/videobuf2-v4l2.c include/media/videobuf2-core.h +1 more+32 -320 replies
6/16vb2: add is_unordered callback for driversdrivers/media/common/videobuf2/videobuf2-core.c include/media/videobuf2-core.h+22 -00 replies
7/16v4l: add unordered flag to format description ioctlDocumentation/media/uapi/v4l/vidioc-enum-fmt.rst include/uapi/linux/videodev2.h+8 -00 replies
8/16v4l: mark unordered formatsdrivers/media/v4l2-core/v4l2-ioctl.c+57 -173 replies
9/16cobalt: add .is_unordered() for cobaltdrivers/media/pci/cobalt/cobalt-v4l2.c+4 -01 reply
10/16vb2: mark codec drivers as unordereddrivers/media/platform/coda/coda-common.c drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c +4 more+7 -00 replies
11/16vb2: add explicit fence user APIDocumentation/media/uapi/v4l/buffer.rst drivers/media/common/videobuf2/videobuf2-v4l2.c drivers/media/v4l2-core/v4l2-compat-ioctl32.c +1 more+58 -82 replies
12/16vb2: add in-fence support to QBUFdrivers/media/common/videobuf2/Kconfig drivers/media/common/videobuf2/videobuf2-core.c drivers/media/common/videobuf2/videobuf2-v4l2.c +2 more+242 -415 replies
13/16vb2: add out-fence support to QBUFdrivers/media/common/videobuf2/videobuf2-core.c drivers/media/common/videobuf2/videobuf2-v4l2.c drivers/media/dvb-core/dvb_vb2.c +1 more+136 -92 replies
14/16v4l: introduce the fences capabilityDocumentation/media/uapi/v4l/vidioc-querycap.rst include/uapi/linux/videodev2.h+4 -00 replies
15/16v4l: Add V4L2_CAP_FENCES to driversdrivers/media/platform/exynos-gsc/gsc-m2m.c drivers/media/platform/m2m-deinterlace.c drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c +7 more+40 -100 replies
16/16v4l: Document explicit synchronization behaviorDocumentation/media/uapi/v4l/vidioc-qbuf.rst Documentation/media/uapi/v4l/vidioc-querybuf.rst+61 -40 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v10 yet.

Read the v10 thread

Cover letter [PATCH v10 00/16] V4L2 Explicit Synchronization

Hi all,

The most relevant change for this round is that all the work done in the fence callback is now moved to a workqueue, that runs with the queue lock held.

Although this introduces some latency, it is however needed to take the vb2_queue mutex and safely call vb2 ops.

Given the fence callback can be called fully asynchronously, and given it needs to be associated with a vb2_buffer, we now need to refcount vb2_buffer. This allows to safely "attach" the vb2_buffer to the fence callback.

To prevent annoying deadlocks, and because the fence callback is called with the fence spinlock, it's best to avoid calling dma_fence_put in the fence callback itself. So the fence is now put in the DQBUF operation (or in cancel paths).

Hopefully, I took care of all the feedback provided by Hans and Brian on v9. Please let me know if you guys catch anything else.

Thanks!

Changes from v9:

* Move fence callback to workqueue, and call vb2_start_streaming if needed.
* Refcount vb2_buffer.
* Check return of get_unused_fd.
* Increase seqno for out-fences that reuse the context.
* Go back to is_unordered callback.
* Mark unordered formats in cobalt driver.
* Improve CAP_FENCES check.
* Minor documentation changes.

Ezequiel Garcia (1):
videobuf2: Make struct vb2_buffer refcounted

Gustavo Padovan (15):
xilinx: regroup caps on querycap
hackrf: group device capabilities
omap3isp: group device capabilities
vb2: move vb2_ops functions to videobuf2-core.[ch]
vb2: add is_unordered callback for drivers
v4l: add unordered flag to format description ioctl
v4l: mark unordered formats
cobalt: add .is_unordered() for cobalt
vb2: mark codec drivers as unordered
vb2: add explicit fence user API
vb2: add in-fence support to QBUF
vb2: add out-fence support to QBUF
v4l: introduce the fences capability
v4l: Add V4L2_CAP_FENCES to drivers
v4l: Document explicit synchronization behavior

 Documentation/media/uapi/v4l/buffer.rst            |  48 ++-
 Documentation/media/uapi/v4l/vidioc-enum-fmt.rst   |   7 +
 Documentation/media/uapi/v4l/vidioc-qbuf.rst       |  53 ++-
 Documentation/media/uapi/v4l/vidioc-querybuf.rst   |  12 +-
 Documentation/media/uapi/v4l/vidioc-querycap.rst   |   3 +
 drivers/media/common/videobuf2/Kconfig             |   1 +
 drivers/media/common/videobuf2/videobuf2-core.c    | 376 ++++++++++++++++++---
 drivers/media/common/videobuf2/videobuf2-v4l2.c    |  65 +++-
 drivers/media/dvb-core/dvb_vb2.c                   |   2 +-
 drivers/media/pci/cobalt/cobalt-v4l2.c             |   4 +
 drivers/media/platform/coda/coda-common.c          |   1 +
 drivers/media/platform/exynos-gsc/gsc-m2m.c        |   3 +-
 drivers/media/platform/m2m-deinterlace.c           |   3 +-
 drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c       |   3 +-
 drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c |   1 +
 .../media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c |   2 +-
 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c |   1 +
 .../media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c |   3 +-
 drivers/media/platform/mx2_emmaprp.c               |   3 +-
 drivers/media/platform/omap3isp/ispvideo.c         |  10 +-
 drivers/media/platform/qcom/venus/vdec.c           |   4 +-
 drivers/media/platform/qcom/venus/venc.c           |   4 +-
 drivers/media/platform/s5p-mfc/s5p_mfc_dec.c       |   1 +
 drivers/media/platform/s5p-mfc/s5p_mfc_enc.c       |   1 +
 drivers/media/platform/sh_veu.c                    |   3 +-
 drivers/media/platform/xilinx/xilinx-dma.c         |  10 +-
 drivers/media/usb/hackrf/hackrf.c                  |  11 +-
 drivers/media/v4l2-core/v4l2-compat-ioctl32.c      |   4 +-
 drivers/media/v4l2-core/v4l2-ioctl.c               |  98 +++++-
 include/media/videobuf2-core.h                     |  76 ++++-
 include/media/videobuf2-v4l2.h                     |  18 -
 include/uapi/linux/videodev2.h                     |  10 +-
 32 files changed, 708 insertions(+), 133 deletions(-)
Signature · 1 line
2.16.3