Message ID | 20210218191844.297869-5-benjamin.gaignard@collabora.com |
---|---|
State | Superseded |
Headers | show |
Series | Add HANTRO G2/HEVC decoder support for IMX8MQ | expand |
Le 18/02/2021 à 22:34, Jernej Škrabec a écrit : > Hi! > > Dne četrtek, 18. februar 2021 ob 20:18:39 CET je Benjamin Gaignard napisal(a): >> The HEVC HANTRO driver needs to know the number of bits to skip at >> the beginning of the slice header. >> That is a hardware specific requirement so create a dedicated control >> that this purpose. >> >> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> >> --- >> include/uapi/linux/hantro-v4l2-controls.h | 20 ++++++++++++++++++++ >> include/uapi/linux/v4l2-controls.h | 5 +++++ >> 2 files changed, 25 insertions(+) >> create mode 100644 include/uapi/linux/hantro-v4l2-controls.h >> >> diff --git a/include/uapi/linux/hantro-v4l2-controls.h b/include/uapi/linux/ > hantro-v4l2-controls.h >> new file mode 100644 >> index 000000000000..30b1999b7af3 >> --- /dev/null >> +++ b/include/uapi/linux/hantro-v4l2-controls.h >> @@ -0,0 +1,20 @@ >> +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ >> + >> +#ifndef __UAPI_HANTRO_V4L2_CONYTROLS_H__ >> +#define __UAPI_HANTRO_V4L2_CONYTROLS_H__ >> + >> +#include <linux/v4l2-controls.h> >> +#include <media/hevc-ctrls.h> >> + >> +#define V4L2_CID_HANTRO_HEVC_EXTRA_DECODE_PARAMS > (V4L2_CID_USER_HANTRO_BASE + 0) >> + >> +/** >> + * struct hantro_hevc_extra_decode_params - extra decode parameters for > hantro driver >> + * @hevc_hdr_skip_lenght: header first bits offset >> + */ >> +struct hantro_hevc_extra_decode_params { >> + __u32 hevc_hdr_skip_lenght; > typo: lenght -> length > > Same mistake in description above. Thanks I will fix that in v3 Benjamin > > Best regards, > Jernej > >> + __u8 padding[4]; >> +}; >> + >> +#endif >> diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2- > controls.h >> index 039c0d7add1b..ced7486c7f46 100644 >> --- a/include/uapi/linux/v4l2-controls.h >> +++ b/include/uapi/linux/v4l2-controls.h >> @@ -209,6 +209,11 @@ enum v4l2_colorfx { >> * We reserve 128 controls for this driver. >> */ >> #define V4L2_CID_USER_CCS_BASE (V4L2_CID_USER_BASE + > 0x10f0) >> +/* >> + * The base for HANTRO driver controls. >> + * We reserve 32 controls for this driver. >> + */ >> +#define V4L2_CID_USER_HANTRO_BASE (V4L2_CID_USER_BASE + > 0x1170) >> >> /* MPEG-class control IDs */ >> /* The MPEG controls are applicable to all codec controls >> -- >> 2.25.1 >> >> > >
>The HEVC HANTRO driver needs to know the number of bits to skip at >the beginning of the slice header. >That is a hardware specific requirement so create a dedicated control >that this purpose. > >Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> >--- > include/uapi/linux/hantro-v4l2-controls.h | 20 ++++++++++++++++++++ > include/uapi/linux/v4l2-controls.h | 5 +++++ > 2 files changed, 25 insertions(+) > create mode 100644 include/uapi/linux/hantro-v4l2-controls.h > >diff --git a/include/uapi/linux/hantro-v4l2-controls.h b/include/uapi/linux/hantro-v4l2-controls.h >new file mode 100644 >index 000000000000..30b1999b7af3 >--- /dev/null >+++ b/include/uapi/linux/hantro-v4l2-controls.h >@@ -0,0 +1,20 @@ >+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ >+ >+#ifndef __UAPI_HANTRO_V4L2_CONYTROLS_H__ >+#define __UAPI_HANTRO_V4L2_CONYTROLS_H__ >+ >+#include <linux/v4l2-controls.h> >+#include <media/hevc-ctrls.h> >+ >+#define V4L2_CID_HANTRO_HEVC_EXTRA_DECODE_PARAMS (V4L2_CID_USER_HANTRO_BASE + 0) >+ >+/** >+ * struct hantro_hevc_extra_decode_params - extra decode parameters for hantro driver >+ * @hevc_hdr_skip_lenght: header first bits offset >+ */ >+struct hantro_hevc_extra_decode_params { >+ __u32 hevc_hdr_skip_lenght; >+ __u8 padding[4]; >+}; Can you clarify how hevc_hdr_skip_length differs from v4l2_ctrl_hevc_slice_params.data_bit_offset? At first sight they would appear to be very similar. Regards John Cox >+#endif >diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h >index 039c0d7add1b..ced7486c7f46 100644 >--- a/include/uapi/linux/v4l2-controls.h >+++ b/include/uapi/linux/v4l2-controls.h >@@ -209,6 +209,11 @@ enum v4l2_colorfx { > * We reserve 128 controls for this driver. > */ > #define V4L2_CID_USER_CCS_BASE (V4L2_CID_USER_BASE + 0x10f0) >+/* >+ * The base for HANTRO driver controls. >+ * We reserve 32 controls for this driver. >+ */ >+#define V4L2_CID_USER_HANTRO_BASE (V4L2_CID_USER_BASE + 0x1170) > > /* MPEG-class control IDs */ > /* The MPEG controls are applicable to all codec controls
Le 22/02/2021 à 17:16, John Cox a écrit : >> The HEVC HANTRO driver needs to know the number of bits to skip at >> the beginning of the slice header. >> That is a hardware specific requirement so create a dedicated control >> that this purpose. >> >> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> >> --- >> include/uapi/linux/hantro-v4l2-controls.h | 20 ++++++++++++++++++++ >> include/uapi/linux/v4l2-controls.h | 5 +++++ >> 2 files changed, 25 insertions(+) >> create mode 100644 include/uapi/linux/hantro-v4l2-controls.h >> >> diff --git a/include/uapi/linux/hantro-v4l2-controls.h b/include/uapi/linux/hantro-v4l2-controls.h >> new file mode 100644 >> index 000000000000..30b1999b7af3 >> --- /dev/null >> +++ b/include/uapi/linux/hantro-v4l2-controls.h >> @@ -0,0 +1,20 @@ >> +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ >> + >> +#ifndef __UAPI_HANTRO_V4L2_CONYTROLS_H__ >> +#define __UAPI_HANTRO_V4L2_CONYTROLS_H__ >> + >> +#include <linux/v4l2-controls.h> >> +#include <media/hevc-ctrls.h> >> + >> +#define V4L2_CID_HANTRO_HEVC_EXTRA_DECODE_PARAMS (V4L2_CID_USER_HANTRO_BASE + 0) >> + >> +/** >> + * struct hantro_hevc_extra_decode_params - extra decode parameters for hantro driver >> + * @hevc_hdr_skip_lenght: header first bits offset >> + */ >> +struct hantro_hevc_extra_decode_params { >> + __u32 hevc_hdr_skip_lenght; >> + __u8 padding[4]; >> +}; > Can you clarify how hevc_hdr_skip_length differs from > v4l2_ctrl_hevc_slice_params.data_bit_offset? At first sight they would > appear to be very similar. hevc_hdr_skip_length is the difference between the start positions of 2 nals. v4l2_ctrl_hevc_slice_params.data_bit_offset is the offset of the data in the nal. Benjamin > > Regards > > John Cox > >> +#endif >> diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h >> index 039c0d7add1b..ced7486c7f46 100644 >> --- a/include/uapi/linux/v4l2-controls.h >> +++ b/include/uapi/linux/v4l2-controls.h >> @@ -209,6 +209,11 @@ enum v4l2_colorfx { >> * We reserve 128 controls for this driver. >> */ >> #define V4L2_CID_USER_CCS_BASE (V4L2_CID_USER_BASE + 0x10f0) >> +/* >> + * The base for HANTRO driver controls. >> + * We reserve 32 controls for this driver. >> + */ >> +#define V4L2_CID_USER_HANTRO_BASE (V4L2_CID_USER_BASE + 0x1170) >> >> /* MPEG-class control IDs */ >> /* The MPEG controls are applicable to all codec controls
On Mon, 2021-02-22 at 17:28 +0100, Benjamin Gaignard wrote: > > Le 22/02/2021 à 17:16, John Cox a écrit : > > > The HEVC HANTRO driver needs to know the number of bits to skip at > > > the beginning of the slice header. > > > That is a hardware specific requirement so create a dedicated control > > > that this purpose. > > > > > > Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> > > > --- > > > include/uapi/linux/hantro-v4l2-controls.h | 20 ++++++++++++++++++++ > > > include/uapi/linux/v4l2-controls.h | 5 +++++ > > > 2 files changed, 25 insertions(+) > > > create mode 100644 include/uapi/linux/hantro-v4l2-controls.h > > > > > > diff --git a/include/uapi/linux/hantro-v4l2-controls.h b/include/uapi/linux/hantro-v4l2-controls.h > > > new file mode 100644 > > > index 000000000000..30b1999b7af3 > > > --- /dev/null > > > +++ b/include/uapi/linux/hantro-v4l2-controls.h > > > @@ -0,0 +1,20 @@ > > > +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ > > > + > > > +#ifndef __UAPI_HANTRO_V4L2_CONYTROLS_H__ > > > +#define __UAPI_HANTRO_V4L2_CONYTROLS_H__ > > > + > > > +#include <linux/v4l2-controls.h> > > > +#include <media/hevc-ctrls.h> > > > + > > > +#define V4L2_CID_HANTRO_HEVC_EXTRA_DECODE_PARAMS (V4L2_CID_USER_HANTRO_BASE + 0) > > > + > > > +/** > > > + * struct hantro_hevc_extra_decode_params - extra decode parameters for hantro driver > > > + * @hevc_hdr_skip_lenght: header first bits offset > > > + */ > > > +struct hantro_hevc_extra_decode_params { > > > + __u32 hevc_hdr_skip_lenght; > > > + __u8 padding[4]; > > > +}; > > Can you clarify how hevc_hdr_skip_length differs from > > v4l2_ctrl_hevc_slice_params.data_bit_offset? At first sight they would > > appear to be very similar. > > hevc_hdr_skip_length is the difference between the start positions of 2 nals. > v4l2_ctrl_hevc_slice_params.data_bit_offset is the offset of the data in the nal. > I think the hardware is weird enough that we should have detailed documentation to the exact expectation for this control, i.e. detailing exactly what syntax elements userspace is expected to pass the distance. Maybe documenting this somewhere in Documentation/.../media/something, and then linking that in the kernel-doc comment for hantro_hevc_extra_decode_params. Thanks, Ezequiel
Le lundi 22 février 2021 à 17:28 +0100, Benjamin Gaignard a écrit : > > Le 22/02/2021 à 17:16, John Cox a écrit : > > > The HEVC HANTRO driver needs to know the number of bits to skip at > > > the beginning of the slice header. > > > That is a hardware specific requirement so create a dedicated control > > > that this purpose. > > > > > > Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> > > > --- > > > include/uapi/linux/hantro-v4l2-controls.h | 20 ++++++++++++++++++++ > > > include/uapi/linux/v4l2-controls.h | 5 +++++ > > > 2 files changed, 25 insertions(+) > > > create mode 100644 include/uapi/linux/hantro-v4l2-controls.h > > > > > > diff --git a/include/uapi/linux/hantro-v4l2-controls.h > > > b/include/uapi/linux/hantro-v4l2-controls.h > > > new file mode 100644 > > > index 000000000000..30b1999b7af3 > > > --- /dev/null > > > +++ b/include/uapi/linux/hantro-v4l2-controls.h > > > @@ -0,0 +1,20 @@ > > > +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ > > > + > > > +#ifndef __UAPI_HANTRO_V4L2_CONYTROLS_H__ > > > +#define __UAPI_HANTRO_V4L2_CONYTROLS_H__ > > > + > > > +#include <linux/v4l2-controls.h> > > > +#include <media/hevc-ctrls.h> > > > + > > > +#define > > > V4L2_CID_HANTRO_HEVC_EXTRA_DECODE_PARAMS (V4L2_CID_USER_HANTRO_BASE > > > + 0) > > > + > > > +/** > > > + * struct hantro_hevc_extra_decode_params - extra decode parameters for > > > hantro driver > > > + * @hevc_hdr_skip_lenght: header first bits offset > > > + */ > > > +struct hantro_hevc_extra_decode_params { > > > + __u32 hevc_hdr_skip_lenght; > > > + __u8 padding[4]; > > > +}; > > Can you clarify how hevc_hdr_skip_length differs from > > v4l2_ctrl_hevc_slice_params.data_bit_offset? At first sight they would > > appear to be very similar. > > hevc_hdr_skip_length is the difference between the start positions of 2 nals. > v4l2_ctrl_hevc_slice_params.data_bit_offset is the offset of the data in the > nal. More precisely (and doc should reflect this please), the Hantro skip is the distance in bits for data in the slice_segment_header() header syntax after 'slice_type'. The slice_segment_header_extension_length and bytes seems excluded from reading the reference code, we don't know if this is because this extended header is simply not supported or if it's being parsed by the HW. I believe we need to clarify this before merging the control. If dependent_slice_segment_flag is set, then this offsets seems to be 0. This fact also needs further investigation since this flag, as you mention, isn't passed and is needed to decide whether to parse or not the slice_type. Benjamin, I think we need some HW fact checking for all these, and finally better documentation. > > > Benjamin > > > > > Regards > > > > John Cox > > > > > +#endif > > > diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2- > > > controls.h > > > index 039c0d7add1b..ced7486c7f46 100644 > > > --- a/include/uapi/linux/v4l2-controls.h > > > +++ b/include/uapi/linux/v4l2-controls.h > > > @@ -209,6 +209,11 @@ enum v4l2_colorfx { > > > * We reserve 128 controls for this driver. > > > */ > > > #define V4L2_CID_USER_CCS_BASE (V4L2_CID_USER_BASE + > > > 0x10f0) > > > +/* > > > + * The base for HANTRO driver controls. > > > + * We reserve 32 controls for this driver. > > > + */ > > > +#define V4L2_CID_USER_HANTRO_BASE (V4L2_CID_USER_BASE + > > > 0x1170) > > > > > > /* MPEG-class control IDs */ > > > /* The MPEG controls are applicable to all codec controls >
diff --git a/include/uapi/linux/hantro-v4l2-controls.h b/include/uapi/linux/hantro-v4l2-controls.h new file mode 100644 index 000000000000..30b1999b7af3 --- /dev/null +++ b/include/uapi/linux/hantro-v4l2-controls.h @@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ + +#ifndef __UAPI_HANTRO_V4L2_CONYTROLS_H__ +#define __UAPI_HANTRO_V4L2_CONYTROLS_H__ + +#include <linux/v4l2-controls.h> +#include <media/hevc-ctrls.h> + +#define V4L2_CID_HANTRO_HEVC_EXTRA_DECODE_PARAMS (V4L2_CID_USER_HANTRO_BASE + 0) + +/** + * struct hantro_hevc_extra_decode_params - extra decode parameters for hantro driver + * @hevc_hdr_skip_lenght: header first bits offset + */ +struct hantro_hevc_extra_decode_params { + __u32 hevc_hdr_skip_lenght; + __u8 padding[4]; +}; + +#endif diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 039c0d7add1b..ced7486c7f46 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -209,6 +209,11 @@ enum v4l2_colorfx { * We reserve 128 controls for this driver. */ #define V4L2_CID_USER_CCS_BASE (V4L2_CID_USER_BASE + 0x10f0) +/* + * The base for HANTRO driver controls. + * We reserve 32 controls for this driver. + */ +#define V4L2_CID_USER_HANTRO_BASE (V4L2_CID_USER_BASE + 0x1170) /* MPEG-class control IDs */ /* The MPEG controls are applicable to all codec controls
The HEVC HANTRO driver needs to know the number of bits to skip at the beginning of the slice header. That is a hardware specific requirement so create a dedicated control that this purpose. Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> --- include/uapi/linux/hantro-v4l2-controls.h | 20 ++++++++++++++++++++ include/uapi/linux/v4l2-controls.h | 5 +++++ 2 files changed, 25 insertions(+) create mode 100644 include/uapi/linux/hantro-v4l2-controls.h