diff mbox series

media: uapi: v4l: Don't expose generic metadata formats to userspace

Message ID 20240426153319.26872-1-laurent.pinchart@ideasonboard.com
State Accepted
Commit d69c8429ea80af02e89e5b3eecb78e417ad049c8
Headers show
Series Generic line based metadata, without sensor API changes | expand

Commit Message

Laurent Pinchart April 26, 2024, 3:33 p.m. UTC
The generic metadata pixel formats (V4L2_META_FMT_GENERIC_*) are meant
to be used in conjunction with device-specific media bus codes. Those
codes are work in progress and not available in the upstream kernel yet.
To make sure the generic metadata pixel formats won't be used by
userspace until we have the full infrastructure in place, keep their
definition private to the kernel for now.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
This patch can be squashed with "[PATCH v3 05/14] media: uapi: v4l: Add
generic 8-bit metadata format definitions" or kept separate.
---
 include/uapi/linux/videodev2.h | 2 ++
 1 file changed, 2 insertions(+)


base-commit: 5a6272f644afa3db2f00e77ff8b0ea9df51ea875

Comments

Tomi Valkeinen April 29, 2024, 7:05 a.m. UTC | #1
On 26/04/2024 18:33, Laurent Pinchart wrote:
> The generic metadata pixel formats (V4L2_META_FMT_GENERIC_*) are meant
> to be used in conjunction with device-specific media bus codes. Those
> codes are work in progress and not available in the upstream kernel yet.
> To make sure the generic metadata pixel formats won't be used by
> userspace until we have the full infrastructure in place, keep their
> definition private to the kernel for now.

Does it matter? How can the userspace use the generic formats, if no 
driver provides them?

  Tomi

> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
> This patch can be squashed with "[PATCH v3 05/14] media: uapi: v4l: Add
> generic 8-bit metadata format definitions" or kept separate.
> ---
>   include/uapi/linux/videodev2.h | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
> index f74aca14044f..1c0bb4f9ecac 100644
> --- a/include/uapi/linux/videodev2.h
> +++ b/include/uapi/linux/videodev2.h
> @@ -842,6 +842,7 @@ struct v4l2_pix_format {
>   #define V4L2_META_FMT_RK_ISP1_PARAMS	v4l2_fourcc('R', 'K', '1', 'P') /* Rockchip ISP1 3A Parameters */
>   #define V4L2_META_FMT_RK_ISP1_STAT_3A	v4l2_fourcc('R', 'K', '1', 'S') /* Rockchip ISP1 3A Statistics */
>   
> +#ifdef __KERNEL__
>   /*
>    * Line-based metadata formats. Remember to update v4l_fill_fmtdesc() when
>    * adding new ones!
> @@ -853,6 +854,7 @@ struct v4l2_pix_format {
>   #define V4L2_META_FMT_GENERIC_CSI2_16	v4l2_fourcc('M', 'C', '1', 'G') /* 16-bit CSI-2 packed 8-bit metadata */
>   #define V4L2_META_FMT_GENERIC_CSI2_20	v4l2_fourcc('M', 'C', '1', 'K') /* 20-bit CSI-2 packed 8-bit metadata */
>   #define V4L2_META_FMT_GENERIC_CSI2_24	v4l2_fourcc('M', 'C', '1', 'O') /* 24-bit CSI-2 packed 8-bit metadata */
> +#endif
>   
>   /* priv field value to indicates that subsequent fields are valid. */
>   #define V4L2_PIX_FMT_PRIV_MAGIC		0xfeedcafe
> 
> base-commit: 5a6272f644afa3db2f00e77ff8b0ea9df51ea875
Laurent Pinchart April 29, 2024, 8:33 a.m. UTC | #2
On Mon, Apr 29, 2024 at 10:05:15AM +0300, Tomi Valkeinen wrote:
> On 26/04/2024 18:33, Laurent Pinchart wrote:
> > The generic metadata pixel formats (V4L2_META_FMT_GENERIC_*) are meant
> > to be used in conjunction with device-specific media bus codes. Those
> > codes are work in progress and not available in the upstream kernel yet.
> > To make sure the generic metadata pixel formats won't be used by
> > userspace until we have the full infrastructure in place, keep their
> > definition private to the kernel for now.
> 
> Does it matter? How can the userspace use the generic formats, if no 
> driver provides them?

I agree with you, but this series generated some level of discomfort and
voices were raised that the generic formats could be abused. Sakari and
I don't believe that's the case, but because only part of the puzzle has
been submitted for v6.10 (the device-specific media bus codes will be
for v6.11 - if all goes well), I can understand that the big picture may
appear a bit confusing for people who haven't followed the development.

I expect this patch to be reverted for v6.11.

> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > ---
> > This patch can be squashed with "[PATCH v3 05/14] media: uapi: v4l: Add
> > generic 8-bit metadata format definitions" or kept separate.
> > ---
> >   include/uapi/linux/videodev2.h | 2 ++
> >   1 file changed, 2 insertions(+)
> > 
> > diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
> > index f74aca14044f..1c0bb4f9ecac 100644
> > --- a/include/uapi/linux/videodev2.h
> > +++ b/include/uapi/linux/videodev2.h
> > @@ -842,6 +842,7 @@ struct v4l2_pix_format {
> >   #define V4L2_META_FMT_RK_ISP1_PARAMS	v4l2_fourcc('R', 'K', '1', 'P') /* Rockchip ISP1 3A Parameters */
> >   #define V4L2_META_FMT_RK_ISP1_STAT_3A	v4l2_fourcc('R', 'K', '1', 'S') /* Rockchip ISP1 3A Statistics */
> >   
> > +#ifdef __KERNEL__
> >   /*
> >    * Line-based metadata formats. Remember to update v4l_fill_fmtdesc() when
> >    * adding new ones!
> > @@ -853,6 +854,7 @@ struct v4l2_pix_format {
> >   #define V4L2_META_FMT_GENERIC_CSI2_16	v4l2_fourcc('M', 'C', '1', 'G') /* 16-bit CSI-2 packed 8-bit metadata */
> >   #define V4L2_META_FMT_GENERIC_CSI2_20	v4l2_fourcc('M', 'C', '1', 'K') /* 20-bit CSI-2 packed 8-bit metadata */
> >   #define V4L2_META_FMT_GENERIC_CSI2_24	v4l2_fourcc('M', 'C', '1', 'O') /* 24-bit CSI-2 packed 8-bit metadata */
> > +#endif
> >   
> >   /* priv field value to indicates that subsequent fields are valid. */
> >   #define V4L2_PIX_FMT_PRIV_MAGIC		0xfeedcafe
> > 
> > base-commit: 5a6272f644afa3db2f00e77ff8b0ea9df51ea875
diff mbox series

Patch

diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index f74aca14044f..1c0bb4f9ecac 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -842,6 +842,7 @@  struct v4l2_pix_format {
 #define V4L2_META_FMT_RK_ISP1_PARAMS	v4l2_fourcc('R', 'K', '1', 'P') /* Rockchip ISP1 3A Parameters */
 #define V4L2_META_FMT_RK_ISP1_STAT_3A	v4l2_fourcc('R', 'K', '1', 'S') /* Rockchip ISP1 3A Statistics */
 
+#ifdef __KERNEL__
 /*
  * Line-based metadata formats. Remember to update v4l_fill_fmtdesc() when
  * adding new ones!
@@ -853,6 +854,7 @@  struct v4l2_pix_format {
 #define V4L2_META_FMT_GENERIC_CSI2_16	v4l2_fourcc('M', 'C', '1', 'G') /* 16-bit CSI-2 packed 8-bit metadata */
 #define V4L2_META_FMT_GENERIC_CSI2_20	v4l2_fourcc('M', 'C', '1', 'K') /* 20-bit CSI-2 packed 8-bit metadata */
 #define V4L2_META_FMT_GENERIC_CSI2_24	v4l2_fourcc('M', 'C', '1', 'O') /* 24-bit CSI-2 packed 8-bit metadata */
+#endif
 
 /* priv field value to indicates that subsequent fields are valid. */
 #define V4L2_PIX_FMT_PRIV_MAGIC		0xfeedcafe