Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1493073imm; Sat, 4 Aug 2018 04:43:53 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdzIKxNsPWrAa1YyCM34P78q/yJmRnhG664R8g9JsL2st/A3sdxNEwvg1Db8FnURWtIGEgC X-Received: by 2002:a63:551e:: with SMTP id j30-v6mr7182483pgb.92.1533383033731; Sat, 04 Aug 2018 04:43:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533383033; cv=none; d=google.com; s=arc-20160816; b=xuXcgtoQIpjXfQKkEw1cal+C8X9/vH7OQifu7Sov+PGPgvHfOr0PhICAqBrdujYAcX bchcnZNbRS99rzaakD9FQuUdGusL2pKhCOMiqvuULC1h6KWwyBe7/tRZC2SWmusPGahF DDuQo5Z3r0RXrhvmAeq8mM49Njie+ArRSv689t9at63Mj18i+sTMpnF8CNWAzm5mf1LH onC5yjKnYqTPbk2KLaqRfRJY99bMxmte1eSnRYSOjDLp22hzW9NkGfiTEDCAWv9XmNiO JGeDNTw5QRRJZWaeW6XSynC/3Kk5J0ybDm4bL2JKDmQZObPR36sCKee1Ftkq25KmdM/i CVZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=AYcu7h4MeQZ7bdc0m/musrSzwVlRGbOtYpIgYoA0gwY=; b=qRDxlQM6qod6i1Q/tZXPCSSPEas1XmTMIqBC2WXT64AFDdZkLibTudDYottzRnfGwk Hnt2pp0heBFYBSR1LZ1Sah6vbtaz+IaTJ2Gv8ZW0vh95kUc0resgP+Z3HnljvvJwwfsn yOUIsrTIOxop8soeYNfDvCh5e7tVaCCARQVuDXfxwgkAuYxUvyLGPVa24HsOCmp5WX4t Ukr/z5honDWSOInRgE9EubE59Si9cxNsjjRvS+fVOroY0Nca8Z8hpQYjPoCphUa2visi DGSUZkbIVManO29HVE0dwF08LMkyGEzQ/CZhDRcMnRBTbU55lA9p0oXeK9KHqJC0VnbU dSrg== 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 k1-v6si5458635pld.424.2018.08.04.04.43.37; Sat, 04 Aug 2018 04:43:53 -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 S1727293AbeHDNnO (ORCPT + 99 others); Sat, 4 Aug 2018 09:43:14 -0400 Received: from lb3-smtp-cloud7.xs4all.net ([194.109.24.31]:42306 "EHLO lb3-smtp-cloud7.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726588AbeHDNnN (ORCPT ); Sat, 4 Aug 2018 09:43:13 -0400 Received: from [192.168.2.10] ([212.251.195.8]) by smtp-cloud7.xs4all.net with ESMTPA id luxEfCkc36brUluxHfFFYV; Sat, 04 Aug 2018 13:42:44 +0200 Subject: Re: [PATCH v6 2/8] media: v4l: Add definition for Allwinner's MB32-tiled NV12 format To: Paul Kocialkowski , 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 References: <20180725100256.22833-1-paul.kocialkowski@bootlin.com> <20180725100256.22833-3-paul.kocialkowski@bootlin.com> From: Hans Verkuil Message-ID: <4628cfe1-e42f-67ad-20b3-078c6a96d6ed@xs4all.nl> Date: Sat, 4 Aug 2018 13:42:40 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20180725100256.22833-3-paul.kocialkowski@bootlin.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4wfLE7QWxNKvgVzKkC/bJEpLcSZ/h1FPl7Wlfqntdgb0I9U93V5U9LQhctycI3uTgoymCB/mO12oZgauVk9NJSZq4GsY27wxxmlD5JBw14szgujd3U2EsY 9URF3KsXNfygKXuv0NgFRLXQjR9NyoVkv2wiaiPIHmoIbLztUjCwO008ZmDMuADAGSd8S/qoIKX2ji9nKPE85ltxEbeIdmmuVb4vxIpR2IfUMLNA+q89XvJn DXtyTw5vtFT6V2o/Hlo0rSAFVKO/QqHTE1RAS2md3xgDPAtP9JDNuvgrNntbjq9VM+Q9VM9K8/qXUm/KXspgFfUKBG0Gmu7PlH/sq4rgCWiMqMkyyf2VoH+A rBRAegBcKH9GcteLDkcHEN1bv+aTkIpVdQjGtj8emzr7kn3HebHxeAEm9SI7KnoaUcp8KOl60YcNt/yOjkYcVfHYwW74dvMusPCbY64JW6EIYc6pOfizlLxh iYkke0y0/lGVUZOSJhSE+3QS/Q6BsFmIpiYzoM20UGF031ovBemMc2fOWya6+UBwBFdqYJq+uCfMiURr58y58o59rOOrFlGfrQ5GhVbilQ1haEFS4bJFG5Wn n1tZ/qq+6b4lfzNP+LlESNjmgd/W2ZhqgzKKkxkSyTjWKZjqHBupzbQpc+7SipSyfwWyEqnzhDERWZFaRbWN6xvuMr4LOfnrHBVMOhuVSM/hpSl9fuIYqfri PKHMXROndEYxpkR+7B/KKJTJ3c5NrSNffu9FSyZsmoTPWE+zBDsjcTF9nKEeAZmCfkyNYSd8/x4tHQrB5Id0YgxB/vRwPD3HJDI/o3BDN7/2RY5LAUcA7hSl ZjSTqHRiKmvOthiqtrb8RXpavD6K3C9D6yn3MwamAPq9xEfvBV0GhtRlwrKUWEhtRXRZE87sRyAF7pIq0EDLJMa8W2eq6zdc69BqyZC4YseCU4TEsHS9uKH3 W3BT6El63olYMdvnd78R34pQoQ+9qmCfaJMlBH2UlNMOmVWFihT0tRmKmvNx/LDDyW96u2ZsPJGrKr/GiL+UCCrP/ujuncItfqH3VOEUCFYar8W0ErckcnEK T99D+e0M1Uqzid4aDiD8NikGC02UdSX1xIk= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > > 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 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..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 engine > + hardware, with 32x32 tiles for the luminance plane and 32x64 tiles > + for the chrominance plane. Each tile is a linear pixel data > + representation within its own bounds. Each tile follows the previous > + one linearly (as in, from left to right, top to bottom). as in, -> as in: > + > + The frame 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 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 = "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_MB32_NV12: descr = "Allwinner tiled NV12 format"; break; "Allwinner Tiled NV12 Format" If it is Allwinner specific, then that should be in the PIX_FMT name as well: something like V4L2_PIX_FMT_ALLWINNER_MB32_NV12 or perhaps SUNXI_MB32_NV12. 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 Allwinner specific since other devices might choose this format. You can go either way, as long as it is consistent. > 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 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') /* 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_MB32_NV12 v4l2_fourcc('M', 'N', '1', '2') /* Allwinner 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 */ > Regards, Hans