Skip to content

Commit

Permalink
media: v4l: Add definition for the Sunxi tiled NV12 format
Browse files Browse the repository at this point in the history
This introduces support for the Sunxi tiled NV12 format, where each
component of the YUV frame is divided into macroblocks. Hence, the size
of each plane requires specific alignment. The pixels inside each
macroblock are coded in linear order (line after line from top to
bottom).

This tiled NV12 format is used by the video engine on Allwinner
platforms: it is the default format for decoded frames (and the only
one available in the oldest supported platforms).

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
  • Loading branch information
Paul Kocialkowski authored and Mauro Carvalho Chehab committed Sep 24, 2018
1 parent c27bb30 commit 36cf35b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
15 changes: 14 additions & 1 deletion Documentation/media/uapi/v4l/pixfmt-reserved.rst
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,20 @@ please make a proposal on the linux-media mailing list.
It is an opaque intermediate format and the MDP hardware must be
used to convert ``V4L2_PIX_FMT_MT21C`` to ``V4L2_PIX_FMT_NV12M``,
``V4L2_PIX_FMT_YUV420M`` or ``V4L2_PIX_FMT_YVU420``.

* .. _V4L2-PIX-FMT-SUNXI-TILED-NV12:

- ``V4L2_PIX_FMT_SUNXI_TILED_NV12``
- 'ST12'
- Two-planar NV12-based format used by the video engine found on Allwinner
(codenamed sunxi) platforms, with 32x32 tiles for the luminance plane
and 32x64 tiles for the chrominance plane. The data in each tile is
stored in linear order, within the tile bounds. Each tile follows the
previous one linearly in memory (from left to right, top to bottom).

The associated buffer dimensions are aligned to match an integer number
of tiles, resulting in 32-aligned resolutions for the luminance plane
and 16-aligned resolutions for the chrominance plane (with 2x2
subsampling).

.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|

Expand Down
1 change: 1 addition & 0 deletions drivers/media/v4l2-core/v4l2-ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1337,6 +1337,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
case V4L2_PIX_FMT_SE401: descr = "GSPCA SE401"; break;
case V4L2_PIX_FMT_S5C_UYVY_JPG: descr = "S5C73MX interleaved UYVY/JPEG"; break;
case V4L2_PIX_FMT_MT21C: descr = "Mediatek Compressed Format"; break;
case V4L2_PIX_FMT_SUNXI_TILED_NV12: descr = "Sunxi Tiled NV12 Format"; break;
default:
WARN(1, "Unknown pixelformat 0x%08x\n", fmt->pixelformat);
if (fmt->description[0])
Expand Down
1 change: 1 addition & 0 deletions include/uapi/linux/videodev2.h
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,7 @@ struct v4l2_pix_format {
#define V4L2_PIX_FMT_Z16 v4l2_fourcc('Z', '1', '6', ' ') /* Depth data 16-bit */
#define V4L2_PIX_FMT_MT21C v4l2_fourcc('M', 'T', '2', '1') /* Mediatek compressed block mode */
#define V4L2_PIX_FMT_INZI v4l2_fourcc('I', 'N', 'Z', 'I') /* Intel Planar Greyscale 10-bit and Depth 16-bit */
#define V4L2_PIX_FMT_SUNXI_TILED_NV12 v4l2_fourcc('S', 'T', '1', '2') /* Sunxi Tiled NV12 Format */

/* 10bit raw bayer packed, 32 bytes for every 25 pixels, last LSB 6 bits unused */
#define V4L2_PIX_FMT_IPU3_SBGGR10 v4l2_fourcc('i', 'p', '3', 'b') /* IPU3 packed 10-bit BGGR bayer */
Expand Down

0 comments on commit 36cf35b

Please sign in to comment.