2017-03-05 10:00:46

by Randy Li

[permalink] [raw]
Subject: [PATCH v6 0/3] Add pixel format for 10 bits YUV video

Thanks to Clint's work, this version just correct some wrong info
in the comment.

I also offer a driver sample here, but it have been verified with
the 10 bits properly. I lacks of the userspace tool. And I am
not sure whether it is a properly way to support the pixel format
used in rockchip, although it is not common used pixel format,
but it could save lots of memory, it may be welcome by the
other vendor, also I think the 3GR serial from Intel would
use the same pixel format as the video IP comes from rockchip.

Randy Li (3):
drm_fourcc: Add new P010, P016 video format
v4l: Add 10/16-bits per channel YUV pixel formats
drm/rockchip: Support 10 bits yuv format in vop

Documentation/media/uapi/v4l/pixfmt-p010.rst | 126 ++++++++++++++++++++++++
Documentation/media/uapi/v4l/pixfmt-p010m.rst | 135 ++++++++++++++++++++++++++
Documentation/media/uapi/v4l/pixfmt-p016.rst | 125 ++++++++++++++++++++++++
Documentation/media/uapi/v4l/pixfmt-p016m.rst | 134 +++++++++++++++++++++++++
Documentation/media/uapi/v4l/yuv-formats.rst | 4 +
drivers/gpu/drm/drm_fourcc.c | 3 +
drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 1 +
drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 34 ++++++-
drivers/gpu/drm/rockchip/rockchip_drm_vop.h | 1 +
drivers/gpu/drm/rockchip/rockchip_vop_reg.c | 2 +
include/uapi/drm/drm_fourcc.h | 32 ++++++
include/uapi/linux/videodev2.h | 5 +
12 files changed, 599 insertions(+), 3 deletions(-)
create mode 100644 Documentation/media/uapi/v4l/pixfmt-p010.rst
create mode 100644 Documentation/media/uapi/v4l/pixfmt-p010m.rst
create mode 100644 Documentation/media/uapi/v4l/pixfmt-p016.rst
create mode 100644 Documentation/media/uapi/v4l/pixfmt-p016m.rst

--
2.7.4


2017-03-05 10:00:59

by Randy Li

[permalink] [raw]
Subject: [PATCH v6 1/3] drm_fourcc: Add new P010, P016 video format

P010 is a planar 4:2:0 YUV with interleaved UV plane, 10 bits
per channel video format.

P016 is a planar 4:2:0 YUV with interleaved UV plane, 16 bits
per channel video format.

V3: Added P012 and fixed cpp for P010
V4: format definition refined per review
V5: Format comment block for each new pixel format
V6: reversed Cb/Cr order in comments
v7: reversed Cb/Cr order in comments of header files, remove
the wrong part of commit message.

Cc: Daniel Stone <[email protected]>
Cc: Ville Syrjälä <[email protected]>

Signed-off-by: Randy Li <[email protected]>
Signed-off-by: Clint Taylor <[email protected]>
---
drivers/gpu/drm/drm_fourcc.c | 3 +++
include/uapi/drm/drm_fourcc.h | 21 +++++++++++++++++++++
2 files changed, 24 insertions(+)

diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c
index 90d2cc8..3e0fd58 100644
--- a/drivers/gpu/drm/drm_fourcc.c
+++ b/drivers/gpu/drm/drm_fourcc.c
@@ -165,6 +165,9 @@ const struct drm_format_info *__drm_format_info(u32 format)
{ .format = DRM_FORMAT_UYVY, .depth = 0, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1 },
{ .format = DRM_FORMAT_VYUY, .depth = 0, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1 },
{ .format = DRM_FORMAT_AYUV, .depth = 0, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
+ { .format = DRM_FORMAT_P010, .depth = 0, .num_planes = 2, .cpp = { 2, 4, 0 }, .hsub = 2, .vsub = 2 },
+ { .format = DRM_FORMAT_P012, .depth = 0, .num_planes = 2, .cpp = { 2, 4, 0 }, .hsub = 2, .vsub = 2 },
+ { .format = DRM_FORMAT_P016, .depth = 0, .num_planes = 2, .cpp = { 2, 4, 0 }, .hsub = 2, .vsub = 2 },
};

unsigned int i;
diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
index ef20abb..306f979 100644
--- a/include/uapi/drm/drm_fourcc.h
+++ b/include/uapi/drm/drm_fourcc.h
@@ -128,6 +128,27 @@ extern "C" {
#define DRM_FORMAT_NV42 fourcc_code('N', 'V', '4', '2') /* non-subsampled Cb:Cr plane */

/*
+ * 2 plane YCbCr MSB aligned
+ * index 0 = Y plane, [15:0] Y:x [10:6] little endian
+ * index 1 = Cb:Cr plane, [31:0] Cb:x:Cr:x [10:6:10:6] little endian
+ */
+#define DRM_FORMAT_P010 fourcc_code('P', '0', '1', '0') /* 2x2 subsampled Cb:Cr plane 10 bits per channel */
+
+/*
+ * 2 plane YCbCr MSB aligned
+ * index 0 = Y plane, [15:0] Y:x [12:4] little endian
+ * index 1 = Cb:Cr plane, [31:0] Cb:x:Cr:x [12:4:12:4] little endian
+ */
+#define DRM_FORMAT_P012 fourcc_code('P', '0', '1', '2') /* 2x2 subsampled Cb:Cr plane 12 bits per channel */
+
+/*
+ * 2 plane YCbCr MSB aligned
+ * index 0 = Y plane, [15:0] Y little endian
+ * index 1 = Cb:Cr plane, [31:0] Cb:Cr [16:16] little endian
+ */
+#define DRM_FORMAT_P016 fourcc_code('P', '0', '1', '6') /* 2x2 subsampled Cb:Cr plane 16 bits per channel */
+
+/*
* 3 plane YCbCr
* index 0: Y plane, [7:0] Y
* index 1: Cb plane, [7:0] Cb
--
2.7.4

2017-03-05 10:01:14

by Randy Li

[permalink] [raw]
Subject: [PATCH v6 2/3] v4l: Add 10/16-bits per channel YUV pixel formats

The formats added by this patch are:
V4L2_PIX_FMT_P010
V4L2_PIX_FMT_P010M
V4L2_PIX_FMT_P016
V4L2_PIX_FMT_P016M
Currently, none of driver uses those format.

Also a variant of V4L2_PIX_FMT_P010M pixel format is added.
The V4L2_PIX_FMT_P010CM is a compat variant of the V4L2_PIX_FMT_P010,
which uses the unused 6 bits to store the next pixel. And with
the alignment requirement of the hardware, it usually would be
some extra space left at the end of a stride.

Signed-off-by: Randy Li <[email protected]>
---
Documentation/media/uapi/v4l/pixfmt-p010.rst | 126 ++++++++++++++++++++++++
Documentation/media/uapi/v4l/pixfmt-p010m.rst | 135 ++++++++++++++++++++++++++
Documentation/media/uapi/v4l/pixfmt-p016.rst | 125 ++++++++++++++++++++++++
Documentation/media/uapi/v4l/pixfmt-p016m.rst | 134 +++++++++++++++++++++++++
Documentation/media/uapi/v4l/yuv-formats.rst | 4 +
include/uapi/linux/videodev2.h | 5 +
6 files changed, 529 insertions(+)
create mode 100644 Documentation/media/uapi/v4l/pixfmt-p010.rst
create mode 100644 Documentation/media/uapi/v4l/pixfmt-p010m.rst
create mode 100644 Documentation/media/uapi/v4l/pixfmt-p016.rst
create mode 100644 Documentation/media/uapi/v4l/pixfmt-p016m.rst

diff --git a/Documentation/media/uapi/v4l/pixfmt-p010.rst b/Documentation/media/uapi/v4l/pixfmt-p010.rst
new file mode 100644
index 0000000..59ed118
--- /dev/null
+++ b/Documentation/media/uapi/v4l/pixfmt-p010.rst
@@ -0,0 +1,126 @@
+.. -*- coding: utf-8; mode: rst -*-
+
+.. _V4L2-PIX-FMT-P010:
+
+******************************************************
+V4L2_PIX_FMT_P010 ('P010')
+******************************************************
+
+
+V4L2_PIX_FMT_P010
+Formats with ½ horizontal and vertical chroma resolution. One luminance and
+one chrominance plane with alternating
+chroma samples as simliar to ``V4L2_PIX_FMT_NV12``
+
+
+Description
+===========
+
+It is a two-plane versions of the YUV 4:2:0 format. The three
+components are separated into two sub-images or planes. The Y plane is
+first. The Y plane has 16 bits per pixel, but only 10 bits are used with the
+rest 6 bits set to zero. For ``V4L2_PIX_FMT_P010``, a combined CbCr plane
+immediately follows the Y plane in memory. The CbCr
+plane is the same width, in bytes, as the Y plane (and of the image),
+but is half as tall in pixels. Each CbCr pair belongs to four pixels.
+For example, Cb\ :sub:`0`/Cr\ :sub:`0` belongs to Y'\ :sub:`00`,
+Y'\ :sub:`01`, Y'\ :sub:`10`, Y'\ :sub:`11`.
+If the Y plane has pad bytes after each row, then the CbCr plane has as
+many pad bytes after its rows.
+
+**Byte Order.**
+Each cell is two bytes.
+
+
+.. flat-table::
+ :header-rows: 0
+ :stub-columns: 0
+
+ * - start + 0:
+ - Y'\ :sub:`00`
+ - Y'\ :sub:`01`
+ - Y'\ :sub:`02`
+ - Y'\ :sub:`03`
+ * - start + 4:
+ - Y'\ :sub:`10`
+ - Y'\ :sub:`11`
+ - Y'\ :sub:`12`
+ - Y'\ :sub:`13`
+ * - start + 8:
+ - Y'\ :sub:`20`
+ - Y'\ :sub:`21`
+ - Y'\ :sub:`22`
+ - Y'\ :sub:`23`
+ * - start + 12:
+ - Y'\ :sub:`30`
+ - Y'\ :sub:`31`
+ - Y'\ :sub:`32`
+ - Y'\ :sub:`33`
+ * - start + 16:
+ - Cb\ :sub:`00`
+ - Cr\ :sub:`00`
+ - Cb\ :sub:`01`
+ - Cr\ :sub:`01`
+ * - start + 20:
+ - Cb\ :sub:`10`
+ - Cr\ :sub:`10`
+ - Cb\ :sub:`11`
+ - Cr\ :sub:`11`
+
+
+**Color Sample Location..**
+
+.. flat-table::
+ :header-rows: 0
+ :stub-columns: 0
+
+ * -
+ - 0
+ -
+ - 1
+ - 2
+ -
+ - 3
+ * - 0
+ - Y
+ -
+ - Y
+ - Y
+ -
+ - Y
+ * -
+ -
+ - C
+ -
+ -
+ - C
+ -
+ * - 1
+ - Y
+ -
+ - Y
+ - Y
+ -
+ - Y
+ * -
+ * - 2
+ - Y
+ -
+ - Y
+ - Y
+ -
+ - Y
+ * -
+ -
+ - C
+ -
+ -
+ - C
+ -
+ * - 3
+ - Y
+ -
+ - Y
+ - Y
+ -
+ - Y
diff --git a/Documentation/media/uapi/v4l/pixfmt-p010m.rst b/Documentation/media/uapi/v4l/pixfmt-p010m.rst
new file mode 100644
index 0000000..6697d15
--- /dev/null
+++ b/Documentation/media/uapi/v4l/pixfmt-p010m.rst
@@ -0,0 +1,135 @@
+.. -*- coding: utf-8; mode: rst -*-
+
+.. _V4L2-PIX-FMT-P010M:
+
+***********************************************************************************
+V4L2_PIX_FMT_P010M ('PM10')
+***********************************************************************************
+
+
+V4L2_PIX_FMT_P010M
+Variation of ``V4L2_PIX_FMT_P010`` with planes non contiguous in memory.
+
+
+Description
+===========
+
+This is a multi-planar, two-plane version of the YUV 4:2:0 format. The
+three components are separated into two sub-images or planes.
+``V4L2_PIX_FMT_P010M`` differs from ``V4L2_PIX_FMT_P010`` in that the
+two planes are non-contiguous in memory, i.e. the chroma plane do not
+necessarily immediately follows the luma plane. The luminance data
+occupies the first plane. The Y plane has 16 bits per pixel, but only
+10 bits are used with the rest 6 bits set to zero. In the
+second plane there is a chrominance data with alternating chroma
+samples. The CbCr plane is the same width, in bytes, as the Y plane (and
+of the image), but is half as tall in pixels. Each CbCr pair belongs to
+four pixels. For example, Cb\ :sub:`0`/Cr\ :sub:`0` belongs to
+Y'\ :sub:`00`, Y'\ :sub:`01`, Y'\ :sub:`10`, Y'\ :sub:`11`.
+
+``V4L2_PIX_FMT_P010M`` is intended to be used only in drivers and
+applications that support the multi-planar API, described in
+:ref:`planar-apis`.
+
+If the Y plane has pad bytes after each row, then the CbCr plane has as
+many pad bytes after its rows.
+
+**Byte Order.**
+Each cell is two bytes.
+
+.. flat-table::
+ :header-rows: 0
+ :stub-columns: 0
+
+ * - start0 + 0:
+ - Y'\ :sub:`00`
+ - Y'\ :sub:`01`
+ - Y'\ :sub:`02`
+ - Y'\ :sub:`03`
+ * - start0 + 4:
+ - Y'\ :sub:`10`
+ - Y'\ :sub:`11`
+ - Y'\ :sub:`12`
+ - Y'\ :sub:`13`
+ * - start0 + 8:
+ - Y'\ :sub:`20`
+ - Y'\ :sub:`21`
+ - Y'\ :sub:`22`
+ - Y'\ :sub:`23`
+ * - start0 + 12:
+ - Y'\ :sub:`30`
+ - Y'\ :sub:`31`
+ - Y'\ :sub:`32`
+ - Y'\ :sub:`33`
+ * -
+ * - start1 + 0:
+ - Cb\ :sub:`00`
+ - Cr\ :sub:`00`
+ - Cb\ :sub:`01`
+ - Cr\ :sub:`01`
+ * - start1 + 4:
+ - Cb\ :sub:`10`
+ - Cr\ :sub:`10`
+ - Cb\ :sub:`11`
+ - Cr\ :sub:`11`
+
+
+**Color Sample Location..**
+
+
+
+.. flat-table::
+ :header-rows: 0
+ :stub-columns: 0
+
+ * -
+ - 0
+ -
+ - 1
+ - 2
+ -
+ - 3
+ * - 0
+ - Y
+ -
+ - Y
+ - Y
+ -
+ - Y
+ * -
+ -
+ - C
+ -
+ -
+ - C
+ -
+ * - 1
+ - Y
+ -
+ - Y
+ - Y
+ -
+ - Y
+ * -
+ * - 2
+ - Y
+ -
+ - Y
+ - Y
+ -
+ - Y
+ * -
+ -
+ - C
+ -
+ -
+ -
+ - C
+ -
+ * - 3
+ - Y
+ -
+ - Y
+ - Y
+ -
+ - Y
diff --git a/Documentation/media/uapi/v4l/pixfmt-p016.rst b/Documentation/media/uapi/v4l/pixfmt-p016.rst
new file mode 100644
index 0000000..a6d60b3
--- /dev/null
+++ b/Documentation/media/uapi/v4l/pixfmt-p016.rst
@@ -0,0 +1,125 @@
+.. -*- coding: utf-8; mode: rst -*-
+
+.. _V4L2-PIX-FMT-P016:
+
+******************************************************
+V4L2_PIX_FMT_P016 ('P016')
+******************************************************
+
+
+V4L2_PIX_FMT_P016
+Formats with ½ horizontal and vertical chroma resolution. One luminance and
+one chrominance plane with alternating
+chroma samples as simliar to ``V4L2_PIX_FMT_NV12``
+
+
+Description
+===========
+
+It is a two-plane versions of the YUV 4:2:0 format. The three
+components are separated into two sub-images or planes. The Y plane is
+first. The Y plane has 16 bits per pixel. For ``V4L2_PIX_FMT_P016``, a
+combined CbCr plane immediately follows the Y plane in memory. The CbCr
+plane is the same width, in bytes, as the Y plane (and of the image),
+but is half as tall in pixels. Each CbCr pair belongs to four pixels.
+For example, Cb\ :sub:`0`/Cr\ :sub:`0` belongs to Y'\ :sub:`00`,
+Y'\ :sub:`01`, Y'\ :sub:`10`, Y'\ :sub:`11`.
+If the Y plane has pad bytes after each row, then the CbCr plane has as
+many pad bytes after its rows.
+
+**Byte Order.**
+Each cell is two bytes.
+
+
+.. flat-table::
+ :header-rows: 0
+ :stub-columns: 0
+
+ * - start + 0:
+ - Y'\ :sub:`00`
+ - Y'\ :sub:`01`
+ - Y'\ :sub:`02`
+ - Y'\ :sub:`03`
+ * - start + 4:
+ - Y'\ :sub:`10`
+ - Y'\ :sub:`11`
+ - Y'\ :sub:`12`
+ - Y'\ :sub:`13`
+ * - start + 8:
+ - Y'\ :sub:`20`
+ - Y'\ :sub:`21`
+ - Y'\ :sub:`22`
+ - Y'\ :sub:`23`
+ * - start + 12:
+ - Y'\ :sub:`30`
+ - Y'\ :sub:`31`
+ - Y'\ :sub:`32`
+ - Y'\ :sub:`33`
+ * - start + 16:
+ - Cb\ :sub:`00`
+ - Cr\ :sub:`00`
+ - Cb\ :sub:`01`
+ - Cr\ :sub:`01`
+ * - start + 20:
+ - Cb\ :sub:`10`
+ - Cr\ :sub:`10`
+ - Cb\ :sub:`11`
+ - Cr\ :sub:`11`
+
+
+**Color Sample Location..**
+
+.. flat-table::
+ :header-rows: 0
+ :stub-columns: 0
+
+ * -
+ - 0
+ -
+ - 1
+ - 2
+ -
+ - 3
+ * - 0
+ - Y
+ -
+ - Y
+ - Y
+ -
+ - Y
+ * -
+ -
+ - C
+ -
+ -
+ - C
+ -
+ * - 1
+ - Y
+ -
+ - Y
+ - Y
+ -
+ - Y
+ * -
+ * - 2
+ - Y
+ -
+ - Y
+ - Y
+ -
+ - Y
+ * -
+ -
+ - C
+ -
+ -
+ - C
+ -
+ * - 3
+ - Y
+ -
+ - Y
+ - Y
+ -
+ - Y
diff --git a/Documentation/media/uapi/v4l/pixfmt-p016m.rst b/Documentation/media/uapi/v4l/pixfmt-p016m.rst
new file mode 100644
index 0000000..14c434d
--- /dev/null
+++ b/Documentation/media/uapi/v4l/pixfmt-p016m.rst
@@ -0,0 +1,134 @@
+.. -*- coding: utf-8; mode: rst -*-
+
+.. _V4L2-PIX-FMT-P016M:
+
+***********************************************************************************
+V4L2_PIX_FMT_P016M ('PM16')
+***********************************************************************************
+
+
+V4L2_PIX_FMT_P016M
+Variation of ``V4L2_PIX_FMT_P016`` with planes non contiguous in memory.
+
+
+Description
+===========
+
+This is a multi-planar, two-plane version of the YUV 4:2:0 format. The
+three components are separated into two sub-images or planes.
+``V4L2_PIX_FMT_P016M`` differs from ``V4L2_PIX_FMT_P016`` in that the
+two planes are non-contiguous in memory, i.e. the chroma plane do not
+necessarily immediately follows the luma plane. The luminance data
+occupies the first plane. The Y plane has 16 bits per pixel. In the
+second plane there is a chrominance data with alternating chroma
+samples. The CbCr plane is the same width, in bytes, as the Y plane (and
+of the image), but is half as tall in pixels. Each CbCr pair belongs to
+four pixels. For example, Cb\ :sub:`0`/Cr\ :sub:`0` belongs to
+Y'\ :sub:`00`, Y'\ :sub:`01`, Y'\ :sub:`10`, Y'\ :sub:`11`.
+
+``V4L2_PIX_FMT_P016M`` is intended to be used only in drivers and
+applications that support the multi-planar API, described in
+:ref:`planar-apis`.
+
+If the Y plane has pad bytes after each row, then the CbCr plane has as
+many pad bytes after its rows.
+
+**Byte Order.**
+Each cell is two bytes.
+
+.. flat-table::
+ :header-rows: 0
+ :stub-columns: 0
+
+ * - start0 + 0:
+ - Y'\ :sub:`00`
+ - Y'\ :sub:`01`
+ - Y'\ :sub:`02`
+ - Y'\ :sub:`03`
+ * - start0 + 4:
+ - Y'\ :sub:`10`
+ - Y'\ :sub:`11`
+ - Y'\ :sub:`12`
+ - Y'\ :sub:`13`
+ * - start0 + 8:
+ - Y'\ :sub:`20`
+ - Y'\ :sub:`21`
+ - Y'\ :sub:`22`
+ - Y'\ :sub:`23`
+ * - start0 + 12:
+ - Y'\ :sub:`30`
+ - Y'\ :sub:`31`
+ - Y'\ :sub:`32`
+ - Y'\ :sub:`33`
+ * -
+ * - start1 + 0:
+ - Cb\ :sub:`00`
+ - Cr\ :sub:`00`
+ - Cb\ :sub:`01`
+ - Cr\ :sub:`01`
+ * - start1 + 4:
+ - Cb\ :sub:`10`
+ - Cr\ :sub:`10`
+ - Cb\ :sub:`11`
+ - Cr\ :sub:`11`
+
+
+**Color Sample Location..**
+
+
+
+.. flat-table::
+ :header-rows: 0
+ :stub-columns: 0
+
+ * -
+ - 0
+ -
+ - 1
+ - 2
+ -
+ - 3
+ * - 0
+ - Y
+ -
+ - Y
+ - Y
+ -
+ - Y
+ * -
+ -
+ - C
+ -
+ -
+ - C
+ -
+ * - 1
+ - Y
+ -
+ - Y
+ - Y
+ -
+ - Y
+ * -
+ * - 2
+ - Y
+ -
+ - Y
+ - Y
+ -
+ - Y
+ * -
+ -
+ - C
+ -
+ -
+ -
+ - C
+ -
+ * - 3
+ - Y
+ -
+ - Y
+ - Y
+ -
+ - Y
diff --git a/Documentation/media/uapi/v4l/yuv-formats.rst b/Documentation/media/uapi/v4l/yuv-formats.rst
index 3334ea4..1474192 100644
--- a/Documentation/media/uapi/v4l/yuv-formats.rst
+++ b/Documentation/media/uapi/v4l/yuv-formats.rst
@@ -53,3 +53,7 @@ to brightness information.
pixfmt-nv16m
pixfmt-nv24
pixfmt-m420
+ pixfmt-p010
+ pixfmt-p010m
+ pixfmt-p016
+ pixfmt-p016m
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 45184a2..d2f2013 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -550,6 +550,8 @@ struct v4l2_pix_format {
#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 */
#define V4L2_PIX_FMT_NV42 v4l2_fourcc('N', 'V', '4', '2') /* 24 Y/CrCb 4:4:4 */
+#define V4L2_PIX_FMT_P010 v4l2_fourcc('P', '0', '1', '0') /* 20 Y/CbCr 4:2:0, 10 bits per channel */
+#define V4L2_PIX_FMT_P016 v4l2_fourcc('P', '0', '1', '6') /* 32 Y/CbCr 4:2:0, 16 bits per channel */

/* two non contiguous planes - one Y, one Cr + Cb interleaved */
#define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 */
@@ -558,6 +560,9 @@ struct v4l2_pix_format {
#define V4L2_PIX_FMT_NV61M v4l2_fourcc('N', 'M', '6', '1') /* 16 Y/CrCb 4:2:2 */
#define V4L2_PIX_FMT_NV12MT v4l2_fourcc('T', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 64x32 macroblocks */
#define V4L2_PIX_FMT_NV12MT_16X16 v4l2_fourcc('V', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 16x16 macroblocks */
+#define V4L2_PIX_FMT_P010M v4l2_fourcc('P', 'M', '1', '0') /* 32 Y/CbCr 4:2:0, 10 bits per channel */
+#define V4L2_PIX_FMT_P016M v4l2_fourcc('P', 'M', '1', '6') /* 32 Y/CbCr 4:2:0, 16 bits per channel */
+#define V4L2_PIX_FMT_P010CM v4l2_fourcc('C', 'M', '1', '0') /* 20 Y/CbCr 4:2:0, 10 bits per channel, compact format */

/* three planes - Y Cb, Cr */
#define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y', 'U', 'V', '9') /* 9 YUV 4:1:0 */
--
2.7.4

2017-03-05 10:01:12

by Randy Li

[permalink] [raw]
Subject: [PATCH v6 3/3] drm/rockchip: Support 10 bits yuv format in vop

The rockchip use a special pixel format for those yuv pixel
format with 10 bits color depth.

Signed-off-by: Randy Li <[email protected]>
---
drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 1 +
drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 34 ++++++++++++++++++++++++++---
drivers/gpu/drm/rockchip/rockchip_drm_vop.h | 1 +
drivers/gpu/drm/rockchip/rockchip_vop_reg.c | 2 ++
include/uapi/drm/drm_fourcc.h | 11 ++++++++++
5 files changed, 46 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
index c9ccdf8..250fd29 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
@@ -230,6 +230,7 @@ void rockchip_drm_mode_config_init(struct drm_device *dev)
*/
dev->mode_config.max_width = 4096;
dev->mode_config.max_height = 4096;
+ dev->mode_config.allow_fb_modifiers = true;

dev->mode_config.funcs = &rockchip_drm_mode_config_funcs;
dev->mode_config.helper_private = &rockchip_mode_config_helpers;
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index 76c79ac..45da270 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -232,6 +232,7 @@ static enum vop_data_format vop_convert_format(uint32_t format)
case DRM_FORMAT_BGR565:
return VOP_FMT_RGB565;
case DRM_FORMAT_NV12:
+ case DRM_FORMAT_P010:
return VOP_FMT_YUV420SP;
case DRM_FORMAT_NV16:
return VOP_FMT_YUV422SP;
@@ -249,12 +250,28 @@ static bool is_yuv_support(uint32_t format)
case DRM_FORMAT_NV12:
case DRM_FORMAT_NV16:
case DRM_FORMAT_NV24:
+ case DRM_FORMAT_P010:
return true;
default:
return false;
}
}

+static bool is_support_fb(struct drm_framebuffer *fb)
+{
+ switch (fb->format->format) {
+ case DRM_FORMAT_NV12:
+ case DRM_FORMAT_NV16:
+ case DRM_FORMAT_NV24:
+ return true;
+ case DRM_FORMAT_P010:
+ if (fb->modifier == DRM_FORMAT_MOD_ROCKCHIP_10BITS)
+ return true;
+ default:
+ return false;
+ }
+
+}
static bool is_alpha_support(uint32_t format)
{
switch (format) {
@@ -680,7 +697,7 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
* Src.x1 can be odd when do clip, but yuv plane start point
* need align with 2 pixel.
*/
- if (is_yuv_support(fb->format->format) && ((state->src.x1 >> 16) % 2))
+ if (is_support_fb(fb) && ((state->src.x1 >> 16) % 2))
return -EINVAL;

return 0;
@@ -723,6 +740,7 @@ static void vop_plane_atomic_update(struct drm_plane *plane,
dma_addr_t dma_addr;
uint32_t val;
bool rb_swap;
+ bool is_10_bits = false;
int format;

/*
@@ -739,6 +757,9 @@ static void vop_plane_atomic_update(struct drm_plane *plane,
return;
}

+ if (fb->modifier == DRM_FORMAT_MOD_ROCKCHIP_10BITS)
+ is_10_bits = true;
+
obj = rockchip_fb_get_gem_obj(fb, 0);
rk_obj = to_rockchip_obj(obj);

@@ -753,7 +774,10 @@ static void vop_plane_atomic_update(struct drm_plane *plane,
dsp_sty = dest->y1 + crtc->mode.vtotal - crtc->mode.vsync_start;
dsp_st = dsp_sty << 16 | (dsp_stx & 0xffff);

- offset = (src->x1 >> 16) * fb->format->cpp[0];
+ if (is_10_bits)
+ offset = (src->x1 >> 16) * 10 / 8;
+ else
+ offset = (src->x1 >> 16) * fb->format->cpp[0];
offset += (src->y1 >> 16) * fb->pitches[0];
dma_addr = rk_obj->dma_addr + offset + fb->offsets[0];

@@ -764,6 +788,7 @@ static void vop_plane_atomic_update(struct drm_plane *plane,
VOP_WIN_SET(vop, win, format, format);
VOP_WIN_SET(vop, win, yrgb_vir, fb->pitches[0] >> 2);
VOP_WIN_SET(vop, win, yrgb_mst, dma_addr);
+ VOP_WIN_SET(vop, win, fmt_10, is_10_bits);
if (is_yuv_support(fb->format->format)) {
int hsub = drm_format_horz_chroma_subsampling(fb->format->format);
int vsub = drm_format_vert_chroma_subsampling(fb->format->format);
@@ -772,7 +797,10 @@ static void vop_plane_atomic_update(struct drm_plane *plane,
uv_obj = rockchip_fb_get_gem_obj(fb, 1);
rk_uv_obj = to_rockchip_obj(uv_obj);

- offset = (src->x1 >> 16) * bpp / hsub;
+ if (is_10_bits)
+ offset = (src->x1 >> 16) * 10 / 8 / hsub;
+ else
+ offset = (src->x1 >> 16) * bpp / hsub;
offset += (src->y1 >> 16) * fb->pitches[1] / vsub;

dma_addr = rk_uv_obj->dma_addr + offset + fb->offsets[1];
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h
index 5a4faa85..1743797 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h
@@ -116,6 +116,7 @@ struct vop_win_phy {

struct vop_reg enable;
struct vop_reg format;
+ struct vop_reg fmt_10;
struct vop_reg rb_swap;
struct vop_reg act_info;
struct vop_reg dsp_info;
diff --git a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c
index 91fbc7b..9bbdf3c 100644
--- a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c
+++ b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c
@@ -44,6 +44,7 @@ static const uint32_t formats_win_full[] = {
DRM_FORMAT_NV12,
DRM_FORMAT_NV16,
DRM_FORMAT_NV24,
+ DRM_FORMAT_P010,
};

static const uint32_t formats_win_lite[] = {
@@ -178,6 +179,7 @@ static const struct vop_win_phy rk3288_win01_data = {
.nformats = ARRAY_SIZE(formats_win_full),
.enable = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 0),
.format = VOP_REG(RK3288_WIN0_CTRL0, 0x7, 1),
+ .fmt_10 = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 4),
.rb_swap = VOP_REG(RK3288_WIN0_CTRL0, 0x1, 12),
.act_info = VOP_REG(RK3288_WIN0_ACT_INFO, 0x1fff1fff, 0),
.dsp_info = VOP_REG(RK3288_WIN0_DSP_INFO, 0x0fff0fff, 0),
diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
index 306f979..209bdb6 100644
--- a/include/uapi/drm/drm_fourcc.h
+++ b/include/uapi/drm/drm_fourcc.h
@@ -189,6 +189,7 @@ extern "C" {
#define DRM_FORMAT_MOD_VENDOR_SAMSUNG 0x04
#define DRM_FORMAT_MOD_VENDOR_QCOM 0x05
#define DRM_FORMAT_MOD_VENDOR_VIVANTE 0x06
+#define DRM_FORMAT_MOD_VENDOR_ROCKCHIP 0x07
/* add more to the end as needed */

#define fourcc_mod_code(vendor, val) \
@@ -313,6 +314,16 @@ extern "C" {
*/
#define DRM_FORMAT_MOD_VIVANTE_SPLIT_SUPER_TILED fourcc_mod_code(VIVANTE, 4)

+/*
+ * Rockchip 10bits color depth layout
+ *
+ * It could be regard as a compact variant of P010. The 6 bits set to zero
+ * in P010 are used to store the next pixel in this format. The stride should
+ * be aligned with 8 bit(a byte), so there would be zero bits at the last byte
+ * if the pixel can't fill it. And this format is not a tiling layout.
+ */
+#define DRM_FORMAT_MOD_ROCKCHIP_10BITS fourcc_mod_code(ROCKCHIP, 1)
+
#if defined(__cplusplus)
}
#endif
--
2.7.4

2017-03-06 13:07:15

by Ville Syrjälä

[permalink] [raw]
Subject: Re: [PATCH v6 1/3] drm_fourcc: Add new P010, P016 video format

On Sun, Mar 05, 2017 at 06:00:31PM +0800, Randy Li wrote:
> P010 is a planar 4:2:0 YUV with interleaved UV plane, 10 bits
> per channel video format.
>
> P016 is a planar 4:2:0 YUV with interleaved UV plane, 16 bits
> per channel video format.
>
> V3: Added P012 and fixed cpp for P010
> V4: format definition refined per review
> V5: Format comment block for each new pixel format
> V6: reversed Cb/Cr order in comments
> v7: reversed Cb/Cr order in comments of header files, remove
> the wrong part of commit message.

What? Why? You just undid what Clint did in v6.

>
> Cc: Daniel Stone <[email protected]>
> Cc: Ville Syrj?l? <[email protected]>
>
> Signed-off-by: Randy Li <[email protected]>
> Signed-off-by: Clint Taylor <[email protected]>
> ---
> drivers/gpu/drm/drm_fourcc.c | 3 +++
> include/uapi/drm/drm_fourcc.h | 21 +++++++++++++++++++++
> 2 files changed, 24 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c
> index 90d2cc8..3e0fd58 100644
> --- a/drivers/gpu/drm/drm_fourcc.c
> +++ b/drivers/gpu/drm/drm_fourcc.c
> @@ -165,6 +165,9 @@ const struct drm_format_info *__drm_format_info(u32 format)
> { .format = DRM_FORMAT_UYVY, .depth = 0, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1 },
> { .format = DRM_FORMAT_VYUY, .depth = 0, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1 },
> { .format = DRM_FORMAT_AYUV, .depth = 0, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
> + { .format = DRM_FORMAT_P010, .depth = 0, .num_planes = 2, .cpp = { 2, 4, 0 }, .hsub = 2, .vsub = 2 },
> + { .format = DRM_FORMAT_P012, .depth = 0, .num_planes = 2, .cpp = { 2, 4, 0 }, .hsub = 2, .vsub = 2 },
> + { .format = DRM_FORMAT_P016, .depth = 0, .num_planes = 2, .cpp = { 2, 4, 0 }, .hsub = 2, .vsub = 2 },
> };
>
> unsigned int i;
> diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
> index ef20abb..306f979 100644
> --- a/include/uapi/drm/drm_fourcc.h
> +++ b/include/uapi/drm/drm_fourcc.h
> @@ -128,6 +128,27 @@ extern "C" {
> #define DRM_FORMAT_NV42 fourcc_code('N', 'V', '4', '2') /* non-subsampled Cb:Cr plane */
>
> /*
> + * 2 plane YCbCr MSB aligned
> + * index 0 = Y plane, [15:0] Y:x [10:6] little endian
> + * index 1 = Cb:Cr plane, [31:0] Cb:x:Cr:x [10:6:10:6] little endian
> + */
> +#define DRM_FORMAT_P010 fourcc_code('P', '0', '1', '0') /* 2x2 subsampled Cb:Cr plane 10 bits per channel */
> +
> +/*
> + * 2 plane YCbCr MSB aligned
> + * index 0 = Y plane, [15:0] Y:x [12:4] little endian
> + * index 1 = Cb:Cr plane, [31:0] Cb:x:Cr:x [12:4:12:4] little endian
> + */
> +#define DRM_FORMAT_P012 fourcc_code('P', '0', '1', '2') /* 2x2 subsampled Cb:Cr plane 12 bits per channel */
> +
> +/*
> + * 2 plane YCbCr MSB aligned
> + * index 0 = Y plane, [15:0] Y little endian
> + * index 1 = Cb:Cr plane, [31:0] Cb:Cr [16:16] little endian
> + */
> +#define DRM_FORMAT_P016 fourcc_code('P', '0', '1', '6') /* 2x2 subsampled Cb:Cr plane 16 bits per channel */
> +
> +/*
> * 3 plane YCbCr
> * index 0: Y plane, [7:0] Y
> * index 1: Cb plane, [7:0] Cb
> --
> 2.7.4

--
Ville Syrj?l?
Intel OTC

2017-03-06 17:58:52

by Randy Li

[permalink] [raw]
Subject: Re: [PATCH v6 1/3] drm_fourcc: Add new P010, P016 video format



從我的 iPad 傳送

> Ville Syrjälä <[email protected]> 於 2017年3月6日 下午9:06 寫道:
>
>> On Sun, Mar 05, 2017 at 06:00:31PM +0800, Randy Li wrote:
>> P010 is a planar 4:2:0 YUV with interleaved UV plane, 10 bits
>> per channel video format.
>>
>> P016 is a planar 4:2:0 YUV with interleaved UV plane, 16 bits
>> per channel video format.
>>
>> V3: Added P012 and fixed cpp for P010
>> V4: format definition refined per review
>> V5: Format comment block for each new pixel format
>> V6: reversed Cb/Cr order in comments
>> v7: reversed Cb/Cr order in comments of header files, remove
>> the wrong part of commit message.
>
> What? Why? You just undid what Clint did in v6.
He missed a file also keeping the wrong description of rockchip.
>
>>
>> Cc: Daniel Stone <[email protected]>
>> Cc: Ville Syrjälä <[email protected]>
>>
>> Signed-off-by: Randy Li <[email protected]>
>> Signed-off-by: Clint Taylor <[email protected]>
>> ---
>> drivers/gpu/drm/drm_fourcc.c | 3 +++
>> include/uapi/drm/drm_fourcc.h | 21 +++++++++++++++++++++
>> 2 files changed, 24 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c
>> index 90d2cc8..3e0fd58 100644
>> --- a/drivers/gpu/drm/drm_fourcc.c
>> +++ b/drivers/gpu/drm/drm_fourcc.c
>> @@ -165,6 +165,9 @@ const struct drm_format_info *__drm_format_info(u32 format)
>> { .format = DRM_FORMAT_UYVY, .depth = 0, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1 },
>> { .format = DRM_FORMAT_VYUY, .depth = 0, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1 },
>> { .format = DRM_FORMAT_AYUV, .depth = 0, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>> + { .format = DRM_FORMAT_P010, .depth = 0, .num_planes = 2, .cpp = { 2, 4, 0 }, .hsub = 2, .vsub = 2 },
>> + { .format = DRM_FORMAT_P012, .depth = 0, .num_planes = 2, .cpp = { 2, 4, 0 }, .hsub = 2, .vsub = 2 },
>> + { .format = DRM_FORMAT_P016, .depth = 0, .num_planes = 2, .cpp = { 2, 4, 0 }, .hsub = 2, .vsub = 2 },
>> };
>>
>> unsigned int i;
>> diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
>> index ef20abb..306f979 100644
>> --- a/include/uapi/drm/drm_fourcc.h
>> +++ b/include/uapi/drm/drm_fourcc.h
>> @@ -128,6 +128,27 @@ extern "C" {
>> #define DRM_FORMAT_NV42 fourcc_code('N', 'V', '4', '2') /* non-subsampled Cb:Cr plane */
>>
>> /*
>> + * 2 plane YCbCr MSB aligned
>> + * index 0 = Y plane, [15:0] Y:x [10:6] little endian
>> + * index 1 = Cb:Cr plane, [31:0] Cb:x:Cr:x [10:6:10:6] little endian
>> + */
>> +#define DRM_FORMAT_P010 fourcc_code('P', '0', '1', '0') /* 2x2 subsampled Cb:Cr plane 10 bits per channel */
>> +
>> +/*
>> + * 2 plane YCbCr MSB aligned
>> + * index 0 = Y plane, [15:0] Y:x [12:4] little endian
>> + * index 1 = Cb:Cr plane, [31:0] Cb:x:Cr:x [12:4:12:4] little endian
>> + */
>> +#define DRM_FORMAT_P012 fourcc_code('P', '0', '1', '2') /* 2x2 subsampled Cb:Cr plane 12 bits per channel */
>> +
>> +/*
>> + * 2 plane YCbCr MSB aligned
>> + * index 0 = Y plane, [15:0] Y little endian
>> + * index 1 = Cb:Cr plane, [31:0] Cb:Cr [16:16] little endian
>> + */
>> +#define DRM_FORMAT_P016 fourcc_code('P', '0', '1', '6') /* 2x2 subsampled Cb:Cr plane 16 bits per channel */
>> +
>> +/*
>> * 3 plane YCbCr
>> * index 0: Y plane, [7:0] Y
>> * index 1: Cb plane, [7:0] Cb
>> --
>> 2.7.4
>
> --
> Ville Syrjälä
> Intel OTC

2017-03-06 18:47:16

by Ville Syrjälä

[permalink] [raw]
Subject: Re: [PATCH v6 1/3] drm_fourcc: Add new P010, P016 video format

On Tue, Mar 07, 2017 at 01:58:23AM +0800, Ayaka wrote:
>
>
> 從我的 iPad 傳送
>
> > Ville Syrjälä <[email protected]> 於 2017年3月6日 下午9:06 寫道:
> >
> >> On Sun, Mar 05, 2017 at 06:00:31PM +0800, Randy Li wrote:
> >> P010 is a planar 4:2:0 YUV with interleaved UV plane, 10 bits
> >> per channel video format.
> >>
> >> P016 is a planar 4:2:0 YUV with interleaved UV plane, 16 bits
> >> per channel video format.
> >>
> >> V3: Added P012 and fixed cpp for P010
> >> V4: format definition refined per review
> >> V5: Format comment block for each new pixel format
> >> V6: reversed Cb/Cr order in comments
> >> v7: reversed Cb/Cr order in comments of header files, remove
> >> the wrong part of commit message.
> >
> > What? Why? You just undid what Clint did in v6.
> He missed a file also keeping the wrong description of rockchip.

I don't follow. Who missed what exactly?

> >
> >>
> >> Cc: Daniel Stone <[email protected]>
> >> Cc: Ville Syrjälä <[email protected]>
> >>
> >> Signed-off-by: Randy Li <[email protected]>
> >> Signed-off-by: Clint Taylor <[email protected]>
> >> ---
> >> drivers/gpu/drm/drm_fourcc.c | 3 +++
> >> include/uapi/drm/drm_fourcc.h | 21 +++++++++++++++++++++
> >> 2 files changed, 24 insertions(+)
> >>
> >> diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c
> >> index 90d2cc8..3e0fd58 100644
> >> --- a/drivers/gpu/drm/drm_fourcc.c
> >> +++ b/drivers/gpu/drm/drm_fourcc.c
> >> @@ -165,6 +165,9 @@ const struct drm_format_info *__drm_format_info(u32 format)
> >> { .format = DRM_FORMAT_UYVY, .depth = 0, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1 },
> >> { .format = DRM_FORMAT_VYUY, .depth = 0, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1 },
> >> { .format = DRM_FORMAT_AYUV, .depth = 0, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
> >> + { .format = DRM_FORMAT_P010, .depth = 0, .num_planes = 2, .cpp = { 2, 4, 0 }, .hsub = 2, .vsub = 2 },
> >> + { .format = DRM_FORMAT_P012, .depth = 0, .num_planes = 2, .cpp = { 2, 4, 0 }, .hsub = 2, .vsub = 2 },
> >> + { .format = DRM_FORMAT_P016, .depth = 0, .num_planes = 2, .cpp = { 2, 4, 0 }, .hsub = 2, .vsub = 2 },
> >> };
> >>
> >> unsigned int i;
> >> diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
> >> index ef20abb..306f979 100644
> >> --- a/include/uapi/drm/drm_fourcc.h
> >> +++ b/include/uapi/drm/drm_fourcc.h
> >> @@ -128,6 +128,27 @@ extern "C" {
> >> #define DRM_FORMAT_NV42 fourcc_code('N', 'V', '4', '2') /* non-subsampled Cb:Cr plane */
> >>
> >> /*
> >> + * 2 plane YCbCr MSB aligned
> >> + * index 0 = Y plane, [15:0] Y:x [10:6] little endian
> >> + * index 1 = Cb:Cr plane, [31:0] Cb:x:Cr:x [10:6:10:6] little endian
> >> + */
> >> +#define DRM_FORMAT_P010 fourcc_code('P', '0', '1', '0') /* 2x2 subsampled Cb:Cr plane 10 bits per channel */
> >> +
> >> +/*
> >> + * 2 plane YCbCr MSB aligned
> >> + * index 0 = Y plane, [15:0] Y:x [12:4] little endian
> >> + * index 1 = Cb:Cr plane, [31:0] Cb:x:Cr:x [12:4:12:4] little endian
> >> + */
> >> +#define DRM_FORMAT_P012 fourcc_code('P', '0', '1', '2') /* 2x2 subsampled Cb:Cr plane 12 bits per channel */
> >> +
> >> +/*
> >> + * 2 plane YCbCr MSB aligned
> >> + * index 0 = Y plane, [15:0] Y little endian
> >> + * index 1 = Cb:Cr plane, [31:0] Cb:Cr [16:16] little endian
> >> + */
> >> +#define DRM_FORMAT_P016 fourcc_code('P', '0', '1', '6') /* 2x2 subsampled Cb:Cr plane 16 bits per channel */
> >> +
> >> +/*
> >> * 3 plane YCbCr
> >> * index 0: Y plane, [7:0] Y
> >> * index 1: Cb plane, [7:0] Cb
> >> --
> >> 2.7.4
> >
> > --
> > Ville Syrjälä
> > Intel OTC

--
Ville Syrjälä
Intel OTC

2017-03-06 20:27:29

by Randy Li

[permalink] [raw]
Subject: Re: [PATCH v6 1/3] drm_fourcc: Add new P010, P016 video format



從我的 iPad 傳送

> Ville Syrjälä <[email protected]> 於 2017年3月7日 上午2:34 寫道:
>
>> On Tue, Mar 07, 2017 at 01:58:23AM +0800, Ayaka wrote:
>>
>>
>> 從我的 iPad 傳送
>>
>>>> Ville Syrjälä <[email protected]> 於 2017年3月6日 下午9:06 寫道:
>>>>
>>>> On Sun, Mar 05, 2017 at 06:00:31PM +0800, Randy Li wrote:
>>>> P010 is a planar 4:2:0 YUV with interleaved UV plane, 10 bits
>>>> per channel video format.
>>>>
>>>> P016 is a planar 4:2:0 YUV with interleaved UV plane, 16 bits
>>>> per channel video format.
>>>>
>>>> V3: Added P012 and fixed cpp for P010
>>>> V4: format definition refined per review
>>>> V5: Format comment block for each new pixel format
>>>> V6: reversed Cb/Cr order in comments
>>>> v7: reversed Cb/Cr order in comments of header files, remove
>>>> the wrong part of commit message.
>>>
>>> What? Why? You just undid what Clint did in v6.
>> He missed a file also keeping the wrong description of rockchip.
>
> I don't follow. Who missed what exactly?
What he sent is v5, I increase the order number twice in the message, it confuse me as well.
I think Clint forgot the include/uapi/drm/drm_fourcc.h .
>
>
>>>
>>>>
>>>> Cc: Daniel Stone <[email protected]>
>>>> Cc: Ville Syrjälä <[email protected]>
>>>>
>>>> Signed-off-by: Randy Li <[email protected]>
>>>> Signed-off-by: Clint Taylor <[email protected]>
>>>> ---
>>>> drivers/gpu/drm/drm_fourcc.c | 3 +++
>>>> include/uapi/drm/drm_fourcc.h | 21 +++++++++++++++++++++
>>>> 2 files changed, 24 insertions(+)
>>>>
>>>> diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c
>>>> index 90d2cc8..3e0fd58 100644
>>>> --- a/drivers/gpu/drm/drm_fourcc.c
>>>> +++ b/drivers/gpu/drm/drm_fourcc.c
>>>> @@ -165,6 +165,9 @@ const struct drm_format_info *__drm_format_info(u32 format)
>>>> { .format = DRM_FORMAT_UYVY, .depth = 0, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1 },
>>>> { .format = DRM_FORMAT_VYUY, .depth = 0, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1 },
>>>> { .format = DRM_FORMAT_AYUV, .depth = 0, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>> + { .format = DRM_FORMAT_P010, .depth = 0, .num_planes = 2, .cpp = { 2, 4, 0 }, .hsub = 2, .vsub = 2 },
>>>> + { .format = DRM_FORMAT_P012, .depth = 0, .num_planes = 2, .cpp = { 2, 4, 0 }, .hsub = 2, .vsub = 2 },
>>>> + { .format = DRM_FORMAT_P016, .depth = 0, .num_planes = 2, .cpp = { 2, 4, 0 }, .hsub = 2, .vsub = 2 },
>>>> };
>>>>
>>>> unsigned int i;
>>>> diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
>>>> index ef20abb..306f979 100644
>>>> --- a/include/uapi/drm/drm_fourcc.h
>>>> +++ b/include/uapi/drm/drm_fourcc.h
>>>> @@ -128,6 +128,27 @@ extern "C" {
>>>> #define DRM_FORMAT_NV42 fourcc_code('N', 'V', '4', '2') /* non-subsampled Cb:Cr plane */
>>>>
>>>> /*
>>>> + * 2 plane YCbCr MSB aligned
>>>> + * index 0 = Y plane, [15:0] Y:x [10:6] little endian
>>>> + * index 1 = Cb:Cr plane, [31:0] Cb:x:Cr:x [10:6:10:6] little endian
>>>> + */
>>>> +#define DRM_FORMAT_P010 fourcc_code('P', '0', '1', '0') /* 2x2 subsampled Cb:Cr plane 10 bits per channel */
>>>> +
>>>> +/*
>>>> + * 2 plane YCbCr MSB aligned
>>>> + * index 0 = Y plane, [15:0] Y:x [12:4] little endian
>>>> + * index 1 = Cb:Cr plane, [31:0] Cb:x:Cr:x [12:4:12:4] little endian
>>>> + */
>>>> +#define DRM_FORMAT_P012 fourcc_code('P', '0', '1', '2') /* 2x2 subsampled Cb:Cr plane 12 bits per channel */
>>>> +
>>>> +/*
>>>> + * 2 plane YCbCr MSB aligned
>>>> + * index 0 = Y plane, [15:0] Y little endian
>>>> + * index 1 = Cb:Cr plane, [31:0] Cb:Cr [16:16] little endian
>>>> + */
>>>> +#define DRM_FORMAT_P016 fourcc_code('P', '0', '1', '6') /* 2x2 subsampled Cb:Cr plane 16 bits per channel */
>>>> +
>>>> +/*
>>>> * 3 plane YCbCr
>>>> * index 0: Y plane, [7:0] Y
>>>> * index 1: Cb plane, [7:0] Cb
>>>> --
>>>> 2.7.4
>>>
>>> --
>>> Ville Syrjälä
>>> Intel OTC
>
> --
> Ville Syrjälä
> Intel OTC

Subject: Re: [PATCH v6 1/3] drm_fourcc: Add new P010, P016 video format

On Tue, 2017-03-07 at 04:27 +0800, Ayaka wrote:
>
> 從我的 iPad 傳送
>
> > Ville Syrjälä <[email protected]> 於 2017年3月7日 上午2:34 寫道:
> >
> > > On Tue, Mar 07, 2017 at 01:58:23AM +0800, Ayaka wrote:
> > >
> > >
> > > 從我的 iPad 傳送
> > >
> > > > > Ville Syrjälä <[email protected]> 於 2017年3月6日 下午9:06 寫道:
> > > > >
> > > > > On Sun, Mar 05, 2017 at 06:00:31PM +0800, Randy Li wrote:
> > > > > P010 is a planar 4:2:0 YUV with interleaved UV plane, 10 bits
> > > > > per channel video format.
> > > > >
> > > > > P016 is a planar 4:2:0 YUV with interleaved UV plane, 16 bits
> > > > > per channel video format.
> > > > >
> > > > > V3: Added P012 and fixed cpp for P010
> > > > > V4: format definition refined per review
> > > > > V5: Format comment block for each new pixel format
> > > > > V6: reversed Cb/Cr order in comments
> > > > > v7: reversed Cb/Cr order in comments of header files, remove
> > > > > the wrong part of commit message.
> > > >
> > > > What? Why? You just undid what Clint did in v6.
> > >
> > > He missed a file also keeping the wrong description of rockchip.
> >
> > I don't follow. Who missed what exactly?
>
> What he sent is v5, I increase the order number twice in the message, it confuse me as well.
> I think Clint forgot the include/uapi/drm/drm_fourcc.h .

Clint did send a v6, and that updates "include/uapi/drm/drm_fourcc.h":

https://patchwork.freedesktop.org/patch/141342/


Ander

> >
> >
> > > >
> > > > >
> > > > > Cc: Daniel Stone <[email protected]>
> > > > > Cc: Ville Syrjälä <[email protected]>
> > > > >
> > > > > Signed-off-by: Randy Li <[email protected]>
> > > > > Signed-off-by: Clint Taylor <[email protected]>
> > > > > ---
> > > > > drivers/gpu/drm/drm_fourcc.c | 3 +++
> > > > > include/uapi/drm/drm_fourcc.h | 21 +++++++++++++++++++++
> > > > > 2 files changed, 24 insertions(+)
> > > > >
> > > > > diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c
> > > > > index 90d2cc8..3e0fd58 100644
> > > > > --- a/drivers/gpu/drm/drm_fourcc.c
> > > > > +++ b/drivers/gpu/drm/drm_fourcc.c
> > > > > @@ -165,6 +165,9 @@ const struct drm_format_info *__drm_format_info(u32 format)
> > > > > { .format = DRM_FORMAT_UYVY, .depth = 0, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1 },
> > > > > { .format = DRM_FORMAT_VYUY, .depth = 0, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1 },
> > > > > { .format = DRM_FORMAT_AYUV, .depth = 0, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
> > > > > + { .format = DRM_FORMAT_P010, .depth = 0, .num_planes = 2, .cpp = { 2, 4, 0 }, .hsub = 2, .vsub = 2 },
> > > > > + { .format = DRM_FORMAT_P012, .depth = 0, .num_planes = 2, .cpp = { 2, 4, 0 }, .hsub = 2, .vsub = 2 },
> > > > > + { .format = DRM_FORMAT_P016, .depth = 0, .num_planes = 2, .cpp = { 2, 4, 0 }, .hsub = 2, .vsub = 2 },
> > > > > };
> > > > >
> > > > > unsigned int i;
> > > > > diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
> > > > > index ef20abb..306f979 100644
> > > > > --- a/include/uapi/drm/drm_fourcc.h
> > > > > +++ b/include/uapi/drm/drm_fourcc.h
> > > > > @@ -128,6 +128,27 @@ extern "C" {
> > > > > #define DRM_FORMAT_NV42 fourcc_code('N', 'V', '4', '2') /* non-subsampled Cb:Cr plane */
> > > > >
> > > > > /*
> > > > > + * 2 plane YCbCr MSB aligned
> > > > > + * index 0 = Y plane, [15:0] Y:x [10:6] little endian
> > > > > + * index 1 = Cb:Cr plane, [31:0] Cb:x:Cr:x [10:6:10:6] little endian
> > > > > + */
> > > > > +#define DRM_FORMAT_P010 fourcc_code('P', '0', '1', '0') /* 2x2 subsampled Cb:Cr plane 10 bits per channel */
> > > > > +
> > > > > +/*
> > > > > + * 2 plane YCbCr MSB aligned
> > > > > + * index 0 = Y plane, [15:0] Y:x [12:4] little endian
> > > > > + * index 1 = Cb:Cr plane, [31:0] Cb:x:Cr:x [12:4:12:4] little endian
> > > > > + */
> > > > > +#define DRM_FORMAT_P012 fourcc_code('P', '0', '1', '2') /* 2x2 subsampled Cb:Cr plane 12 bits per channel */
> > > > > +
> > > > > +/*
> > > > > + * 2 plane YCbCr MSB aligned
> > > > > + * index 0 = Y plane, [15:0] Y little endian
> > > > > + * index 1 = Cb:Cr plane, [31:0] Cb:Cr [16:16] little endian
> > > > > + */
> > > > > +#define DRM_FORMAT_P016 fourcc_code('P', '0', '1', '6') /* 2x2 subsampled Cb:Cr plane 16 bits per channel */
> > > > > +
> > > > > +/*
> > > > > * 3 plane YCbCr
> > > > > * index 0: Y plane, [7:0] Y
> > > > > * index 1: Cb plane, [7:0] Cb
> > > > > --
> > > > > 2.7.4
> > > >
> > > > --
> > > > Ville Syrjälä
> > > > Intel OTC
> >
> > --
> > Ville Syrjälä
> > Intel OTC
>
> _______________________________________________
> dri-devel mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

2017-03-27 04:13:57

by Randy Li

[permalink] [raw]
Subject: Re: [PATCH v6 1/3] drm_fourcc: Add new P010, P016 video format



從我的 iPad 傳送

> Ander Conselvan De Oliveira <[email protected]> 於 2017年3月14日 下午9:53 寫道:
>
>> On Tue, 2017-03-07 at 04:27 +0800, Ayaka wrote:
>>
>> 從我的 iPad 傳送
>>
>>>> Ville Syrjälä <[email protected]> 於 2017年3月7日 上午2:34 寫道:
>>>>
>>>> On Tue, Mar 07, 2017 at 01:58:23AM +0800, Ayaka wrote:
>>>>
>>>>
>>>> 從我的 iPad 傳送
>>>>
>>>>>> Ville Syrjälä <[email protected]> 於 2017年3月6日 下午9:06 寫道:
>>>>>>
>>>>>> On Sun, Mar 05, 2017 at 06:00:31PM +0800, Randy Li wrote:
>>>>>> P010 is a planar 4:2:0 YUV with interleaved UV plane, 10 bits
>>>>>> per channel video format.
>>>>>>
>>>>>> P016 is a planar 4:2:0 YUV with interleaved UV plane, 16 bits
>>>>>> per channel video format.
>>>>>>
>>>>>> V3: Added P012 and fixed cpp for P010
>>>>>> V4: format definition refined per review
>>>>>> V5: Format comment block for each new pixel format
>>>>>> V6: reversed Cb/Cr order in comments
>>>>>> v7: reversed Cb/Cr order in comments of header files, remove
>>>>>> the wrong part of commit message.
>>>>>
>>>>> What? Why? You just undid what Clint did in v6.
>>>>
>>>> He missed a file also keeping the wrong description of rockchip.
>>>
>>> I don't follow. Who missed what exactly?
>>
>> What he sent is v5, I increase the order number twice in the message, it confuse me as well.
>> I think Clint forgot the include/uapi/drm/drm_fourcc.h .
>
> Clint did send a v6, and that updates "include/uapi/drm/drm_fourcc.h":
>
> https://patchwork.freedesktop.org/patch/141342/
Oh, yes but he still used Cr:Cb, but I think it should be Cb:Cr
since I think the V is after the U.
>
>
> Ander
>
>>>
>>>
>>>>>
>>>>>>
>>>>>> Cc: Daniel Stone <[email protected]>
>>>>>> Cc: Ville Syrjälä <[email protected]>
>>>>>>
>>>>>> Signed-off-by: Randy Li <[email protected]>
>>>>>> Signed-off-by: Clint Taylor <[email protected]>
>>>>>> ---
>>>>>> drivers/gpu/drm/drm_fourcc.c | 3 +++
>>>>>> include/uapi/drm/drm_fourcc.h | 21 +++++++++++++++++++++
>>>>>> 2 files changed, 24 insertions(+)
>>>>>>
>>>>>> diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c
>>>>>> index 90d2cc8..3e0fd58 100644
>>>>>> --- a/drivers/gpu/drm/drm_fourcc.c
>>>>>> +++ b/drivers/gpu/drm/drm_fourcc.c
>>>>>> @@ -165,6 +165,9 @@ const struct drm_format_info *__drm_format_info(u32 format)
>>>>>> { .format = DRM_FORMAT_UYVY, .depth = 0, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1 },
>>>>>> { .format = DRM_FORMAT_VYUY, .depth = 0, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1 },
>>>>>> { .format = DRM_FORMAT_AYUV, .depth = 0, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>>>> + { .format = DRM_FORMAT_P010, .depth = 0, .num_planes = 2, .cpp = { 2, 4, 0 }, .hsub = 2, .vsub = 2 },
>>>>>> + { .format = DRM_FORMAT_P012, .depth = 0, .num_planes = 2, .cpp = { 2, 4, 0 }, .hsub = 2, .vsub = 2 },
>>>>>> + { .format = DRM_FORMAT_P016, .depth = 0, .num_planes = 2, .cpp = { 2, 4, 0 }, .hsub = 2, .vsub = 2 },
>>>>>> };
>>>>>>
>>>>>> unsigned int i;
>>>>>> diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
>>>>>> index ef20abb..306f979 100644
>>>>>> --- a/include/uapi/drm/drm_fourcc.h
>>>>>> +++ b/include/uapi/drm/drm_fourcc.h
>>>>>> @@ -128,6 +128,27 @@ extern "C" {
>>>>>> #define DRM_FORMAT_NV42 fourcc_code('N', 'V', '4', '2') /* non-subsampled Cb:Cr plane */
>>>>>>
>>>>>> /*
>>>>>> + * 2 plane YCbCr MSB aligned
>>>>>> + * index 0 = Y plane, [15:0] Y:x [10:6] little endian
>>>>>> + * index 1 = Cb:Cr plane, [31:0] Cb:x:Cr:x [10:6:10:6] little endian
>>>>>> + */
>>>>>> +#define DRM_FORMAT_P010 fourcc_code('P', '0', '1', '0') /* 2x2 subsampled Cb:Cr plane 10 bits per channel */
>>>>>> +
>>>>>> +/*
>>>>>> + * 2 plane YCbCr MSB aligned
>>>>>> + * index 0 = Y plane, [15:0] Y:x [12:4] little endian
>>>>>> + * index 1 = Cb:Cr plane, [31:0] Cb:x:Cr:x [12:4:12:4] little endian
>>>>>> + */
>>>>>> +#define DRM_FORMAT_P012 fourcc_code('P', '0', '1', '2') /* 2x2 subsampled Cb:Cr plane 12 bits per channel */
>>>>>> +
>>>>>> +/*
>>>>>> + * 2 plane YCbCr MSB aligned
>>>>>> + * index 0 = Y plane, [15:0] Y little endian
>>>>>> + * index 1 = Cb:Cr plane, [31:0] Cb:Cr [16:16] little endian
>>>>>> + */
>>>>>> +#define DRM_FORMAT_P016 fourcc_code('P', '0', '1', '6') /* 2x2 subsampled Cb:Cr plane 16 bits per channel */
>>>>>> +
>>>>>> +/*
>>>>>> * 3 plane YCbCr
>>>>>> * index 0: Y plane, [7:0] Y
>>>>>> * index 1: Cb plane, [7:0] Cb
>>>>>> --
>>>>>> 2.7.4
>>>>>
>>>>> --
>>>>> Ville Syrjälä
>>>>> Intel OTC
>>>
>>> --
>>> Ville Syrjälä
>>> Intel OTC
>>
>> _______________________________________________
>> dri-devel mailing list
>> [email protected]
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel

2017-03-27 22:52:17

by Clint Taylor

[permalink] [raw]
Subject: Re: [PATCH v6 1/3] drm_fourcc: Add new P010, P016 video format

On 03/26/2017 09:05 PM, Ayaka wrote:
>
>
> 從我的 iPad 傳送
>
>> Ander Conselvan De Oliveira <[email protected]> 於 2017年3月14日 下午9:53 寫道:
>>
>>> On Tue, 2017-03-07 at 04:27 +0800, Ayaka wrote:
>>>
>>> 從我的 iPad 傳送
>>>
>>>>> Ville Syrjälä <[email protected]> 於 2017年3月7日 上午2:34 寫道:
>>>>>
>>>>> On Tue, Mar 07, 2017 at 01:58:23AM +0800, Ayaka wrote:
>>>>>
>>>>>
>>>>> 從我的 iPad 傳送
>>>>>
>>>>>>> Ville Syrjälä <[email protected]> 於 2017年3月6日 下午9:06 寫道:
>>>>>>>
>>>>>>> On Sun, Mar 05, 2017 at 06:00:31PM +0800, Randy Li wrote:
>>>>>>> P010 is a planar 4:2:0 YUV with interleaved UV plane, 10 bits
>>>>>>> per channel video format.
>>>>>>>
>>>>>>> P016 is a planar 4:2:0 YUV with interleaved UV plane, 16 bits
>>>>>>> per channel video format.
>>>>>>>
>>>>>>> V3: Added P012 and fixed cpp for P010
>>>>>>> V4: format definition refined per review
>>>>>>> V5: Format comment block for each new pixel format
>>>>>>> V6: reversed Cb/Cr order in comments
>>>>>>> v7: reversed Cb/Cr order in comments of header files, remove
>>>>>>> the wrong part of commit message.
>>>>>>
>>>>>> What? Why? You just undid what Clint did in v6.
>>>>>
>>>>> He missed a file also keeping the wrong description of rockchip.
>>>>
>>>> I don't follow. Who missed what exactly?
>>>
>>> What he sent is v5, I increase the order number twice in the message, it confuse me as well.
>>> I think Clint forgot the include/uapi/drm/drm_fourcc.h .
>>
>> Clint did send a v6, and that updates "include/uapi/drm/drm_fourcc.h":
>>
>> https://patchwork.freedesktop.org/patch/141342/
> Oh, yes but he still used Cr:Cb, but I think it should be Cb:Cr
> since I think the V is after the U.

From the MSDN fourcc website:
"If the combined U-V array is addressed as an array of DWORDs, the least
significant word (LSW) contains the U value and the most significant
word (MSW) contains the V value. The stride of the combined U-V plane is
equal to the stride of the Y plane. The U-V plane has half as many lines
as the Y plane."

The LSW contains U and the MSW contains V, hence the Cr:Cb in the
comments of the V6 patch.

-Clint

>>
>>
>> Ander
>>
>>>>
>>>>
>>>>>>
>>>>>>>
>>>>>>> Cc: Daniel Stone <[email protected]>
>>>>>>> Cc: Ville Syrjälä <[email protected]>
>>>>>>>
>>>>>>> Signed-off-by: Randy Li <[email protected]>
>>>>>>> Signed-off-by: Clint Taylor <[email protected]>
>>>>>>> ---
>>>>>>> drivers/gpu/drm/drm_fourcc.c | 3 +++
>>>>>>> include/uapi/drm/drm_fourcc.h | 21 +++++++++++++++++++++
>>>>>>> 2 files changed, 24 insertions(+)
>>>>>>>
>>>>>>> diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c
>>>>>>> index 90d2cc8..3e0fd58 100644
>>>>>>> --- a/drivers/gpu/drm/drm_fourcc.c
>>>>>>> +++ b/drivers/gpu/drm/drm_fourcc.c
>>>>>>> @@ -165,6 +165,9 @@ const struct drm_format_info *__drm_format_info(u32 format)
>>>>>>> { .format = DRM_FORMAT_UYVY, .depth = 0, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1 },
>>>>>>> { .format = DRM_FORMAT_VYUY, .depth = 0, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1 },
>>>>>>> { .format = DRM_FORMAT_AYUV, .depth = 0, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>>>>> + { .format = DRM_FORMAT_P010, .depth = 0, .num_planes = 2, .cpp = { 2, 4, 0 }, .hsub = 2, .vsub = 2 },
>>>>>>> + { .format = DRM_FORMAT_P012, .depth = 0, .num_planes = 2, .cpp = { 2, 4, 0 }, .hsub = 2, .vsub = 2 },
>>>>>>> + { .format = DRM_FORMAT_P016, .depth = 0, .num_planes = 2, .cpp = { 2, 4, 0 }, .hsub = 2, .vsub = 2 },
>>>>>>> };
>>>>>>>
>>>>>>> unsigned int i;
>>>>>>> diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
>>>>>>> index ef20abb..306f979 100644
>>>>>>> --- a/include/uapi/drm/drm_fourcc.h
>>>>>>> +++ b/include/uapi/drm/drm_fourcc.h
>>>>>>> @@ -128,6 +128,27 @@ extern "C" {
>>>>>>> #define DRM_FORMAT_NV42 fourcc_code('N', 'V', '4', '2') /* non-subsampled Cb:Cr plane */
>>>>>>>
>>>>>>> /*
>>>>>>> + * 2 plane YCbCr MSB aligned
>>>>>>> + * index 0 = Y plane, [15:0] Y:x [10:6] little endian
>>>>>>> + * index 1 = Cb:Cr plane, [31:0] Cb:x:Cr:x [10:6:10:6] little endian
>>>>>>> + */
>>>>>>> +#define DRM_FORMAT_P010 fourcc_code('P', '0', '1', '0') /* 2x2 subsampled Cb:Cr plane 10 bits per channel */
>>>>>>> +
>>>>>>> +/*
>>>>>>> + * 2 plane YCbCr MSB aligned
>>>>>>> + * index 0 = Y plane, [15:0] Y:x [12:4] little endian
>>>>>>> + * index 1 = Cb:Cr plane, [31:0] Cb:x:Cr:x [12:4:12:4] little endian
>>>>>>> + */
>>>>>>> +#define DRM_FORMAT_P012 fourcc_code('P', '0', '1', '2') /* 2x2 subsampled Cb:Cr plane 12 bits per channel */
>>>>>>> +
>>>>>>> +/*
>>>>>>> + * 2 plane YCbCr MSB aligned
>>>>>>> + * index 0 = Y plane, [15:0] Y little endian
>>>>>>> + * index 1 = Cb:Cr plane, [31:0] Cb:Cr [16:16] little endian
>>>>>>> + */
>>>>>>> +#define DRM_FORMAT_P016 fourcc_code('P', '0', '1', '6') /* 2x2 subsampled Cb:Cr plane 16 bits per channel */
>>>>>>> +
>>>>>>> +/*
>>>>>>> * 3 plane YCbCr
>>>>>>> * index 0: Y plane, [7:0] Y
>>>>>>> * index 1: Cb plane, [7:0] Cb
>>>>>>> --
>>>>>>> 2.7.4
>>>>>>
>>>>>> --
>>>>>> Ville Syrjälä
>>>>>> Intel OTC
>>>>
>>>> --
>>>> Ville Syrjälä
>>>> Intel OTC
>>>
>>> _______________________________________________
>>> dri-devel mailing list
>>> [email protected]
>>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>

2017-03-28 02:34:22

by Randy Li

[permalink] [raw]
Subject: Re: [PATCH v6 1/3] drm_fourcc: Add new P010, P016 video format



從我的 iPad 傳送

> Clint Taylor <[email protected]> 於 2017年3月28日 上午6:49 寫道:
>
>> On 03/26/2017 09:05 PM, Ayaka wrote:
>>
>>
>> 從我的 iPad 傳送
>>
>>>> Ander Conselvan De Oliveira <[email protected]> 於 2017年3月14日 下午9:53 寫道:
>>>>
>>>> On Tue, 2017-03-07 at 04:27 +0800, Ayaka wrote:
>>>>
>>>> 從我的 iPad 傳送
>>>>
>>>>>> Ville Syrjälä <[email protected]> 於 2017年3月7日 上午2:34 寫道:
>>>>>>
>>>>>> On Tue, Mar 07, 2017 at 01:58:23AM +0800, Ayaka wrote:
>>>>>>
>>>>>>
>>>>>> 從我的 iPad 傳送
>>>>>>
>>>>>>>> Ville Syrjälä <[email protected]> 於 2017年3月6日 下午9:06 寫道:
>>>>>>>>
>>>>>>>> On Sun, Mar 05, 2017 at 06:00:31PM +0800, Randy Li wrote:
>>>>>>>> P010 is a planar 4:2:0 YUV with interleaved UV plane, 10 bits
>>>>>>>> per channel video format.
>>>>>>>>
>>>>>>>> P016 is a planar 4:2:0 YUV with interleaved UV plane, 16 bits
>>>>>>>> per channel video format.
>>>>>>>>
>>>>>>>> V3: Added P012 and fixed cpp for P010
>>>>>>>> V4: format definition refined per review
>>>>>>>> V5: Format comment block for each new pixel format
>>>>>>>> V6: reversed Cb/Cr order in comments
>>>>>>>> v7: reversed Cb/Cr order in comments of header files, remove
>>>>>>>> the wrong part of commit message.
>>>>>>>
>>>>>>> What? Why? You just undid what Clint did in v6.
>>>>>>
>>>>>> He missed a file also keeping the wrong description of rockchip.
>>>>>
>>>>> I don't follow. Who missed what exactly?
>>>>
>>>> What he sent is v5, I increase the order number twice in the message, it confuse me as well.
>>>> I think Clint forgot the include/uapi/drm/drm_fourcc.h .
>>>
>>> Clint did send a v6, and that updates "include/uapi/drm/drm_fourcc.h":
>>>
>>> https://patchwork.freedesktop.org/patch/141342/
>> Oh, yes but he still used Cr:Cb, but I think it should be Cb:Cr
>> since I think the V is after the U.
>
> From the MSDN fourcc website:
> "If the combined U-V array is addressed as an array of DWORDs, the least significant word (LSW) contains the U value and the most significant word (MSW) contains the V value. The stride of the combined U-V plane is equal to the stride of the Y plane. The U-V plane has half as many lines as the Y plane."
>
> The LSW contains U and the MSW contains V, hence the Cr:Cb in the comments of the V6 patch.
>
> -Clint
ok it is correct. I think I mistake it that is why my converter for gstreamer doesn't work
>
>>>
>>>
>>> Ander
>>>
>>>>>
>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>> Cc: Daniel Stone <[email protected]>
>>>>>>>> Cc: Ville Syrjälä <[email protected]>
>>>>>>>>
>>>>>>>> Signed-off-by: Randy Li <[email protected]>
>>>>>>>> Signed-off-by: Clint Taylor <[email protected]>
>>>>>>>> ---
>>>>>>>> drivers/gpu/drm/drm_fourcc.c | 3 +++
>>>>>>>> include/uapi/drm/drm_fourcc.h | 21 +++++++++++++++++++++
>>>>>>>> 2 files changed, 24 insertions(+)
>>>>>>>>
>>>>>>>> diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c
>>>>>>>> index 90d2cc8..3e0fd58 100644
>>>>>>>> --- a/drivers/gpu/drm/drm_fourcc.c
>>>>>>>> +++ b/drivers/gpu/drm/drm_fourcc.c
>>>>>>>> @@ -165,6 +165,9 @@ const struct drm_format_info *__drm_format_info(u32 format)
>>>>>>>> { .format = DRM_FORMAT_UYVY, .depth = 0, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1 },
>>>>>>>> { .format = DRM_FORMAT_VYUY, .depth = 0, .num_planes = 1, .cpp = { 2, 0, 0 }, .hsub = 2, .vsub = 1 },
>>>>>>>> { .format = DRM_FORMAT_AYUV, .depth = 0, .num_planes = 1, .cpp = { 4, 0, 0 }, .hsub = 1, .vsub = 1 },
>>>>>>>> + { .format = DRM_FORMAT_P010, .depth = 0, .num_planes = 2, .cpp = { 2, 4, 0 }, .hsub = 2, .vsub = 2 },
>>>>>>>> + { .format = DRM_FORMAT_P012, .depth = 0, .num_planes = 2, .cpp = { 2, 4, 0 }, .hsub = 2, .vsub = 2 },
>>>>>>>> + { .format = DRM_FORMAT_P016, .depth = 0, .num_planes = 2, .cpp = { 2, 4, 0 }, .hsub = 2, .vsub = 2 },
>>>>>>>> };
>>>>>>>>
>>>>>>>> unsigned int i;
>>>>>>>> diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
>>>>>>>> index ef20abb..306f979 100644
>>>>>>>> --- a/include/uapi/drm/drm_fourcc.h
>>>>>>>> +++ b/include/uapi/drm/drm_fourcc.h
>>>>>>>> @@ -128,6 +128,27 @@ extern "C" {
>>>>>>>> #define DRM_FORMAT_NV42 fourcc_code('N', 'V', '4', '2') /* non-subsampled Cb:Cr plane */
>>>>>>>>
>>>>>>>> /*
>>>>>>>> + * 2 plane YCbCr MSB aligned
>>>>>>>> + * index 0 = Y plane, [15:0] Y:x [10:6] little endian
>>>>>>>> + * index 1 = Cb:Cr plane, [31:0] Cb:x:Cr:x [10:6:10:6] little endian
>>>>>>>> + */
>>>>>>>> +#define DRM_FORMAT_P010 fourcc_code('P', '0', '1', '0') /* 2x2 subsampled Cb:Cr plane 10 bits per channel */
>>>>>>>> +
>>>>>>>> +/*
>>>>>>>> + * 2 plane YCbCr MSB aligned
>>>>>>>> + * index 0 = Y plane, [15:0] Y:x [12:4] little endian
>>>>>>>> + * index 1 = Cb:Cr plane, [31:0] Cb:x:Cr:x [12:4:12:4] little endian
>>>>>>>> + */
>>>>>>>> +#define DRM_FORMAT_P012 fourcc_code('P', '0', '1', '2') /* 2x2 subsampled Cb:Cr plane 12 bits per channel */
>>>>>>>> +
>>>>>>>> +/*
>>>>>>>> + * 2 plane YCbCr MSB aligned
>>>>>>>> + * index 0 = Y plane, [15:0] Y little endian
>>>>>>>> + * index 1 = Cb:Cr plane, [31:0] Cb:Cr [16:16] little endian
>>>>>>>> + */
>>>>>>>> +#define DRM_FORMAT_P016 fourcc_code('P', '0', '1', '6') /* 2x2 subsampled Cb:Cr plane 16 bits per channel */
>>>>>>>> +
>>>>>>>> +/*
>>>>>>>> * 3 plane YCbCr
>>>>>>>> * index 0: Y plane, [7:0] Y
>>>>>>>> * index 1: Cb plane, [7:0] Cb
>>>>>>>> --
>>>>>>>> 2.7.4
>>>>>>>
>>>>>>> --
>>>>>>> Ville Syrjälä
>>>>>>> Intel OTC
>>>>>
>>>>> --
>>>>> Ville Syrjälä
>>>>> Intel OTC
>>>>
>>>> _______________________________________________
>>>> dri-devel mailing list
>>>> [email protected]
>>>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>>

2017-04-17 19:34:06

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: Re: [PATCH v6 2/3] v4l: Add 10/16-bits per channel YUV pixel formats

Em Sun, 5 Mar 2017 18:00:32 +0800
Randy Li <[email protected]> escreveu:

> The formats added by this patch are:
> V4L2_PIX_FMT_P010
> V4L2_PIX_FMT_P010M
> V4L2_PIX_FMT_P016
> V4L2_PIX_FMT_P016M
> Currently, none of driver uses those format.
>
> Also a variant of V4L2_PIX_FMT_P010M pixel format is added.
> The V4L2_PIX_FMT_P010CM is a compat variant of the V4L2_PIX_FMT_P010,
> which uses the unused 6 bits to store the next pixel. And with
> the alignment requirement of the hardware, it usually would be
> some extra space left at the end of a stride.

You should check your patches with checkpatch... I'm getting
this:


WARNING: 'simliar' may be misspelled - perhaps 'similar'?
#61: FILE: Documentation/media/uapi/v4l/pixfmt-p010.rst:13:
+chroma samples as simliar to ``V4L2_PIX_FMT_NV12``


WARNING: 'simliar' may be misspelled - perhaps 'similar'?
#334: FILE: Documentation/media/uapi/v4l/pixfmt-p016.rst:13:
+chroma samples as simliar to ``V4L2_PIX_FMT_NV12``


>
> Signed-off-by: Randy Li <[email protected]>
> ---
> Documentation/media/uapi/v4l/pixfmt-p010.rst | 126 ++++++++++++++++++++++++
> Documentation/media/uapi/v4l/pixfmt-p010m.rst | 135 ++++++++++++++++++++++++++
> Documentation/media/uapi/v4l/pixfmt-p016.rst | 125 ++++++++++++++++++++++++
> Documentation/media/uapi/v4l/pixfmt-p016m.rst | 134 +++++++++++++++++++++++++
> Documentation/media/uapi/v4l/yuv-formats.rst | 4 +
> include/uapi/linux/videodev2.h | 5 +
> 6 files changed, 529 insertions(+)
> create mode 100644 Documentation/media/uapi/v4l/pixfmt-p010.rst
> create mode 100644 Documentation/media/uapi/v4l/pixfmt-p010m.rst
> create mode 100644 Documentation/media/uapi/v4l/pixfmt-p016.rst
> create mode 100644 Documentation/media/uapi/v4l/pixfmt-p016m.rst
>
> diff --git a/Documentation/media/uapi/v4l/pixfmt-p010.rst b/Documentation/media/uapi/v4l/pixfmt-p010.rst
> new file mode 100644
> index 0000000..59ed118
> --- /dev/null
> +++ b/Documentation/media/uapi/v4l/pixfmt-p010.rst
> @@ -0,0 +1,126 @@
> +.. -*- coding: utf-8; mode: rst -*-
> +
> +.. _V4L2-PIX-FMT-P010:
> +
> +******************************************************
> +V4L2_PIX_FMT_P010 ('P010')
> +******************************************************
> +
> +
> +V4L2_PIX_FMT_P010
> +Formats with ½ horizontal and vertical chroma resolution. One luminance and
> +one chrominance plane with alternating
> +chroma samples as simliar to ``V4L2_PIX_FMT_NV12``

It is probably ok to use the UTF symbol for 1/2, but you should check
if both PDF and HTML outputs will be ok.

> +
> +
> +Description
> +===========
> +
> +It is a two-plane versions of the YUV 4:2:0 format. The three
> +components are separated into two sub-images or planes. The Y plane is
> +first. The Y plane has 16 bits per pixel, but only 10 bits are used with the
> +rest 6 bits set to zero. For ``V4L2_PIX_FMT_P010``, a combined CbCr plane
> +immediately follows the Y plane in memory. The CbCr
> +plane is the same width, in bytes, as the Y plane (and of the image),
> +but is half as tall in pixels. Each CbCr pair belongs to four pixels.
> +For example, Cb\ :sub:`0`/Cr\ :sub:`0` belongs to Y'\ :sub:`00`,
> +Y'\ :sub:`01`, Y'\ :sub:`10`, Y'\ :sub:`11`.
> +If the Y plane has pad bytes after each row, then the CbCr plane has as
> +many pad bytes after its rows.
> +
> +**Byte Order.**
> +Each cell is two bytes.
> +
> +
> +.. flat-table::
> + :header-rows: 0
> + :stub-columns: 0
> +
> + * - start + 0:
> + - Y'\ :sub:`00`
> + - Y'\ :sub:`01`
> + - Y'\ :sub:`02`
> + - Y'\ :sub:`03`
> + * - start + 4:
> + - Y'\ :sub:`10`
> + - Y'\ :sub:`11`
> + - Y'\ :sub:`12`
> + - Y'\ :sub:`13`
> + * - start + 8:
> + - Y'\ :sub:`20`
> + - Y'\ :sub:`21`
> + - Y'\ :sub:`22`
> + - Y'\ :sub:`23`
> + * - start + 12:
> + - Y'\ :sub:`30`
> + - Y'\ :sub:`31`
> + - Y'\ :sub:`32`
> + - Y'\ :sub:`33`
> + * - start + 16:
> + - Cb\ :sub:`00`
> + - Cr\ :sub:`00`
> + - Cb\ :sub:`01`
> + - Cr\ :sub:`01`
> + * - start + 20:
> + - Cb\ :sub:`10`
> + - Cr\ :sub:`10`
> + - Cb\ :sub:`11`
> + - Cr\ :sub:`11`
> +
> +
> +**Color Sample Location..**
> +
> +.. flat-table::
> + :header-rows: 0
> + :stub-columns: 0
> +
> + * -
> + - 0
> + -
> + - 1
> + - 2
> + -
> + - 3
> + * - 0
> + - Y
> + -
> + - Y
> + - Y
> + -
> + - Y
> + * -
> + -
> + - C
> + -
> + -
> + - C
> + -
> + * - 1
> + - Y
> + -
> + - Y
> + - Y
> + -
> + - Y
> + * -
> + * - 2
> + - Y
> + -
> + - Y
> + - Y
> + -
> + - Y
> + * -
> + -
> + - C
> + -
> + -
> + - C
> + -
> + * - 3
> + - Y
> + -
> + - Y
> + - Y
> + -
> + - Y
> diff --git a/Documentation/media/uapi/v4l/pixfmt-p010m.rst b/Documentation/media/uapi/v4l/pixfmt-p010m.rst
> new file mode 100644
> index 0000000..6697d15
> --- /dev/null
> +++ b/Documentation/media/uapi/v4l/pixfmt-p010m.rst
> @@ -0,0 +1,135 @@
> +.. -*- coding: utf-8; mode: rst -*-
> +
> +.. _V4L2-PIX-FMT-P010M:
> +
> +***********************************************************************************
> +V4L2_PIX_FMT_P010M ('PM10')
> +***********************************************************************************
> +
> +
> +V4L2_PIX_FMT_P010M
> +Variation of ``V4L2_PIX_FMT_P010`` with planes non contiguous in memory.
> +
> +
> +Description
> +===========
> +
> +This is a multi-planar, two-plane version of the YUV 4:2:0 format. The
> +three components are separated into two sub-images or planes.
> +``V4L2_PIX_FMT_P010M`` differs from ``V4L2_PIX_FMT_P010`` in that the
> +two planes are non-contiguous in memory, i.e. the chroma plane do not
> +necessarily immediately follows the luma plane. The luminance data
> +occupies the first plane. The Y plane has 16 bits per pixel, but only
> +10 bits are used with the rest 6 bits set to zero. In the
> +second plane there is a chrominance data with alternating chroma
> +samples. The CbCr plane is the same width, in bytes, as the Y plane (and
> +of the image), but is half as tall in pixels. Each CbCr pair belongs to
> +four pixels. For example, Cb\ :sub:`0`/Cr\ :sub:`0` belongs to
> +Y'\ :sub:`00`, Y'\ :sub:`01`, Y'\ :sub:`10`, Y'\ :sub:`11`.
> +
> +``V4L2_PIX_FMT_P010M`` is intended to be used only in drivers and
> +applications that support the multi-planar API, described in
> +:ref:`planar-apis`.
> +
> +If the Y plane has pad bytes after each row, then the CbCr plane has as
> +many pad bytes after its rows.
> +
> +**Byte Order.**
> +Each cell is two bytes.
> +
> +.. flat-table::
> + :header-rows: 0
> + :stub-columns: 0
> +
> + * - start0 + 0:
> + - Y'\ :sub:`00`
> + - Y'\ :sub:`01`
> + - Y'\ :sub:`02`
> + - Y'\ :sub:`03`
> + * - start0 + 4:
> + - Y'\ :sub:`10`
> + - Y'\ :sub:`11`
> + - Y'\ :sub:`12`
> + - Y'\ :sub:`13`
> + * - start0 + 8:
> + - Y'\ :sub:`20`
> + - Y'\ :sub:`21`
> + - Y'\ :sub:`22`
> + - Y'\ :sub:`23`
> + * - start0 + 12:
> + - Y'\ :sub:`30`
> + - Y'\ :sub:`31`
> + - Y'\ :sub:`32`
> + - Y'\ :sub:`33`
> + * -
> + * - start1 + 0:
> + - Cb\ :sub:`00`
> + - Cr\ :sub:`00`
> + - Cb\ :sub:`01`
> + - Cr\ :sub:`01`
> + * - start1 + 4:
> + - Cb\ :sub:`10`
> + - Cr\ :sub:`10`
> + - Cb\ :sub:`11`
> + - Cr\ :sub:`11`
> +
> +
> +**Color Sample Location..**
> +
> +
> +
> +.. flat-table::
> + :header-rows: 0
> + :stub-columns: 0
> +
> + * -
> + - 0
> + -
> + - 1
> + - 2
> + -
> + - 3
> + * - 0
> + - Y
> + -
> + - Y
> + - Y
> + -
> + - Y
> + * -
> + -
> + - C
> + -
> + -
> + - C
> + -
> + * - 1
> + - Y
> + -
> + - Y
> + - Y
> + -
> + - Y
> + * -
> + * - 2
> + - Y
> + -
> + - Y
> + - Y
> + -
> + - Y
> + * -
> + -
> + - C
> + -
> + -
> + -
> + - C
> + -
> + * - 3
> + - Y
> + -
> + - Y
> + - Y
> + -
> + - Y
> diff --git a/Documentation/media/uapi/v4l/pixfmt-p016.rst b/Documentation/media/uapi/v4l/pixfmt-p016.rst
> new file mode 100644
> index 0000000..a6d60b3
> --- /dev/null
> +++ b/Documentation/media/uapi/v4l/pixfmt-p016.rst
> @@ -0,0 +1,125 @@
> +.. -*- coding: utf-8; mode: rst -*-
> +
> +.. _V4L2-PIX-FMT-P016:
> +
> +******************************************************
> +V4L2_PIX_FMT_P016 ('P016')
> +******************************************************
> +
> +
> +V4L2_PIX_FMT_P016
> +Formats with ½ horizontal and vertical chroma resolution. One luminance and
> +one chrominance plane with alternating
> +chroma samples as simliar to ``V4L2_PIX_FMT_NV12``
> +
> +
> +Description
> +===========
> +
> +It is a two-plane versions of the YUV 4:2:0 format. The three
> +components are separated into two sub-images or planes. The Y plane is
> +first. The Y plane has 16 bits per pixel. For ``V4L2_PIX_FMT_P016``, a
> +combined CbCr plane immediately follows the Y plane in memory. The CbCr
> +plane is the same width, in bytes, as the Y plane (and of the image),
> +but is half as tall in pixels. Each CbCr pair belongs to four pixels.
> +For example, Cb\ :sub:`0`/Cr\ :sub:`0` belongs to Y'\ :sub:`00`,
> +Y'\ :sub:`01`, Y'\ :sub:`10`, Y'\ :sub:`11`.
> +If the Y plane has pad bytes after each row, then the CbCr plane has as
> +many pad bytes after its rows.
> +
> +**Byte Order.**
> +Each cell is two bytes.
> +
> +
> +.. flat-table::
> + :header-rows: 0
> + :stub-columns: 0
> +
> + * - start + 0:
> + - Y'\ :sub:`00`
> + - Y'\ :sub:`01`
> + - Y'\ :sub:`02`
> + - Y'\ :sub:`03`
> + * - start + 4:
> + - Y'\ :sub:`10`
> + - Y'\ :sub:`11`
> + - Y'\ :sub:`12`
> + - Y'\ :sub:`13`
> + * - start + 8:
> + - Y'\ :sub:`20`
> + - Y'\ :sub:`21`
> + - Y'\ :sub:`22`
> + - Y'\ :sub:`23`
> + * - start + 12:
> + - Y'\ :sub:`30`
> + - Y'\ :sub:`31`
> + - Y'\ :sub:`32`
> + - Y'\ :sub:`33`
> + * - start + 16:
> + - Cb\ :sub:`00`
> + - Cr\ :sub:`00`
> + - Cb\ :sub:`01`
> + - Cr\ :sub:`01`
> + * - start + 20:
> + - Cb\ :sub:`10`
> + - Cr\ :sub:`10`
> + - Cb\ :sub:`11`
> + - Cr\ :sub:`11`
> +
> +
> +**Color Sample Location..**
> +
> +.. flat-table::
> + :header-rows: 0
> + :stub-columns: 0
> +
> + * -
> + - 0
> + -
> + - 1
> + - 2
> + -
> + - 3
> + * - 0
> + - Y
> + -
> + - Y
> + - Y
> + -
> + - Y
> + * -
> + -
> + - C
> + -
> + -
> + - C
> + -
> + * - 1
> + - Y
> + -
> + - Y
> + - Y
> + -
> + - Y
> + * -
> + * - 2
> + - Y
> + -
> + - Y
> + - Y
> + -
> + - Y
> + * -
> + -
> + - C
> + -
> + -
> + - C
> + -
> + * - 3
> + - Y
> + -
> + - Y
> + - Y
> + -
> + - Y
> diff --git a/Documentation/media/uapi/v4l/pixfmt-p016m.rst b/Documentation/media/uapi/v4l/pixfmt-p016m.rst
> new file mode 100644
> index 0000000..14c434d
> --- /dev/null
> +++ b/Documentation/media/uapi/v4l/pixfmt-p016m.rst
> @@ -0,0 +1,134 @@
> +.. -*- coding: utf-8; mode: rst -*-
> +
> +.. _V4L2-PIX-FMT-P016M:
> +
> +***********************************************************************************
> +V4L2_PIX_FMT_P016M ('PM16')
> +***********************************************************************************
> +
> +
> +V4L2_PIX_FMT_P016M
> +Variation of ``V4L2_PIX_FMT_P016`` with planes non contiguous in memory.
> +
> +
> +Description
> +===========
> +
> +This is a multi-planar, two-plane version of the YUV 4:2:0 format. The
> +three components are separated into two sub-images or planes.
> +``V4L2_PIX_FMT_P016M`` differs from ``V4L2_PIX_FMT_P016`` in that the
> +two planes are non-contiguous in memory, i.e. the chroma plane do not
> +necessarily immediately follows the luma plane. The luminance data
> +occupies the first plane. The Y plane has 16 bits per pixel. In the
> +second plane there is a chrominance data with alternating chroma
> +samples. The CbCr plane is the same width, in bytes, as the Y plane (and
> +of the image), but is half as tall in pixels. Each CbCr pair belongs to
> +four pixels. For example, Cb\ :sub:`0`/Cr\ :sub:`0` belongs to
> +Y'\ :sub:`00`, Y'\ :sub:`01`, Y'\ :sub:`10`, Y'\ :sub:`11`.
> +
> +``V4L2_PIX_FMT_P016M`` is intended to be used only in drivers and
> +applications that support the multi-planar API, described in
> +:ref:`planar-apis`.
> +
> +If the Y plane has pad bytes after each row, then the CbCr plane has as
> +many pad bytes after its rows.
> +
> +**Byte Order.**
> +Each cell is two bytes.
> +
> +.. flat-table::
> + :header-rows: 0
> + :stub-columns: 0
> +
> + * - start0 + 0:
> + - Y'\ :sub:`00`
> + - Y'\ :sub:`01`
> + - Y'\ :sub:`02`
> + - Y'\ :sub:`03`
> + * - start0 + 4:
> + - Y'\ :sub:`10`
> + - Y'\ :sub:`11`
> + - Y'\ :sub:`12`
> + - Y'\ :sub:`13`
> + * - start0 + 8:
> + - Y'\ :sub:`20`
> + - Y'\ :sub:`21`
> + - Y'\ :sub:`22`
> + - Y'\ :sub:`23`
> + * - start0 + 12:
> + - Y'\ :sub:`30`
> + - Y'\ :sub:`31`
> + - Y'\ :sub:`32`
> + - Y'\ :sub:`33`
> + * -
> + * - start1 + 0:
> + - Cb\ :sub:`00`
> + - Cr\ :sub:`00`
> + - Cb\ :sub:`01`
> + - Cr\ :sub:`01`
> + * - start1 + 4:
> + - Cb\ :sub:`10`
> + - Cr\ :sub:`10`
> + - Cb\ :sub:`11`
> + - Cr\ :sub:`11`
> +
> +
> +**Color Sample Location..**
> +
> +
> +
> +.. flat-table::
> + :header-rows: 0
> + :stub-columns: 0
> +
> + * -
> + - 0
> + -
> + - 1
> + - 2
> + -
> + - 3
> + * - 0
> + - Y
> + -
> + - Y
> + - Y
> + -
> + - Y
> + * -
> + -
> + - C
> + -
> + -
> + - C
> + -
> + * - 1
> + - Y
> + -
> + - Y
> + - Y
> + -
> + - Y
> + * -
> + * - 2
> + - Y
> + -
> + - Y
> + - Y
> + -
> + - Y
> + * -
> + -
> + - C
> + -
> + -
> + -
> + - C
> + -
> + * - 3
> + - Y
> + -
> + - Y
> + - Y
> + -
> + - Y
> diff --git a/Documentation/media/uapi/v4l/yuv-formats.rst b/Documentation/media/uapi/v4l/yuv-formats.rst
> index 3334ea4..1474192 100644
> --- a/Documentation/media/uapi/v4l/yuv-formats.rst
> +++ b/Documentation/media/uapi/v4l/yuv-formats.rst
> @@ -53,3 +53,7 @@ to brightness information.
> pixfmt-nv16m
> pixfmt-nv24
> pixfmt-m420
> + pixfmt-p010
> + pixfmt-p010m
> + pixfmt-p016
> + pixfmt-p016m
> diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
> index 45184a2..d2f2013 100644
> --- a/include/uapi/linux/videodev2.h
> +++ b/include/uapi/linux/videodev2.h
> @@ -550,6 +550,8 @@ struct v4l2_pix_format {
> #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 */
> #define V4L2_PIX_FMT_NV42 v4l2_fourcc('N', 'V', '4', '2') /* 24 Y/CrCb 4:4:4 */
> +#define V4L2_PIX_FMT_P010 v4l2_fourcc('P', '0', '1', '0') /* 20 Y/CbCr 4:2:0, 10 bits per channel */
> +#define V4L2_PIX_FMT_P016 v4l2_fourcc('P', '0', '1', '6') /* 32 Y/CbCr 4:2:0, 16 bits per channel */
>
> /* two non contiguous planes - one Y, one Cr + Cb interleaved */
> #define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 */
> @@ -558,6 +560,9 @@ struct v4l2_pix_format {
> #define V4L2_PIX_FMT_NV61M v4l2_fourcc('N', 'M', '6', '1') /* 16 Y/CrCb 4:2:2 */
> #define V4L2_PIX_FMT_NV12MT v4l2_fourcc('T', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 64x32 macroblocks */
> #define V4L2_PIX_FMT_NV12MT_16X16 v4l2_fourcc('V', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 16x16 macroblocks */
> +#define V4L2_PIX_FMT_P010M v4l2_fourcc('P', 'M', '1', '0') /* 32 Y/CbCr 4:2:0, 10 bits per channel */
> +#define V4L2_PIX_FMT_P016M v4l2_fourcc('P', 'M', '1', '6') /* 32 Y/CbCr 4:2:0, 16 bits per channel */
> +#define V4L2_PIX_FMT_P010CM v4l2_fourcc('C', 'M', '1', '0') /* 20 Y/CbCr 4:2:0, 10 bits per channel, compact format */
>
> /* three planes - Y Cb, Cr */
> #define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y', 'U', 'V', '9') /* 9 YUV 4:1:0 */



Thanks,
Mauro

2017-04-21 11:06:10

by Randy Li

[permalink] [raw]
Subject: Re: [PATCH v6 2/3] v4l: Add 10/16-bits per channel YUV pixel formats



On 04/18/2017 03:33 AM, Mauro Carvalho Chehab wrote:
> Em Sun, 5 Mar 2017 18:00:32 +0800
> Randy Li <[email protected]> escreveu:
>
>> The formats added by this patch are:
>> V4L2_PIX_FMT_P010
>> V4L2_PIX_FMT_P010M
>> V4L2_PIX_FMT_P016
>> V4L2_PIX_FMT_P016M
>> Currently, none of driver uses those format.
>>
>> Also a variant of V4L2_PIX_FMT_P010M pixel format is added.
>> The V4L2_PIX_FMT_P010CM is a compat variant of the V4L2_PIX_FMT_P010,
Some developers from Gstreamer think it should be renamed as CM10 for
the P010CM, I don't have much idea about that.
>> which uses the unused 6 bits to store the next pixel. And with
>> the alignment requirement of the hardware, it usually would be
>> some extra space left at the end of a stride.
> You should check your patches with checkpatch... I'm getting
> this:
>
>
> WARNING: 'simliar' may be misspelled - perhaps 'similar'?
> #61: FILE: Documentation/media/uapi/v4l/pixfmt-p010.rst:13:
> +chroma samples as simliar to ``V4L2_PIX_FMT_NV12``
I am sorry about that
>
>
> WARNING: 'simliar' may be misspelled - perhaps 'similar'?
> #334: FILE: Documentation/media/uapi/v4l/pixfmt-p016.rst:13:
> +chroma samples as simliar to ``V4L2_PIX_FMT_NV12``
>
>
>> Signed-off-by: Randy Li <[email protected]>
>> ---
>> Documentation/media/uapi/v4l/pixfmt-p010.rst | 126 ++++++++++++++++++++++++
>> Documentation/media/uapi/v4l/pixfmt-p010m.rst | 135 ++++++++++++++++++++++++++
>> Documentation/media/uapi/v4l/pixfmt-p016.rst | 125 ++++++++++++++++++++++++
>> Documentation/media/uapi/v4l/pixfmt-p016m.rst | 134 +++++++++++++++++++++++++
>> Documentation/media/uapi/v4l/yuv-formats.rst | 4 +
>> include/uapi/linux/videodev2.h | 5 +
>> 6 files changed, 529 insertions(+)
>> create mode 100644 Documentation/media/uapi/v4l/pixfmt-p010.rst
>> create mode 100644 Documentation/media/uapi/v4l/pixfmt-p010m.rst
>> create mode 100644 Documentation/media/uapi/v4l/pixfmt-p016.rst
>> create mode 100644 Documentation/media/uapi/v4l/pixfmt-p016m.rst
>>
>> diff --git a/Documentation/media/uapi/v4l/pixfmt-p010.rst b/Documentation/media/uapi/v4l/pixfmt-p010.rst
>> new file mode 100644
>> index 0000000..59ed118
>> --- /dev/null
>> +++ b/Documentation/media/uapi/v4l/pixfmt-p010.rst
>> @@ -0,0 +1,126 @@
>> +.. -*- coding: utf-8; mode: rst -*-
>> +
>> +.. _V4L2-PIX-FMT-P010:
>> +
>> +******************************************************
>> +V4L2_PIX_FMT_P010 ('P010')
>> +******************************************************
>> +
>> +
>> +V4L2_PIX_FMT_P010
>> +Formats with ½ horizontal and vertical chroma resolution. One luminance and
>> +one chrominance plane with alternating
>> +chroma samples as simliar to ``V4L2_PIX_FMT_NV12``
> It is probably ok to use the UTF symbol for 1/2, but you should check
> if both PDF and HTML outputs will be ok.
I see, I would upload a new version later
>
>> +
>> +
>> +Description
>> +===========
>> +
>> +It is a two-plane versions of the YUV 4:2:0 format. The three
>> +components are separated into two sub-images or planes. The Y plane is
>> +first. The Y plane has 16 bits per pixel, but only 10 bits are used with the
>> +rest 6 bits set to zero. For ``V4L2_PIX_FMT_P010``, a combined CbCr plane
>> +immediately follows the Y plane in memory. The CbCr
>> +plane is the same width, in bytes, as the Y plane (and of the image),
>> +but is half as tall in pixels. Each CbCr pair belongs to four pixels.
>> +For example, Cb\ :sub:`0`/Cr\ :sub:`0` belongs to Y'\ :sub:`00`,
>> +Y'\ :sub:`01`, Y'\ :sub:`10`, Y'\ :sub:`11`.
>> +If the Y plane has pad bytes after each row, then the CbCr plane has as
>> +many pad bytes after its rows.
>> +
>> +**Byte Order.**
>> +Each cell is two bytes.
>> +
>> +
>> +.. flat-table::
>> + :header-rows: 0
>> + :stub-columns: 0
>> +
>> + * - start + 0:
>> + - Y'\ :sub:`00`
>> + - Y'\ :sub:`01`
>> + - Y'\ :sub:`02`
>> + - Y'\ :sub:`03`
>> + * - start + 4:
>> + - Y'\ :sub:`10`
>> + - Y'\ :sub:`11`
>> + - Y'\ :sub:`12`
>> + - Y'\ :sub:`13`
>> + * - start + 8:
>> + - Y'\ :sub:`20`
>> + - Y'\ :sub:`21`
>> + - Y'\ :sub:`22`
>> + - Y'\ :sub:`23`
>> + * - start + 12:
>> + - Y'\ :sub:`30`
>> + - Y'\ :sub:`31`
>> + - Y'\ :sub:`32`
>> + - Y'\ :sub:`33`
>> + * - start + 16:
>> + - Cb\ :sub:`00`
>> + - Cr\ :sub:`00`
>> + - Cb\ :sub:`01`
>> + - Cr\ :sub:`01`
>> + * - start + 20:
>> + - Cb\ :sub:`10`
>> + - Cr\ :sub:`10`
>> + - Cb\ :sub:`11`
>> + - Cr\ :sub:`11`
>> +
>> +
>> +**Color Sample Location..**
>> +
>> +.. flat-table::
>> + :header-rows: 0
>> + :stub-columns: 0
>> +
>> + * -
>> + - 0
>> + -
>> + - 1
>> + - 2
>> + -
>> + - 3
>> + * - 0
>> + - Y
>> + -
>> + - Y
>> + - Y
>> + -
>> + - Y
>> + * -
>> + -
>> + - C
>> + -
>> + -
>> + - C
>> + -
>> + * - 1
>> + - Y
>> + -
>> + - Y
>> + - Y
>> + -
>> + - Y
>> + * -
>> + * - 2
>> + - Y
>> + -
>> + - Y
>> + - Y
>> + -
>> + - Y
>> + * -
>> + -
>> + - C
>> + -
>> + -
>> + - C
>> + -
>> + * - 3
>> + - Y
>> + -
>> + - Y
>> + - Y
>> + -
>> + - Y
>> diff --git a/Documentation/media/uapi/v4l/pixfmt-p010m.rst b/Documentation/media/uapi/v4l/pixfmt-p010m.rst
>> new file mode 100644
>> index 0000000..6697d15
>> --- /dev/null
>> +++ b/Documentation/media/uapi/v4l/pixfmt-p010m.rst
>> @@ -0,0 +1,135 @@
>> +.. -*- coding: utf-8; mode: rst -*-
>> +
>> +.. _V4L2-PIX-FMT-P010M:
>> +
>> +***********************************************************************************
>> +V4L2_PIX_FMT_P010M ('PM10')
>> +***********************************************************************************
>> +
>> +
>> +V4L2_PIX_FMT_P010M
>> +Variation of ``V4L2_PIX_FMT_P010`` with planes non contiguous in memory.
>> +
>> +
>> +Description
>> +===========
>> +
>> +This is a multi-planar, two-plane version of the YUV 4:2:0 format. The
>> +three components are separated into two sub-images or planes.
>> +``V4L2_PIX_FMT_P010M`` differs from ``V4L2_PIX_FMT_P010`` in that the
>> +two planes are non-contiguous in memory, i.e. the chroma plane do not
>> +necessarily immediately follows the luma plane. The luminance data
>> +occupies the first plane. The Y plane has 16 bits per pixel, but only
>> +10 bits are used with the rest 6 bits set to zero. In the
>> +second plane there is a chrominance data with alternating chroma
>> +samples. The CbCr plane is the same width, in bytes, as the Y plane (and
>> +of the image), but is half as tall in pixels. Each CbCr pair belongs to
>> +four pixels. For example, Cb\ :sub:`0`/Cr\ :sub:`0` belongs to
>> +Y'\ :sub:`00`, Y'\ :sub:`01`, Y'\ :sub:`10`, Y'\ :sub:`11`.
>> +
>> +``V4L2_PIX_FMT_P010M`` is intended to be used only in drivers and
>> +applications that support the multi-planar API, described in
>> +:ref:`planar-apis`.
>> +
>> +If the Y plane has pad bytes after each row, then the CbCr plane has as
>> +many pad bytes after its rows.
>> +
>> +**Byte Order.**
>> +Each cell is two bytes.
>> +
>> +.. flat-table::
>> + :header-rows: 0
>> + :stub-columns: 0
>> +
>> + * - start0 + 0:
>> + - Y'\ :sub:`00`
>> + - Y'\ :sub:`01`
>> + - Y'\ :sub:`02`
>> + - Y'\ :sub:`03`
>> + * - start0 + 4:
>> + - Y'\ :sub:`10`
>> + - Y'\ :sub:`11`
>> + - Y'\ :sub:`12`
>> + - Y'\ :sub:`13`
>> + * - start0 + 8:
>> + - Y'\ :sub:`20`
>> + - Y'\ :sub:`21`
>> + - Y'\ :sub:`22`
>> + - Y'\ :sub:`23`
>> + * - start0 + 12:
>> + - Y'\ :sub:`30`
>> + - Y'\ :sub:`31`
>> + - Y'\ :sub:`32`
>> + - Y'\ :sub:`33`
>> + * -
>> + * - start1 + 0:
>> + - Cb\ :sub:`00`
>> + - Cr\ :sub:`00`
>> + - Cb\ :sub:`01`
>> + - Cr\ :sub:`01`
>> + * - start1 + 4:
>> + - Cb\ :sub:`10`
>> + - Cr\ :sub:`10`
>> + - Cb\ :sub:`11`
>> + - Cr\ :sub:`11`
>> +
>> +
>> +**Color Sample Location..**
>> +
>> +
>> +
>> +.. flat-table::
>> + :header-rows: 0
>> + :stub-columns: 0
>> +
>> + * -
>> + - 0
>> + -
>> + - 1
>> + - 2
>> + -
>> + - 3
>> + * - 0
>> + - Y
>> + -
>> + - Y
>> + - Y
>> + -
>> + - Y
>> + * -
>> + -
>> + - C
>> + -
>> + -
>> + - C
>> + -
>> + * - 1
>> + - Y
>> + -
>> + - Y
>> + - Y
>> + -
>> + - Y
>> + * -
>> + * - 2
>> + - Y
>> + -
>> + - Y
>> + - Y
>> + -
>> + - Y
>> + * -
>> + -
>> + - C
>> + -
>> + -
>> + -
>> + - C
>> + -
>> + * - 3
>> + - Y
>> + -
>> + - Y
>> + - Y
>> + -
>> + - Y
>> diff --git a/Documentation/media/uapi/v4l/pixfmt-p016.rst b/Documentation/media/uapi/v4l/pixfmt-p016.rst
>> new file mode 100644
>> index 0000000..a6d60b3
>> --- /dev/null
>> +++ b/Documentation/media/uapi/v4l/pixfmt-p016.rst
>> @@ -0,0 +1,125 @@
>> +.. -*- coding: utf-8; mode: rst -*-
>> +
>> +.. _V4L2-PIX-FMT-P016:
>> +
>> +******************************************************
>> +V4L2_PIX_FMT_P016 ('P016')
>> +******************************************************
>> +
>> +
>> +V4L2_PIX_FMT_P016
>> +Formats with ½ horizontal and vertical chroma resolution. One luminance and
>> +one chrominance plane with alternating
>> +chroma samples as simliar to ``V4L2_PIX_FMT_NV12``
>> +
>> +
>> +Description
>> +===========
>> +
>> +It is a two-plane versions of the YUV 4:2:0 format. The three
>> +components are separated into two sub-images or planes. The Y plane is
>> +first. The Y plane has 16 bits per pixel. For ``V4L2_PIX_FMT_P016``, a
>> +combined CbCr plane immediately follows the Y plane in memory. The CbCr
>> +plane is the same width, in bytes, as the Y plane (and of the image),
>> +but is half as tall in pixels. Each CbCr pair belongs to four pixels.
>> +For example, Cb\ :sub:`0`/Cr\ :sub:`0` belongs to Y'\ :sub:`00`,
>> +Y'\ :sub:`01`, Y'\ :sub:`10`, Y'\ :sub:`11`.
>> +If the Y plane has pad bytes after each row, then the CbCr plane has as
>> +many pad bytes after its rows.
>> +
>> +**Byte Order.**
>> +Each cell is two bytes.
>> +
>> +
>> +.. flat-table::
>> + :header-rows: 0
>> + :stub-columns: 0
>> +
>> + * - start + 0:
>> + - Y'\ :sub:`00`
>> + - Y'\ :sub:`01`
>> + - Y'\ :sub:`02`
>> + - Y'\ :sub:`03`
>> + * - start + 4:
>> + - Y'\ :sub:`10`
>> + - Y'\ :sub:`11`
>> + - Y'\ :sub:`12`
>> + - Y'\ :sub:`13`
>> + * - start + 8:
>> + - Y'\ :sub:`20`
>> + - Y'\ :sub:`21`
>> + - Y'\ :sub:`22`
>> + - Y'\ :sub:`23`
>> + * - start + 12:
>> + - Y'\ :sub:`30`
>> + - Y'\ :sub:`31`
>> + - Y'\ :sub:`32`
>> + - Y'\ :sub:`33`
>> + * - start + 16:
>> + - Cb\ :sub:`00`
>> + - Cr\ :sub:`00`
>> + - Cb\ :sub:`01`
>> + - Cr\ :sub:`01`
>> + * - start + 20:
>> + - Cb\ :sub:`10`
>> + - Cr\ :sub:`10`
>> + - Cb\ :sub:`11`
>> + - Cr\ :sub:`11`
>> +
>> +
>> +**Color Sample Location..**
>> +
>> +.. flat-table::
>> + :header-rows: 0
>> + :stub-columns: 0
>> +
>> + * -
>> + - 0
>> + -
>> + - 1
>> + - 2
>> + -
>> + - 3
>> + * - 0
>> + - Y
>> + -
>> + - Y
>> + - Y
>> + -
>> + - Y
>> + * -
>> + -
>> + - C
>> + -
>> + -
>> + - C
>> + -
>> + * - 1
>> + - Y
>> + -
>> + - Y
>> + - Y
>> + -
>> + - Y
>> + * -
>> + * - 2
>> + - Y
>> + -
>> + - Y
>> + - Y
>> + -
>> + - Y
>> + * -
>> + -
>> + - C
>> + -
>> + -
>> + - C
>> + -
>> + * - 3
>> + - Y
>> + -
>> + - Y
>> + - Y
>> + -
>> + - Y
>> diff --git a/Documentation/media/uapi/v4l/pixfmt-p016m.rst b/Documentation/media/uapi/v4l/pixfmt-p016m.rst
>> new file mode 100644
>> index 0000000..14c434d
>> --- /dev/null
>> +++ b/Documentation/media/uapi/v4l/pixfmt-p016m.rst
>> @@ -0,0 +1,134 @@
>> +.. -*- coding: utf-8; mode: rst -*-
>> +
>> +.. _V4L2-PIX-FMT-P016M:
>> +
>> +***********************************************************************************
>> +V4L2_PIX_FMT_P016M ('PM16')
>> +***********************************************************************************
>> +
>> +
>> +V4L2_PIX_FMT_P016M
>> +Variation of ``V4L2_PIX_FMT_P016`` with planes non contiguous in memory.
>> +
>> +
>> +Description
>> +===========
>> +
>> +This is a multi-planar, two-plane version of the YUV 4:2:0 format. The
>> +three components are separated into two sub-images or planes.
>> +``V4L2_PIX_FMT_P016M`` differs from ``V4L2_PIX_FMT_P016`` in that the
>> +two planes are non-contiguous in memory, i.e. the chroma plane do not
>> +necessarily immediately follows the luma plane. The luminance data
>> +occupies the first plane. The Y plane has 16 bits per pixel. In the
>> +second plane there is a chrominance data with alternating chroma
>> +samples. The CbCr plane is the same width, in bytes, as the Y plane (and
>> +of the image), but is half as tall in pixels. Each CbCr pair belongs to
>> +four pixels. For example, Cb\ :sub:`0`/Cr\ :sub:`0` belongs to
>> +Y'\ :sub:`00`, Y'\ :sub:`01`, Y'\ :sub:`10`, Y'\ :sub:`11`.
>> +
>> +``V4L2_PIX_FMT_P016M`` is intended to be used only in drivers and
>> +applications that support the multi-planar API, described in
>> +:ref:`planar-apis`.
>> +
>> +If the Y plane has pad bytes after each row, then the CbCr plane has as
>> +many pad bytes after its rows.
>> +
>> +**Byte Order.**
>> +Each cell is two bytes.
>> +
>> +.. flat-table::
>> + :header-rows: 0
>> + :stub-columns: 0
>> +
>> + * - start0 + 0:
>> + - Y'\ :sub:`00`
>> + - Y'\ :sub:`01`
>> + - Y'\ :sub:`02`
>> + - Y'\ :sub:`03`
>> + * - start0 + 4:
>> + - Y'\ :sub:`10`
>> + - Y'\ :sub:`11`
>> + - Y'\ :sub:`12`
>> + - Y'\ :sub:`13`
>> + * - start0 + 8:
>> + - Y'\ :sub:`20`
>> + - Y'\ :sub:`21`
>> + - Y'\ :sub:`22`
>> + - Y'\ :sub:`23`
>> + * - start0 + 12:
>> + - Y'\ :sub:`30`
>> + - Y'\ :sub:`31`
>> + - Y'\ :sub:`32`
>> + - Y'\ :sub:`33`
>> + * -
>> + * - start1 + 0:
>> + - Cb\ :sub:`00`
>> + - Cr\ :sub:`00`
>> + - Cb\ :sub:`01`
>> + - Cr\ :sub:`01`
>> + * - start1 + 4:
>> + - Cb\ :sub:`10`
>> + - Cr\ :sub:`10`
>> + - Cb\ :sub:`11`
>> + - Cr\ :sub:`11`
>> +
>> +
>> +**Color Sample Location..**
>> +
>> +
>> +
>> +.. flat-table::
>> + :header-rows: 0
>> + :stub-columns: 0
>> +
>> + * -
>> + - 0
>> + -
>> + - 1
>> + - 2
>> + -
>> + - 3
>> + * - 0
>> + - Y
>> + -
>> + - Y
>> + - Y
>> + -
>> + - Y
>> + * -
>> + -
>> + - C
>> + -
>> + -
>> + - C
>> + -
>> + * - 1
>> + - Y
>> + -
>> + - Y
>> + - Y
>> + -
>> + - Y
>> + * -
>> + * - 2
>> + - Y
>> + -
>> + - Y
>> + - Y
>> + -
>> + - Y
>> + * -
>> + -
>> + - C
>> + -
>> + -
>> + -
>> + - C
>> + -
>> + * - 3
>> + - Y
>> + -
>> + - Y
>> + - Y
>> + -
>> + - Y
>> diff --git a/Documentation/media/uapi/v4l/yuv-formats.rst b/Documentation/media/uapi/v4l/yuv-formats.rst
>> index 3334ea4..1474192 100644
>> --- a/Documentation/media/uapi/v4l/yuv-formats.rst
>> +++ b/Documentation/media/uapi/v4l/yuv-formats.rst
>> @@ -53,3 +53,7 @@ to brightness information.
>> pixfmt-nv16m
>> pixfmt-nv24
>> pixfmt-m420
>> + pixfmt-p010
>> + pixfmt-p010m
>> + pixfmt-p016
>> + pixfmt-p016m
>> diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
>> index 45184a2..d2f2013 100644
>> --- a/include/uapi/linux/videodev2.h
>> +++ b/include/uapi/linux/videodev2.h
>> @@ -550,6 +550,8 @@ struct v4l2_pix_format {
>> #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 */
>> #define V4L2_PIX_FMT_NV42 v4l2_fourcc('N', 'V', '4', '2') /* 24 Y/CrCb 4:4:4 */
>> +#define V4L2_PIX_FMT_P010 v4l2_fourcc('P', '0', '1', '0') /* 20 Y/CbCr 4:2:0, 10 bits per channel */
>> +#define V4L2_PIX_FMT_P016 v4l2_fourcc('P', '0', '1', '6') /* 32 Y/CbCr 4:2:0, 16 bits per channel */
>>
>> /* two non contiguous planes - one Y, one Cr + Cb interleaved */
>> #define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 */
>> @@ -558,6 +560,9 @@ struct v4l2_pix_format {
>> #define V4L2_PIX_FMT_NV61M v4l2_fourcc('N', 'M', '6', '1') /* 16 Y/CrCb 4:2:2 */
>> #define V4L2_PIX_FMT_NV12MT v4l2_fourcc('T', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 64x32 macroblocks */
>> #define V4L2_PIX_FMT_NV12MT_16X16 v4l2_fourcc('V', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 16x16 macroblocks */
>> +#define V4L2_PIX_FMT_P010M v4l2_fourcc('P', 'M', '1', '0') /* 32 Y/CbCr 4:2:0, 10 bits per channel */
>> +#define V4L2_PIX_FMT_P016M v4l2_fourcc('P', 'M', '1', '6') /* 32 Y/CbCr 4:2:0, 16 bits per channel */
>> +#define V4L2_PIX_FMT_P010CM v4l2_fourcc('C', 'M', '1', '0') /* 20 Y/CbCr 4:2:0, 10 bits per channel, compact format */
>>
>> /* three planes - Y Cb, Cr */
>> #define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y', 'U', 'V', '9') /* 9 YUV 4:1:0 */
>
>
> Thanks,
> Mauro