Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4944468imm; Tue, 7 Aug 2018 09:53:52 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf8g2SLVHesNnBJ0liHBThdXLePW9rV1d0gqNq3NQUiI46kRYbJs7xuQZml3+rma/sfIJAG X-Received: by 2002:a63:455c:: with SMTP id u28-v6mr19575238pgk.210.1533660832582; Tue, 07 Aug 2018 09:53:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533660832; cv=none; d=google.com; s=arc-20160816; b=RYNBAzqEogunRyCRm1fOtiDaxlwcidg59BDu40ki0pI1nz/EjfnBBixy4U6mG2gnQ/ ZK3az8pJjGYFcAiP2EEXKualYCi+KmTdgz6RDMcowopnLxPi2bySVNvLcWq/fvJjDo7O sUTcbFVFR+HPalrzMbwgySqj8+00CbN+IdMEkjdl2pQ45RO6adLjYwvN3knFaWn1m76f dbsvNECrcjleXSWvWxfWt41ng4/hWE8m1KErvVzyVuM5D/Ljea8YPoXg/d1uMUa3fe+D PukyYJ7Vea43/wJmDmS+ZO9Rqq1shKqhDperOHCHxhTBQXeorroTvdxc2DhE4oKeH9FK 6LdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:organization:references :in-reply-to:date:cc:to:from:subject:message-id :arc-authentication-results; bh=AWoZdha6NQoh2uHh+FauKwUIgXunj+PUaXP/sdb1sdA=; b=ekX4eqKbNCI0vfqX7410odXjQZ03g+IM7EzaX8sJd/PWtTi/uDYWdHJzvPDbailA2N 27/uvbsKcz71FWtR4j8a74Gbbh4FuZCqiO+boC77t/dDobrdTEM6wn1UD2t/F9A4DotX sdcRgnGteXbnZEmoDADeMrhtbYKcmWkxgNco59/yDwWXpFpAIu5ujw+kdgRDrxj4xpIZ h5I0f0ain2GNjHElUY73whWXEaq0IfyqmNnKLXy3UfANHHmRm1Qt71WuyC/JbiySg0kE vkmhIv4F5Q+tGIqKViiOWNbHlWK9f8D//CNXvXBudUThnBrd0EFRh2lUpa6VhR9owhbA xriQ== 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 x32-v6si1346100pld.330.2018.08.07.09.53.37; Tue, 07 Aug 2018 09:53:52 -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 S2389840AbeHGSzk (ORCPT + 99 others); Tue, 7 Aug 2018 14:55:40 -0400 Received: from mail.bootlin.com ([62.4.15.54]:35520 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389292AbeHGSzk (ORCPT ); Tue, 7 Aug 2018 14:55:40 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 238712072F; Tue, 7 Aug 2018 18:40:30 +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 shortcircuit=ham autolearn=disabled version=3.4.0 Received: from aptenodytes (220.107.128.77.rev.sfr.net [77.128.107.220]) by mail.bootlin.com (Postfix) with ESMTPSA id 87D6D2072C; Tue, 7 Aug 2018 18:40:14 +0200 (CEST) Message-ID: <2f2f5721ab5b07e36ec920b9d9c7fa0839b99a95.camel@bootlin.com> Subject: Re: [PATCH v6 2/8] media: v4l: Add definition for Allwinner's MB32-tiled NV12 format From: Paul Kocialkowski To: Hans Verkuil , 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 , Thomas Petazzoni , linux-sunxi@googlegroups.com, Hugues Fruchet , Randy Li , Ezequiel Garcia , Tomasz Figa , Alexandre Courbot , Philipp Zabel , Laurent Pinchart , Sakari Ailus Date: Tue, 07 Aug 2018 18:40:15 +0200 In-Reply-To: <4628cfe1-e42f-67ad-20b3-078c6a96d6ed@xs4all.nl> References: <20180725100256.22833-1-paul.kocialkowski@bootlin.com> <20180725100256.22833-3-paul.kocialkowski@bootlin.com> <4628cfe1-e42f-67ad-20b3-078c6a96d6ed@xs4all.nl> Organization: Bootlin Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-P8kg2P4hui+LtIFpvQmg" X-Mailer: Evolution 3.28.4 Mime-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-P8kg2P4hui+LtIFpvQmg Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, On Sat, 2018-08-04 at 13:42 +0200, Hans Verkuil wrote: > On 07/25/2018 12:02 PM, Paul Kocialkowski wrote: > > This introduces support for Allwinner's MB32-tiled NV12 format, where > > each plane is divided into macroblocks of 32x32 pixels. Hence, the size > > of each plane has to be aligned to 32 bytes. The pixels inside each > > macroblock are coded as they would be if the macroblock was a single > > plane, line after line. > >=20 > > The MB32-tiled NV12 format is used by the video engine on Allwinner > > platforms: it is the default format for decoded frames (and the only on= e > > available in the oldest supported platforms). > >=20 > > 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(-) > >=20 > > diff --git a/Documentation/media/uapi/v4l/pixfmt-reserved.rst b/Documen= tation/media/uapi/v4l/pixfmt-reserved.rst > > index 38af1472a4b4..9a68b6a787bf 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-MB32-NV12: > > + > > + - ``V4L2_PIX_FMT_MB32_NV12`` > > + - 'MN12' > > + - Two-planar NV12-based format used by the Allwinner video engin= e > > + hardware, with 32x32 tiles for the luminance plane and 32x64 t= iles > > + for the chrominance plane. Each tile is a linear pixel data > > + representation within its own bounds. Each tile follows the pr= evious > > + one linearly (as in, from left to right, top to bottom). >=20 > as in, -> as in: Thanks! > > + > > + The frame dimensions are aligned to match an integer number of > > + tiles, resulting in 32-aligned resolutions for the luminance p= lane > > + and 16-aligned resolutions for the chrominance plane (with 2x2 > > + subsampling). > > =20 > > .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}| > > =20 > > diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-= core/v4l2-ioctl.c > > index 68e914b83a03..7e1c200de10d 100644 > > --- a/drivers/media/v4l2-core/v4l2-ioctl.c > > +++ b/drivers/media/v4l2-core/v4l2-ioctl.c > > @@ -1331,6 +1331,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc = *fmt) > > case V4L2_PIX_FMT_SE401: descr =3D "GSPCA SE401"; break; > > case V4L2_PIX_FMT_S5C_UYVY_JPG: descr =3D "S5C73MX interleaved UYVY/= JPEG"; break; > > case V4L2_PIX_FMT_MT21C: descr =3D "Mediatek Compressed Format"; bre= ak; > > + case V4L2_PIX_FMT_MB32_NV12: descr =3D "Allwinner tiled NV12 format"= ; break; >=20 > "Allwinner Tiled NV12 Format" >=20 > If it is Allwinner specific, then that should be in the PIX_FMT name as w= ell: > something like V4L2_PIX_FMT_ALLWINNER_MB32_NV12 or perhaps SUNXI_MB32_NV1= 2. >=20 > On the other hand, you could also see this as a variant of e.g. V4L2_PIX_= FMT_NV12MT > or V4L2_PIX_FMT_NV12MT_16X16. In that case it is not necessarily Allwinne= r specific > since other devices might choose this format. You can go either way, as l= ong > as it is consistent. I think it is fair to say that the format is Allwinner-specific and unlikely to be found elsewhere. It is not actually very well described by "MB32" since the chroma tiles have a different pixel size than the luma tiles (16x64). It would probably be clearer to just call the format: V4L2_PIX_FMT_SUNXI_TILED_NV12 Cheers, Paul > > 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/videod= ev2.h > > index d171361ed9b3..453d27142e31 100644 > > --- a/include/uapi/linux/videodev2.h > > +++ b/include/uapi/linux/videodev2.h > > @@ -670,6 +670,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') /* Media= tek 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_MB32_NV12 v4l2_fourcc('M', 'N', '1', '2') /* Allw= inner tiled NV12 format */ > > =20 > > /* 10bit raw bayer packed, 32 bytes for every 25 pixels, last LSB 6 bi= ts unused */ > > #define V4L2_PIX_FMT_IPU3_SBGGR10 v4l2_fourcc('i', 'p', '3', 'b') /* I= PU3 packed 10-bit BGGR bayer */ > >=20 >=20 > Regards, >=20 > Hans --=20 Paul Kocialkowski, Bootlin (formerly Free Electrons) Embedded Linux and kernel engineering https://bootlin.com --=-P8kg2P4hui+LtIFpvQmg Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEJZpWjZeIetVBefti3cLmz3+fv9EFAltpy28ACgkQ3cLmz3+f v9HLmAf/RgksuYQ8lngC8+h3sb9hAx5sV8yZIFeYAMGkw0U+TjPf3cbaabQGe/iX VLGaBWwk+SCfKeN2e1jF1QxyfX2Qvkf4LITmIgayaNImrzsQLMcgQSsXmPN/2KJF t6jsZFxQnT492mZCRMK/Sa/Mrrfbun+pwD+LpqxcWMbVC9NiKB3LXVg3co5dSBPK Iz8douPTsNENKXH3CV0h+tGXmmX7aDDrJmNo0KhfCWGGCGPF8K9BtKt5DhjNNe7y k3YhSSJji3Tqef/fmr6biiDUFauad6pAF8CzUs+lf402PriQr6+t1wSrXgQsaJPD yDE+uI1ETDX6p0GKPCpoUlifNfP1pA== =VNOz -----END PGP SIGNATURE----- --=-P8kg2P4hui+LtIFpvQmg--