Skip to content

Commit 36cf35b

Browse files
paulkocialkowskimchehab
authored andcommitted
media: v4l: Add definition for the Sunxi tiled NV12 format
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>
1 parent c27bb30 commit 36cf35b

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

Documentation/media/uapi/v4l/pixfmt-reserved.rst

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,20 @@ please make a proposal on the linux-media mailing list.
243243
It is an opaque intermediate format and the MDP hardware must be
244244
used to convert ``V4L2_PIX_FMT_MT21C`` to ``V4L2_PIX_FMT_NV12M``,
245245
``V4L2_PIX_FMT_YUV420M`` or ``V4L2_PIX_FMT_YVU420``.
246-
246+
* .. _V4L2-PIX-FMT-SUNXI-TILED-NV12:
247+
248+
- ``V4L2_PIX_FMT_SUNXI_TILED_NV12``
249+
- 'ST12'
250+
- Two-planar NV12-based format used by the video engine found on Allwinner
251+
(codenamed sunxi) platforms, with 32x32 tiles for the luminance plane
252+
and 32x64 tiles for the chrominance plane. The data in each tile is
253+
stored in linear order, within the tile bounds. Each tile follows the
254+
previous one linearly in memory (from left to right, top to bottom).
255+
256+
The associated buffer dimensions are aligned to match an integer number
257+
of tiles, resulting in 32-aligned resolutions for the luminance plane
258+
and 16-aligned resolutions for the chrominance plane (with 2x2
259+
subsampling).
247260

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

drivers/media/v4l2-core/v4l2-ioctl.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1337,6 +1337,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
13371337
case V4L2_PIX_FMT_SE401: descr = "GSPCA SE401"; break;
13381338
case V4L2_PIX_FMT_S5C_UYVY_JPG: descr = "S5C73MX interleaved UYVY/JPEG"; break;
13391339
case V4L2_PIX_FMT_MT21C: descr = "Mediatek Compressed Format"; break;
1340+
case V4L2_PIX_FMT_SUNXI_TILED_NV12: descr = "Sunxi Tiled NV12 Format"; break;
13401341
default:
13411342
WARN(1, "Unknown pixelformat 0x%08x\n", fmt->pixelformat);
13421343
if (fmt->description[0])

include/uapi/linux/videodev2.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,7 @@ struct v4l2_pix_format {
677677
#define V4L2_PIX_FMT_Z16 v4l2_fourcc('Z', '1', '6', ' ') /* Depth data 16-bit */
678678
#define V4L2_PIX_FMT_MT21C v4l2_fourcc('M', 'T', '2', '1') /* Mediatek compressed block mode */
679679
#define V4L2_PIX_FMT_INZI v4l2_fourcc('I', 'N', 'Z', 'I') /* Intel Planar Greyscale 10-bit and Depth 16-bit */
680+
#define V4L2_PIX_FMT_SUNXI_TILED_NV12 v4l2_fourcc('S', 'T', '1', '2') /* Sunxi Tiled NV12 Format */
680681

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

0 commit comments

Comments
 (0)