Re: [PATCH v2 1/2] media: docs-rst: Document memory-to-memory video decoder interface
From: Stanimir Varbanov
Date: Mon Nov 12 2018 - 10:04:16 EST
Hi Tomasz,
On 10/22/18 5:48 PM, 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@xxxxxxxxxxxx>
> ---
> Documentation/media/uapi/v4l/dev-decoder.rst | 1082 +++++++++++++++++
> Documentation/media/uapi/v4l/devices.rst | 1 +
> 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, 1137 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..09c7a6621b8e
> --- /dev/null
> +++ b/Documentation/media/uapi/v4l/dev-decoder.rst
> +State machine
> +=============
> +
> +.. kernel-render:: DOT
> + :alt: DOT digraph of decoder state machine
> + :caption: Decoder state machine
> +
> + digraph decoder_state_machine {
> + node [shape = doublecircle, label="Decoding"] Decoding;
> +
> + node [shape = circle, label="Initialization"] Initialization;
> + node [shape = circle, label="Capture\nsetup"] CaptureSetup;
> + node [shape = circle, label="Dynamic\nresolution\nchange"] ResChange;
> + node [shape = circle, label="Stopped"] Stopped;
> + node [shape = circle, label="Drain"] Drain;
> + node [shape = circle, label="Seek"] Seek;
> + node [shape = circle, label="End of stream"] EoS;
> +
> + node [shape = point]; qi
> + qi -> Initialization [ label = "open()" ];
> +
> + Initialization -> CaptureSetup [ label = "CAPTURE\nformat\nestablished" ];
> +
> + CaptureSetup -> Stopped [ label = "CAPTURE\nbuffers\nready" ];
> +
> + Decoding -> ResChange [ label = "Stream\nresolution\nchange" ];
> + Decoding -> Drain [ label = "V4L2_DEC_CMD_STOP" ];
> + Decoding -> EoS [ label = "EoS mark\nin the stream" ];
> + Decoding -> Seek [ label = "VIDIOC_STREAMOFF(OUTPUT)" ];
> + Decoding -> Stopped [ label = "VIDIOC_STREAMOFF(CAPTURE)" ];
> + Decoding -> Decoding;
> +
> + ResChange -> CaptureSetup [ label = "CAPTURE\nformat\nestablished" ];
> + ResChange -> Seek [ label = "VIDIOC_STREAMOFF(OUTPUT)" ];
> +
> + EoS -> Drain [ label = "Implicit\ndrain" ];
> +
> + Drain -> Stopped [ label = "All CAPTURE\nbuffers dequeued\nor\nVIDIOC_STREAMOFF(CAPTURE)" ];
> + Drain -> Seek [ label = "VIDIOC_STREAMOFF(OUTPUT)" ];
> +
> + Seek -> Decoding [ label = "VIDIOC_STREAMON(OUTPUT)" ];
> + Seek -> Initialization [ label = "VIDIOC_REQBUFS(OUTPUT, 0)" ];
Shouldn't this be [ label = "VIDIOC_STREAMOFF(CAPTURE)" ], for me it is
looks more natural for v4l2?
For example I want to exit immediately from decoding state with calls to
streamoff(OUTPUT) and streamoff(CAPTURE). This could be when you press
ctrl-c while playing video, in this case I don't expect EoS nor buffers
draining.
> +
> + Stopped -> Decoding [ label = "V4L2_DEC_CMD_START\nor\nVIDIOC_STREAMON(CAPTURE)" ];
> + Stopped -> Seek [ label = "VIDIOC_STREAMOFF(OUTPUT)" ];
> + }
> +
--
regards,
Stan