Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3445174pxb; Mon, 4 Apr 2022 17:12:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxMZLUbGQ795TcYVvghX0+G1Bko5z6Nx3jxiKPsqfoc0WYaHgaYlReirhMuDfvVBidULmoN X-Received: by 2002:a17:902:e547:b0:156:bde6:bd85 with SMTP id n7-20020a170902e54700b00156bde6bd85mr675153plf.108.1649117571654; Mon, 04 Apr 2022 17:12:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649117571; cv=none; d=google.com; s=arc-20160816; b=PAi3OX6HyLdhmEsNTiEGagbktuCTLJUfRtD2liUsrrXQalIyboo8WEZgi0YL0MkLI+ yCjckKcVBsf9AcD0D4J0TZw1DbPErUyWhb7ki+MHqL4CGk5pEktwNgGLgLDTAqc9cWb+ 6/bnQbMm7DEb7SSAlCTXQEINkF0OrqaR97N4X0WTbozYYdmCACtlQCgV2/bhltGTlBQr DTMXsC71a+1APOK6PdkWUnj6AxModiY1TzKGlqxIpuCCqtK2NyUK3X1U9smRNC1AkjWR PqoIBelVk1aKgcaZzd8Gixl0yzhaRlUphhPM84AOWk8GgMLO7swdAOEkUjors/qrS0Wg 3Ggg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=kQvgsNE745XJuJ6iQFh2ocrZ1FaGQ90V1eHhcTssmcc=; b=nqRhBjwQvHtAif2yY7+1GLcnrZPwOeg4NAM0jhlD7zT5HjjaTicngdCRS7n+lg8+5U L0ub9grFfzzBIoRIQai2ld/gJkS4rQWo+/nyxjypr5XyDQAOeBEcDt/yihCdLiU7PGrR rFXoJ/h5aX9itM+njJWkzbprvhI7NEszz7PVYU1ZpxdYMpquhNOHlmF7AEEWqk5JtliL 6B7/6N4d9sTUJoW+NS0NspJTc59AQEturp25DnU/op6B1/Z1RZJSHuuL1zEyOb95FQ6g iA1qJdmzSwZP/PcmfC86c+UpV9Z4pAAyectSzQ3WhykkP/CzhOJ1Gden4REckDvQ1pQB aCSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=WZIs6MwW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id x7-20020a17090a6b4700b001cabc409081si657281pjl.67.2022.04.04.17.12.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 17:12:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=WZIs6MwW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 062FD6CA6A; Mon, 4 Apr 2022 16:43:37 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346927AbiDDJDY (ORCPT + 99 others); Mon, 4 Apr 2022 05:03:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347940AbiDDJDW (ORCPT ); Mon, 4 Apr 2022 05:03:22 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 846E42AE21; Mon, 4 Apr 2022 02:01:26 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:52e1:bbc1:ca8:7fa9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: benjamin.gaignard) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id E276F1F459EE; Mon, 4 Apr 2022 10:01:24 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1649062885; bh=eQtNSGmGa1pYpJmMUFL5G2DikWxM7q2G3a/sHXYemxc=; h=From:To:Cc:Subject:Date:From; b=WZIs6MwWroWsHpqJigxYLbozMdK2SMgLjTSqduxV2REGxMJzM/u+DD2LsCVMaXvIo PoBlZLPKn7FnGBU4BVEwci0Q8N7o4OuZkx3WLMxjRhn4lihdTPu6flA0K4W634HTn+ o8jiRimu6tvGJqcYFc7yUsV97mJIT/IOw4/tCMLJcb8/1t/hV+Bah32ArGSIt7Xl/0 bd+rB6vUSC9kw4iM2+12dUYIN9vdpm6v0jRpQB8zU9KLWOmWn+/ZsxToj95TJflLMR 2ceVUmrMKwLnFJL99Qgs/FkBXFdA0TNtiQvRQsH/k6S5GHNlaWTsZHi0T5dzECNndt XJTpXYt/W7xiw== From: Benjamin Gaignard To: mchehab@kernel.org, hverkuil@xs4all.nl, 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, Benjamin Gaignard , Nicolas Dufresne Subject: [PATCH] media: Add P010 video format Date: Mon, 4 Apr 2022 11:01:16 +0200 Message-Id: <20220404090116.353034-1-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 P010 is a YUV format with 10-bits per pixel with interleaved UV. Signed-off-by: Benjamin Gaignard Acked-by: Nicolas Dufresne --- Note that P010 is already known in GStreamer, only the mapping with v4l2 pixel format is missing. This patch has been acked in this series but never merged: https://patchwork.kernel.org/project/linux-rockchip/patch/20210618131526.566762-5-benjamin.gaignard@collabora.com/ After rebased it on v5.18-rc1, resend in standalone mode. .../media/v4l/pixfmt-yuv-planar.rst | 76 +++++++++++++++++++ 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, 79 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..6d65c8ac44f0 100644 --- a/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst +++ b/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst @@ -102,6 +102,13 @@ All components are stored with the same number of bits per component. - 64x32 tiles Horizontal Z order + * - V4L2_PIX_FMT_P010 + - 'P010' + - 16 + - 4:2:0 + - Cb, Cr + - No + - Linear * - V4L2_PIX_FMT_NV12MT_16X16 - 'VM12' - 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,74 @@ number of lines as the luma plane. - Cb\ :sub:`33` - Cr\ :sub:`33` +.. _V4L2_PIX_FMT_P010: + +P010 +---- + +The number of bytes in one luminance row must be divisible by 16, +which means there will be padded 0 in the right edge when necessary. + +.. raw:: latex + + \begingroup + \small + \setlength{\tabcolsep}{2pt} + +.. tabularcolumns:: |p{2.6cm}|p{0.70cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}| + +.. flat-table:: P010 16 Bits per component + :header-rows: 2 + :stub-columns: 0 + + * - Identifier + - Code + - :cspan:`7` Byte 0 in memory + + - :cspan:`7` Byte 1 + * - + - + - 7 + - 6 + - 5 + - 4 + - 3 + - 2 + - 1 + - 0 + + - 7 + - 6 + - 5 + - 4 + - 3 + - 2 + - 1 + - 0 + * - ``V4L2_PIX_FMT_P010`` + - 'P010' + + - Y\ :sub:`9` + - Y\ :sub:`8` + - Y\ :sub:`7` + - Y\ :sub:`6` + - Y\ :sub:`5` + - Y\ :sub:`4` + - Y\ :sub:`3` + - Y\ :sub:`2` + + - Y\ :sub:`1` + - Y\ :sub:`0` + - 0 + - 0 + - 0 + - 0 + - 0 + - 0 + +.. 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 96e307fe3aab..e14d7e1a038e 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_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 4c09969e7112..2e451c454db3 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') /* 15 Y/CbCr 4:2:0 10-bit per pixel*/ /* 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 */ -- 2.32.0