Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1227670iob; Thu, 19 May 2022 01:59:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwuVieTAXeMfof/cEDirkzYGnI106tuMJLa06kGCrixQFJKAYKwsfCk+HO5cUWAByF/ZpgU X-Received: by 2002:a05:6a00:16c7:b0:4f7:e497:69b8 with SMTP id l7-20020a056a0016c700b004f7e49769b8mr3700984pfc.6.1652950767445; Thu, 19 May 2022 01:59:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652950767; cv=none; d=google.com; s=arc-20160816; b=nRfxo4Cv46BysaMQDD2M6l+kxaF2PesgloaQpDeWueCmhwLaIwiyuVLJeRpF8NeK9G Ik/XmpiDcXDOhN612m2enBDJkjEmoFPUcLVEPbHqZKYMePnhIvA8gvCEilAUBksmLjzq zcBsU/urNpLKHr+ruOnpBZ6u16yuLIIXadoNhTVUI9aPwGVOx2UjfynpFhKGFEBbNjee Lp0iqDot63yk6J9RxOFPbocHRGx/9BMDnXSzPc+mZCj6gYn3G78WIOxrqLlKrNxOS7Nz trBbrAzYB5JPuOUO/3w0TuSK40fj5/pTYH7Q87Zclp9zR+cLdmhOCrX/nqlbf+nIM7M3 AQrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=N6tg0idCNEyxD9XHJatqb/Sxeq3xp5+S1Quv7KehB7k=; b=Q3rTbyRy8768Khv1Cvwfc5x/aaK4WM2rtiJa21E6aG3nuN4FrZxVyT2aoQN5Iz3cEw U/V86TP7zM8Br/464smEGHK+7AvX+AvbvWmBq0EORYmc9FSGnGB3pYjShzkXuHav7NyP 8MuxYUn8E2k1mbbRakbCWQdsn5uJlPxknP/MWxo9LxhV3pnA4d1afvu4Qjiu3nQ5S/Dq aQycM4goluEmCfNFl+075er99nEKkd5NrEqgkWBHkXEgQqvsIQBJXyZxgtdTEp8r5eRK 7mFADgjs0wiJsR6zA4cz/RAPkFVilMSxcnV1CPEdL3rYB+03ZsHz4IL0Sqrky4j8t/+T s/8A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id be3-20020a170902aa0300b001617b5f178bsi6556641plb.83.2022.05.19.01.59.11; Thu, 19 May 2022 01:59:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230251AbiESG5T (ORCPT + 99 others); Thu, 19 May 2022 02:57:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229500AbiESG5Q (ORCPT ); Thu, 19 May 2022 02:57:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DEC8B82FC; Wed, 18 May 2022 23:57:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 039F361AC1; Thu, 19 May 2022 06:57:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95985C34100; Thu, 19 May 2022 06:57:10 +0000 (UTC) Message-ID: <60a9c660-16cd-8f5b-8626-be34e8977781@xs4all.nl> Date: Thu, 19 May 2022 08:57:08 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCH v4] media: Add P010 video format Content-Language: en-US To: Benjamin Gaignard , ezequiel@vanguardiasur.com.ar, p.zabel@pengutronix.de, mchehab@kernel.org, gregkh@linuxfoundation.org, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, heiko@sntech.de, wens@csie.org, jernej.skrabec@gmail.com, samuel@sholland.org Cc: kernel@pengutronix.de, linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, kernel@collabora.com, Nicolas Dufresne References: <20220518132105.629797-1-benjamin.gaignard@collabora.com> From: Hans Verkuil In-Reply-To: <20220518132105.629797-1-benjamin.gaignard@collabora.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-8.8 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,NICE_REPLY_A,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Benjamin, On 5/18/22 15:21, Benjamin Gaignard wrote: > P010 is a YUV format with 16-bits per pixel with interleaved UV. That should be: "10 bits per component" > > Signed-off-by: Benjamin Gaignard > Acked-by: Nicolas Dufresne > --- > version 4: > - Fix 10-bits per components wording. > > version 3: > - remove LE suffix > - rebased on media_tree_master branch > > .../media/v4l/pixfmt-yuv-planar.rst | 54 +++++++++++++++++++ > drivers/media/v4l2-core/v4l2-common.c | 1 + > drivers/media/v4l2-core/v4l2-ioctl.c | 1 + > include/uapi/linux/videodev2.h | 1 + > 4 files changed, 57 insertions(+) > > diff --git a/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst b/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst > index 8dff5906639b..a900ff66911a 100644 > --- a/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst > +++ b/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst > @@ -109,6 +109,13 @@ All components are stored with the same number of bits per component. > - Cb, Cr > - No > - 16x16 tiles > + * - V4L2_PIX_FMT_P010 > + - 'P010' > + - 10 > + - 4:2:0 > + - Cb, Cr > + - Yes > + - Linear > * - V4L2_PIX_FMT_NV16 > - 'NV16' > - 8 > @@ -171,6 +178,7 @@ horizontally. > .. _V4L2-PIX-FMT-NV21: > .. _V4L2-PIX-FMT-NV12M: > .. _V4L2-PIX-FMT-NV21M: > +.. _V4L2-PIX-FMT-P010: > > NV12, NV21, NV12M and NV21M > --------------------------- > @@ -519,6 +527,52 @@ number of lines as the luma plane. > - Cb\ :sub:`33` > - Cr\ :sub:`33` > > +.. _V4L2_PIX_FMT_P010: > + > +P010 > +---- > + > +Like NV12 with 10 bits per component, expanded to 16 bits. > +Data in the 10 high bits, zeros in the 6 low bits, arranged in little endian order. > + > +.. flat-table:: Sample 4x4 P010 Image > + :header-rows: 0 > + :stub-columns: 0 > + > + * - start + 0: > + - Y'\ :sub:`00` > + - Y'\ :sub:`01` > + - Y'\ :sub:`02` > + - Y'\ :sub:`03` > + * - start + 8: > + - Y'\ :sub:`10` > + - Y'\ :sub:`11` > + - Y'\ :sub:`12` > + - Y'\ :sub:`13` > + * - start + 16: > + - Y'\ :sub:`20` > + - Y'\ :sub:`21` > + - Y'\ :sub:`22` > + - Y'\ :sub:`23` > + * - start + 24: > + - Y'\ :sub:`30` > + - Y'\ :sub:`31` > + - Y'\ :sub:`32` > + - Y'\ :sub:`33` > + * - start + 32: > + - Cb\ :sub:`00` > + - Cr\ :sub:`00` > + - Cb\ :sub:`01` > + - Cr\ :sub:`01` > + * - start + 40: > + - Cb\ :sub:`10` > + - Cr\ :sub:`10` > + - Cb\ :sub:`11` > + - Cr\ :sub:`11` > + > +.. raw:: latex > + > + \endgroup > > Fully Planar YUV Formats > ======================== > diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c > index df34b2a283bc..1e38ad8906a2 100644 > --- a/drivers/media/v4l2-core/v4l2-common.c > +++ b/drivers/media/v4l2-core/v4l2-common.c > @@ -266,6 +266,7 @@ const struct v4l2_format_info *v4l2_format_info(u32 format) > { .format = V4L2_PIX_FMT_NV61, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 2, .vdiv = 1 }, > { .format = V4L2_PIX_FMT_NV24, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 1, .vdiv = 1 }, > { .format = V4L2_PIX_FMT_NV42, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 1, .vdiv = 1 }, > + { .format = V4L2_PIX_FMT_P010, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 2, 2, 0, 0 }, .hdiv = 2, .vdiv = 1 }, > > { .format = V4L2_PIX_FMT_YUV410, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 3, .bpp = { 1, 1, 1, 0 }, .hdiv = 4, .vdiv = 4 }, > { .format = V4L2_PIX_FMT_YVU410, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 3, .bpp = { 1, 1, 1, 0 }, .hdiv = 4, .vdiv = 4 }, > diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c > index e2636539c9db..536aaeb4df82 100644 > --- a/drivers/media/v4l2-core/v4l2-ioctl.c > +++ b/drivers/media/v4l2-core/v4l2-ioctl.c > @@ -1305,6 +1305,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) > case V4L2_PIX_FMT_NV61: descr = "Y/CrCb 4:2:2"; break; > case V4L2_PIX_FMT_NV24: descr = "Y/CbCr 4:4:4"; break; > case V4L2_PIX_FMT_NV42: descr = "Y/CrCb 4:4:4"; break; > + case V4L2_PIX_FMT_P010: descr = "10-bit Y/CrCb 4:2:0"; break; > case V4L2_PIX_FMT_NV12_4L4: descr = "Y/CbCr 4:2:0 (4x4 Linear)"; break; > case V4L2_PIX_FMT_NV12_16L16: descr = "Y/CbCr 4:2:0 (16x16 Linear)"; break; > case V4L2_PIX_FMT_NV12_32L32: descr = "Y/CbCr 4:2:0 (32x32 Linear)"; break; > diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h > index 6d465dc443b7..311f106bbdf5 100644 > --- a/include/uapi/linux/videodev2.h > +++ b/include/uapi/linux/videodev2.h > @@ -601,6 +601,7 @@ struct v4l2_pix_format { > #define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') /* 16 Y/CrCb 4:2:2 */ > #define V4L2_PIX_FMT_NV24 v4l2_fourcc('N', 'V', '2', '4') /* 24 Y/CbCr 4:4:4 */ > #define V4L2_PIX_FMT_NV42 v4l2_fourcc('N', 'V', '4', '2') /* 24 Y/CrCb 4:4:4 */ > +#define V4L2_PIX_FMT_P010 v4l2_fourcc('P', '0', '1', '0') /* 16 Y/CbCr 4:2:0 16-bit per pixel */ As discussed on irc, this should be: /* 24 Y/CbCr 4:2:0 10-bit per pixel */ Regards, Hans > > /* two non contiguous planes - one Y, one Cr + Cb interleaved */ > #define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 */