linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Ezequiel Garcia <ezequiel@collabora.com>, linux-media@vger.kernel.org
Cc: Paul Kocialkowski <paul.kocialkowski@bootlin.com>,
	Yong Deng <yong.deng@magewell.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Nicolas Dufresne <nicolas.dufresne@collabora.com>
Subject: Re: [PATCH v2 3/4] media: Add NV12_4L4 tiled format
Date: Wed, 4 Aug 2021 12:05:25 +0200	[thread overview]
Message-ID: <41fdaecb-7637-3bb1-b224-4eba7c3a8acd@xs4all.nl> (raw)
In-Reply-To: <20210727145745.25203-4-ezequiel@collabora.com>

On 27/07/2021 16:57, Ezequiel Garcia wrote:
> This format is produced by VeriSilicon Hantro G2 and VC8000D cores.
> It is a simple 4x4 tiling layout in a linear way.
> 
> The pixel format was introduced by GStreamer using FourCC VT12,
> so let's stick to it.
> 
> Link: https://gstreamer.freedesktop.org/documentation/video/video-format.html
> Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
> ---
>  Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst | 6 ++++++
>  drivers/media/v4l2-core/v4l2-common.c                       | 3 +++
>  drivers/media/v4l2-core/v4l2-ioctl.c                        | 1 +
>  include/uapi/linux/videodev2.h                              | 1 +
>  4 files changed, 11 insertions(+)
> 
> diff --git a/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst b/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst
> index 884828f2272c..0fc74351605a 100644
> --- a/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst
> +++ b/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst
> @@ -254,6 +254,7 @@ of the luma plane.
>  
>  .. _V4L2-PIX-FMT-NV12MT:
>  .. _V4L2-PIX-FMT-NV12MT-16X16:
> +.. _V4L2-PIX-FMT-NV12-4L4:
>  .. _V4L2-PIX-FMT-NV12-16L16:
>  .. _V4L2-PIX-FMT-NV12-32L32:
>  
> @@ -279,6 +280,11 @@ If the vertical resolution is an odd number of macroblocks, the last row of
>  macroblocks is stored in linear order. The layouts of the luma and chroma
>  planes are identical.
>  
> +``V4L2_PIX_FMT_NV12_4L4`` stores pixel in 4x4 tiles, and stores
> +tiles linearly in memory. The line stride and image height must be
> +aligned to a multiple of 4. The layouts of the luma and chroma planes are
> +identical.
> +
>  ``V4L2_PIX_FMT_NV12_16L16`` stores pixel in 16x16 tiles, and stores
>  tiles linearly in memory. The line stride and image height must be
>  aligned to a multiple of 16. The layouts of the luma and chroma planes are
> diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c
> index 04af03285a20..df34b2a283bc 100644
> --- a/drivers/media/v4l2-core/v4l2-common.c
> +++ b/drivers/media/v4l2-core/v4l2-common.c
> @@ -275,6 +275,9 @@ 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 },
>  
> +		/* 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 },
> +
>  		/* 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 },
>  		{ .format = V4L2_PIX_FMT_YVU420M, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 3, .comp_planes = 3, .bpp = { 1, 1, 1, 0 }, .hdiv = 2, .vdiv = 2 },
> diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
> index 9a4195dcd2aa..00c15630fc60 100644
> --- a/drivers/media/v4l2-core/v4l2-ioctl.c
> +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
> @@ -1281,6 +1281,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
>  	case V4L2_PIX_FMT_NV61:		descr = "Y/CrCb 4:2:2"; break;
>  	case V4L2_PIX_FMT_NV24:		descr = "Y/CbCr 4:4:4"; break;
>  	case V4L2_PIX_FMT_NV42:		descr = "Y/CrCb 4:4:4"; break;
> +	case V4L2_PIX_FMT_NV12_4L4:	descr = "Y/CbCr 4:2:0 (4x4 linear tiles)"; break;

To remain consistent I would also rename this to "Y/CbCr 4:2:0 (4x4 Linear)".

Regards,

	Hans

>  	case V4L2_PIX_FMT_NV12_16L16:	descr = "Y/CbCr 4:2:0 (16x16 linear tiles)"; break;
>  	case V4L2_PIX_FMT_NV12_32L32:   descr = "Y/CbCr 4:2:0 (32x32 linear tiles)"; break;
>  	case V4L2_PIX_FMT_NV12M:	descr = "Y/CbCr 4:2:0 (N-C)"; break;
> diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
> index 60abed3243f3..5cf71d3aa0a4 100644
> --- a/include/uapi/linux/videodev2.h
> +++ b/include/uapi/linux/videodev2.h
> @@ -627,6 +627,7 @@ struct v4l2_pix_format {
>  #define V4L2_PIX_FMT_YVU444M v4l2_fourcc('Y', 'M', '4', '2') /* 24  YVU444 planar */
>  
>  /* Tiled YUV formats */
> +#define V4L2_PIX_FMT_NV12_4L4 v4l2_fourcc('V', 'T', '1', '2')   /* 12  Y/CbCr 4:2:0  4x4 tiles */
>  #define V4L2_PIX_FMT_NV12_16L16 v4l2_fourcc('H', 'M', '1', '2') /* 12  Y/CbCr 4:2:0 16x16 tiles */
>  #define V4L2_PIX_FMT_NV12_32L32 v4l2_fourcc('S', 'T', '1', '2') /* 12  Y/CbCr 4:2:0 32x32 tiles */
>  
> 


  reply	other threads:[~2021-08-04 10:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-27 14:57 [PATCH v2 0/4] media: visiting YUV tiled formats Ezequiel Garcia
2021-07-27 14:57 ` [PATCH v2 1/4] media: Rename V4L2_PIX_FMT_SUNXI_TILED_NV12 to V4L2_PIX_FMT_NV12_32L32 Ezequiel Garcia
2021-08-04 10:00   ` Hans Verkuil
2021-07-27 14:57 ` [PATCH v2 2/4] media: Rename V4L2_PIX_FMT_HM12 to V4L2_PIX_FMT_NV12_16L16 Ezequiel Garcia
2021-08-04 10:03   ` Hans Verkuil
2021-07-27 14:57 ` [PATCH v2 3/4] media: Add NV12_4L4 tiled format Ezequiel Garcia
2021-08-04 10:05   ` Hans Verkuil [this message]
2021-07-27 14:57 ` [PATCH v2 4/4] media: Clean V4L2_PIX_FMT_NV12MT documentation Ezequiel Garcia

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41fdaecb-7637-3bb1-b224-4eba7c3a8acd@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=ezequiel@collabora.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=nicolas.dufresne@collabora.com \
    --cc=paul.kocialkowski@bootlin.com \
    --cc=yong.deng@magewell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).