lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8f05866a-1244-5e85-9b37-409526970779@xs4all.nl>
Date:   Fri, 5 Apr 2019 13:21:12 +0200
From:   Hans Verkuil <hverkuil@...all.nl>
To:     Philipp Zabel <p.zabel@...gutronix.de>,
        Tomasz Figa <tfiga@...omium.org>, linux-media@...r.kernel.org
Cc:     linux-kernel@...r.kernel.org,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        Pawel Osciak <posciak@...omium.org>,
        Alexandre Courbot <acourbot@...omium.org>,
        Kamil Debski <kamil@...as.org>,
        Andrzej Hajda <a.hajda@...sung.com>,
        Kyungmin Park <kyungmin.park@...sung.com>,
        Jeongtae Park <jtp.park@...sung.com>,
        Tiffany Lin (林慧珊) 
        <tiffany.lin@...iatek.com>,
        Andrew-CT Chen (陳智迪) 
        <andrew-ct.chen@...iatek.com>,
        Stanimir Varbanov <stanimir.varbanov@...aro.org>,
        Todor Tomov <todor.tomov@...aro.org>,
        Nicolas Dufresne <nicolas@...fresne.ca>,
        Paul Kocialkowski <paul.kocialkowski@...tlin.com>,
        Laurent Pinchart <laurent.pinchart@...asonboard.com>,
        dave.stevenson@...pberrypi.org,
        Ezequiel Garcia <ezequiel@...labora.com>,
        Maxime Jourdan <maxi.jourdan@...adoo.fr>
Subject: Re: [PATCH v3 1/2] media: docs-rst: Document memory-to-memory video
 decoder interface

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@...omium.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.

> 
>> +   Although mandatory, the availability of decoder commands may be queried
>> +   using :c:func:`VIDIOC_TRY_DECODER_CMD`.
> 
> Do the TRY_DECODER_CMD also return -EBUSY during the draining phase?

No.

Regards,

	Hans

> 
> regards
> Philipp
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ