2023-03-24 15:15:36

by Paul Kocialkowski

[permalink] [raw]
Subject: [PATCH 2/9] media: v4l2: Add NV12_16L16 pixel format to v4l2 format info

Represent the NV12_16L16 pixel format in the v4l2 format info table.
This is a 16x16 tiled version of NV12.

Signed-off-by: Paul Kocialkowski <[email protected]>
---
drivers/media/v4l2-core/v4l2-common.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c
index 3d044b31caad..5101989716aa 100644
--- a/drivers/media/v4l2-core/v4l2-common.c
+++ b/drivers/media/v4l2-core/v4l2-common.c
@@ -280,6 +280,8 @@ const struct v4l2_format_info *v4l2_format_info(u32 format)
/* Tiled YUV formats */
{ .format = V4L2_PIX_FMT_NV12_4L4, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 2, .vdiv = 2 },
{ .format = V4L2_PIX_FMT_P010_4L4, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 2, 4, 0, 0 }, .hdiv = 2, .vdiv = 2 },
+ { .format = V4L2_PIX_FMT_NV12_16L16, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 2, .vdiv = 2,
+ .block_w = { 16, 16, 0, 0 }, .block_h = { 16, 16, 0, 0 } },

/* YUV planar formats, non contiguous variant */
{ .format = V4L2_PIX_FMT_YUV420M, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 3, .comp_planes = 3, .bpp = { 1, 1, 1, 0 }, .hdiv = 2, .vdiv = 2 },
--
2.39.2


2023-03-25 07:07:42

by Jernej Škrabec

[permalink] [raw]
Subject: Re: [PATCH 2/9] media: v4l2: Add NV12_16L16 pixel format to v4l2 format info

Dne petek, 24. marec 2023 ob 16:12:21 CET je Paul Kocialkowski napisal(a):
> Represent the NV12_16L16 pixel format in the v4l2 format info table.
> This is a 16x16 tiled version of NV12.
>
> Signed-off-by: Paul Kocialkowski <[email protected]>

Reviewed-by: Jernej Skrabec <[email protected]>

Best regards,
Jernej


2023-03-25 21:25:41

by Laurent Pinchart

[permalink] [raw]
Subject: Re: [PATCH 2/9] media: v4l2: Add NV12_16L16 pixel format to v4l2 format info

Hi Paul,

Thank you for the patch.

On Fri, Mar 24, 2023 at 04:12:21PM +0100, Paul Kocialkowski wrote:
> Represent the NV12_16L16 pixel format in the v4l2 format info table.
> This is a 16x16 tiled version of NV12.
>
> Signed-off-by: Paul Kocialkowski <[email protected]>
> ---
> drivers/media/v4l2-core/v4l2-common.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c
> index 3d044b31caad..5101989716aa 100644
> --- a/drivers/media/v4l2-core/v4l2-common.c
> +++ b/drivers/media/v4l2-core/v4l2-common.c
> @@ -280,6 +280,8 @@ const struct v4l2_format_info *v4l2_format_info(u32 format)
> /* Tiled YUV formats */
> { .format = V4L2_PIX_FMT_NV12_4L4, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 2, .vdiv = 2 },
> { .format = V4L2_PIX_FMT_P010_4L4, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 2, 4, 0, 0 }, .hdiv = 2, .vdiv = 2 },
> + { .format = V4L2_PIX_FMT_NV12_16L16, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 2, .vdiv = 2,
> + .block_w = { 16, 16, 0, 0 }, .block_h = { 16, 16, 0, 0 } },

Not necessarily related to this patch, but I'm a bit puzzled by why
V4L2_PIX_FMT_NV12_4L4 doesn't list block sizes.

>
> /* YUV planar formats, non contiguous variant */
> { .format = V4L2_PIX_FMT_YUV420M, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 3, .comp_planes = 3, .bpp = { 1, 1, 1, 0 }, .hdiv = 2, .vdiv = 2 },

--
Regards,

Laurent Pinchart

2023-03-31 18:59:29

by Nicolas Dufresne

[permalink] [raw]
Subject: Re: [PATCH 2/9] media: v4l2: Add NV12_16L16 pixel format to v4l2 format info

Le samedi 25 mars 2023 à 23:01 +0200, Laurent Pinchart a écrit :
> Hi Paul,
>
> Thank you for the patch.
>
> On Fri, Mar 24, 2023 at 04:12:21PM +0100, Paul Kocialkowski wrote:
> > Represent the NV12_16L16 pixel format in the v4l2 format info table.
> > This is a 16x16 tiled version of NV12.
> >
> > Signed-off-by: Paul Kocialkowski <[email protected]>
> > ---
> > drivers/media/v4l2-core/v4l2-common.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c
> > index 3d044b31caad..5101989716aa 100644
> > --- a/drivers/media/v4l2-core/v4l2-common.c
> > +++ b/drivers/media/v4l2-core/v4l2-common.c
> > @@ -280,6 +280,8 @@ const struct v4l2_format_info *v4l2_format_info(u32 format)
> > /* Tiled YUV formats */
> > { .format = V4L2_PIX_FMT_NV12_4L4, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 2, .vdiv = 2 },
> > { .format = V4L2_PIX_FMT_P010_4L4, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 2, 4, 0, 0 }, .hdiv = 2, .vdiv = 2 },
> > + { .format = V4L2_PIX_FMT_NV12_16L16, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 2, .vdiv = 2,
> > + .block_w = { 16, 16, 0, 0 }, .block_h = { 16, 16, 0, 0 } },
>
> Not necessarily related to this patch, but I'm a bit puzzled by why
> V4L2_PIX_FMT_NV12_4L4 doesn't list block sizes.

It looks like Ezequiel introduced that initially, but didn't introduce any tiled
format, as a side effect, we missed it and no one ever used it.

In practice, its not dramatic, since most of the time, the alignment needed is
bigger then the block (specially with only 4x4 tiles), but we should certainly
fix that, thanks for spotting.

>
> >
> > /* YUV planar formats, non contiguous variant */
> > { .format = V4L2_PIX_FMT_YUV420M, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 3, .comp_planes = 3, .bpp = { 1, 1, 1, 0 }, .hdiv = 2, .vdiv = 2 },
>

2023-04-05 04:49:18

by Laurent Pinchart

[permalink] [raw]
Subject: Re: [PATCH 2/9] media: v4l2: Add NV12_16L16 pixel format to v4l2 format info

Hi Nicolas,

On Fri, Mar 31, 2023 at 02:54:20PM -0400, Nicolas Dufresne wrote:
> Le samedi 25 mars 2023 à 23:01 +0200, Laurent Pinchart a écrit :
> > On Fri, Mar 24, 2023 at 04:12:21PM +0100, Paul Kocialkowski wrote:
> > > Represent the NV12_16L16 pixel format in the v4l2 format info table.
> > > This is a 16x16 tiled version of NV12.
> > >
> > > Signed-off-by: Paul Kocialkowski <[email protected]>
> > > ---
> > > drivers/media/v4l2-core/v4l2-common.c | 2 ++
> > > 1 file changed, 2 insertions(+)
> > >
> > > diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c
> > > index 3d044b31caad..5101989716aa 100644
> > > --- a/drivers/media/v4l2-core/v4l2-common.c
> > > +++ b/drivers/media/v4l2-core/v4l2-common.c
> > > @@ -280,6 +280,8 @@ const struct v4l2_format_info *v4l2_format_info(u32 format)
> > > /* Tiled YUV formats */
> > > { .format = V4L2_PIX_FMT_NV12_4L4, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 2, .vdiv = 2 },
> > > { .format = V4L2_PIX_FMT_P010_4L4, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 2, 4, 0, 0 }, .hdiv = 2, .vdiv = 2 },
> > > + { .format = V4L2_PIX_FMT_NV12_16L16, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 2, .vdiv = 2,
> > > + .block_w = { 16, 16, 0, 0 }, .block_h = { 16, 16, 0, 0 } },
> >
> > Not necessarily related to this patch, but I'm a bit puzzled by why
> > V4L2_PIX_FMT_NV12_4L4 doesn't list block sizes.
>
> It looks like Ezequiel introduced that initially, but didn't introduce any tiled
> format, as a side effect, we missed it and no one ever used it.
>
> In practice, its not dramatic, since most of the time, the alignment needed is
> bigger then the block (specially with only 4x4 tiles), but we should certainly
> fix that, thanks for spotting.

Just to make sure this won't fall through the cracks, will you send a
patch ?

> > >
> > > /* YUV planar formats, non contiguous variant */
> > > { .format = V4L2_PIX_FMT_YUV420M, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 3, .comp_planes = 3, .bpp = { 1, 1, 1, 0 }, .hdiv = 2, .vdiv = 2 },

--
Regards,

Laurent Pinchart

2023-04-11 13:05:48

by Nicolas Dufresne

[permalink] [raw]
Subject: Re: [PATCH 2/9] media: v4l2: Add NV12_16L16 pixel format to v4l2 format info

Hi Laurent,

Le mer. 5 avr. 2023, 00 h 21, Laurent Pinchart
<[email protected]> a écrit :
> Hi Nicolas,
>
> On Fri, Mar 31, 2023 at 02:54:20PM -0400, Nicolas Dufresne wrote:
> > Le samedi 25 mars 2023 à 23:01 +0200, Laurent Pinchart a écrit :
> > > On Fri, Mar 24, 2023 at 04:12:21PM +0100, Paul Kocialkowski wrote:
> > > > Represent the NV12_16L16 pixel format in the v4l2 format info table.
> > > > This is a 16x16 tiled version of NV12.
> > > >
> > > > Signed-off-by: Paul Kocialkowski <[email protected]>
> > > > ---
> > > >  drivers/media/v4l2-core/v4l2-common.c | 2 ++
> > > >  1 file changed, 2 insertions(+)
> > > >
> > > > diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-
core/v4l2-common.c
> > > > index 3d044b31caad..5101989716aa 100644
> > > > --- a/drivers/media/v4l2-core/v4l2-common.c
> > > > +++ b/drivers/media/v4l2-core/v4l2-common.c
> > > > @@ -280,6 +280,8 @@ const struct v4l2_format_info *v4l2_format_info(u32
format)
> > > >           /* Tiled YUV formats */
> > > >           { .format = V4L2_PIX_FMT_NV12_4L4, .pixel_enc =
V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 },
.hdiv = 2, .vdiv = 2 },
> > > >           { .format = V4L2_PIX_FMT_P010_4L4, .pixel_enc =
V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 2, 4, 0, 0 },
.hdiv = 2, .vdiv = 2 },
> > > > +         { .format = V4L2_PIX_FMT_NV12_16L16,    .pixel_enc =
V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 },
.hdiv = 2, .vdiv = 2,
> > > > +           .block_w = { 16, 16, 0, 0 }, .block_h = { 16, 16, 0, 0 } },
> > >
> > > Not necessarily related to this patch, but I'm a bit puzzled by why
> > > V4L2_PIX_FMT_NV12_4L4 doesn't list block sizes.
> >
> > It looks like Ezequiel introduced that initially, but didn't introduce any
tiled
> > format, as a side effect, we missed it and no one ever used it.
> >
> > In practice, its not dramatic, since most of the time, the alignment needed
is
> > bigger then the block (specially with only 4x4 tiles), but we should
certainly
> > fix that, thanks for spotting.
>
> Just to make sure this won't fall through the cracks, will you send a
> patch ?

I didn't had any immediate plan to fix it (lack of time, absence of related
bugs). Andrzej, do you happen to have some time ? The SUNXI pixel format should
have that too, along with some NXP format.

regards,
Nicolas
>
> > > > 
> > > >           /* YUV planar formats, non contiguous variant */
> > > >           { .format = V4L2_PIX_FMT_YUV420M, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 3, .comp_planes = 3, .bpp = { 1, 1, 1, 0 }, .hdiv = 2, .vdiv = 2 },
>
> --
> Regards,
>
> Laurent Pinchart

2023-04-11 15:49:26

by Nicolas Dufresne

[permalink] [raw]
Subject: Re: [PATCH 2/9] media: v4l2: Add NV12_16L16 pixel format to v4l2 format info

Le vendredi 24 mars 2023 à 16:12 +0100, Paul Kocialkowski a écrit :
> Represent the NV12_16L16 pixel format in the v4l2 format info table.
> This is a 16x16 tiled version of NV12.
>
> Signed-off-by: Paul Kocialkowski <[email protected]>

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

> ---
> drivers/media/v4l2-core/v4l2-common.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c
> index 3d044b31caad..5101989716aa 100644
> --- a/drivers/media/v4l2-core/v4l2-common.c
> +++ b/drivers/media/v4l2-core/v4l2-common.c
> @@ -280,6 +280,8 @@ const struct v4l2_format_info *v4l2_format_info(u32 format)
> /* Tiled YUV formats */
> { .format = V4L2_PIX_FMT_NV12_4L4, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 2, .vdiv = 2 },
> { .format = V4L2_PIX_FMT_P010_4L4, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 2, 4, 0, 0 }, .hdiv = 2, .vdiv = 2 },
> + { .format = V4L2_PIX_FMT_NV12_16L16, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 2, .vdiv = 2,
> + .block_w = { 16, 16, 0, 0 }, .block_h = { 16, 16, 0, 0 } },
>
> /* YUV planar formats, non contiguous variant */
> { .format = V4L2_PIX_FMT_YUV420M, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 3, .comp_planes = 3, .bpp = { 1, 1, 1, 0 }, .hdiv = 2, .vdiv = 2 },