From: Hans Verkuil <hverkuil@xs4all.nl>
To: Philipp Zabel <p.zabel@pengutronix.de>,
Tomasz Figa <tfiga@chromium.org>,
linux-media@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
"Mauro Carvalho Chehab" <mchehab@kernel.org>,
"Pawel Osciak" <posciak@chromium.org>,
"Alexandre Courbot" <acourbot@chromium.org>,
"Kamil Debski" <kamil@wypas.org>,
"Andrzej Hajda" <a.hajda@samsung.com>,
"Kyungmin Park" <kyungmin.park@samsung.com>,
"Jeongtae Park" <jtp.park@samsung.com>,
"Tiffany Lin (林慧珊)" <tiffany.lin@mediatek.com>,
"Andrew-CT Chen (陳智迪)" <andrew-ct.chen@mediatek.com>,
"Stanimir Varbanov" <stanimir.varbanov@linaro.org>,
"Todor Tomov" <todor.tomov@linaro.org>,
"Nicolas Dufresne" <nicolas@ndufresne.ca>,
"Paul Kocialkowski" <paul.kocialkowski@bootlin.com>,
"Laurent Pinchart" <laurent.pinchart@ideasonboard.com>,
dave.stevenson@raspberrypi.org,
"Ezequiel Garcia" <ezequiel@collabora.com>,
"Maxime Jourdan" <maxi.jourdan@wanadoo.fr>
Subject: Re: [PATCH v3 1/2] media: docs-rst: Document memory-to-memory video decoder interface
Date: Wed, 10 Apr 2019 11:29:38 +0200 [thread overview]
Message-ID: <394033d7-b3ec-4c2f-8fc0-caf8ce860998@xs4all.nl> (raw)
In-Reply-To: <1554829036.5799.6.camel@pengutronix.de>
On 4/9/19 6:57 PM, Philipp Zabel wrote:
> On Fri, 2019-04-05 at 13:21 +0200, Hans Verkuil wrote:
>> On 4/5/19 12:59 PM, Philipp Zabel wrote:
>>> On Thu, 2019-01-24 at 19:04 +0900, Tomasz Figa wrote:
>>>> Due to complexity of the video decoding process, the V4L2 drivers of
>>>> stateful decoder hardware require specific sequences of V4L2 API calls
>>>> to be followed. These include capability enumeration, initialization,
>>>> decoding, seek, pause, dynamic resolution change, drain and end of
>>>> stream.
>>>>
>>>> Specifics of the above have been discussed during Media Workshops at
>>>> LinuxCon Europe 2012 in Barcelona and then later Embedded Linux
>>>> Conference Europe 2014 in Düsseldorf. The de facto Codec API that
>>>> originated at those events was later implemented by the drivers we already
>>>> have merged in mainline, such as s5p-mfc or coda.
>>>>
>>>> The only thing missing was the real specification included as a part of
>>>> Linux Media documentation. Fix it now and document the decoder part of
>>>> the Codec API.
>>>>
>>>> Signed-off-by: Tomasz Figa <tfiga@chromium.org>
>>>> ---
>>>> Documentation/media/uapi/v4l/dev-decoder.rst | 1076 +++++++++++++++++
>>>> Documentation/media/uapi/v4l/dev-mem2mem.rst | 5 +
>>>> Documentation/media/uapi/v4l/pixfmt-v4l2.rst | 5 +
>>>> Documentation/media/uapi/v4l/v4l2.rst | 10 +-
>>>> .../media/uapi/v4l/vidioc-decoder-cmd.rst | 40 +-
>>>> Documentation/media/uapi/v4l/vidioc-g-fmt.rst | 14 +
>>>> 6 files changed, 1135 insertions(+), 15 deletions(-)
>>>> create mode 100644 Documentation/media/uapi/v4l/dev-decoder.rst
>>>>
>>>> diff --git a/Documentation/media/uapi/v4l/dev-decoder.rst b/Documentation/media/uapi/v4l/dev-decoder.rst
>>>> new file mode 100644
>>>> index 000000000000..b7db2352ad41
>>>> --- /dev/null
>>>> +++ b/Documentation/media/uapi/v4l/dev-decoder.rst
>>>> @@ -0,0 +1,1076 @@
>>>> +.. -*- coding: utf-8; mode: rst -*-
>>>> +
>>>> +.. _decoder:
>>>> +
>>>> +*************************************************
>>>> +Memory-to-memory Stateful Video Decoder Interface
>>>> +*************************************************
>>>> +
>>>
>>> [...]
>>>> +
>>>> +Drain
>>>> +=====
>>>> +
>>>
>>> [...]
>>>> +
>>>> +3. Once all the ``OUTPUT`` buffers queued before the ``V4L2_DEC_CMD_STOP`` call
>>>> + are dequeued and the last ``CAPTURE`` buffer is dequeued, the decoder is
>>>> + stopped and it will accept, but not process, any newly queued ``OUTPUT``
>>>> + buffers until the client issues any of the following operations:
>>>> +
>>>
>>> [...]
>>>> +
>>>> +.. note::
>>>> +
>>>> + Once the drain sequence is initiated, the client needs to drive it to
>>>> + completion, as described by the steps above, unless it aborts the process by
>>>> + issuing :c:func:`VIDIOC_STREAMOFF` on any of the ``OUTPUT`` or ``CAPTURE``
>>>> + queues. The client is not allowed to issue ``V4L2_DEC_CMD_START`` or
>>>> + ``V4L2_DEC_CMD_STOP`` again while the drain sequence is in progress and they
>>>> + will fail with -EBUSY error code if attempted.
>>>
>>> Should the V4L2_DEC_CMD_STOP documentation in
>>> Documentation/media/uapi/v4l/vidioc-decoder-cmd.rst:
>>>
>>> * - ``V4L2_DEC_CMD_STOP``
>>> - 1
>>> - Stop the decoder. When the decoder is already stopped, this
>>> command does nothing.
>>>
>>> be updated to mention that for mem2mem decoders this not only does
>>> nothing, but returns an -EBUSY error return value?
>>
>> Yes. Basically in this case the STOP is still in progress, so returning
>> EBUSY makes sense and should be documented.
>>
>>>
>>> Also, if V4L2_DEC_CMD_STOP_IMMEDIATELY is set, should the decoder drop
>>> all pending buffers and signal EOS immediately? Should this be mentioned
>>> here?
>>
>> Hmm, the decoder spec says that flags should be set to 0, and current codec
>> drivers explicitly disallow a non-0 flags value.
>>
>> I'm not sure if there is a practical use-case for V4L2_DEC_CMD_STOP_IMMEDIATELY
>> in the context of a decoder. If you want to stop immediately, then just call
>> streamoff on the OUTPUT queue.
>
> v4l2-compliance currently complains if V4L2_DEC_CMD_STOP_IMMEDIATELY is
> not supported:
>
> fail: v4l2-test-codecs.cpp(104): ret != 0
> test VIDIOC_(TRY_)DECODER_CMD: FAIL
>
> Should testDecoder be changed to set the V4L2_DEC_CMD_STOP_IMMEDIATELY
> flag only if node->codec_mask does not have the STATEFUL_DECODER bit
> set?
Yes. I see that the vicodec driver doesn't handle the DECODER_CMD ioctl
correctly, which is why I haven't noticed this v4l2-compliance issue before.
Regards,
Hans
>
> regards
> Philipp
>
next prev parent reply other threads:[~2019-04-10 9:29 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-24 10:04 [PATCH v3 0/2] Document memory-to-memory video codec interfaces Tomasz Figa
2019-01-24 10:04 ` [PATCH v3 1/2] media: docs-rst: Document memory-to-memory video decoder interface Tomasz Figa
2019-01-29 13:11 ` Hans Verkuil
2019-01-31 10:45 ` Hans Verkuil
2019-01-31 12:30 ` Hans Verkuil
2019-01-31 12:38 ` Hans Verkuil
2019-01-31 12:44 ` Philipp Zabel
2019-01-31 13:19 ` Hans Verkuil
2019-02-07 8:51 ` Tomasz Figa
2019-04-05 10:59 ` Philipp Zabel
2019-04-05 11:21 ` Hans Verkuil
2019-04-09 10:28 ` Tomasz Figa
2019-04-09 16:57 ` Philipp Zabel
2019-04-10 9:29 ` Hans Verkuil [this message]
2019-01-24 10:04 ` [PATCH v3 2/2] media: docs-rst: Document memory-to-memory video encoder interface Tomasz Figa
2019-01-29 13:52 ` Hans Verkuil
2019-03-14 13:57 ` Hans Verkuil
2019-04-05 8:12 ` Tomasz Figa
2019-04-05 10:03 ` Hans Verkuil
2019-04-08 9:23 ` Tomasz Figa
2019-04-08 11:11 ` Hans Verkuil
2019-04-09 9:35 ` Tomasz Figa
2019-04-10 8:50 ` Hans Verkuil
2019-04-10 16:05 ` Nicolas Dufresne
2019-04-15 8:56 ` Tomasz Figa
2019-04-15 12:30 ` Nicolas Dufresne
2019-04-05 5:53 ` Tomasz Figa
2019-04-05 7:09 ` Hans Verkuil
2019-03-21 10:10 ` Hans Verkuil
2019-04-08 6:59 ` Tomasz Figa
2019-04-08 7:43 ` Hans Verkuil
2019-04-08 9:35 ` Tomasz Figa
2019-03-25 13:12 ` Hans Verkuil
2019-03-25 16:33 ` Hans Verkuil
2019-04-08 8:40 ` Tomasz Figa
2019-04-08 8:36 ` Tomasz Figa
2019-04-08 8:43 ` Hans Verkuil
2019-04-09 7:11 ` Tomasz Figa
2019-04-09 9:37 ` Hans Verkuil
2019-04-09 9:43 ` Tomasz Figa
2019-05-22 8:43 ` Tomasz Figa
2019-05-22 8:51 ` Hans Verkuil
2019-05-22 14:16 ` Michael Tretter
2019-04-30 17:34 ` Michael Tretter
2019-05-14 8:12 ` Tomasz Figa
2019-05-16 8:37 ` Michael Tretter
2019-05-16 8:48 ` Tomasz Figa
2019-01-24 10:38 ` [PATCH v3 0/2] Document memory-to-memory video codec interfaces Hans Verkuil
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=394033d7-b3ec-4c2f-8fc0-caf8ce860998@xs4all.nl \
--to=hverkuil@xs4all.nl \
--cc=a.hajda@samsung.com \
--cc=acourbot@chromium.org \
--cc=andrew-ct.chen@mediatek.com \
--cc=dave.stevenson@raspberrypi.org \
--cc=ezequiel@collabora.com \
--cc=jtp.park@samsung.com \
--cc=kamil@wypas.org \
--cc=kyungmin.park@samsung.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=maxi.jourdan@wanadoo.fr \
--cc=mchehab@kernel.org \
--cc=nicolas@ndufresne.ca \
--cc=p.zabel@pengutronix.de \
--cc=paul.kocialkowski@bootlin.com \
--cc=posciak@chromium.org \
--cc=stanimir.varbanov@linaro.org \
--cc=tfiga@chromium.org \
--cc=tiffany.lin@mediatek.com \
--cc=todor.tomov@linaro.org \
/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;
as well as URLs for NNTP newsgroup(s).