Re: [PATCH v3 1/7] media: Add P010 tiled format

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Ezequiel, Benjamin,

Le mercredi 06 juillet 2022 à 20:28 +0200, Jernej Skrabec a écrit :
> From: Ezequiel Garcia <ezequiel@xxxxxxxxxxxxxxxxxxxx>
> 
> Add P010 tiled format
> 
> Tested-by: Benjamin Gaignard <benjamin.gaignard@xxxxxxxxxxxxx>

I just tested Hantro G2 myself, and that highlights that this was not really
tested. I believe no-one had written software detiler to verify this, so tested
meant something like "its producing data". In fact, it seems that P010_4L4 is
not a pixel formats, at least not one covered by Hantro driver.

I've dumped the tiled data, and the per tile format is not made of 16bit
components, but instead its similar to Rockchip format, where 4 pixels are
packed  over. As part of the AV1 driver writing, I made a detiler for that
format.

https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3447

Let's be more careful next time, pixels formats are frozen into our API, and
there is a lot of them already, lets not invent any.

Hans, what should we do about this one ? I can split off the NV12_10LE40_4L4
format from the AV1 patchset, and port G2 to use that instead. That would leave
behind P010_4L4 as unused (actually unexistant). Any better ideas ? Perhaps we
could steal the fourcc, its not terribly meaningful, and make P010_4L4 an alias
?

Nicolas

> Signed-off-by: Ezequiel Garcia <ezequiel@xxxxxxxxxxxxxxxxxxxx>
> [rebased, updated pixel format name and added description]
> Signed-off-by: Jernej Skrabec <jernej.skrabec@xxxxxxxxx>
> ---
>  .../media/v4l/pixfmt-yuv-planar.rst            | 18 +++++++++++++++---
>  drivers/media/v4l2-core/v4l2-common.c          |  1 +
>  drivers/media/v4l2-core/v4l2-ioctl.c           |  1 +
>  include/uapi/linux/videodev2.h                 |  1 +
>  4 files changed, 18 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst b/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst
> index a900ff66911a..faba259a2b92 100644
> --- a/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst
> +++ b/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst
> @@ -116,6 +116,13 @@ All components are stored with the same number of bits per component.
>        - Cb, Cr
>        - Yes
>        - Linear
> +    * - V4L2_PIX_FMT_P010_4L4
> +      - 'T010'
> +      - 10
> +      - 4:2:0
> +      - Cb, Cr
> +      - Yes
> +      - 4x4 tiles
>      * - V4L2_PIX_FMT_NV16
>        - 'NV16'
>        - 8
> @@ -528,11 +535,12 @@ number of lines as the luma plane.
>        - Cr\ :sub:`33`
>  
>  .. _V4L2_PIX_FMT_P010:
> +.. _V4L2-PIX-FMT-P010-4L4:
>  
> -P010
> -----
> +P010 and tiled P010
> +-------------------
>  
> -Like NV12 with 10 bits per component, expanded to 16 bits.
> +P010 is like NV12 with 10 bits per component, expanded to 16 bits.
>  Data in the 10 high bits, zeros in the 6 low bits, arranged in little endian order.
>  
>  .. flat-table:: Sample 4x4 P010 Image
> @@ -570,6 +578,10 @@ Data in the 10 high bits, zeros in the 6 low bits, arranged in little endian ord
>        - Cb\ :sub:`11`
>        - Cr\ :sub:`11`
>  
> +``V4L2_PIX_FMT_P010_4L4`` stores pixels in 4x4 tiles, and stores tiles linearly
> +in memory. The line stride must be aligned to multiple of 8 and image height to
> +a multiple of 4. The layouts of the luma and chroma planes are identical.
> +
>  .. raw:: latex
>  
>      \endgroup
> diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c
> index 1e38ad8906a2..e0fbe6ba4b6c 100644
> --- a/drivers/media/v4l2-core/v4l2-common.c
> +++ b/drivers/media/v4l2-core/v4l2-common.c
> @@ -278,6 +278,7 @@ 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 },
>  
>  		/* 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 },
> diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
> index e2526701294e..7aa3af389b51 100644
> --- a/drivers/media/v4l2-core/v4l2-ioctl.c
> +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
> @@ -1310,6 +1310,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
>  	case V4L2_PIX_FMT_NV12_4L4:	descr = "Y/CbCr 4:2:0 (4x4 Linear)"; break;
>  	case V4L2_PIX_FMT_NV12_16L16:	descr = "Y/CbCr 4:2:0 (16x16 Linear)"; break;
>  	case V4L2_PIX_FMT_NV12_32L32:   descr = "Y/CbCr 4:2:0 (32x32 Linear)"; break;
> +	case V4L2_PIX_FMT_P010_4L4:	descr = "10-bit Y/CbCr 4:2:0 (4x4 Linear)"; break;
>  	case V4L2_PIX_FMT_NV12M:	descr = "Y/CbCr 4:2:0 (N-C)"; break;
>  	case V4L2_PIX_FMT_NV21M:	descr = "Y/CrCb 4:2:0 (N-C)"; break;
>  	case V4L2_PIX_FMT_NV16M:	descr = "Y/CbCr 4:2:2 (N-C)"; break;
> diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
> index 5311ac4fde35..32bedeb04152 100644
> --- a/include/uapi/linux/videodev2.h
> +++ b/include/uapi/linux/videodev2.h
> @@ -630,6 +630,7 @@ struct v4l2_pix_format {
>  #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 */
> +#define V4L2_PIX_FMT_P010_4L4 v4l2_fourcc('T', '0', '1', '0') /* 12  Y/CbCr 4:2:0 10-bit 4x4 macroblocks */
>  
>  /* Tiled YUV formats, non contiguous planes */
>  #define V4L2_PIX_FMT_NV12MT  v4l2_fourcc('T', 'M', '1', '2') /* 12  Y/CbCr 4:2:0 64x32 tiles */






[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux