Thread (30 messages) 30 messages, 3 authors, 2021-12-04

RE: [EXT] Re: [PATCH v13 02/13] media:Add nv12mt_8l128 and nv12mt_10be_8l128 video format.

From: Ming Qian <ming.qian@nxp.com>
Date: 2021-12-02 10:03:40
Also in: linux-devicetree, linux-media, lkml

-----Original Message-----
From: Hans Verkuil [mailto:hverkuil-cisco@xs4all.nl]
Sent: Thursday, December 2, 2021 5:40 PM
To: Ming Qian <ming.qian@nxp.com>; mchehab@kernel.org;
shawnguo@kernel.org; robh+dt@kernel.org; s.hauer@pengutronix.de
Cc: kernel@pengutronix.de; festevam@gmail.com; dl-linux-imx
[off-list ref]; Aisheng Dong [off-list ref];
linux-media@vger.kernel.org; linux-kernel@vger.kernel.org;
devicetree@vger.kernel.org; linux-arm-kernel@lists.infradead.org
Subject: [EXT] Re: [PATCH v13 02/13] media:Add nv12mt_8l128 and
nv12mt_10be_8l128 video format.

Caution: EXT Email

On 30/11/2021 10:48, Ming Qian wrote:
quoted
nv12mt_8l128 is 8-bit tiled nv12 format used by amphion decoder.
nv12mt_10be_8l128 is 10-bit tiled format used by amphion decoder.
The tile size is 8x128

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Shijie Qin <redacted>
Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
---
 .../userspace-api/media/v4l/pixfmt-yuv-planar.rst | 15 +++++++++++++++
 drivers/media/v4l2-core/v4l2-ioctl.c              |  2 ++
 include/uapi/linux/videodev2.h                    |  2 ++
 3 files changed, 19 insertions(+)

diff --git
a/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst
b/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst
index 3a09d93d405b..fc3baa2753ab 100644
--- a/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst
+++ b/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst
@@ -257,6 +257,8 @@ of the luma plane.
 .. _V4L2-PIX-FMT-NV12-4L4:
 .. _V4L2-PIX-FMT-NV12-16L16:
 .. _V4L2-PIX-FMT-NV12-32L32:
+.. _V4L2_PIX_FMT_NV12MT_8L128:
+.. _V4L2_PIX_FMT_NV12MT_10BE_8L128:

 Tiled NV12
 ----------
@@ -296,6 +298,19 @@ tiles linearly in memory. The line stride and
image height must be  aligned to a multiple of 32. The layouts of the
luma and chroma planes are  identical.

+``V4L2_PIX_FMT_NV12MT_8L128`` is similar to ``V4L2_PIX_FMT_NV12M``
+but stores pixel in 2D 8x128 tiles, and stores tiles linearly in memory.
pixel -> pixels (note: also wrong in the text
V4L2_PIX_FMT_NV12_4L4/16L16/32L32)

Shouldn't this be called V4L2_PIX_FMT_NV12M_8L128? The 'MT' suffix seems
to be specific to macroblock tiles and not linear tiles.
I'll change it, I thought the t means tiled
quoted
+The image height must be aligned to a multiple of 128.
+The layouts of the luma and chroma planes are identical.
+
+``V4L2_PIX_FMT_NV12MT_10BE_8L128`` is similar to
+``V4L2_PIX_FMT_NV12M`` but stores
+10 bits pixel in 2D 8x128 tiles, and stores tiles linearly in memory.
+the data is arranged at the big end.
at the big end -> in big endian order

I assume the 10 bit pixels are packed? So 5 bytes contain 4 10-bit pixels layout
like this (for luma):

byte 0: Y0(bits 9-2)
byte 1: Y0(bits 1-0) Y1(bits 9-4)
byte 2: Y1(bits 3-0) Y2(bits 9-6)
byte 3: Y2(bits 5-0) Y3(bits 9-8)
byte 4: Y3(bits 7-0)
quoted
+The image height must be aligned to a multiple of 128.
+The layouts of the luma and chroma planes are identical.
+Note the tile size is 8bytes multiplied by 128 bytes, it means that
+the low bits and high bits of one pixel may be in differnt tiles.
differnt -> different
Got it
quoted
+
 .. _nv12mt:

 .. kernel-figure:: nv12mt.svg
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c
b/drivers/media/v4l2-core/v4l2-ioctl.c
index 69b74d0e8a90..400eec0157a7 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -1388,6 +1388,8 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc
*fmt)
quoted
      case V4L2_META_FMT_VIVID:       descr = "Vivid Metadata";
break;
quoted
      case V4L2_META_FMT_RK_ISP1_PARAMS:      descr = "Rockchip
ISP1 3A Parameters"; break;
quoted
      case V4L2_META_FMT_RK_ISP1_STAT_3A:     descr = "Rockchip
ISP1 3A Statistics"; break;
quoted
+     case V4L2_PIX_FMT_NV12MT_8L128: descr = "NV12M (8x128
Linear)"; break;
quoted
+     case V4L2_PIX_FMT_NV12MT_10BE_8L128:    descr = "NV12M
10BE(8x128 Linear)"; break;

"10-bit NV12M (8x128 Linear, BE)"
quoted
      default:
              /* Compressed formats */ diff --git
a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index f118fe7a9f58..9443c3109928 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -632,6 +632,8 @@ struct v4l2_pix_format {
 /* 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 */  #define V4L2_PIX_FMT_NV12MT_16X16
v4l2_fourcc('V', 'M', '1', '2') /* 12  Y/CbCr 4:2:0 16x16 tiles */
+#define V4L2_PIX_FMT_NV12MT_8L128      v4l2_fourcc('N', 'A', '1', '2')
/* Y/CbCr 4:2:0 8x128 tiles */
quoted
+#define V4L2_PIX_FMT_NV12MT_10BE_8L128 v4l2_fourcc('N', 'T', '1',
+'2') /* Y/CbCr 4:2:0 10-bit 8x128 tiles */
Use v4l2_fourcc_be to denote that this is a BE format.
quoted
 /* Bayer formats - see
https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.s
iliconimaging.com%2FRGB%2520Bayer.htm&amp;data=04%7C01%7Cming.qia
n%40n
quoted
xp.com%7Ce303b4acc4c7478171bc08d9b577abe4%7C686ea1d3bc2b4c6fa92
cd99c5c
quoted
301635%7C0%7C0%7C637740347869679174%7CUnknown%7CTWFpbGZsb3
d8eyJWIjoiMC
quoted
4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&a
mp;sd
quoted
ata=DJGu6nhkZwiJlVD7oqXG0ZUOGBMmrILtiYirX87MyEo%3D&amp;reserved=
0 */
quoted
#define V4L2_PIX_FMT_SBGGR8  v4l2_fourcc('B', 'A', '8', '1') /*  8
BGBG.. GRGR.. */
Regards,

        Hans
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help