Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp747121imi; Thu, 21 Jul 2022 10:07:18 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tzZGXAfdy/44gIuQ5bRlWmGo6KPPb+Juj3HxHuyo5JpiutCRWVPIOMuzLk2YwbcdDAeW1g X-Received: by 2002:a17:902:788b:b0:16c:dbb2:2c02 with SMTP id q11-20020a170902788b00b0016cdbb22c02mr28359083pll.13.1658423238248; Thu, 21 Jul 2022 10:07:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658423238; cv=none; d=google.com; s=arc-20160816; b=KvOqGPX6pm3YfEtFuQluS8M0mZdDBB/InOav//84Le7LnubSmqeW+Nhv7JoQsZFk+r zGUUgpoD9Bglqzs4gOjXE1XgItq6W2rkz2/dtvb3I0D5uNz95VyTFKGTwsJu8H5ovaY4 wXOho6AlcZWQwBxhbFHlZZd0LlUglxOxODARu//cRHfXw0SLcaWjLTPcyhhmh3UnQHEf a1FuxgD4vruJ7BQtEgJfcxetcw8dHS6E0KcbIEdljaXVY/smwAg1SGMjcfE+WrGch4Kj LzgbVnIePLcp6D7F8Y38C/I98xDZ4sqYOGfBllfsMzLQonjXfisNUFmEbI5CrMl9imu8 9dxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=D8Hw7bVcaZYD2wbq6WzJseY/TBdIN/nOD5gwWTkQWqM=; b=QM3oBIC68noq0hlgSqBg87yNaE2wleakecgNs9xYfyxLjNhMxaoyYimO/ZikhQ/RnZ 3bfLa+/sqJkmZPQcKmSWIgbCYMSJ/7WtEDraG+J4K/oet+Ac3Ie/F9sEvFauyBKXaVQ0 ZhOedrlNzWEMVLIfVDiQwc1pDE42CMH4YQgr1tFGPcscxLYAonN7hbTe8PPzc/+pUofz yUS/F4IJYZoG7EUtxzg0JY2H2CFChewJybojqfyengoRWmj9eIGMfeJGyWw7Sdwx9+Es LSTELiirzma6DSA5eMOR6t2kjS/1qrLVB+WkXuR6IsHzeRZoFESs3RJVbywn17LRLrbL vYaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=htOvEoeI; 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=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l11-20020a056a00140b00b0052849e93874si2991459pfu.266.2022.07.21.10.06.59; Thu, 21 Jul 2022 10:07:18 -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; dkim=pass header.i=@collabora.com header.s=mail header.b=htOvEoeI; 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=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230323AbiGUQ7G (ORCPT + 99 others); Thu, 21 Jul 2022 12:59:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229456AbiGUQ7E (ORCPT ); Thu, 21 Jul 2022 12:59:04 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B28D89A70; Thu, 21 Jul 2022 09:59:03 -0700 (PDT) Received: from localhost (dynamic-089-204-139-174.89.204.139.pool.telefonica.de [89.204.139.174]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: sebastianfricke) by madras.collabora.co.uk (Postfix) with ESMTPSA id 6A6426601AB9; Thu, 21 Jul 2022 17:59:01 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1658422741; bh=nytjLL1qqhxW1al82U0BuwYCZTfI48D3p8N0FpybNgU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=htOvEoeIYIh8p5vABCMSkf28ZUGJq5tbnbIH2LD0eatDIbVprolQ78XXCICqk0EoL KPK0u0afkhxWJf24FfcwVvSN/fZWuz8j35MXEor2AT4BbHeccMoXR3oXdQwCoxuP6k pm8t43DIv6YK+F5P/1TulCM16uJz7E6N7dBqS5WfKDP2R8FmKRW7NvusKynodb06Lw MbUIAOs1RUURlpddBJfoDFdaQluoTmzYIAh4R+m1Ez0lH1nUMmoafJ/uuShnfqJus0 brnreWc6jDAXTqJq0PoxP7Bm1TGW2Q0FVEea4hWEVvl0V6HNGXj3j71rLy04DE7xCr S/9BB4yYCRDKg== Date: Thu, 21 Jul 2022 18:58:57 +0200 From: Sebastian Fricke To: Laurent Pinchart Cc: Nicolas Dufresne , linux-media@vger.kernel.org, jernej.skrabec@gmail.com, knaerzche@gmail.com, kernel@collabora.com, bob.beckett@collabora.com, ezequiel@vanguardiasur.com.ar, mchehab@kernel.org, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-staging@lists.linux.dev, Jonas Karlman , Yury Norov , Andy Shevchenko , Rasmus Villemoes , Hans Verkuil , Benjamin Gaignard , Ming Qian , Sakari Ailus , Ricardo Ribalda , Andrzej Pietrasiewicz , Sergey Senozhatsky Subject: Re: [PATCH 1/6] media: v4l2: Add NV15 pixel format Message-ID: <20220721165857.euuywbja3kw5m43g@basti-XPS-13-9310> References: <20220713162449.133738-1-sebastian.fricke@collabora.com> <20220713162449.133738-2-sebastian.fricke@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS 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 Hey Laurent and Nicolas, On 15.07.2022 03:04, Laurent Pinchart wrote: >On Thu, Jul 14, 2022 at 09:02:38AM -0400, Nicolas Dufresne wrote: >> Le mercredi 13 juillet 2022 à 21:28 +0300, Laurent Pinchart a écrit : >> > Hi Sebastian and Jonas, >> > >> > Thank you for the patch. Thank you for your review :). >> > >> > On Wed, Jul 13, 2022 at 06:24:46PM +0200, Sebastian Fricke wrote: >> > > From: Jonas Karlman >> > > >> > > Add the NV15 pixel format used by the Rockchip Video Decoder for 10-bit >> > > buffers. >> > > >> > > NV15 is a packed 10-bit 4:2:0 Y/CbCr format similar to P010 and P210 but >> > > has no padding between components. Instead, luminance and chrominance >> > > samples are grouped into 4s so that each group is packed into an integer >> > > number of bytes: >> > > >> > > YYYY = UVUV = 4 * 10 bits = 40 bits = 5 bytes >> > > >> > > The '15' suffix refers to the optimum effective bits per pixel which is >> > > achieved when the total number of luminance samples is a multiple of 8 >> > > for NV15. >> > > >> > > Signed-off-by: Jonas Karlman >> > > Signed-off-by: Sebastian Fricke >> > > --- >> > > .../media/v4l/pixfmt-yuv-planar.rst | 53 +++++++++++++++++++ >> > > drivers/media/v4l2-core/v4l2-common.c | 2 + >> > > 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 a900ff66911a..42ab3fe4667f 100644 >> > > --- a/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst >> > > +++ b/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst >> > > @@ -79,6 +79,13 @@ All components are stored with the same number of bits per component. >> > > - Cr, Cb >> > > - Yes >> > > - Linear >> > > + * - V4L2_PIX_FMT_NV15 >> > > + - 'NV15' >> > > + - 15 >> > > + - 4:2:0 >> > > + - Cb, Cr >> > > + - Yes >> > > + - Linear >> > > * - V4L2_PIX_FMT_NV12M >> > > - 'NM12' >> > > - 8 >> > > @@ -176,6 +183,7 @@ horizontally. >> > > >> > > .. _V4L2-PIX-FMT-NV12: >> > > .. _V4L2-PIX-FMT-NV21: >> > > +.. _V4L2-PIX-FMT-NV15: >> > > .. _V4L2-PIX-FMT-NV12M: >> > > .. _V4L2-PIX-FMT-NV21M: >> > > .. _V4L2-PIX-FMT-P010: >> > > @@ -570,6 +578,51 @@ Data in the 10 high bits, zeros in the 6 low bits, arranged in little endian ord >> > > - Cb\ :sub:`11` >> > > - Cr\ :sub:`11` >> > > >> > > +.. _V4L2_PIX_FMT_NV15: >> > > + >> > > +NV15 >> > > +---- >> > > + >> > > +Like P010 but a packed 10-bit 4:2:0 semi-planar Y/CbCr format without padding between components. >> > >> > "packed 10-bit semi-planar" sounds confusing, as "packed YUV" usually >> > refers to YUYV-style formats, but I'm not sure how to express that >> > better. >> >> Perhaps: >> >> "Similar to P010 (10-bit 4:":0 semi-planer Y/CbCr), though unlike P010, the >> there is not padding between components." I'll take that for V2. >> >> > > +Instead, luminance and chrominance samples are grouped into 4s so that each group is packed into an integer >> > > +number of bytes: >> > >> > Could you please wrap the description at 80 columns ? Will do. >> > >> > > +YYYY = UVUV = 4 * 10 bits = 40 bits = 5 bytes >> > > + >> > > +.. flat-table:: Sample 4x4 NV15 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` >> > >> > This doesn't look right. You need to describe the data at the bit level, >> > so show how the 10-bit samples are packed into bytes. >> >> A word of NV15 is 40 bits, so 1 word of NV12 is 5 bytes, 4 pixels. I believe >> there is no choice here but to describe 4 pixels for Y plane, and 4 pixels for >> CbCr plane. This might be a bit big though. > >I agree, it may not be the prettiest, but I'd rather have a larger table >than a format that is understood differently by different drivers. Been >there, done that, not again :-) I'll prepare something for V2 (at my current workload in about 3 weeks at the earliest). Greetings, Sebastian > >> > > + >> > > .. raw:: latex >> > > >> > > \endgroup >> > > diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c >> > > index 1e38ad8906a2..23a0cb02ea3a 100644 >> > > --- a/drivers/media/v4l2-core/v4l2-common.c >> > > +++ b/drivers/media/v4l2-core/v4l2-common.c >> > > @@ -262,6 +262,8 @@ const struct v4l2_format_info *v4l2_format_info(u32 format) >> > > /* YUV planar formats */ >> > > { .format = V4L2_PIX_FMT_NV12, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 2, .vdiv = 2 }, >> > > { .format = V4L2_PIX_FMT_NV21, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 2, .vdiv = 2 }, >> > > + { .format = V4L2_PIX_FMT_NV15, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 5, 5, 0, 0 }, .hdiv = 2, .vdiv = 2, >> > > + .block_w = { 4, 2, 0, 0 }, .block_h = { 1, 1, 0, 0 } }, >> > > { .format = V4L2_PIX_FMT_NV16, .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_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 }, >> > > diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c >> > > index e2526701294e..9e5510cb255e 100644 >> > > --- a/drivers/media/v4l2-core/v4l2-ioctl.c >> > > +++ b/drivers/media/v4l2-core/v4l2-ioctl.c >> > > @@ -1302,6 +1302,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) >> > > case V4L2_PIX_FMT_M420: descr = "YUV 4:2:0 (M420)"; break; >> > > case V4L2_PIX_FMT_NV12: descr = "Y/CbCr 4:2:0"; break; >> > > case V4L2_PIX_FMT_NV21: descr = "Y/CrCb 4:2:0"; break; >> > > + case V4L2_PIX_FMT_NV15: descr = "10-bit Y/CbCr 4:2:0 (Packed)"; break; >> > > case V4L2_PIX_FMT_NV16: descr = "Y/CbCr 4:2:2"; break; >> > > case V4L2_PIX_FMT_NV61: descr = "Y/CrCb 4:2:2"; break; >> > > case V4L2_PIX_FMT_NV24: descr = "Y/CbCr 4:4:4"; break; >> > > diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h >> > > index 5a73b92ffe4d..47ff34d6b79f 100644 >> > > --- a/include/uapi/linux/videodev2.h >> > > +++ b/include/uapi/linux/videodev2.h >> > > @@ -598,6 +598,7 @@ struct v4l2_pix_format { >> > > /* two planes -- one Y, one Cr + Cb interleaved */ >> > > #define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 */ >> > > #define V4L2_PIX_FMT_NV21 v4l2_fourcc('N', 'V', '2', '1') /* 12 Y/CrCb 4:2:0 */ >> > > +#define V4L2_PIX_FMT_NV15 v4l2_fourcc('N', 'V', '1', '5') /* 15 Y/CbCr 4:2:0 10-bit packed */ >> > > #define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6') /* 16 Y/CbCr 4:2:2 */ >> > > #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 */ > >-- >Regards, > >Laurent Pinchart