2022-02-08 13:37:12

by Dmitry Osipenko

[permalink] [raw]
Subject: [PATCH v3 1/4] media: v4l2-ctrls: Add new V4L2_H264_DECODE_PARAM_FLAG_P/BFRAME flags

Add new V4L2_H264_DECODE_PARAM_FLAG_P/BFRAME flags that are needed by
NVIDIA Tegra video decoder. Userspace will have to set these flags in
accordance to the type of a decoded frame.

Signed-off-by: Dmitry Osipenko <[email protected]>
---
.../userspace-api/media/v4l/ext-ctrls-codec-stateless.rst | 6 ++++++
include/uapi/linux/v4l2-controls.h | 2 ++
2 files changed, 8 insertions(+)

diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec-stateless.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec-stateless.rst
index cc080c4257d0..f87584ad90ba 100644
--- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec-stateless.rst
+++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec-stateless.rst
@@ -616,6 +616,12 @@ Stateless Codec Control ID
* - ``V4L2_H264_DECODE_PARAM_FLAG_BOTTOM_FIELD``
- 0x00000004
-
+ * - ``V4L2_H264_DECODE_PARAM_FLAG_PFRAME``
+ - 0x00000008
+ -
+ * - ``V4L2_H264_DECODE_PARAM_FLAG_BFRAME``
+ - 0x00000010
+ -

.. raw:: latex

diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h
index c8e0f84d204d..e3d48d571062 100644
--- a/include/uapi/linux/v4l2-controls.h
+++ b/include/uapi/linux/v4l2-controls.h
@@ -1563,6 +1563,8 @@ struct v4l2_h264_dpb_entry {
#define V4L2_H264_DECODE_PARAM_FLAG_IDR_PIC 0x01
#define V4L2_H264_DECODE_PARAM_FLAG_FIELD_PIC 0x02
#define V4L2_H264_DECODE_PARAM_FLAG_BOTTOM_FIELD 0x04
+#define V4L2_H264_DECODE_PARAM_FLAG_PFRAME 0x08
+#define V4L2_H264_DECODE_PARAM_FLAG_BFRAME 0x10

#define V4L2_CID_STATELESS_H264_DECODE_PARAMS (V4L2_CID_CODEC_STATELESS_BASE + 7)
/**
--
2.34.1



2022-02-11 16:44:33

by Nicolas Dufresne

[permalink] [raw]
Subject: Re: [PATCH v3 1/4] media: v4l2-ctrls: Add new V4L2_H264_DECODE_PARAM_FLAG_P/BFRAME flags

Le lundi 07 février 2022 à 17:19 +0300, Dmitry Osipenko a écrit :
> Add new V4L2_H264_DECODE_PARAM_FLAG_P/BFRAME flags that are needed by
> NVIDIA Tegra video decoder. Userspace will have to set these flags in
> accordance to the type of a decoded frame.
>
> Signed-off-by: Dmitry Osipenko <[email protected]>
> ---

Can you share here (out of commit) a userland implementation that was used to
demonstrate the new API ? It does not matter which project (GStreamer, FFMPEG,
Chromium, your_test_progtram). Should be fairly straightforward. This is just to
be transparent.

> .../userspace-api/media/v4l/ext-ctrls-codec-stateless.rst | 6 ++++++
> include/uapi/linux/v4l2-controls.h | 2 ++
> 2 files changed, 8 insertions(+)
>
> diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec-stateless.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec-stateless.rst
> index cc080c4257d0..f87584ad90ba 100644
> --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec-stateless.rst
> +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec-stateless.rst
> @@ -616,6 +616,12 @@ Stateless Codec Control ID
> * - ``V4L2_H264_DECODE_PARAM_FLAG_BOTTOM_FIELD``
> - 0x00000004
> -
> + * - ``V4L2_H264_DECODE_PARAM_FLAG_PFRAME``
> + - 0x00000008
> + -
> + * - ``V4L2_H264_DECODE_PARAM_FLAG_BFRAME``
> + - 0x00000010
> + -
>
> .. raw:: latex
>
> diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h
> index c8e0f84d204d..e3d48d571062 100644
> --- a/include/uapi/linux/v4l2-controls.h
> +++ b/include/uapi/linux/v4l2-controls.h
> @@ -1563,6 +1563,8 @@ struct v4l2_h264_dpb_entry {
> #define V4L2_H264_DECODE_PARAM_FLAG_IDR_PIC 0x01
> #define V4L2_H264_DECODE_PARAM_FLAG_FIELD_PIC 0x02
> #define V4L2_H264_DECODE_PARAM_FLAG_BOTTOM_FIELD 0x04
> +#define V4L2_H264_DECODE_PARAM_FLAG_PFRAME 0x08
> +#define V4L2_H264_DECODE_PARAM_FLAG_BFRAME 0x10
>
> #define V4L2_CID_STATELESS_H264_DECODE_PARAMS (V4L2_CID_CODEC_STATELESS_BASE + 7)
> /**

Please update the doc too, see:
Documentation/userspace-api/media/v4l/ext-ctrls-codec-stateless.rst:

2022-02-11 16:52:31

by Dmitry Osipenko

[permalink] [raw]
Subject: Re: [PATCH v3 1/4] media: v4l2-ctrls: Add new V4L2_H264_DECODE_PARAM_FLAG_P/BFRAME flags

11.02.2022 16:29, Nicolas Dufresne пишет:
> Le lundi 07 février 2022 à 17:19 +0300, Dmitry Osipenko a écrit :
>> Add new V4L2_H264_DECODE_PARAM_FLAG_P/BFRAME flags that are needed by
>> NVIDIA Tegra video decoder. Userspace will have to set these flags in
>> accordance to the type of a decoded frame.
>>
>> Signed-off-by: Dmitry Osipenko <[email protected]>
>> ---
> Can you share here (out of commit) a userland implementation that was used to
> demonstrate the new API ? It does not matter which project (GStreamer, FFMPEG,
> Chromium, your_test_progtram). Should be fairly straightforward. This is just to
> be transparent.
>

You may find all the links in the cover letter, please see the
grate-driver's GStreamer [1] and libvdpau-tegra [2]:

[1] https://github.com/grate-driver/gstreamer/commits/main
[2] https://github.com/grate-driver/libvdpau-tegra/commits/master

2022-02-18 15:32:54

by Nicolas Dufresne

[permalink] [raw]
Subject: Re: [PATCH v3 1/4] media: v4l2-ctrls: Add new V4L2_H264_DECODE_PARAM_FLAG_P/BFRAME flags

Le lundi 07 février 2022 à 17:19 +0300, Dmitry Osipenko a écrit :
> Add new V4L2_H264_DECODE_PARAM_FLAG_P/BFRAME flags that are needed by
> NVIDIA Tegra video decoder. Userspace will have to set these flags in
> accordance to the type of a decoded frame.
>
> Signed-off-by: Dmitry Osipenko <[email protected]>

Reviewed-by: Nicolas Dufresne <[email protected]>

> ---
> .../userspace-api/media/v4l/ext-ctrls-codec-stateless.rst | 6 ++++++
> include/uapi/linux/v4l2-controls.h | 2 ++
> 2 files changed, 8 insertions(+)
>
> diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec-stateless.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec-stateless.rst
> index cc080c4257d0..f87584ad90ba 100644
> --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec-stateless.rst
> +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec-stateless.rst
> @@ -616,6 +616,12 @@ Stateless Codec Control ID
> * - ``V4L2_H264_DECODE_PARAM_FLAG_BOTTOM_FIELD``
> - 0x00000004
> -
> + * - ``V4L2_H264_DECODE_PARAM_FLAG_PFRAME``
> + - 0x00000008
> + -
> + * - ``V4L2_H264_DECODE_PARAM_FLAG_BFRAME``
> + - 0x00000010
> + -
>
> .. raw:: latex
>
> diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h
> index c8e0f84d204d..e3d48d571062 100644
> --- a/include/uapi/linux/v4l2-controls.h
> +++ b/include/uapi/linux/v4l2-controls.h
> @@ -1563,6 +1563,8 @@ struct v4l2_h264_dpb_entry {
> #define V4L2_H264_DECODE_PARAM_FLAG_IDR_PIC 0x01
> #define V4L2_H264_DECODE_PARAM_FLAG_FIELD_PIC 0x02
> #define V4L2_H264_DECODE_PARAM_FLAG_BOTTOM_FIELD 0x04
> +#define V4L2_H264_DECODE_PARAM_FLAG_PFRAME 0x08
> +#define V4L2_H264_DECODE_PARAM_FLAG_BFRAME 0x10
>
> #define V4L2_CID_STATELESS_H264_DECODE_PARAMS (V4L2_CID_CODEC_STATELESS_BASE + 7)
> /**