2022-02-27 16:30:57

by Jernej Škrabec

[permalink] [raw]
Subject: [RFC PATCH 2/8] media: Add P010 format

Add P010 format, which is commonly used for 10-bit videos.

Signed-off-by: Jernej Skrabec <[email protected]>
---
drivers/media/v4l2-core/v4l2-common.c | 2 ++
drivers/media/v4l2-core/v4l2-ioctl.c | 1 +
include/uapi/linux/videodev2.h | 1 +
3 files changed, 4 insertions(+)

diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c
index 1db0020e08c0..4ede36546e9c 100644
--- a/drivers/media/v4l2-core/v4l2-common.c
+++ b/drivers/media/v4l2-core/v4l2-common.c
@@ -275,6 +275,8 @@ const struct v4l2_format_info *v4l2_format_info(u32 format)
{ .format = V4L2_PIX_FMT_YUV422P, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 3, .bpp = { 1, 1, 1, 0 }, .hdiv = 2, .vdiv = 1 },
{ .format = V4L2_PIX_FMT_GREY, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 1, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 },

+ { .format = V4L2_PIX_FMT_P010, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 2, 4, 0, 0 }, .hdiv = 2, .vdiv = 2 },
+
/* 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 },
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
index 048f326c57b9..a8d999e23e5b 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -1295,6 +1295,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
case V4L2_PIX_FMT_M420: descr = "YUV 4:2:0 (M420)"; break;
case V4L2_PIX_FMT_NV12: descr = "Y/CbCr 4:2:0"; break;
case V4L2_PIX_FMT_NV21: descr = "Y/CrCb 4:2:0"; break;
+ case V4L2_PIX_FMT_P010: descr = "10-bit Y/CbCr 4:2:0"; break;
case V4L2_PIX_FMT_NV16: descr = "Y/CbCr 4:2:2"; break;
case V4L2_PIX_FMT_NV61: descr = "Y/CrCb 4:2:2"; break;
case V4L2_PIX_FMT_NV24: descr = "Y/CbCr 4:4:4"; break;
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 772dbadd1a24..211bc11a48cb 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -597,6 +597,7 @@ struct v4l2_pix_format {
/* two planes -- one Y, one Cr + Cb interleaved */
#define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 */
#define V4L2_PIX_FMT_NV21 v4l2_fourcc('N', 'V', '2', '1') /* 12 Y/CrCb 4:2:0 */
+#define V4L2_PIX_FMT_P010 v4l2_fourcc('P', '0', '1', '0') /* 24 Y/CbCr 4:2:0 10-bit */
#define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6') /* 16 Y/CbCr 4:2:2 */
#define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') /* 16 Y/CrCb 4:2:2 */
#define V4L2_PIX_FMT_NV24 v4l2_fourcc('N', 'V', '2', '4') /* 24 Y/CbCr 4:4:4 */
--
2.35.1


2022-02-28 13:20:35

by Nicolas Dufresne

[permalink] [raw]
Subject: Re: [RFC PATCH 2/8] media: Add P010 format

Le dimanche 27 février 2022 à 15:49 +0100, Jernej Skrabec a écrit :
> Add P010 format, which is commonly used for 10-bit videos.

There is a much more complete patch that was sent previously (with documentation
and all):

https://patchwork.kernel.org/project/linux-rockchip/patch/[email protected]/

regards,
Nicolas

>
> Signed-off-by: Jernej Skrabec <[email protected]>
> ---
> drivers/media/v4l2-core/v4l2-common.c | 2 ++
> drivers/media/v4l2-core/v4l2-ioctl.c | 1 +
> include/uapi/linux/videodev2.h | 1 +
> 3 files changed, 4 insertions(+)
>
> diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c
> index 1db0020e08c0..4ede36546e9c 100644
> --- a/drivers/media/v4l2-core/v4l2-common.c
> +++ b/drivers/media/v4l2-core/v4l2-common.c
> @@ -275,6 +275,8 @@ const struct v4l2_format_info *v4l2_format_info(u32 format)
> { .format = V4L2_PIX_FMT_YUV422P, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 3, .bpp = { 1, 1, 1, 0 }, .hdiv = 2, .vdiv = 1 },
> { .format = V4L2_PIX_FMT_GREY, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 1, 0, 0, 0 }, .hdiv = 1, .vdiv = 1 },
>
> + { .format = V4L2_PIX_FMT_P010, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 2, 4, 0, 0 }, .hdiv = 2, .vdiv = 2 },
> +
> /* 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 },
> diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
> index 048f326c57b9..a8d999e23e5b 100644
> --- a/drivers/media/v4l2-core/v4l2-ioctl.c
> +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
> @@ -1295,6 +1295,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
> case V4L2_PIX_FMT_M420: descr = "YUV 4:2:0 (M420)"; break;
> case V4L2_PIX_FMT_NV12: descr = "Y/CbCr 4:2:0"; break;
> case V4L2_PIX_FMT_NV21: descr = "Y/CrCb 4:2:0"; break;
> + case V4L2_PIX_FMT_P010: descr = "10-bit Y/CbCr 4:2:0"; break;
> case V4L2_PIX_FMT_NV16: descr = "Y/CbCr 4:2:2"; break;
> case V4L2_PIX_FMT_NV61: descr = "Y/CrCb 4:2:2"; break;
> case V4L2_PIX_FMT_NV24: descr = "Y/CbCr 4:4:4"; break;
> diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
> index 772dbadd1a24..211bc11a48cb 100644
> --- a/include/uapi/linux/videodev2.h
> +++ b/include/uapi/linux/videodev2.h
> @@ -597,6 +597,7 @@ struct v4l2_pix_format {
> /* two planes -- one Y, one Cr + Cb interleaved */
> #define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 */
> #define V4L2_PIX_FMT_NV21 v4l2_fourcc('N', 'V', '2', '1') /* 12 Y/CrCb 4:2:0 */
> +#define V4L2_PIX_FMT_P010 v4l2_fourcc('P', '0', '1', '0') /* 24 Y/CbCr 4:2:0 10-bit */
> #define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6') /* 16 Y/CbCr 4:2:2 */
> #define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') /* 16 Y/CrCb 4:2:2 */
> #define V4L2_PIX_FMT_NV24 v4l2_fourcc('N', 'V', '2', '4') /* 24 Y/CbCr 4:4:4 */

2022-02-28 17:34:12

by Jernej Škrabec

[permalink] [raw]
Subject: Re: Re: [RFC PATCH 2/8] media: Add P010 format

Dne ponedeljek, 28. februar 2022 ob 13:48:53 CET je Nicolas Dufresne
napisal(a):
> Le dimanche 27 f?vrier 2022 ? 15:49 +0100, Jernej Skrabec a ?crit :
> > Add P010 format, which is commonly used for 10-bit videos.
>
> There is a much more complete patch that was sent previously (with
documentation
> and all):
>
> https://patchwork.kernel.org/project/linux-rockchip/patch/
[email protected]/

Great, I'll take it for next revision. Although I'm not sure what "much more
complete" means. Only additional thing is documentation.

Best regards,
Jernej

>
> regards,
> Nicolas
>
> >
> > Signed-off-by: Jernej Skrabec <[email protected]>
> > ---
> > drivers/media/v4l2-core/v4l2-common.c | 2 ++
> > drivers/media/v4l2-core/v4l2-ioctl.c | 1 +
> > include/uapi/linux/videodev2.h | 1 +
> > 3 files changed, 4 insertions(+)
> >
> > diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-
core/v4l2-common.c
> > index 1db0020e08c0..4ede36546e9c 100644
> > --- a/drivers/media/v4l2-core/v4l2-common.c
> > +++ b/drivers/media/v4l2-core/v4l2-common.c
> > @@ -275,6 +275,8 @@ const struct v4l2_format_info *v4l2_format_info(u32
format)
> > { .format = V4L2_PIX_FMT_YUV422P, .pixel_enc =
V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 3, .bpp = { 1, 1, 1, 0 },
.hdiv = 2, .vdiv = 1 },
> > { .format = V4L2_PIX_FMT_GREY, .pixel_enc =
V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 1, 0, 0, 0 },
.hdiv = 1, .vdiv = 1 },
> >
> > + { .format = V4L2_PIX_FMT_P010, .pixel_enc =
V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 2, 4, 0, 0 },
.hdiv = 2, .vdiv = 2 },
> > +
> > /* 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 },
> > diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-
core/v4l2-ioctl.c
> > index 048f326c57b9..a8d999e23e5b 100644
> > --- a/drivers/media/v4l2-core/v4l2-ioctl.c
> > +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
> > @@ -1295,6 +1295,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc
*fmt)
> > case V4L2_PIX_FMT_M420: descr = "YUV 4:2:0
(M420)"; break;
> > case V4L2_PIX_FMT_NV12: descr = "Y/CbCr 4:2:0"; break;
> > case V4L2_PIX_FMT_NV21: descr = "Y/CrCb 4:2:0"; break;
> > + case V4L2_PIX_FMT_P010: descr = "10-bit Y/CbCr 4:2:0";
break;
> > case V4L2_PIX_FMT_NV16: descr = "Y/CbCr 4:2:2"; break;
> > case V4L2_PIX_FMT_NV61: descr = "Y/CrCb 4:2:2"; break;
> > case V4L2_PIX_FMT_NV24: descr = "Y/CbCr 4:4:4"; break;
> > diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/
videodev2.h
> > index 772dbadd1a24..211bc11a48cb 100644
> > --- a/include/uapi/linux/videodev2.h
> > +++ b/include/uapi/linux/videodev2.h
> > @@ -597,6 +597,7 @@ struct v4l2_pix_format {
> > /* two planes -- one Y, one Cr + Cb interleaved */
> > #define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') /* 12 Y/CbCr
4:2:0 */
> > #define V4L2_PIX_FMT_NV21 v4l2_fourcc('N', 'V', '2', '1') /* 12 Y/CrCb
4:2:0 */
> > +#define V4L2_PIX_FMT_P010 v4l2_fourcc('P', '0', '1', '0') /* 24 Y/CbCr
4:2:0 10-bit */
> > #define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6') /* 16 Y/CbCr
4:2:2 */
> > #define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') /* 16 Y/CrCb
4:2:2 */
> > #define V4L2_PIX_FMT_NV24 v4l2_fourcc('N', 'V', '2', '4') /* 24 Y/CbCr
4:4:4 */
>
>


2022-02-28 17:54:27

by Nicolas Dufresne

[permalink] [raw]
Subject: Re: Re: [RFC PATCH 2/8] media: Add P010 format

Le lundi 28 février 2022 à 17:32 +0100, Jernej Škrabec a écrit :
> Dne ponedeljek, 28. februar 2022 ob 13:48:53 CET je Nicolas Dufresne
> napisal(a):
> > Le dimanche 27 février 2022 à 15:49 +0100, Jernej Skrabec a écrit :
> > > Add P010 format, which is commonly used for 10-bit videos.
> >
> > There is a much more complete patch that was sent previously (with
> documentation
> > and all):
> >
> > https://patchwork.kernel.org/project/linux-rockchip/patch/
> [email protected]/
>
> Great, I'll take it for next revision. Although I'm not sure what "much more
> complete" means. Only additional thing is documentation.

When adding uAPI, doc is really important, so having the format documented means
the other patch is "much more" ready to be merged.

cheers,
Nicolas

>
> Best regards,
> Jernej
>
> >
> > regards,
> > Nicolas
> >
> > >
> > > Signed-off-by: Jernej Skrabec <[email protected]>
> > > ---
> > > drivers/media/v4l2-core/v4l2-common.c | 2 ++
> > > drivers/media/v4l2-core/v4l2-ioctl.c | 1 +
> > > include/uapi/linux/videodev2.h | 1 +
> > > 3 files changed, 4 insertions(+)
> > >
> > > diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-
> core/v4l2-common.c
> > > index 1db0020e08c0..4ede36546e9c 100644
> > > --- a/drivers/media/v4l2-core/v4l2-common.c
> > > +++ b/drivers/media/v4l2-core/v4l2-common.c
> > > @@ -275,6 +275,8 @@ const struct v4l2_format_info *v4l2_format_info(u32
> format)
> > > { .format = V4L2_PIX_FMT_YUV422P, .pixel_enc =
> V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 3, .bpp = { 1, 1, 1, 0 },
> .hdiv = 2, .vdiv = 1 },
> > > { .format = V4L2_PIX_FMT_GREY, .pixel_enc =
> V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 1, 0, 0, 0 },
> .hdiv = 1, .vdiv = 1 },
> > >
> > > + { .format = V4L2_PIX_FMT_P010, .pixel_enc =
> V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 2, 4, 0, 0 },
> .hdiv = 2, .vdiv = 2 },
> > > +
> > > /* 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 },
> > > diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-
> core/v4l2-ioctl.c
> > > index 048f326c57b9..a8d999e23e5b 100644
> > > --- a/drivers/media/v4l2-core/v4l2-ioctl.c
> > > +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
> > > @@ -1295,6 +1295,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc
> *fmt)
> > > case V4L2_PIX_FMT_M420: descr = "YUV 4:2:0
> (M420)"; break;
> > > case V4L2_PIX_FMT_NV12: descr = "Y/CbCr 4:2:0"; break;
> > > case V4L2_PIX_FMT_NV21: descr = "Y/CrCb 4:2:0"; break;
> > > + case V4L2_PIX_FMT_P010: descr = "10-bit Y/CbCr 4:2:0";
> break;
> > > case V4L2_PIX_FMT_NV16: descr = "Y/CbCr 4:2:2"; break;
> > > case V4L2_PIX_FMT_NV61: descr = "Y/CrCb 4:2:2"; break;
> > > case V4L2_PIX_FMT_NV24: descr = "Y/CbCr 4:4:4"; break;
> > > diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/
> videodev2.h
> > > index 772dbadd1a24..211bc11a48cb 100644
> > > --- a/include/uapi/linux/videodev2.h
> > > +++ b/include/uapi/linux/videodev2.h
> > > @@ -597,6 +597,7 @@ struct v4l2_pix_format {
> > > /* two planes -- one Y, one Cr + Cb interleaved */
> > > #define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') /* 12 Y/CbCr
> 4:2:0 */
> > > #define V4L2_PIX_FMT_NV21 v4l2_fourcc('N', 'V', '2', '1') /* 12 Y/CrCb
> 4:2:0 */
> > > +#define V4L2_PIX_FMT_P010 v4l2_fourcc('P', '0', '1', '0') /* 24 Y/CbCr
> 4:2:0 10-bit */
> > > #define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6') /* 16 Y/CbCr
> 4:2:2 */
> > > #define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') /* 16 Y/CrCb
> 4:2:2 */
> > > #define V4L2_PIX_FMT_NV24 v4l2_fourcc('N', 'V', '2', '4') /* 24 Y/CbCr
> 4:4:4 */
> >
> >
>
>

2022-04-05 00:34:33

by Benjamin Gaignard

[permalink] [raw]
Subject: Re: [RFC PATCH 2/8] media: Add P010 format


Le 04/04/2022 à 02:04, Ezequiel Garcia a écrit :
> Hi Nicolas, Benjamin,
>
> On Mon, Feb 28, 2022 at 9:48 AM Nicolas Dufresne <[email protected]> wrote:
>> Le dimanche 27 février 2022 à 15:49 +0100, Jernej Skrabec a écrit :
>>> Add P010 format, which is commonly used for 10-bit videos.
>> There is a much more complete patch that was sent previously (with documentation
>> and all):
>>
>> https://patchwork.kernel.org/project/linux-rockchip/patch/[email protected]/
>>
> I believe "media: Add P010 video format" should be good to go, I think
> we could merge it.
>
> I can't find it on my gmail inbox, for some reason.. can you guys
> please repost it,
> and/or reply to with a gently ping for Hans (and please Cc me on this mail) ?

I have rebased it on v5-18-rc1 tag and send it.
You should have it in your mailbox now.

Regards,
Benjamin

>
> Thanks!
> Ezequiel

2022-04-05 02:02:15

by Ezequiel Garcia

[permalink] [raw]
Subject: Re: [RFC PATCH 2/8] media: Add P010 format

Hi Nicolas, Benjamin,

On Mon, Feb 28, 2022 at 9:48 AM Nicolas Dufresne <[email protected]> wrote:
>
> Le dimanche 27 février 2022 à 15:49 +0100, Jernej Skrabec a écrit :
> > Add P010 format, which is commonly used for 10-bit videos.
>
> There is a much more complete patch that was sent previously (with documentation
> and all):
>
> https://patchwork.kernel.org/project/linux-rockchip/patch/[email protected]/
>

I believe "media: Add P010 video format" should be good to go, I think
we could merge it.

I can't find it on my gmail inbox, for some reason.. can you guys
please repost it,
and/or reply to with a gently ping for Hans (and please Cc me on this mail) ?

Thanks!
Ezequiel