diff mbox series

[RFC,2/8] media: Add P010 format

Message ID 20220227144926.3006585-3-jernej.skrabec@gmail.com (mailing list archive)
State New, archived
Headers show
Series media: hantro: Add 10-bit support | expand

Commit Message

Jernej Škrabec Feb. 27, 2022, 2:49 p.m. UTC
Add P010 format, which is commonly used for 10-bit videos.

Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
---
 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(+)

Comments

Nicolas Dufresne Feb. 28, 2022, 12:48 p.m. UTC | #1
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/20210618131526.566762-5-benjamin.gaignard@collabora.com/

regards,
Nicolas

> 
> Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
> ---
>  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  */
Jernej Škrabec Feb. 28, 2022, 4:32 p.m. UTC | #2
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/
20210618131526.566762-5-benjamin.gaignard@collabora.com/

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 <jernej.skrabec@gmail.com>
> > ---
> >  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  */
> 
>
Nicolas Dufresne Feb. 28, 2022, 5:02 p.m. UTC | #3
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/
> 20210618131526.566762-5-benjamin.gaignard@collabora.com/
> 
> 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 <jernej.skrabec@gmail.com>
> > > ---
> > >  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  */
> > 
> > 
> 
>
Ezequiel Garcia April 4, 2022, 12:04 a.m. UTC | #4
Hi Nicolas, Benjamin,

On Mon, Feb 28, 2022 at 9:48 AM Nicolas Dufresne <nicolas@ndufresne.ca> 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/20210618131526.566762-5-benjamin.gaignard@collabora.com/
>

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
Benjamin Gaignard April 4, 2022, 9:02 a.m. UTC | #5
Le 04/04/2022 à 02:04, Ezequiel Garcia a écrit :
> Hi Nicolas, Benjamin,
>
> On Mon, Feb 28, 2022 at 9:48 AM Nicolas Dufresne <nicolas@ndufresne.ca> 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/20210618131526.566762-5-benjamin.gaignard@collabora.com/
>>
> 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
diff mbox series

Patch

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  */