From: Brian Starkey <brian.starkey@arm.com>
To: Gustavo Padovan <gustavo@padovan.org>
Cc: linux-media@vger.kernel.org, Hans Verkuil <hverkuil@xs4all.nl>,
Mauro Carvalho Chehab <mchehab@osg.samsung.com>,
Shuah Khan <shuahkh@osg.samsung.com>,
Pawel Osciak <pawel@osciak.com>,
Alexandre Courbot <acourbot@chromium.org>,
Sakari Ailus <sakari.ailus@iki.fi>,
linux-kernel@vger.kernel.org,
Gustavo Padovan <gustavo.padovan@collabora.com>
Subject: Re: [RFC v4 17/17] [media] v4l: Document explicit synchronization behaviour
Date: Fri, 27 Oct 2017 11:08:23 +0100 [thread overview]
Message-ID: <20171027100822.GG40170@e107564-lin.cambridge.arm.com> (raw)
In-Reply-To: <20171020215012.20646-18-gustavo@padovan.org>
On Fri, Oct 20, 2017 at 07:50:12PM -0200, Gustavo Padovan wrote:
>From: Gustavo Padovan <gustavo.padovan@collabora.com>
>
>Add section to VIDIOC_QBUF about it
>
>v3:
> - make the out_fence refer to the current buffer (Hans)
> - Note what happens when the IN_FENCE is not set (Hans)
>
>v2:
> - mention that fences are files (Hans)
> - rework for the new API
>
>Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
>---
> Documentation/media/uapi/v4l/vidioc-qbuf.rst | 31 ++++++++++++++++++++++++++++
> 1 file changed, 31 insertions(+)
>
>diff --git a/Documentation/media/uapi/v4l/vidioc-qbuf.rst b/Documentation/media/uapi/v4l/vidioc-qbuf.rst
>index 9e448a4aa3aa..a65a50578bad 100644
>--- a/Documentation/media/uapi/v4l/vidioc-qbuf.rst
>+++ b/Documentation/media/uapi/v4l/vidioc-qbuf.rst
>@@ -118,6 +118,37 @@ immediately with an ``EAGAIN`` error code when no buffer is available.
> The struct :c:type:`v4l2_buffer` structure is specified in
> :ref:`buffer`.
>
>+Explicit Synchronization
>+------------------------
>+
>+Explicit Synchronization allows us to control the synchronization of
>+shared buffers from userspace by passing fences to the kernel and/or
>+receiving them from it. Fences passed to the kernel are named in-fences and
>+the kernel should wait on them to signal before using the buffer, i.e., queueing
>+it to the driver. On the other side, the kernel can create out-fences for the
>+buffers it queues to the drivers. Out-fences signal when the driver is
>+finished with buffer, i.e., the buffer is ready. The fences are represented
>+as a file and passed as a file descriptor to userspace.
>+
>+The in-fences are communicated to the kernel at the ``VIDIOC_QBUF`` ioctl
>+using the ``V4L2_BUF_FLAG_IN_FENCE`` buffer
>+flags and the `fence_fd` field. If an in-fence needs to be passed to the kernel,
>+`fence_fd` should be set to the fence file descriptor number and the
>+``V4L2_BUF_FLAG_IN_FENCE`` should be set as well Setting one but not the other
>+will cause ``VIDIOC_QBUF`` to return with error.
nit: full-stop before "Setting".
Also, depending what is decided about passing in a -1 in-fence, the
wording might want to include that behaviour.
>+
>+The fence_fd field (formely the reserved2 field) will be ignored if the
>+``V4L2_BUF_FLAG_IN_FENCE`` is not set.
>+
>+To get an out-fence back from V4L2 the ``V4L2_BUF_FLAG_OUT_FENCE`` flag should
>+be set to ask for a fence to be attached to the buffer. To become aware of
>+the out-fence created one should listen for the ``V4L2_EVENT_OUT_FENCE`` event.
>+An event will be triggered for every buffer queued to the V4L2 driver with the
>+``V4L2_BUF_FLAG_OUT_FENCE``.
Is it worth mentioning the immediate out-fence behaviour for ordered
queues? And/or clarifying that otherwise the V4L2_EVENT_OUT_FENCE
event will not be sent until all in-fence(s) on the buffer (or
previously queued ones) have signalled.
Cheers,
-Brian
>+
>+At streamoff the out-fences will either signal normally if the drivers waits
>+for the operations on the buffers to finish or signal with error if the
>+driver cancels the pending operations.
>
> Return Value
> ============
>--
>2.13.6
>
next prev parent reply other threads:[~2017-10-27 10:08 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-20 21:49 [RFC v4 00/17] V4L2 Explicit Synchronization support Gustavo Padovan
2017-10-20 21:49 ` [RFC v4 01/17] [media] v4l: create v4l2_event_subscribe_v4l2() Gustavo Padovan
2017-10-24 12:51 ` Hans Verkuil
2017-10-20 21:49 ` [RFC v4 02/17] [media] v4l: use v4l2_subscribe_event_v4l2() on vtables Gustavo Padovan
2017-10-20 21:49 ` [RFC v4 03/17] [media] v4l: use v4l2_subscribe_event_v4l2() on drivers Gustavo Padovan
2017-10-20 21:49 ` [RFC v4 04/17] WIP: [media] v4l2: add v4l2_event_queue_fh_with_cb() Gustavo Padovan
2017-11-03 7:31 ` Hans Verkuil
2017-10-20 21:50 ` [RFC v4 05/17] [media] v4l: add V4L2_EVENT_OUT_FENCE event Gustavo Padovan
2017-10-24 13:09 ` Hans Verkuil
2017-10-20 21:50 ` [RFC v4 06/17] [media] vb2: add .send_out_fence() to notify userspace of out_fence_fd Gustavo Padovan
2017-10-20 21:50 ` [RFC v4 07/17] [media] vivid: assign the specific device to the vb2_queue->dev Gustavo Padovan
2017-10-20 21:50 ` [RFC v4 08/17] [media] vb2: add 'ordered_in_driver' property to queues Gustavo Padovan
2017-10-24 13:11 ` Hans Verkuil
2017-10-20 21:50 ` [RFC v4 09/17] [media] vb2: add 'ordered_in_vb2' " Gustavo Padovan
2017-11-03 7:23 ` Hans Verkuil
2017-10-20 21:50 ` [RFC v4 10/17] [media] vivid: mark vivid queues as ordered_in_driver Gustavo Padovan
2017-10-20 21:50 ` [RFC v4 11/17] [media] vb2: check earlier if stream can be started Gustavo Padovan
2017-10-20 21:50 ` [RFC v4 12/17] [media] vb2: add explicit fence user API Gustavo Padovan
2017-11-03 7:47 ` Hans Verkuil
2017-10-20 21:50 ` [RFC v4 13/17] [media] vb2: add in-fence support to QBUF Gustavo Padovan
2017-10-25 14:49 ` Brian Starkey
2017-11-10 12:38 ` Gustavo Padovan
2017-10-20 21:50 ` [RFC v4 14/17] [media] vb2: add videobuf2 dma-buf fence helpers Gustavo Padovan
2017-10-20 21:50 ` [RFC v4 15/17] [media] vb2: add infrastructure to support out-fences Gustavo Padovan
2017-10-27 9:41 ` Brian Starkey
2017-10-20 21:50 ` [RFC v4 16/17] [media] vb2: add out-fence support to QBUF Gustavo Padovan
2017-10-27 10:01 ` Brian Starkey
2017-11-03 0:03 ` Gustavo Padovan
2017-10-20 21:50 ` [RFC v4 17/17] [media] v4l: Document explicit synchronization behaviour Gustavo Padovan
2017-10-27 10:08 ` Brian Starkey [this message]
2017-11-03 7:53 ` Hans Verkuil
2017-11-03 13:32 ` Gustavo Padovan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171027100822.GG40170@e107564-lin.cambridge.arm.com \
--to=brian.starkey@arm.com \
--cc=acourbot@chromium.org \
--cc=gustavo.padovan@collabora.com \
--cc=gustavo@padovan.org \
--cc=hverkuil@xs4all.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@osg.samsung.com \
--cc=pawel@osciak.com \
--cc=sakari.ailus@iki.fi \
--cc=shuahkh@osg.samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®