Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4879176iob; Mon, 9 May 2022 03:55:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYlZw/x0hoTzBQTJHjH7MbQNA9/jUSo/6pNR3au7OlvyHL1kWKdtLcrj05zxbpOOijlIWy X-Received: by 2002:a17:903:11c7:b0:151:7290:ccc with SMTP id q7-20020a17090311c700b0015172900cccmr15989769plh.95.1652093759521; Mon, 09 May 2022 03:55:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652093759; cv=none; d=google.com; s=arc-20160816; b=AVK51MFqc+lFq8Y5oNiP7ucr0XhHu98vqSqiYDiHvp+TSxWwN6V6pT39rqfvvtQnce 7niHmpbW/S1cGNxdKhQr+5D1odPTvDuBkPZMrUfhL1WuVXI9vl0t5pIfElnHLeoUJf+t w3z502qwUg3i0ntgQ21ikTjXduaN4QfakbG58i36gFWL3Ruz0ArY3wDI7aloN/D9WMwr MG3KzfkAcDy0KgMSJAccsNVSTFX35lsqz8XVwlIqU6OiEBxqfHDogtmnW2dhoiAvcd+n YEXeXcr4MuGr4KOEh+VwTzWuCDh3QAe6H/vZFbBTDyKegRBK3Bto0I9tZhMF97sD4tOZ VpNg== 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=88jiuzR30Jn9Ojt5Pl/wQXXMAZAizuika8njr0tuYMA=; b=G0YPWMkmp5ix5LDISiqObQANhT52wvVIo1cc1W+IGcAkjG8ZHbfPw/DIvjWKtK/FY3 PiPII7+uYRfMA+sEERSmWmKaMq2GpMGKCdRYcFaugLs7mft9CchBNq/aLHAYOA+lmfM1 zSbx5YM8UjfVYUuRNYl2FltOQoaYKE4poBTXDBrm/QqPBqExB4aWo/XkjfxcBEIHdkIF 6dnJWmAYVRu+jBVs4Wf64vhOxP+eBhuhUtMvb5GIZrgSrUge1CtBOVGPYrUZW1utsHfN US8CWa97X6VSTMOtLhvh4JLLvFFsk4xl6qtuUpwth21PsPfOS6QlyUVbaG/9xY3ymq3l GXhg== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id o9-20020a170902bcc900b0015efb0dec43si7219203pls.221.2022.05.09.03.55.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 03:55:59 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 84B1C23E2A5; Mon, 9 May 2022 03:12:29 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233224AbiEIJyv (ORCPT + 99 others); Mon, 9 May 2022 05:54:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236152AbiEIJnc (ORCPT ); Mon, 9 May 2022 05:43:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB7AF1E6549; Mon, 9 May 2022 02:39:37 -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 ams.source.kernel.org (Postfix) with ESMTPS id A3D7EB810B2; Mon, 9 May 2022 09:38:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 739E3C385AB; Mon, 9 May 2022 09:38:50 +0000 (UTC) Message-ID: Date: Mon, 9 May 2022 11:38:48 +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 v2] media: Add P010LE video format Content-Language: en-US To: Benjamin Gaignard , mchehab@kernel.org, ezequiel@vanguardiasur.com.ar Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, jernej.skrabec@gmail.com, p.zabel@pengutronix.de, nicolas@ndufresne.ca, kernel@collabora.com, Nicolas Dufresne References: <20220421124349.452404-1-benjamin.gaignard@collabora.com> From: Hans Verkuil In-Reply-To: <20220421124349.452404-1-benjamin.gaignard@collabora.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 4/21/22 14:43, Benjamin Gaignard wrote: > P010LE is a YUV format with 16-bits per pixel with interleaved UV. > > Signed-off-by: Benjamin Gaignard > Acked-by: Nicolas Dufresne > --- > version 2: > - Fix Hans's remarks > - Add 'LE' suffix to pixel name since P010BE can also exist I don't think you should do this. By default formats are little endian, unless explicitly stated otherwise. So big endian formats typically have a _BE suffix, and they use v4l2_fourcc_be() instead of v4l2_fourcc(). This format is standard little endian, so I would just drop the LE bit. > > .../media/v4l/pixfmt-yuv-planar.rst | 53 +++++++++++++++++++ > 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, 56 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..b9dd4f376fe3 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_P010LE > + - 'P010' > + - 16 > + - 4:2:0 > + - Cb, Cr > + - No > + - 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-P010LE: > > NV12, NV21, NV12M and NV21M > --------------------------- > @@ -519,6 +527,51 @@ number of lines as the luma plane. > - Cb\ :sub:`33` > - Cr\ :sub:`33` > > +.. _V4L2_PIX_FMT_P010LE: > + > +P010LE > +------ > + > +Like NV12 with 16 bits per component, data in the 10 high bits, zeros in the 6 low bits, arranged in little endian order Here it is fine to mention little endian, it's just the fourcc name I have a problem with. Regards, Hans > + > +.. flat-table:: Sample 4x4 P010LE 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..bc73526c41b9 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_P010LE, .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 96e307fe3aab..2ba3440099d0 100644 > --- a/drivers/media/v4l2-core/v4l2-ioctl.c > +++ b/drivers/media/v4l2-core/v4l2-ioctl.c > @@ -1301,6 +1301,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_P010LE: descr = "16-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 4c09969e7112..92822a80a12e 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_P010LE v4l2_fourcc('P', '0', '1', '0') /* 16 Y/CbCr 4:2:0 16-bit per pixel, little endian*/ > > /* 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 */