Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp6785944imm; Tue, 28 Aug 2018 00:37:42 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZjmJ5gqFUdjTVqECOwUFppvFnbEUrO4w5yfBtzZnQQ4lxEq5Czv5UJvHGtl75dwmv1L2+0 X-Received: by 2002:a62:f208:: with SMTP id m8-v6mr306246pfh.222.1535441862300; Tue, 28 Aug 2018 00:37:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535441862; cv=none; d=google.com; s=arc-20160816; b=RBSe2yCIhZjg9XTl06oH4Doj8JtN6sTDJ7kzJ9gOLVxmsdJe1SwXBs3tpCr6OIyCic 0TJAW2H/eAwDODtZsUQ1OCyoxztEQtu0phmNxgyWKaPL4G7s2u1bf+rxkGSynsxUqaz3 DOacHwE/0UY0FHd5j9vge2boufZnFzKJgle4YfV9omU5k1fRP1jIJVaqgC+/i6cmZUnb dsQ7Gm9fvorW/9bUkjUC6kQRvmgrx55XeyPsE0v7V4Bj2blNSQelKhHSbdHNdBygHRJv xfV9eapem7nrIeVm3iiUtI48WvLVq4OPJA04RI7jYtwe1NM/87UiYgr0IMYJst0iiS93 IstA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=e37wcj4R3rjnm8dejVoFS97PqG2zVeh9U1vBrOhEa/o=; b=RvhRMdYJ3uz1Nk2MOdCZc9a2RFr+dnOGX/KMokfz16DKFu3xr/wUdSRcRwv/AHyczo 9E8UG+ZAfpwFBg87ShvDMiCI8MrymNvLqnupmEA4jGyzKItJBYyj+wN2Ik1c0bmzZ8xX +UoeShMrifje802z/hCzpaOpywd5BnN0Ed60hbo/sxq/WwGCRnfSkXoL/nUh8q4GcjH6 D2T3U2P3i7bAl2Gcnno9OS0JOasfJx804m+k7zQAhot37KyIHd+sTCw87iyl5XwML5Xv 5l0UH6mbIlFJbOu0UAI2zaFbhZKsljPc4pfN3huHtwlrlgoer4NUONoXOU/djCGPUjZh nlGw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o20-v6si398046pgk.120.2018.08.28.00.37.27; Tue, 28 Aug 2018 00:37:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727500AbeH1L0L (ORCPT + 99 others); Tue, 28 Aug 2018 07:26:11 -0400 Received: from mail.bootlin.com ([62.4.15.54]:33373 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727137AbeH1LZW (ORCPT ); Tue, 28 Aug 2018 07:25:22 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 1FD9420877; Tue, 28 Aug 2018 09:35:01 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost.localdomain (AAubervilliers-681-1-53-19.w90-88.abo.wanadoo.fr [90.88.170.19]) by mail.bootlin.com (Postfix) with ESMTPSA id 9DEFD20787; Tue, 28 Aug 2018 09:35:00 +0200 (CEST) From: Paul Kocialkowski To: linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devel@driverdev.osuosl.org Cc: Mauro Carvalho Chehab , Rob Herring , Mark Rutland , Maxime Ripard , Chen-Yu Tsai , Greg Kroah-Hartman , Paul Kocialkowski , Thomas Petazzoni , Randy Li , Hans Verkuil , Ezequiel Garcia , Tomasz Figa , Alexandre Courbot , Philipp Zabel , Laurent Pinchart , Sakari Ailus , linux-sunxi@googlegroups.com Subject: [PATCH v8 2/8] media: v4l: Add definition for the Sunxi tiled NV12 format Date: Tue, 28 Aug 2018 09:34:18 +0200 Message-Id: <20180828073424.30247-3-paul.kocialkowski@bootlin.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180828073424.30247-1-paul.kocialkowski@bootlin.com> References: <20180828073424.30247-1-paul.kocialkowski@bootlin.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- Documentation/media/uapi/v4l/pixfmt-reserved.rst | 15 ++++++++++++++- drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Documentation/media/uapi/v4l/pixfmt-reserved.rst b/Documentation/media/uapi/v4l/pixfmt-reserved.rst index 38af1472a4b4..0c399858bda2 100644 --- a/Documentation/media/uapi/v4l/pixfmt-reserved.rst +++ b/Documentation/media/uapi/v4l/pixfmt-reserved.rst @@ -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}| diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 1a8feaf6c3f7..c148c44caffb 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -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]) diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index ad7064fcccea..e0eafb02bec4 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -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 */ -- 2.18.0