From patchwork Wed Feb 23 11:39:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 12756876 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A72ACC433EF for ; Wed, 23 Feb 2022 12:44:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=JoNGyZpYN+h0yQ9RcZhvkd2xLZ5ITDiWeVqMD9FCqDY=; b=UmBw1s2X0DDiHn 4AnHIHSlETrovhPGtN2x+7FVlIe4WCuiQsBR4+v4f3B5vZWK7WfPo8jBDgO4RaRvpTV7fNGFYLeQM DEHOd94F4JuzzpWPT/swMlTboUSBVRpWxxJp8As/y/eExpXE29OhPFMdLI00cf1RmLvjGUrTLd/8s 5s342nXF58WIL1taiLGBzoCStBheTLtU3Nc6nafJNWfflcmJJmBC+cL5X9RkjSiHd596ZMr1gad1g juw9z/PoOi5ckgVoDaR5GrUwkM9vNV5fM/zS7qRs7dDgVuAbDhijLpJGJEyOWFFMA9kFpuQiAat/o cEaAAZFtvGYeSh7MQU+w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nMqxo-00EDeR-2S; Wed, 23 Feb 2022 12:41:52 +0000 Received: from mail-db5eur03on0628.outbound.protection.outlook.com ([2a01:111:f400:fe0a::628] helo=EUR03-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nMqG9-00E15e-RR for linux-arm-kernel@lists.infradead.org; Wed, 23 Feb 2022 11:56:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QtGgmwwUeFb5onx0mb/IZtPqkKr66eS4C8EDYz+8+rCQQyDCgytAZs8nlqZAxzSV83/P7N2G0xLY6x1gdZau1l7+IiaxJObDEKQ9R668gfBL87GPk9oqu8hkACD5qK2i1gfbT0+EZxhP1/hlJ8s8XkTPJhFGtUlDIAbCqcLWJ7WOVQomUFY2dL+/eOopEuwKurvVwWUTNFykgCAAT3rFSS+5uTHyJfhrHsmwPlRwuwdIEwnAMd7Wyv/qWrWARAcIRPW7nCJqyxVSH0Edc8am8/i0iz6zkA0xFgl1CpztISdEUp3PF0n+EcTQSpdj0vx9w2J2FDUmU4uvjkKaVANTNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=plLDORXfJ0kB23R1bo+KVE2ciUsqdDqv8gmuxm1eh5c=; b=N43atjl0/GHmCb8O4C9sCd4rIhd6mcXs8Zk1o+wCm5wa6AxORvDxXI3MhdqSLVcg/9mz2I3L4sCuA0/4wVQ6pzFOgLfAhHbOsYzCqGDi3o8W74N9+3GmOTKKQ0ETu/QtBKqTWwZGi8cgKLq0OTwrOJQUUXzt86p3WLGUlsHYSZFpYAognX0WaBNEWWs3JJGoyARiqNid4U9gk/XAwYLI3Th68eArnxwA20BcdHw371860nN3DqgjeS8S9cksieNOxVJR5DELcdIdP8w39/7rdA1al+Ktnc03N7Lhc5rkvz2vTMRneTJXnnGbFLdwtGvr4a+KAYB4OJ/8nsUcnZyy/A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=plLDORXfJ0kB23R1bo+KVE2ciUsqdDqv8gmuxm1eh5c=; b=CWqyWde5iMFLxmJxavjUmzAAaHFccBFJlHICw0Ziv4FFAA6HIvRgrrwJS6CXRbPKjzzaSUwj/gPPA/j2l0ai4aFe0R25j8AM8uwqs7I2sOflCKWSk4mf33Bl/ktYXLg+8eXimeshwFMtilukI9dZ54iRip9zfWJr247Kg5RY0qA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) by AM6PR0402MB3416.eurprd04.prod.outlook.com (2603:10a6:209:6::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.27; Wed, 23 Feb 2022 11:40:53 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::c39:69cf:c4ea:967]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::c39:69cf:c4ea:967%5]) with mapi id 15.20.4995.027; Wed, 23 Feb 2022 11:40:53 +0000 From: Ming Qian To: mchehab@kernel.org, shawnguo@kernel.org, robh+dt@kernel.org, s.hauer@pengutronix.de Cc: hverkuil-cisco@xs4all.nl, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, aisheng.dong@nxp.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v17 02/14] media: add nv12m_8l128 and nv12m_10be_8l128 video format. Date: Wed, 23 Feb 2022 19:39:55 +0800 Message-Id: X-Mailer: git-send-email 2.33.0 In-Reply-To: References: X-ClientProxiedBy: SG2PR0601CA0015.apcprd06.prod.outlook.com (2603:1096:3::25) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ad7d657d-deec-444c-5b1b-08d9f6c158e9 X-MS-TrafficTypeDiagnostic: AM6PR0402MB3416:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hVmY/v1V4IAwenL5Ti+Kfmr2zXCezjrputldvlpz/l97+x5g/r/q+SZyt3XRcZ3INosH42eKeyFoLNnp+9S4EPpM6OMAA4N0wcgA6DHIijSInYtnZlwzyrcnN5eor0UveGig6Qi8NoFcf4D/tre6SL3UPdObK8QIIc8smx0eJeVjHuSGCSfb1As8Zn/RWy/ScZ2/TdTgsy1TqjC/0ShymcSZHU4l9jA+EIFhzl4WP3Chg8MXhCwbBWxNbqP+AqcgQd9VsaJXYEe+4JX4n5CWh2pxsZlFcr31xzSbGllUZFBvuaDDRxZUYE+j4DqNzRl9nWwnmNawrCppiS+rwz4tVteYFCpPL2F9AIecxjRpSHSEknOVVUzHRF2InZSWqxJ5AgsFArAxAxVM1ZcxC/TDTOPcsPU73rpRoLirBn+aif/zi6/IWl74CA3bKTu2SoV6cfWUuiy6/k3U4MXYV6NqB/ewnwEAi5ya0nHoLtNKqPucxEVv76nKmIP1Ye33raj0WyAawbhjTwD0a2b/zkTGDl+d8CKhBPr7Nok4QhotZL58WKUxVstdkRDJmFSAyjQMYikPcXZxtLJ9pMsHJgXfEXZHahF2bbzL0+zLrlFKw8fbYuhM5dxlTXlVm/BlSfUfzdBv3m0ifGuZ07XYVkSuoSrTV5qxNSGV/eYrKkgEsJzG0pl1EN/cT1JeR+tB14B+H9+e+7/cMQil1QgU2zJL3cNW1VFgOnjS1EL+w+vqM2PnBdOPD4pwGsH5nO/VSnZozcYHXjaek7grvawIgHa9mOVHRn+RaIdpPyp7B6YtO54= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB6341.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(36756003)(2616005)(6506007)(6486002)(52116002)(966005)(508600001)(38350700002)(6512007)(2906002)(38100700002)(66476007)(4326008)(186003)(5660300002)(8676002)(8936002)(26005)(66556008)(316002)(44832011)(86362001)(83380400001)(66946007)(7416002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: C2xwsTsc6K8lTiJW4nsB4ccm7vcaBSBWrj59oiXuBA2LBNqLipsFBbLWMfA3iiYi/rRbWYPw305vn5tL4bEw2JDUWOSZl0iB6/NYpkrQM+/yk60WPJ/uJuS3/mwVaI0XqRi9xURthVM9UI8A+jmS2aIi0JLFRjO6EnpWggBKxgpq3qsjj7Iu9mrHpBBzeqrfH5NHgZ7ccOIwT/5C1zoj5cBUcDK1qCG6zOeNe5w19cc7RbORZ39xsKbMMHWL5iYkETkun/EEx1ulXqtvJIC9l+qu/TlxG6H/n++od/WtwsXXRwqCZIDmcftzaHZsFfRiIkHnn+gajxug5w0DfzbN/7T4cBh3LeXImZUbYN6hAb7pQvT253C8XFxfzwmIt2pPwOGGkM6aciSS8R2TD1vvKYKOJ4K/AobjSyQAd8nSjahPlPfn2L+LjakWopFH9JVzeHl4wNC+BRkhJJizjW65aSrhbKcG1hBFOys0tDRWjGxdjSG7mFrJean7wzQK114OyxMDv6Th13gKP9VxBIyPp/jE0zyy8gc9O1sdB7NoqKlLB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f3vL0+e7iEQ4DauSKxSvU9bcae1eY= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ad7d657d-deec-444c-5b1b-08d9f6c158e9 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Feb 2022 11:40:53.2319 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: LZd8vg4mtN1Lmqt96tDBtxSWEOVeEvUyjbCKSeVOarAFtvBuwKPxlhq401ORog8Rlt/eT6TsNmlojkukpuJy/w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0402MB3416 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220223_035641_912266_69B3EB17 X-CRM114-Status: GOOD ( 10.65 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org nv12m_8l128 is 8-bit tiled nv12 format used by amphion decoder. nv12m_10be_8l128 is 10-bit tiled format used by amphion decoder. The tile size is 8x128 Signed-off-by: Ming Qian Signed-off-by: Shijie Qin Signed-off-by: Zhou Peng --- .../media/v4l/pixfmt-yuv-planar.rst | 28 +++++++++++++++++-- drivers/media/v4l2-core/v4l2-ioctl.c | 2 ++ include/uapi/linux/videodev2.h | 2 ++ 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst b/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst index 3a09d93d405b..8b2ff1d29639 100644 --- a/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst +++ b/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst @@ -257,6 +257,8 @@ of the luma plane. .. _V4L2-PIX-FMT-NV12-4L4: .. _V4L2-PIX-FMT-NV12-16L16: .. _V4L2-PIX-FMT-NV12-32L32: +.. _V4L2_PIX_FMT_NV12M_8L128: +.. _V4L2_PIX_FMT_NV12M_10BE_8L128: Tiled NV12 ---------- @@ -281,21 +283,41 @@ If the vertical resolution is an odd number of tiles, the last row of tiles is stored in linear order. The layouts of the luma and chroma planes are identical. -``V4L2_PIX_FMT_NV12_4L4`` stores pixel in 4x4 tiles, and stores +``V4L2_PIX_FMT_NV12_4L4`` stores pixels in 4x4 tiles, and stores tiles linearly in memory. The line stride and image height must be aligned to a multiple of 4. The layouts of the luma and chroma planes are identical. -``V4L2_PIX_FMT_NV12_16L16`` stores pixel in 16x16 tiles, and stores +``V4L2_PIX_FMT_NV12_16L16`` stores pixels in 16x16 tiles, and stores tiles linearly in memory. The line stride and image height must be aligned to a multiple of 16. The layouts of the luma and chroma planes are identical. -``V4L2_PIX_FMT_NV12_32L32`` stores pixel in 32x32 tiles, and stores +``V4L2_PIX_FMT_NV12_32L32`` stores pixels in 32x32 tiles, and stores tiles linearly in memory. The line stride and image height must be aligned to a multiple of 32. The layouts of the luma and chroma planes are identical. +``V4L2_PIX_FMT_NV12M_8L128`` is similar to ``V4L2_PIX_FMT_NV12M`` but stores +pixels in 2D 8x128 tiles, and stores tiles linearly in memory. +The image height must be aligned to a multiple of 128. +The layouts of the luma and chroma planes are identical. + +``V4L2_PIX_FMT_NV12M_10BE_8L128`` is similar to ``V4L2_PIX_FMT_NV12M`` but stores +10 bits pixels in 2D 8x128 tiles, and stores tiles linearly in memory. +the data is arranged in big endian order. +The image height must be aligned to a multiple of 128. +The layouts of the luma and chroma planes are identical. +Note the tile size is 8bytes multiplied by 128 bytes, +it means that the low bits and high bits of one pixel may be in different tiles. +The 10 bit pixels are packed, so 5 bytes contain 4 10-bit pixels layout like +this (for luma): +byte 0: Y0(bits 9-2) +byte 1: Y0(bits 1-0) Y1(bits 9-4) +byte 2: Y1(bits 3-0) Y2(bits 9-6) +byte 3: Y2(bits 5-0) Y3(bits 9-8) +byte 4: Y3(bits 7-0) + .. _nv12mt: .. kernel-figure:: nv12mt.svg diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 642cb90f457c..96e307fe3aab 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1390,6 +1390,8 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) case V4L2_META_FMT_VIVID: descr = "Vivid Metadata"; break; case V4L2_META_FMT_RK_ISP1_PARAMS: descr = "Rockchip ISP1 3A Parameters"; break; case V4L2_META_FMT_RK_ISP1_STAT_3A: descr = "Rockchip ISP1 3A Statistics"; break; + case V4L2_PIX_FMT_NV12M_8L128: descr = "NV12M (8x128 Linear)"; break; + case V4L2_PIX_FMT_NV12M_10BE_8L128: descr = "10-bit NV12M (8x128 Linear, BE)"; break; default: /* Compressed formats */ diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index df8b9c486ba1..3768a0a80830 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -632,6 +632,8 @@ struct v4l2_pix_format { /* Tiled YUV formats, non contiguous planes */ #define V4L2_PIX_FMT_NV12MT v4l2_fourcc('T', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 64x32 tiles */ #define V4L2_PIX_FMT_NV12MT_16X16 v4l2_fourcc('V', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 16x16 tiles */ +#define V4L2_PIX_FMT_NV12M_8L128 v4l2_fourcc('N', 'A', '1', '2') /* Y/CbCr 4:2:0 8x128 tiles */ +#define V4L2_PIX_FMT_NV12M_10BE_8L128 v4l2_fourcc_be('N', 'T', '1', '2') /* Y/CbCr 4:2:0 10-bit 8x128 tiles */ /* Bayer formats - see http://www.siliconimaging.com/RGB%20Bayer.htm */ #define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */