From patchwork Wed Aug 3 02:27:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 595710 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C83FAC3F6B0 for ; Wed, 3 Aug 2022 02:28:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234351AbiHCC2l (ORCPT ); Tue, 2 Aug 2022 22:28:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233506AbiHCC2k (ORCPT ); Tue, 2 Aug 2022 22:28:40 -0400 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130054.outbound.protection.outlook.com [40.107.13.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F00AB19C20; Tue, 2 Aug 2022 19:28:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HQ+17Kz5+5B2Ji7E3xmRGFqpo9VOKrHmg7MX2Z3xxEnm4XkgL1kqN5vUtZw+jEyDeA+Y65TUTrG77wvENSLNliRDXzjevKtaE2DZkdHQbBr5NbfJ1VztOvOTnJBTIwjuNJlYW1VFjKhvB88YgdSLdQ4BGlTjDidvUSnnwoWdY1KqQuEX28Xg3Z5nOvFSXMY4y3zN4IVHnKhLEDWl7MuTW7OQ0nlnCIMm6w2Fktf7V22ELBWL3NnINkskAV1v9v3TrxoQuuvj3sTCWGP8Fb2uldJpgORCp6mEodHTFMN5t0sXCKGE6Tai9nOOJ5P/XUUC0VosU9bYEWC6ZDRgZMhYTQ== 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=ILbwKsQESriic4UJzwgOD/LvSf23rx794JCog4tYBBg=; b=JcPItFdfxDnDQqsVNCVRgzuVy8dYgtvtbpvxWxgZr8DKj8KKOuKQBOFKiKzuRrLd/XUMwkM4tsgZBwwRcYI5hZTG2jsq/bkwPz2k02nWw9ezS9FI307iQpnvgTOr1GDurb754vIe+XGLiof9LE3F5BQIJsrZb+odaW3MrkCPZ0GGh5PWA4qO4jBFSma6x6mMXUe8YHgNGWMzi+ALV9xx1+0BVkipCkVLwfTqlarPFjEvFino/Z2uG+VUA2mMXjm9OD91Ag80UcjoGX+A0/T/OpW7iAMsPKJ5fOrs4q9+HzMBQOV3mBV+3cjG6V+LTI3Ia0jPyGSDa0qCLnlZGR7MdQ== 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=ILbwKsQESriic4UJzwgOD/LvSf23rx794JCog4tYBBg=; b=SzBWgdzUWwjLr/1zCj/PnopsK9AFwxUmqkxFsgaoBPlpIF0AmBRk028vkoik8FIp9+BzFFSgjpYYMEzgX6zwD14wuBKpU4Wr9oQNFH9a56UP/E9ViY2x1HBXoRSXfZswkzohIGK6GkuCFxjQ/EMmRsi3UzY1qryiyufTVrjknMU= 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 DB6PR04MB3077.eurprd04.prod.outlook.com (2603:10a6:6:8::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.13; Wed, 3 Aug 2022 02:28:37 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::5db6:3f08:2e04:33c]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::5db6:3f08:2e04:33c%4]) with mapi id 15.20.5504.014; Wed, 3 Aug 2022 02:28:37 +0000 From: Ming Qian To: mchehab@kernel.org, hverkuil-cisco@xs4all.nl Cc: shawnguo@kernel.org, robh+dt@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, xiahong.bao@nxp.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 1/4] media: add nv12_8l128 and nv12_10be_8l128 video format. Date: Wed, 3 Aug 2022 10:27:19 +0800 Message-Id: <84842bffb432884a0fd84de96c6e64ee2273e511.1659493105.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: References: X-ClientProxiedBy: SG2P153CA0022.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c7::9) 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: ddd2c959-cbda-412d-42ca-08da74f7df13 X-MS-TrafficTypeDiagnostic: DB6PR04MB3077:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MOOlOT5x4N45eniHq2NhfEn8J7OgTvn4JMGt5pCCcD7xjuDvktjRLE9npG948ZDQ8/cSY8ynzaDIr6iku+KUq6k/JPPydy6G5vg2o6tPYwFo1+IaNF3XVXXcdGCnHZzm07xgvbTjbagzT3y1cZI9HilSamoxj9cbC3kCuCBr/8Zk8/LPkzQM6kzDd6fjg5zW3DoCLrYspTum4wize3ymBcEIcy2N+oY0QX7tZn8OTDRGO+ZVk4sDWaqANigDgCGexihWtahLMbVLP9S3AFbYma5Dxhq3Yvxzkg/sVLJodcd88vBGbTkaVyg20iwbgqjK0vZ29akjKltRwdt4dv/X1YoksKSZnkyxbRq0Prlo5bMOvWKZ13EfDsHqnPeUiAjQ04HmUpWwl0x+X/iWEqr5yBs+q2XzdcPS2lFSmUaKIWpwY47rliT75QLFiaTC0mTiTJmywtXQPRVnwFmWcddXkwru8P2kqupGQBwrqOvjSa0/dVrTszzcFR4yaZvPDY++aHQaU2ZgVHbnqkP4AaiGrekst/OY6suGaIShOb6zYhAQgaqh6IvfaMNs/Lv+bk4mCY/n2g715LO+OTcEKL8QTEWCV+DEkQYKREsecT3c3ysHnPfs/IMieGY4S3+esW4N3ckBZvySz8/YjtnzynJbbcaQnUQ47ATnM3a3SNkIDX5ng+d2/1frxjhEHkpAo3OyUJ7E0vT/0uBM7iUhzksCGQBOz6AwWV7QXCqujPCfmaTQBrtvyWLF2trpIuIXRpXhbuMIBZeMPwrQEA0PtpyDjfp83qMMAKEsav5REID41MJLY//6WSynQ/Bj0os94a1T 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:(13230016)(4636009)(366004)(376002)(136003)(39860400002)(396003)(346002)(44832011)(5660300002)(8676002)(4326008)(66476007)(66556008)(66946007)(8936002)(7416002)(2906002)(83380400001)(36756003)(86362001)(38100700002)(6486002)(478600001)(41300700001)(38350700002)(316002)(186003)(2616005)(26005)(6666004)(6506007)(6512007)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: COPil/DMnuB96HVKFBZvbH3tvQG7897vxnEKL0nTVjYbU9ySHNFUy0QHO3UqFlorPE7ghTyyGXu93dQ2YIOzyot71ZuG3cOGZp9KjcB2Xs8Eo990kSZlpP0BMGNiLoVGoIlVWtKzlqbhk0PEIVrguqVxptLW+WhbjhKomspzxD99n9gzaGY/EYxCdoSQ2sZB+YbH+2nrMgVzmn261drxfeiUW/vZTmHQBnxpqT3ZddOJ67XDdKGyosBxn4F67ZvhQSJzxPXG8PXWujnbg90Ki/KF2XVZ07mLkgs28dzcStNW84KP/wwHgrtgtcyx4CXBlLqW3cg3WlwaUmAP6G5UX8B+J9P1PT7FiHoDZLEdKRJEPBnscrQPsjeyoHxVpzVmT7u0KcggtRK8rj7X4KY5/bQ/MqKgKzDDoHy+GxO2tSy3yXaZ2nSdfZdN77dUMXNEwqETmYDNTVhOXq26LuUyunyT9p84TcImLHvh7ZcFg7Kn9UlUP4lF/iURuNUqGEOz7Zfp7+Xo/TY3MmYxRwikh107WcZIxFoowixQFPntDqFcQfMq94/J2qqi1lLc+PPI8I95iIrlcuvyla5le4+IKWT61bnOGwLUtyWtjybBknXP9SKEGgHMr3lv7jNlHQz/ccxXjDQdU8cKovNo6MbWdl4xee17qky7gN+wOT4XVIYDNeToZUOPY9WocfZJFLCEv08GJsjD9n65fiXUIYN7I0khzYyW6BaTPjQFsejw7PszgW9NDLCKeEiMbnjCFOd9Fr3uK7CZZ85GKLlAApZI8DDCu5zu+a5R5ZD8+aJL11+PB9SxDwSetYfGYdCqUWrm2Dm+B+SSuXnp4OI8TYc1ST1n/fcQ0xOvmeVE9F87ZOr4tQgr6BDSdDdJZTbmIOgMI5yhUXX9mkzSbyo7xGSqwFJD32tXMHjGy1BacuOauR6eKUsacADJu+YSnXgLRbB0m7kIQljdJlcBXqfDHP5rh0bve24649+WLjCv3GrNpTOophhPnSWyYuGydLmj8wGzE3D6fBn2A+cxphgKO/nPYRD2ry0ntzAkNuCWJbaH2j0kjL2gAz9Llk2k9Hf6mzOeOspJz7olAOAXZHh53QaEVRHJCRdDKNYWIfGsfpCo8Pjap1ObJwKKxZ5L8OvniI2vt1hsGz3EApcxxj2FJTZ7x31zD/fvOiQKxQlMRn6P4Qw2zVDl5ub3ZrfRBCCkke6UoeLhyV2lTteTKFOivF/V7yaPOuu5TP7z+7ocoUs+BXpCbY8mAbgSxL4TJt3+S5zyOqVZ9iWuv38nHYRpRteGiizMkHafwrRiFOIR0ZB3C0AHOliYXA3v7JgBumvKXPUXljuzAbYlr8A1IkArVqOALsFXeVz5TOGN8/wbyYB2BjrtKABzlMRTX+jQ8im+IYt5bxx3SV76BcVwh+3HEVcte4sNJ8R8EBzqQS6ylJ5iAtBgBcu4yI9oVTrwmaCCEzqlAN0hWhIaHgvgUGOhq1zD+Ql1+r4V/TUgWWRLL1xhENBmH1D6jFxU6USwK9wX9rQmdEKLqwawHrmPh0L5d3HtfRT33vcpRCAxsQ6W9siwPyn1+8e9LbuASlEz5gBpjYGc X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ddd2c959-cbda-412d-42ca-08da74f7df13 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Aug 2022 02:28:37.6234 (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: SQrrciaBzNPwYLtyuegEGo2zId5bccCjUL/Ss8kEtmEOD9U20aY/DalcMbxtL3LXRavPt4CxG1EKW0yjWmKoEg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR04MB3077 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org add contiguous nv12 tiled format nv12_8l128 and nv12_10be_8l128 Signed-off-by: Ming Qian Reviewed-by: Nicolas Dufresne --- .../userspace-api/media/v4l/pixfmt-yuv-planar.rst | 8 ++++++++ drivers/media/v4l2-core/v4l2-ioctl.c | 2 ++ include/uapi/linux/videodev2.h | 2 ++ 3 files changed, 12 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst b/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst index 10b1feeb0b57..f1d5bb7b806d 100644 --- a/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst +++ b/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst @@ -273,7 +273,9 @@ of the luma plane. .. _V4L2-PIX-FMT-NV12-16L16: .. _V4L2-PIX-FMT-NV12-32L32: .. _V4L2-PIX-FMT-NV12M-8L128: +.. _V4L2-PIX-FMT-NV12-8L128: .. _V4L2-PIX-FMT-NV12M-10BE-8L128: +.. _V4L2-PIX-FMT-NV12-10BE-8L128: .. _V4L2-PIX-FMT-MM21: Tiled NV12 @@ -319,6 +321,9 @@ 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_NV12_8L128`` is similar to ``V4L2_PIX_FMT_NV12M_8L128`` but stores +two planes in one memory. + ``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. @@ -334,6 +339,9 @@ 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) +``V4L2_PIX_FMT_NV12_10BE_8L128`` is similar to ``V4L2_PIX_FMT_NV12M_10BE_8L128`` but stores +two planes in one memory. + ``V4L2_PIX_FMT_MM21`` store luma pixel in 16x32 tiles, and chroma pixels in 16x16 tiles. The line stride must be aligned to a multiple of 16 and the image height must be aligned to a multiple of 32. The number of luma and chroma diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index c314025d977e..d973bd2ff750 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1444,7 +1444,9 @@ 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_NV12_8L128: descr = "NV12 (8x128 Linear)"; break; case V4L2_PIX_FMT_NV12M_8L128: descr = "NV12M (8x128 Linear)"; break; + case V4L2_PIX_FMT_NV12_10BE_8L128: descr = "10-bit NV12 (8x128 Linear, BE)"; break; case V4L2_PIX_FMT_NV12M_10BE_8L128: descr = "10-bit NV12M (8x128 Linear, BE)"; break; default: diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index cd66e01ed3c3..64f16490dd2b 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -655,6 +655,8 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_NV12_16L16 v4l2_fourcc('H', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 16x16 tiles */ #define V4L2_PIX_FMT_NV12_32L32 v4l2_fourcc('S', 'T', '1', '2') /* 12 Y/CbCr 4:2:0 32x32 tiles */ #define V4L2_PIX_FMT_P010_4L4 v4l2_fourcc('T', '0', '1', '0') /* 12 Y/CbCr 4:2:0 10-bit 4x4 macroblocks */ +#define V4L2_PIX_FMT_NV12_8L128 v4l2_fourcc('A', 'T', '1', '2') /* Y/CbCr 4:2:0 8x128 tiles */ +#define V4L2_PIX_FMT_NV12_10BE_8L128 v4l2_fourcc_be('A', 'X', '1', '2') /* Y/CbCr 4:2:0 10-bit 8x128 tiles */ /* 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 */ From patchwork Wed Aug 3 02:27:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 595209 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62468C00140 for ; Wed, 3 Aug 2022 02:28:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235212AbiHCC2w (ORCPT ); Tue, 2 Aug 2022 22:28:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234779AbiHCC2s (ORCPT ); Tue, 2 Aug 2022 22:28:48 -0400 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130057.outbound.protection.outlook.com [40.107.13.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA3F41CFE5; Tue, 2 Aug 2022 19:28:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QHii/pI4QuIwKRAmgKvMS2XWPDKV/lYt+QGxHZuKOJCk1zVkrAlWVsTF9Ji5x6dFi2yGgC0sq4yY3va9i3LAOKg8ZZsoX+EeBhyhU19sC3Xq4Svk+E+xuIlvsyWerlYvcB6ZXVDOdk24y8PPwsIT8CXvQaplsoM98e/2l0yqQVJ0v1pLYYyg9E9s4Y9v24Y7HzcZgWF1xJELHv7yHDV0GnxakM6e79iAzapOS5fM5MkxqFeshlPzOE/HCia1fvLwfS1aPAClt41asGWNmxz+WTwZFoiHO8ThVgAUIljTEC98SS2RmHEOJewZ2PpL/3xswlfijU+0B/qxje3Ja0O9hw== 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=oQs9NbHO7GD060VBKLV+6+Ue9SBGZ/5cITKeZu9Et6g=; b=e4kC/280p7keqxFtwTNbg2zgiyloe1j2qSvUr2FV+BlRPUL/+cuaNeJBY7lUMeobPerdzITgZHPS0u6tc6m8CcTeMlwDDUy+JXtqEqn2Cu9AIdrb56iMUpegqwBJ4nja0xW8f+FXRshPeJpWJV0u5QplZuosjTSEX/uaVNXUbnvYMG3LhjT8ZzpgBNEtUtuv6GwgSyrhc0PdAc2tVjj93QJjKRmWaj5WaGe++pcBx4Zix56gqY78cF/Dr1gam+ZZVUBrbLHE5aHc/OMxIAJ/71F+NsUU8rHTYPpolWFm7THcDA3t9pOJLFRFgowq0JDDEshosuJaSiP5R8CYXUMMfg== 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=oQs9NbHO7GD060VBKLV+6+Ue9SBGZ/5cITKeZu9Et6g=; b=R9YHqZj/25GNZcFLIdQhJFDXwOzynwfUoXXkk8JZf1mk4tdGkUDgnxjV0gCMckUhuUM5G1dfHrMKvXyCnOIes9bJrmD5pnWawizVhVw6m6nGp62yMDyroppVMlicQZ2Zw8YwcC9OUWa4ZzU3ajwYmR2uY8f/bpVrdurEWfTPIcM= 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 DB6PR04MB3077.eurprd04.prod.outlook.com (2603:10a6:6:8::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.13; Wed, 3 Aug 2022 02:28:41 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::5db6:3f08:2e04:33c]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::5db6:3f08:2e04:33c%4]) with mapi id 15.20.5504.014; Wed, 3 Aug 2022 02:28:41 +0000 From: Ming Qian To: mchehab@kernel.org, hverkuil-cisco@xs4all.nl Cc: shawnguo@kernel.org, robh+dt@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, xiahong.bao@nxp.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 2/4] media: amphion: tell and handle contiguous and non contiguous format Date: Wed, 3 Aug 2022 10:27:20 +0800 Message-Id: <7a17be1ed3bcb703a14f3d67b9fc547ead63a58b.1659493105.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: References: X-ClientProxiedBy: SG2P153CA0022.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c7::9) 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: eb596a40-2096-40f0-e8fd-08da74f7e145 X-MS-TrafficTypeDiagnostic: DB6PR04MB3077:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CRYk2iLUBkTHVc6hvRJO/VAElHPqGrfTa56CtcfKOam2wLyxkPzhF4EBDGDIO398vESweXxnxKZZ8BodHvVJ3lWnDnP24X9/I9206dgJQMl/vQvMR4P80Rn0KpI76/YvS2yfmBrg+DpRGJ5pfdQlvNbohtOyAH3j+pEMhPNmeiw1E+RpAEFtdKMfvhgZoHlZ41OKY2/4UpnzH71MuRcG+jqaHidR5bdRpNEhJSnyGOgfzi/55vLhYJ/8zc0ZmxZLiJrV3URa5wPAaFAPZS3uQ9gkSqNmXGdUv0ZBQXf+WjDmMHPB0cbOjEHwUX4mvl67AuVYsD7ZCze9f2raepWKc7QWsLy+9CFqZHTFFO0TILRfTeGLe+T7ryDTHZlFLhh3PkJjUb/cUESPPD1iQTPriYYG1q1H8Juz+OrErwVfxtllPb4Pi2viqT/6H46DB+sYWK9+JhuCZo2TPTaAu/dYxAVCrVHN/Etkstb7zOP0li6Iu/Ejy6l6N9We/3+UG68USCxBPLukbfdAva+ndzivQucyQkT2Zix/umDv4OqEVCVrbbX9+i2A3NyVw7/wFM0vqCaiYht6JoI9TeqbYPVoGxQgS83k2JHB/xevAmVBlRl3iDCmcJSfopDhweyeL4YcOI+1YeImGlEwp4Q/VKdgjjte4n/qOTrP2IAd9Q4CAhu4xh32w3hV/s8ar0KDbqeSeIgY9/tbGWDIAYQSKvEIa3/wX4cvzny/Vl8lBW+KF06E0tW9r9aJiOmpqdmlRcYSfZEjMOH5apIfrImTibBbdgZMTGsJ4xX1qo/zpTXl7eU= 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:(13230016)(4636009)(366004)(376002)(136003)(39860400002)(396003)(346002)(44832011)(5660300002)(30864003)(8676002)(4326008)(66476007)(66556008)(66946007)(8936002)(7416002)(2906002)(83380400001)(36756003)(86362001)(38100700002)(6486002)(478600001)(41300700001)(38350700002)(316002)(186003)(2616005)(26005)(6666004)(6506007)(6512007)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8OwtkPEaoHN4IVZUebEeiD2Y2m02aBaQFRhXboqcFUgSV1VBcBCB9ruMnNHO/9OJl5RqJ1WXLnL4qo///Bjo2vkVVsbjkjiIrYtqEu+NGGqDIyfj4OTjJ8nJ67gjMZlgD1ZJPyjO7fS8lxW3g49hzVvrprTbt/tNt722vt9/EDFz1UjxFyEpDvV3xhgh7Znusmzl+LBoGn6F3Aq6WBgRyMPsZ1LWsSoaWE4FG2MOAl64sKnb9H/FLMku16RePzMpdV4wm6fA//5aRKxrJqq/88H/hzo4iDUiFmW6Li7BSzj1qTWcvVPyRouf4uU33yNxzs240+ZbK1b7VeCeWmYUHWt/cnC+jpPx56oUaCoA+osVVxMaEWm92r8Kn5jua7KNTR9lBK3rQcLcwBYR8GZD9cRdnqRj2q9p9wLd22vk5OirW2ZMihlMf+iUWtbqj1X5zW6RKa9a11mq9wYuNtDo+46MisTm5g716BKZF0RxGFBAYzbt2Q77C64RRpJVVx0ifDsEiylcsLxwHHltB28nWApTh2zdZD2ZJ1FJNgnqopVGGrWkeoKiClsEj9Y1QUSO1CSfTRV7getTvK01n8A+3kOtZfCI4ha8e4vtj3W972f0I9DS/+M7p0LU9LF/b8n9kUiDrdFyMvDWqmP8pA39PmmaHXEr98K4FTRv2hXRwXhXqC1L5mhGF+yb6UB2TQ4FM+/CDkz3G8huP6+2WTXQR9PMnq85sswR46LmzNuXfPAOkjJYwzayTCTA9XjfPCOGMz+GDRZgk4TxjOGztX77LtC778iPkx7FtXlXBbJuj1JVoUikOzbGh8Q/TofXDwJRGBdUKsUjPLIADq9dRqyMMgNqw8lRbOikNw/baL/O6af7w/yjhAIwTI4Q3mMPKxyF3gxXuKRCBSPijE6JLZnzCq0EmDtNM/gVFkZmeid4NTR5/JAkCEbwB+FbKlJt4bbXUQa17Mio9wUuByGWWOtp5/Hadopup8h1iWXeIlffUG4qUFf5uUZvsueWU45IOse0O3DLdWsUjigvhsdCmzCB4Tf1Hg8fS/gs0TEetf49sI1qtzLQ9WFSfgTotuxoqwj0MzU66UKANDwcEVsdClHhBcgvzGexyssNzUO3Q6XG7eh2p6zojqOCRxsZIeRd18EtDPg4TgtryBd7tdop/OFZc1TNCGtiY2W056lXPeIoz0YhoXlVlv7Fvk7dwMxtsHIyc6dz+ZrANOXmPnwoJQT2xFgo+Rbo9bTZnLYlseUrMx0dCoY6Ez5L5ltsHxYMXQ17vayUmi1PsaqfQSdx46su4C8DpnJLGX5uNm8lyiazr+d3ACHjwsykWUaxKkaQr2HH6LZDkyR/3V6O+xtiU+KUXKm/lBKQ+TkjvHlB10gvxqtMI1UNzu/Do0hzZrfTvJS7BcxH507bYR6SLCPj2mI51pxTIax7UIS+W++zy6z7C8Q0TTjgYFDDsshkMTltCTxyXNwevLexy7P0qqm+QpbXV+lYBM8UtVZPfWf0ITFpfBdRI0EB+XsgtS/tC+zUWbqGgC5o+Ahud72bzxjA1i9jYCijBTRYplUkwJKwdQYyIdtRK55lQKxCm/jn7M032job X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: eb596a40-2096-40f0-e8fd-08da74f7e145 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Aug 2022 02:28:41.4670 (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: fGNuUwq28lf2QizzbZEE/7Kv/2xLF9d0/CjxNqoxMcLqS5+mJHCNrhs99CheAqOXNOcTdSUVfTlz7n9E8UDH2A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR04MB3077 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Driver should tell the number of memory planes and component planes. the amphion vpu support non contiguous planes, but for compatibility with other device that only support contiguous planes. driver can add support for contiguous planes in the same time. Then the mem_planes can be different from the comp_planes. driver need to handle buffer according mem_planes and comp_planes. So driver can support NV12 and NV12M. Signed-off-by: Ming Qian --- drivers/media/platform/amphion/vdec.c | 187 ++++++++++--------- drivers/media/platform/amphion/venc.c | 33 ++-- drivers/media/platform/amphion/vpu.h | 4 +- drivers/media/platform/amphion/vpu_dbg.c | 8 +- drivers/media/platform/amphion/vpu_helpers.c | 48 ++++- drivers/media/platform/amphion/vpu_helpers.h | 2 + drivers/media/platform/amphion/vpu_malone.c | 3 +- drivers/media/platform/amphion/vpu_v4l2.c | 157 ++++++++++++---- drivers/media/platform/amphion/vpu_v4l2.h | 3 +- drivers/media/platform/amphion/vpu_windsor.c | 8 +- 10 files changed, 290 insertions(+), 163 deletions(-) diff --git a/drivers/media/platform/amphion/vdec.c b/drivers/media/platform/amphion/vdec.c index feb75dc204de..48ab664fa7ef 100644 --- a/drivers/media/platform/amphion/vdec.c +++ b/drivers/media/platform/amphion/vdec.c @@ -69,72 +69,85 @@ struct vdec_t { static const struct vpu_format vdec_formats[] = { { .pixfmt = V4L2_PIX_FMT_NV12M_8L128, - .num_planes = 2, + .mem_planes = 2, + .comp_planes = 2, .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, }, { .pixfmt = V4L2_PIX_FMT_NV12M_10BE_8L128, - .num_planes = 2, + .mem_planes = 2, + .comp_planes = 2, .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, }, { .pixfmt = V4L2_PIX_FMT_H264, - .num_planes = 1, + .mem_planes = 1, + .comp_planes = 1, .type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, - .flags = V4L2_FMT_FLAG_DYN_RESOLUTION + .flags = V4L2_FMT_FLAG_DYN_RESOLUTION | V4L2_FMT_FLAG_COMPRESSED }, { .pixfmt = V4L2_PIX_FMT_H264_MVC, - .num_planes = 1, + .mem_planes = 1, + .comp_planes = 1, .type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, - .flags = V4L2_FMT_FLAG_DYN_RESOLUTION + .flags = V4L2_FMT_FLAG_DYN_RESOLUTION | V4L2_FMT_FLAG_COMPRESSED }, { .pixfmt = V4L2_PIX_FMT_HEVC, - .num_planes = 1, + .mem_planes = 1, + .comp_planes = 1, .type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, - .flags = V4L2_FMT_FLAG_DYN_RESOLUTION + .flags = V4L2_FMT_FLAG_DYN_RESOLUTION | V4L2_FMT_FLAG_COMPRESSED }, { .pixfmt = V4L2_PIX_FMT_VC1_ANNEX_G, - .num_planes = 1, + .mem_planes = 1, + .comp_planes = 1, .type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, - .flags = V4L2_FMT_FLAG_DYN_RESOLUTION + .flags = V4L2_FMT_FLAG_DYN_RESOLUTION | V4L2_FMT_FLAG_COMPRESSED }, { .pixfmt = V4L2_PIX_FMT_VC1_ANNEX_L, - .num_planes = 1, + .mem_planes = 1, + .comp_planes = 1, .type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, + .flags = V4L2_FMT_FLAG_COMPRESSED }, { .pixfmt = V4L2_PIX_FMT_MPEG2, - .num_planes = 1, + .mem_planes = 1, + .comp_planes = 1, .type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, - .flags = V4L2_FMT_FLAG_DYN_RESOLUTION + .flags = V4L2_FMT_FLAG_DYN_RESOLUTION | V4L2_FMT_FLAG_COMPRESSED }, { .pixfmt = V4L2_PIX_FMT_MPEG4, - .num_planes = 1, + .mem_planes = 1, + .comp_planes = 1, .type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, - .flags = V4L2_FMT_FLAG_DYN_RESOLUTION + .flags = V4L2_FMT_FLAG_DYN_RESOLUTION | V4L2_FMT_FLAG_COMPRESSED }, { .pixfmt = V4L2_PIX_FMT_XVID, - .num_planes = 1, + .mem_planes = 1, + .comp_planes = 1, .type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, - .flags = V4L2_FMT_FLAG_DYN_RESOLUTION + .flags = V4L2_FMT_FLAG_DYN_RESOLUTION | V4L2_FMT_FLAG_COMPRESSED }, { .pixfmt = V4L2_PIX_FMT_VP8, - .num_planes = 1, + .mem_planes = 1, + .comp_planes = 1, .type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, - .flags = V4L2_FMT_FLAG_DYN_RESOLUTION + .flags = V4L2_FMT_FLAG_DYN_RESOLUTION | V4L2_FMT_FLAG_COMPRESSED }, { .pixfmt = V4L2_PIX_FMT_H263, - .num_planes = 1, + .mem_planes = 1, + .comp_planes = 1, .type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, - .flags = V4L2_FMT_FLAG_DYN_RESOLUTION + .flags = V4L2_FMT_FLAG_DYN_RESOLUTION | V4L2_FMT_FLAG_COMPRESSED }, {0, 0, 0, 0}, }; @@ -256,23 +269,22 @@ static int vdec_enum_fmt(struct file *file, void *fh, struct v4l2_fmtdesc *f) int ret = -EINVAL; vpu_inst_lock(inst); - if (!V4L2_TYPE_IS_OUTPUT(f->type) && vdec->fixed_fmt) { - if (f->index == 0) { - f->pixelformat = inst->cap_format.pixfmt; - f->flags = inst->cap_format.flags; - ret = 0; - } + if (V4L2_TYPE_IS_CAPTURE(f->type) && vdec->fixed_fmt) { + fmt = vpu_get_format(inst, f->type); + if (f->index == 1) + fmt = vpu_helper_find_sibling(inst, f->type, fmt->pixfmt); + if (f->index > 1) + fmt = NULL; } else { fmt = vpu_helper_enum_format(inst, f->type, f->index); - memset(f->reserved, 0, sizeof(f->reserved)); - if (!fmt) - goto exit; - - f->pixelformat = fmt->pixfmt; - f->flags = fmt->flags; - ret = 0; } + if (!fmt) + goto exit; + memset(f->reserved, 0, sizeof(f->reserved)); + f->pixelformat = fmt->pixfmt; + f->flags = fmt->flags; + ret = 0; exit: vpu_inst_unlock(inst); return ret; @@ -289,14 +301,14 @@ static int vdec_g_fmt(struct file *file, void *fh, struct v4l2_format *f) cur_fmt = vpu_get_format(inst, f->type); pixmp->pixelformat = cur_fmt->pixfmt; - pixmp->num_planes = cur_fmt->num_planes; + pixmp->num_planes = cur_fmt->mem_planes; pixmp->width = cur_fmt->width; pixmp->height = cur_fmt->height; pixmp->field = cur_fmt->field; pixmp->flags = cur_fmt->flags; for (i = 0; i < pixmp->num_planes; i++) { pixmp->plane_fmt[i].bytesperline = cur_fmt->bytesperline[i]; - pixmp->plane_fmt[i].sizeimage = cur_fmt->sizeimage[i]; + pixmp->plane_fmt[i].sizeimage = vpu_get_fmt_plane_size(cur_fmt, i); } f->fmt.pix_mp.colorspace = vdec->codec_info.color_primaries; @@ -311,10 +323,19 @@ static int vdec_try_fmt(struct file *file, void *fh, struct v4l2_format *f) { struct vpu_inst *inst = to_inst(file); struct vdec_t *vdec = inst->priv; - - vpu_try_fmt_common(inst, f); + struct vpu_format fmt; vpu_inst_lock(inst); + if (V4L2_TYPE_IS_CAPTURE(f->type) && vdec->fixed_fmt) { + struct vpu_format *cap_fmt = vpu_get_format(inst, f->type); + + if (!vpu_helper_match_format(inst, cap_fmt->type, cap_fmt->pixfmt, + f->fmt.pix_mp.pixelformat)) + f->fmt.pix_mp.pixelformat = cap_fmt->pixfmt; + } + + vpu_try_fmt_common(inst, f, &fmt); + if (vdec->fixed_fmt) { f->fmt.pix_mp.colorspace = vdec->codec_info.color_primaries; f->fmt.pix_mp.xfer_func = vdec->codec_info.transfer_chars; @@ -334,7 +355,7 @@ static int vdec_try_fmt(struct file *file, void *fh, struct v4l2_format *f) static int vdec_s_fmt_common(struct vpu_inst *inst, struct v4l2_format *f) { struct v4l2_pix_format_mplane *pixmp = &f->fmt.pix_mp; - const struct vpu_format *fmt; + struct vpu_format fmt; struct vpu_format *cur_fmt; struct vb2_queue *q; struct vdec_t *vdec = inst->priv; @@ -349,36 +370,30 @@ static int vdec_s_fmt_common(struct vpu_inst *inst, struct v4l2_format *f) if (vb2_is_busy(q)) return -EBUSY; - fmt = vpu_try_fmt_common(inst, f); - if (!fmt) + if (vpu_try_fmt_common(inst, f, &fmt)) return -EINVAL; cur_fmt = vpu_get_format(inst, f->type); if (V4L2_TYPE_IS_OUTPUT(f->type) && inst->state != VPU_CODEC_STATE_DEINIT) { - if (cur_fmt->pixfmt != fmt->pixfmt) { + if (cur_fmt->pixfmt != fmt.pixfmt) { vdec->reset_codec = true; vdec->fixed_fmt = false; } } - cur_fmt->pixfmt = fmt->pixfmt; if (V4L2_TYPE_IS_OUTPUT(f->type) || !vdec->fixed_fmt) { - cur_fmt->num_planes = fmt->num_planes; - cur_fmt->flags = fmt->flags; - cur_fmt->width = pixmp->width; - cur_fmt->height = pixmp->height; - for (i = 0; i < fmt->num_planes; i++) { - cur_fmt->sizeimage[i] = pixmp->plane_fmt[i].sizeimage; - cur_fmt->bytesperline[i] = pixmp->plane_fmt[i].bytesperline; - } - if (pixmp->field != V4L2_FIELD_ANY) - cur_fmt->field = pixmp->field; + memcpy(cur_fmt, &fmt, sizeof(*cur_fmt)); } else { - pixmp->num_planes = cur_fmt->num_planes; + if (vpu_helper_match_format(inst, f->type, cur_fmt->pixfmt, pixmp->pixelformat)) { + cur_fmt->pixfmt = fmt.pixfmt; + cur_fmt->mem_planes = fmt.mem_planes; + } + pixmp->pixelformat = cur_fmt->pixfmt; + pixmp->num_planes = cur_fmt->mem_planes; pixmp->width = cur_fmt->width; pixmp->height = cur_fmt->height; for (i = 0; i < pixmp->num_planes; i++) { pixmp->plane_fmt[i].bytesperline = cur_fmt->bytesperline[i]; - pixmp->plane_fmt[i].sizeimage = cur_fmt->sizeimage[i]; + pixmp->plane_fmt[i].sizeimage = vpu_get_fmt_plane_size(cur_fmt, i); } pixmp->field = cur_fmt->field; } @@ -678,9 +693,11 @@ static struct vpu_vb2_buffer *vdec_find_buffer(struct vpu_inst *inst, u32 luma) static void vdec_buf_done(struct vpu_inst *inst, struct vpu_frame_info *frame) { struct vdec_t *vdec = inst->priv; + struct vpu_format *cur_fmt; struct vpu_vb2_buffer *vpu_buf; struct vb2_v4l2_buffer *vbuf; u32 sequence; + int i; if (!frame) return; @@ -699,6 +716,7 @@ static void vdec_buf_done(struct vpu_inst *inst, struct vpu_frame_info *frame) return; } + cur_fmt = vpu_get_format(inst, inst->cap_format.type); vbuf = &vpu_buf->m2m_buf.vb; if (vbuf->vb2_buf.index != frame->id) dev_err(inst->dev, "[%d] buffer id(%d, %d) dismatch\n", @@ -707,9 +725,9 @@ static void vdec_buf_done(struct vpu_inst *inst, struct vpu_frame_info *frame) if (vpu_get_buffer_state(vbuf) != VPU_BUF_STATE_DECODED) dev_err(inst->dev, "[%d] buffer(%d) ready without decoded\n", inst->id, frame->id); vpu_set_buffer_state(vbuf, VPU_BUF_STATE_READY); - vb2_set_plane_payload(&vbuf->vb2_buf, 0, inst->cap_format.sizeimage[0]); - vb2_set_plane_payload(&vbuf->vb2_buf, 1, inst->cap_format.sizeimage[1]); - vbuf->field = inst->cap_format.field; + for (i = 0; i < vbuf->vb2_buf.num_planes; i++) + vb2_set_plane_payload(&vbuf->vb2_buf, i, vpu_get_fmt_plane_size(cur_fmt, i)); + vbuf->field = cur_fmt->field; vbuf->sequence = sequence; dev_dbg(inst->dev, "[%d][OUTPUT TS]%32lld\n", inst->id, vbuf->vb2_buf.timestamp); @@ -747,15 +765,17 @@ static void vdec_stop_done(struct vpu_inst *inst) static bool vdec_check_source_change(struct vpu_inst *inst) { struct vdec_t *vdec = inst->priv; - const struct vpu_format *fmt; - int i; + const struct vpu_format *sibling; if (!inst->fh.m2m_ctx) return false; + sibling = vpu_helper_find_sibling(inst, inst->cap_format.type, inst->cap_format.pixfmt); + if (sibling && vdec->codec_info.pixfmt == sibling->pixfmt) + vdec->codec_info.pixfmt = inst->cap_format.pixfmt; + if (!vb2_is_streaming(v4l2_m2m_get_dst_vq(inst->fh.m2m_ctx))) return true; - fmt = vpu_helper_find_format(inst, inst->cap_format.type, vdec->codec_info.pixfmt); if (inst->cap_format.pixfmt != vdec->codec_info.pixfmt) return true; if (inst->cap_format.width != vdec->codec_info.decoded_width) @@ -772,14 +792,6 @@ static bool vdec_check_source_change(struct vpu_inst *inst) return true; if (inst->crop.height != vdec->codec_info.height) return true; - if (fmt && inst->cap_format.num_planes != fmt->num_planes) - return true; - for (i = 0; i < inst->cap_format.num_planes; i++) { - if (inst->cap_format.bytesperline[i] != vdec->codec_info.bytesperline[i]) - return true; - if (inst->cap_format.sizeimage[i] != vdec->codec_info.sizeimage[i]) - return true; - } return false; } @@ -787,27 +799,21 @@ static bool vdec_check_source_change(struct vpu_inst *inst) static void vdec_init_fmt(struct vpu_inst *inst) { struct vdec_t *vdec = inst->priv; - const struct vpu_format *fmt; - int i; + struct v4l2_format f; - fmt = vpu_helper_find_format(inst, inst->cap_format.type, vdec->codec_info.pixfmt); - inst->out_format.width = vdec->codec_info.width; - inst->out_format.height = vdec->codec_info.height; - inst->cap_format.width = vdec->codec_info.decoded_width; - inst->cap_format.height = vdec->codec_info.decoded_height; - inst->cap_format.pixfmt = vdec->codec_info.pixfmt; - if (fmt) { - inst->cap_format.num_planes = fmt->num_planes; - inst->cap_format.flags = fmt->flags; - } - for (i = 0; i < inst->cap_format.num_planes; i++) { - inst->cap_format.bytesperline[i] = vdec->codec_info.bytesperline[i]; - inst->cap_format.sizeimage[i] = vdec->codec_info.sizeimage[i]; - } + memset(&f, 0, sizeof(f)); + f.type = inst->cap_format.type; + f.fmt.pix_mp.pixelformat = vdec->codec_info.pixfmt; + f.fmt.pix_mp.width = vdec->codec_info.decoded_width; + f.fmt.pix_mp.height = vdec->codec_info.decoded_height; if (vdec->codec_info.progressive) - inst->cap_format.field = V4L2_FIELD_NONE; + f.fmt.pix_mp.field = V4L2_FIELD_NONE; else - inst->cap_format.field = V4L2_FIELD_SEQ_TB; + f.fmt.pix_mp.field = V4L2_FIELD_SEQ_TB; + vpu_try_fmt_common(inst, &f, &inst->cap_format); + + inst->out_format.width = vdec->codec_info.width; + inst->out_format.height = vdec->codec_info.height; } static void vdec_init_crop(struct vpu_inst *inst) @@ -966,7 +972,10 @@ static int vdec_response_frame(struct vpu_inst *inst, struct vb2_v4l2_buffer *vb info.tag = vdec->seq_tag; info.luma_addr = vpu_get_vb_phy_addr(&vbuf->vb2_buf, 0); info.luma_size = inst->cap_format.sizeimage[0]; - info.chroma_addr = vpu_get_vb_phy_addr(&vbuf->vb2_buf, 1); + if (vbuf->vb2_buf.num_planes > 1) + info.chroma_addr = vpu_get_vb_phy_addr(&vbuf->vb2_buf, 1); + else + info.chroma_addr = info.luma_addr + info.luma_size; info.chromau_size = inst->cap_format.sizeimage[1]; info.bytesperline = inst->cap_format.bytesperline[0]; ret = vpu_session_alloc_fs(inst, &info); @@ -975,7 +984,7 @@ static int vdec_response_frame(struct vpu_inst *inst, struct vb2_v4l2_buffer *vb vpu_buf->tag = info.tag; vpu_buf->luma = info.luma_addr; - vpu_buf->chroma_u = info.chromau_size; + vpu_buf->chroma_u = info.chroma_addr; vpu_buf->chroma_v = 0; vpu_set_buffer_state(vbuf, VPU_BUF_STATE_INUSE); vdec->slots[info.id] = vpu_buf; diff --git a/drivers/media/platform/amphion/venc.c b/drivers/media/platform/amphion/venc.c index 37212f087fdd..060a1ee78b17 100644 --- a/drivers/media/platform/amphion/venc.c +++ b/drivers/media/platform/amphion/venc.c @@ -69,13 +69,16 @@ struct venc_frame_t { static const struct vpu_format venc_formats[] = { { .pixfmt = V4L2_PIX_FMT_NV12M, - .num_planes = 2, + .mem_planes = 2, + .comp_planes = 2, .type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, }, { .pixfmt = V4L2_PIX_FMT_H264, - .num_planes = 1, + .mem_planes = 1, + .comp_planes = 1, .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, + .flags = V4L2_FMT_FLAG_COMPRESSED }, {0, 0, 0, 0}, }; @@ -173,14 +176,14 @@ static int venc_g_fmt(struct file *file, void *fh, struct v4l2_format *f) cur_fmt = vpu_get_format(inst, f->type); pixmp->pixelformat = cur_fmt->pixfmt; - pixmp->num_planes = cur_fmt->num_planes; + pixmp->num_planes = cur_fmt->mem_planes; pixmp->width = cur_fmt->width; pixmp->height = cur_fmt->height; pixmp->field = cur_fmt->field; pixmp->flags = cur_fmt->flags; for (i = 0; i < pixmp->num_planes; i++) { pixmp->plane_fmt[i].bytesperline = cur_fmt->bytesperline[i]; - pixmp->plane_fmt[i].sizeimage = cur_fmt->sizeimage[i]; + pixmp->plane_fmt[i].sizeimage = vpu_get_fmt_plane_size(cur_fmt, i); } f->fmt.pix_mp.colorspace = venc->params.color.primaries; @@ -194,8 +197,9 @@ static int venc_g_fmt(struct file *file, void *fh, struct v4l2_format *f) static int venc_try_fmt(struct file *file, void *fh, struct v4l2_format *f) { struct vpu_inst *inst = to_inst(file); + struct vpu_format fmt; - vpu_try_fmt_common(inst, f); + vpu_try_fmt_common(inst, f, &fmt); return 0; } @@ -203,12 +207,11 @@ static int venc_try_fmt(struct file *file, void *fh, struct v4l2_format *f) static int venc_s_fmt(struct file *file, void *fh, struct v4l2_format *f) { struct vpu_inst *inst = to_inst(file); - const struct vpu_format *fmt; + struct vpu_format fmt; struct vpu_format *cur_fmt; struct vb2_queue *q; struct venc_t *venc = inst->priv; struct v4l2_pix_format_mplane *pix_mp = &f->fmt.pix_mp; - int i; q = v4l2_m2m_get_vq(inst->fh.m2m_ctx, f->type); if (!q) @@ -216,24 +219,12 @@ static int venc_s_fmt(struct file *file, void *fh, struct v4l2_format *f) if (vb2_is_busy(q)) return -EBUSY; - fmt = vpu_try_fmt_common(inst, f); - if (!fmt) + if (vpu_try_fmt_common(inst, f, &fmt)) return -EINVAL; cur_fmt = vpu_get_format(inst, f->type); - cur_fmt->pixfmt = fmt->pixfmt; - cur_fmt->num_planes = fmt->num_planes; - cur_fmt->flags = fmt->flags; - cur_fmt->width = pix_mp->width; - cur_fmt->height = pix_mp->height; - for (i = 0; i < fmt->num_planes; i++) { - cur_fmt->sizeimage[i] = pix_mp->plane_fmt[i].sizeimage; - cur_fmt->bytesperline[i] = pix_mp->plane_fmt[i].bytesperline; - } - - if (pix_mp->field != V4L2_FIELD_ANY) - cur_fmt->field = pix_mp->field; + memcpy(cur_fmt, &fmt, sizeof(*cur_fmt)); if (V4L2_TYPE_IS_OUTPUT(f->type)) { venc->params.input_format = cur_fmt->pixfmt; diff --git a/drivers/media/platform/amphion/vpu.h b/drivers/media/platform/amphion/vpu.h index f914de6ed81e..998591fa5b85 100644 --- a/drivers/media/platform/amphion/vpu.h +++ b/drivers/media/platform/amphion/vpu.h @@ -84,7 +84,8 @@ struct vpu_dev { struct vpu_format { u32 pixfmt; - unsigned int num_planes; + u32 mem_planes; + u32 comp_planes; u32 type; u32 flags; u32 width; @@ -92,6 +93,7 @@ struct vpu_format { u32 sizeimage[VIDEO_MAX_PLANES]; u32 bytesperline[VIDEO_MAX_PLANES]; u32 field; + u32 sibling; }; struct vpu_core_resources { diff --git a/drivers/media/platform/amphion/vpu_dbg.c b/drivers/media/platform/amphion/vpu_dbg.c index f72c8a506b22..c41c9896912c 100644 --- a/drivers/media/platform/amphion/vpu_dbg.c +++ b/drivers/media/platform/amphion/vpu_dbg.c @@ -89,9 +89,9 @@ static int vpu_dbg_instance(struct seq_file *s, void *data) vq->last_buffer_dequeued); if (seq_write(s, str, num)) return 0; - for (i = 0; i < inst->out_format.num_planes; i++) { + for (i = 0; i < inst->out_format.mem_planes; i++) { num = scnprintf(str, sizeof(str), " %d(%d)", - inst->out_format.sizeimage[i], + vpu_get_fmt_plane_size(&inst->out_format, i), inst->out_format.bytesperline[i]); if (seq_write(s, str, num)) return 0; @@ -113,9 +113,9 @@ static int vpu_dbg_instance(struct seq_file *s, void *data) vq->last_buffer_dequeued); if (seq_write(s, str, num)) return 0; - for (i = 0; i < inst->cap_format.num_planes; i++) { + for (i = 0; i < inst->cap_format.mem_planes; i++) { num = scnprintf(str, sizeof(str), " %d(%d)", - inst->cap_format.sizeimage[i], + vpu_get_fmt_plane_size(&inst->cap_format, i), inst->cap_format.bytesperline[i]); if (seq_write(s, str, num)) return 0; diff --git a/drivers/media/platform/amphion/vpu_helpers.c b/drivers/media/platform/amphion/vpu_helpers.c index e9aeb3453dfc..db8f471b9187 100644 --- a/drivers/media/platform/amphion/vpu_helpers.c +++ b/drivers/media/platform/amphion/vpu_helpers.c @@ -59,6 +59,39 @@ const struct vpu_format *vpu_helper_find_format(struct vpu_inst *inst, u32 type, return NULL; } +const struct vpu_format *vpu_helper_find_sibling(struct vpu_inst *inst, u32 type, u32 pixelfmt) +{ + const struct vpu_format *fmt; + const struct vpu_format *sibling; + + fmt = vpu_helper_find_format(inst, type, pixelfmt); + if (!fmt) + return NULL; + if (!fmt->sibling) + return NULL; + sibling = vpu_helper_find_format(inst, type, fmt->sibling); + if (!sibling) + return NULL; + if (sibling->sibling != fmt->pixfmt) + return NULL; + if (sibling->comp_planes != fmt->comp_planes) + return NULL; + return sibling; +} + +bool vpu_helper_match_format(struct vpu_inst *inst, u32 type, u32 fmta, u32 fmtb) +{ + const struct vpu_format *sibling; + + if (fmta == fmtb) + return true; + + sibling = vpu_helper_find_sibling(inst, type, fmta); + if (sibling && sibling->pixfmt == fmtb) + return true; + return false; +} + const struct vpu_format *vpu_helper_enum_format(struct vpu_inst *inst, u32 type, int index) { const struct vpu_format *pfmt; @@ -123,9 +156,10 @@ static u32 get_nv12_plane_size(u32 width, u32 height, int plane_no, u32 bytesperline; u32 size = 0; - bytesperline = ALIGN(width, stride); + bytesperline = width; if (pbl) bytesperline = max(bytesperline, *pbl); + bytesperline = ALIGN(bytesperline, stride); height = ALIGN(height, 2); if (plane_no == 0) size = bytesperline * height; @@ -148,13 +182,13 @@ static u32 get_tiled_8l128_plane_size(u32 fmt, u32 width, u32 height, int plane_ if (interlaced) hs++; - if (fmt == V4L2_PIX_FMT_NV12M_10BE_8L128) + if (fmt == V4L2_PIX_FMT_NV12M_10BE_8L128 || fmt == V4L2_PIX_FMT_NV12_10BE_8L128) bitdepth = 10; bytesperline = DIV_ROUND_UP(width * bitdepth, BITS_PER_BYTE); - bytesperline = ALIGN(bytesperline, 1 << ws); - bytesperline = ALIGN(bytesperline, stride); if (pbl) bytesperline = max(bytesperline, *pbl); + bytesperline = ALIGN(bytesperline, 1 << ws); + bytesperline = ALIGN(bytesperline, stride); height = ALIGN(height, 1 << hs); if (plane_no == 0) size = bytesperline * height; @@ -172,9 +206,10 @@ static u32 get_default_plane_size(u32 width, u32 height, int plane_no, u32 bytesperline; u32 size = 0; - bytesperline = ALIGN(width, stride); + bytesperline = width; if (pbl) bytesperline = max(bytesperline, *pbl); + bytesperline = ALIGN(bytesperline, stride); if (plane_no == 0) size = bytesperline * height; if (pbl) @@ -187,9 +222,12 @@ u32 vpu_helper_get_plane_size(u32 fmt, u32 w, u32 h, int plane_no, u32 stride, u32 interlaced, u32 *pbl) { switch (fmt) { + case V4L2_PIX_FMT_NV12: case V4L2_PIX_FMT_NV12M: return get_nv12_plane_size(w, h, plane_no, stride, interlaced, pbl); + case V4L2_PIX_FMT_NV12_8L128: case V4L2_PIX_FMT_NV12M_8L128: + case V4L2_PIX_FMT_NV12_10BE_8L128: case V4L2_PIX_FMT_NV12M_10BE_8L128: return get_tiled_8l128_plane_size(fmt, w, h, plane_no, stride, interlaced, pbl); default: diff --git a/drivers/media/platform/amphion/vpu_helpers.h b/drivers/media/platform/amphion/vpu_helpers.h index bc28350958be..0eaddb07190d 100644 --- a/drivers/media/platform/amphion/vpu_helpers.h +++ b/drivers/media/platform/amphion/vpu_helpers.h @@ -14,6 +14,8 @@ struct vpu_pair { int vpu_helper_find_in_array_u8(const u8 *array, u32 size, u32 x); bool vpu_helper_check_type(struct vpu_inst *inst, u32 type); const struct vpu_format *vpu_helper_find_format(struct vpu_inst *inst, u32 type, u32 pixelfmt); +const struct vpu_format *vpu_helper_find_sibling(struct vpu_inst *inst, u32 type, u32 pixelfmt); +bool vpu_helper_match_format(struct vpu_inst *inst, u32 type, u32 fmta, u32 fmtb); const struct vpu_format *vpu_helper_enum_format(struct vpu_inst *inst, u32 type, int index); u32 vpu_helper_valid_frame_width(struct vpu_inst *inst, u32 width); u32 vpu_helper_valid_frame_height(struct vpu_inst *inst, u32 height); diff --git a/drivers/media/platform/amphion/vpu_malone.c b/drivers/media/platform/amphion/vpu_malone.c index 51e0702f9ae1..69d9a2269fce 100644 --- a/drivers/media/platform/amphion/vpu_malone.c +++ b/drivers/media/platform/amphion/vpu_malone.c @@ -583,7 +583,8 @@ bool vpu_malone_check_fmt(enum vpu_core_type type, u32 pixelfmt) if (!vpu_imx8q_check_fmt(type, pixelfmt)) return false; - if (pixelfmt == V4L2_PIX_FMT_NV12M_8L128 || pixelfmt == V4L2_PIX_FMT_NV12M_10BE_8L128) + if (pixelfmt == V4L2_PIX_FMT_NV12_8L128 || pixelfmt == V4L2_PIX_FMT_NV12_10BE_8L128 || + pixelfmt == V4L2_PIX_FMT_NV12M_8L128 || pixelfmt == V4L2_PIX_FMT_NV12M_10BE_8L128) return true; if (vpu_malone_format_remap(pixelfmt) == MALONE_FMT_NULL) return false; diff --git a/drivers/media/platform/amphion/vpu_v4l2.c b/drivers/media/platform/amphion/vpu_v4l2.c index 8a3eed957ae6..7afebc8e0004 100644 --- a/drivers/media/platform/amphion/vpu_v4l2.c +++ b/drivers/media/platform/amphion/vpu_v4l2.c @@ -24,6 +24,8 @@ #include "vpu_msgs.h" #include "vpu_helpers.h" +#define MIN_BUFFER_SIZE (80 * 1024) + void vpu_inst_lock(struct vpu_inst *inst) { mutex_lock(&inst->lock); @@ -140,51 +142,126 @@ bool vpu_is_source_empty(struct vpu_inst *inst) return true; } -const struct vpu_format *vpu_try_fmt_common(struct vpu_inst *inst, struct v4l2_format *f) +static int vpu_init_format(struct vpu_inst *inst, struct vpu_format *fmt) +{ + const struct vpu_format *info; + + info = vpu_helper_find_format(inst, fmt->type, fmt->pixfmt); + if (!info) { + info = vpu_helper_enum_format(inst, fmt->type, 0); + if (!info) + return -EINVAL; + } + memcpy(fmt, info, sizeof(*fmt)); + + return 0; +} + +static int vpu_calc_fmt_bytesperline(struct v4l2_format *f, struct vpu_format *fmt) { struct v4l2_pix_format_mplane *pixmp = &f->fmt.pix_mp; - u32 type = f->type; - u32 stride = 1; - u32 bytesperline; - u32 sizeimage; - const struct vpu_format *fmt; - const struct vpu_core_resources *res; int i; - fmt = vpu_helper_find_format(inst, type, pixmp->pixelformat); - if (!fmt) { - fmt = vpu_helper_enum_format(inst, type, 0); - if (!fmt) - return NULL; - pixmp->pixelformat = fmt->pixfmt; + if (pixmp->num_planes == fmt->comp_planes) { + for (i = 0; i < fmt->comp_planes; i++) + fmt->bytesperline[i] = pixmp->plane_fmt[i].bytesperline; + return 0; } + if (pixmp->num_planes > 1) + return -EINVAL; + + /*amphion vpu only support nv12 and nv12 tiled, + * so the bytesperline of luma and chroma should be same + */ + for (i = 0; i < fmt->comp_planes; i++) + fmt->bytesperline[i] = pixmp->plane_fmt[0].bytesperline; + + return 0; +} + +static int vpu_calc_fmt_sizeimage(struct vpu_inst *inst, struct vpu_format *fmt) +{ + u32 stride = 1; + const struct vpu_core_resources *res; + int i; res = vpu_get_resource(inst); if (res) stride = res->stride; - if (pixmp->width) - pixmp->width = vpu_helper_valid_frame_width(inst, pixmp->width); - if (pixmp->height) - pixmp->height = vpu_helper_valid_frame_height(inst, pixmp->height); + + for (i = 0; i < fmt->comp_planes; i++) { + fmt->sizeimage[i] = vpu_helper_get_plane_size(fmt->pixfmt, + fmt->width, + fmt->height, + i, + stride, + fmt->field != V4L2_FIELD_NONE ? 1 : 0, + &fmt->bytesperline[i]); + fmt->sizeimage[i] = max_t(u32, fmt->sizeimage[i], PAGE_SIZE); + if (fmt->flags & V4L2_FMT_FLAG_COMPRESSED) + fmt->sizeimage[i] = max_t(u32, fmt->sizeimage[i], MIN_BUFFER_SIZE); + } + + return 0; +} + +u32 vpu_get_fmt_plane_size(struct vpu_format *fmt, u32 plane_no) +{ + u32 size; + int i; + + if (plane_no >= fmt->mem_planes) + return 0; + + if (fmt->comp_planes == fmt->mem_planes) + return fmt->sizeimage[plane_no]; + if (plane_no < fmt->mem_planes - 1) + return fmt->sizeimage[plane_no]; + size = fmt->sizeimage[plane_no]; + for (i = fmt->mem_planes; i < fmt->comp_planes; i++) + size += fmt->sizeimage[i]; + + return size; +} + +int vpu_try_fmt_common(struct vpu_inst *inst, struct v4l2_format *f, struct vpu_format *fmt) +{ + struct v4l2_pix_format_mplane *pixmp = &f->fmt.pix_mp; + int i; + int ret; + + fmt->pixfmt = pixmp->pixelformat; + fmt->type = f->type; + ret = vpu_init_format(inst, fmt); + if (ret < 0) + return ret; + + fmt->width = pixmp->width; + fmt->height = pixmp->height; + if (fmt->width) + fmt->width = vpu_helper_valid_frame_width(inst, fmt->width); + if (fmt->height) + fmt->height = vpu_helper_valid_frame_height(inst, fmt->height); + fmt->field = pixmp->field == V4L2_FIELD_ANY ? V4L2_FIELD_NONE : pixmp->field; + vpu_calc_fmt_bytesperline(f, fmt); + vpu_calc_fmt_sizeimage(inst, fmt); + if (fmt->flags & V4L2_FMT_FLAG_COMPRESSED) + fmt->sizeimage[0] = max_t(u32, pixmp->plane_fmt[0].sizeimage, fmt->sizeimage[0]); + + pixmp->pixelformat = fmt->pixfmt; + pixmp->width = fmt->width; + pixmp->height = fmt->height; pixmp->flags = fmt->flags; - pixmp->num_planes = fmt->num_planes; - if (pixmp->field == V4L2_FIELD_ANY) - pixmp->field = V4L2_FIELD_NONE; + pixmp->num_planes = fmt->mem_planes; + pixmp->field = fmt->field; + memset(pixmp->reserved, 0, sizeof(pixmp->reserved)); for (i = 0; i < pixmp->num_planes; i++) { - bytesperline = max_t(s32, pixmp->plane_fmt[i].bytesperline, 0); - sizeimage = vpu_helper_get_plane_size(pixmp->pixelformat, - pixmp->width, - pixmp->height, - i, - stride, - pixmp->field > V4L2_FIELD_NONE ? 1 : 0, - &bytesperline); - sizeimage = max_t(s32, pixmp->plane_fmt[i].sizeimage, sizeimage); - pixmp->plane_fmt[i].bytesperline = bytesperline; - pixmp->plane_fmt[i].sizeimage = sizeimage; + pixmp->plane_fmt[i].bytesperline = fmt->bytesperline[i]; + pixmp->plane_fmt[i].sizeimage = vpu_get_fmt_plane_size(fmt, i); + memset(pixmp->plane_fmt[i].reserved, 0, sizeof(pixmp->plane_fmt[i].reserved)); } - return fmt; + return 0; } static bool vpu_check_ready(struct vpu_inst *inst, u32 type) @@ -389,10 +466,10 @@ static int vpu_vb2_queue_setup(struct vb2_queue *vq, cur_fmt = vpu_get_format(inst, vq->type); if (*plane_count) { - if (*plane_count != cur_fmt->num_planes) + if (*plane_count != cur_fmt->mem_planes) return -EINVAL; - for (i = 0; i < cur_fmt->num_planes; i++) { - if (psize[i] < cur_fmt->sizeimage[i]) + for (i = 0; i < cur_fmt->mem_planes; i++) { + if (psize[i] < vpu_get_fmt_plane_size(cur_fmt, i)) return -EINVAL; } return 0; @@ -402,9 +479,9 @@ static int vpu_vb2_queue_setup(struct vb2_queue *vq, *buf_count = max_t(unsigned int, *buf_count, inst->min_buffer_out); else *buf_count = max_t(unsigned int, *buf_count, inst->min_buffer_cap); - *plane_count = cur_fmt->num_planes; - for (i = 0; i < cur_fmt->num_planes; i++) - psize[i] = cur_fmt->sizeimage[i]; + *plane_count = cur_fmt->mem_planes; + for (i = 0; i < cur_fmt->mem_planes; i++) + psize[i] = vpu_get_fmt_plane_size(cur_fmt, i); return 0; } @@ -434,8 +511,8 @@ static int vpu_vb2_buf_prepare(struct vb2_buffer *vb) u32 i; cur_fmt = vpu_get_format(inst, vb->type); - for (i = 0; i < cur_fmt->num_planes; i++) { - if (vpu_get_vb_length(vb, i) < cur_fmt->sizeimage[i]) { + for (i = 0; i < cur_fmt->mem_planes; i++) { + if (vpu_get_vb_length(vb, i) < vpu_get_fmt_plane_size(cur_fmt, i)) { dev_dbg(inst->dev, "[%d] %s buf[%d] is invalid\n", inst->id, vpu_type_name(vb->type), vb->index); vpu_set_buffer_state(vbuf, VPU_BUF_STATE_ERROR); diff --git a/drivers/media/platform/amphion/vpu_v4l2.h b/drivers/media/platform/amphion/vpu_v4l2.h index 795ca33a6a50..ef5de6b66e47 100644 --- a/drivers/media/platform/amphion/vpu_v4l2.h +++ b/drivers/media/platform/amphion/vpu_v4l2.h @@ -16,7 +16,8 @@ unsigned int vpu_get_buffer_state(struct vb2_v4l2_buffer *vbuf); int vpu_v4l2_open(struct file *file, struct vpu_inst *inst); int vpu_v4l2_close(struct file *file); -const struct vpu_format *vpu_try_fmt_common(struct vpu_inst *inst, struct v4l2_format *f); +u32 vpu_get_fmt_plane_size(struct vpu_format *fmt, u32 plane_no); +int vpu_try_fmt_common(struct vpu_inst *inst, struct v4l2_format *f, struct vpu_format *fmt); int vpu_process_output_buffer(struct vpu_inst *inst); int vpu_process_capture_buffer(struct vpu_inst *inst); struct vb2_v4l2_buffer *vpu_next_src_buf(struct vpu_inst *inst); diff --git a/drivers/media/platform/amphion/vpu_windsor.c b/drivers/media/platform/amphion/vpu_windsor.c index 1526af2ef9da..a454f142ae17 100644 --- a/drivers/media/platform/amphion/vpu_windsor.c +++ b/drivers/media/platform/amphion/vpu_windsor.c @@ -775,6 +775,8 @@ static int vpu_windsor_fill_yuv_frame(struct vpu_shared_addr *shared, u32 instance, struct vb2_buffer *vb) { + struct vpu_inst *inst = vb2_get_drv_priv(vb->vb2_queue); + struct vpu_format *out_fmt; struct vpu_enc_yuv_desc *desc; struct vb2_v4l2_buffer *vbuf; @@ -782,6 +784,7 @@ static int vpu_windsor_fill_yuv_frame(struct vpu_shared_addr *shared, return -EINVAL; desc = get_yuv_desc(shared, instance); + out_fmt = vpu_get_format(inst, vb->type); vbuf = to_vb2_v4l2_buffer(vb); desc->frame_id = vbuf->sequence; @@ -790,7 +793,10 @@ static int vpu_windsor_fill_yuv_frame(struct vpu_shared_addr *shared, else desc->key_frame = 0; desc->luma_base = vpu_get_vb_phy_addr(vb, 0); - desc->chroma_base = vpu_get_vb_phy_addr(vb, 1); + if (vb->num_planes > 1) + desc->chroma_base = vpu_get_vb_phy_addr(vb, 1); + else + desc->chroma_base = desc->luma_base + out_fmt->sizeimage[0]; return 0; } From patchwork Wed Aug 3 02:27:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 595709 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 197E1C00140 for ; Wed, 3 Aug 2022 02:29:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234951AbiHCC2y (ORCPT ); Tue, 2 Aug 2022 22:28:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233506AbiHCC2v (ORCPT ); Tue, 2 Aug 2022 22:28:51 -0400 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130057.outbound.protection.outlook.com [40.107.13.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5504525C76; Tue, 2 Aug 2022 19:28:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oKSKhnKxC7zl2+6Sg+GrnNyn7ovAXDeOpw103bjTIs1Qc3CfsG8BfPveNm2NfU9TJ5ux4Evh+WVeC0DXbXzVEMCbRdyYgTF02WZawAWT+BEr5vxZfcLpcIZ6KMQsTN/3bU9UvLKCkRW64onFRq1zXfuMZeLCUP3rlfgEBzlNoUY8SCLBI1cj1CjMC/QbTSXCxTKQ9KdZFBoJo8UK4ddK8d6rynfHOyCpvOE4VgnqeCu6NcYpMw15pQ/rVDwJhoOydag8JmzGyAXYOllyLzjsI9xksIsTpDT4Hv78aXCr6pktkyec9m0gqjtDeRmPLPWG0WrWN7qy50VyEseXRduToA== 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=ZDkTfxNOWCMwgkEiHCmfKKRGxwS7MQ9xxBjraUxchBk=; b=N/1HIJPJvbmTEFusxcrlsBoLWGt7EkvUjvG6GoupRiSeUouCbwXl8e3uJaXEyjYwPrhhBpr19LtLzn+L8iUav3oVCPQlWBTeseZeh13Bo6MyAGyH6fqirY+520t7HGwhjqAMabnUmMMxVRnn5z37TGWOBuUH/6Uzap+nZTYSDofKvXavSqWuYXCiCAz/fs7pfI/lz+dlE3bKuYjV1BA+8gi/8EYXMs3SZldJOC7i6QX03Fnd9l1qX0NmODW2UDdDCmHl3Od9JuJAvFIL+3ISNcicHG48SFgqykL60C67t3+nkL46dSygv4+7XXlbHAmJIdTbh2JT+goMO4LGTOXLiw== 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=ZDkTfxNOWCMwgkEiHCmfKKRGxwS7MQ9xxBjraUxchBk=; b=aVIz6JfCyAY4Qge+GipsQO8Igu+7yJ2Q24eA0YK/jTG3rr+coOtlN2QvIAAPnRub3LSPkW4C9RIwPk7oYZJuycIs9anDm6QHnd+ZrwunPudGuEsd/AFpcPwFRNV6ig8tH0x7jOt0HcmxbB8VclttIKHeS4Hla+JmG4XPuZG4eIQ= 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 DB6PR04MB3077.eurprd04.prod.outlook.com (2603:10a6:6:8::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.13; Wed, 3 Aug 2022 02:28:45 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::5db6:3f08:2e04:33c]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::5db6:3f08:2e04:33c%4]) with mapi id 15.20.5504.014; Wed, 3 Aug 2022 02:28:45 +0000 From: Ming Qian To: mchehab@kernel.org, hverkuil-cisco@xs4all.nl Cc: shawnguo@kernel.org, robh+dt@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, xiahong.bao@nxp.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 3/4] media: amphion: decoder add support for contiguous planes Date: Wed, 3 Aug 2022 10:27:21 +0800 Message-Id: <61100d063b37d3f8aace352d2cb272ed8dd321c2.1659493105.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: References: X-ClientProxiedBy: SG2P153CA0022.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c7::9) 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: 00044e0f-3a37-4b3e-a1c6-08da74f7e38b X-MS-TrafficTypeDiagnostic: DB6PR04MB3077:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xg9eZ2wmL30JE9neHZLONPxlPp49IMhR7HifJzeQKg7C/P9ZkfY0EnoSF/6tLPyE0VtwOaf12JaBP2Alr5Q/NrbNKFIOE4+4TwI9c0HTM2hDWWWwomVI3PNRUR1rmI0PoQQL0nZmUiTiCYKg7UAcywbYWMEMzFfdskk+C+PNRpVOiXmaoq72FAeLvox3yV9KQquV6XczrdwaW564XMXLjR81gi85IfoZ91ZJ7WiPwQaokrZh578inYZpAa4/e/ngOCZUTiTMb1UHIAPG6oc8LXFNq8pxdl4gBeNXnO5tjtMJL2I73bEoVoi6doQeZbm4Ai651ys+13tb07ByM+II+CgyeCd3V2VreEBKbHsIXagP528MgVxou1i6x2uIYX9V58sJnBAiE1+Hozng1ETlZteBH5fS64/vhHYuh+12cPx2BVyqTXn8mcA/oZFHfAA0gQZUf+hxtmxu/cDOx/RAfh25HfO9lCliZt/cF3rVr86XSuU3WmUcQ0Uuh5pxYyecDwXlxGSq7K8vlFoaHxEGoU+39fadmYAAQJTo8LnA/qe+iSMj51xd0m3pBglIQ39rqcSBPfkCj+douZOX5hkSq3m1BW/leDg89o5N8sUndXfqZJjeWAauLoX7MuYPfo8FmdPJBOyGzN3t9p2an4qRr3gPiIvz6Ww5n/EDDR5IPu726q1ATThzVe64Gr3IZsPpiof6S1PpOjvi7NwswcLjbCQFZY7KqELHeIQGGNf07sSVV62kFNUZvS9FLIrUk58T973y1KqYynEP+2VgE/CY1RPEZyD/2wHg1ZQghFQqVM/EV9WgJKs42JVoW6PQMD0h 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:(13230016)(4636009)(366004)(376002)(136003)(39860400002)(396003)(346002)(44832011)(5660300002)(8676002)(4326008)(66476007)(66556008)(66946007)(8936002)(7416002)(2906002)(36756003)(86362001)(38100700002)(6486002)(478600001)(41300700001)(38350700002)(316002)(186003)(2616005)(26005)(6666004)(6506007)(6512007)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: PU8Fp4sj2DJXkDWEsosfLSm0IebrQTQjAsRe/J/2QIc4ERq5EChu0W4SIC/jGoB3Qs85624SDwDSTJxKOd9ANWteWildnyWiTl0P/aQ5i/j4Nh7YfoG8uADi380U6bBsLI/W8Wv0RfX4MeC7jlzHE4vNB1kKMcktjUR6ZKegUtFoCt7gxLigT2lWwwChBS6ePfFmdtnXDlT2QdYlCRkrH8/Ch/4udMMdKXRoO1gNk+Y4DFcYoMTEOjFaEfecy92pOEx8mpeJESFX3cDzQpCPLNaYwiaGjLDhck2DiEAVN4BOoi39SSuJ//Ms9vL5NCr0782pqU4KcCHcwpFx13HI0i1zCd+f6aLJ6wWtktTCBFAABSqYsilwzgxGiAuwp5evfqdOhzaFpkaC5KvCKXmrZ8vPtgx9wSbsbRs/kD/UWZb/KW+GVfYPS/uFGk7QCWoXewesVELyxpmT3yphgBZ/AQe8Lj6KGQ3MaSfprG+N4oA6a3T/0hFS+igomrn6Hdd26mapPHxbUZINSKI2gC3aBksD9rURftKNLBRgKPRqRvXdUdewxRifM1OR8d0svkCGLPuCF176qBwjk3+Fp98jFgTbxkRzigFdhDXdQwWrVXjfIM0n5W2lOtvhK6fFsPyC4Cxea0XHPe4wKkCA8vy/dr+J4nI7a3wEDs5Pc51FiVB87Wi0SyfOubi0JzEdEZjjwKY4PEng1ZzS+VgUkZ5rAHa+VDhcubDaI2tqjV2qecGFRObAzwAir1ZSbKN4rPftkgNp4u8XKEH+/6eNqP7MRPoalBBx0UwpQZiOcfQBrqbFuoatZTCBOIiDMiDs5MLC3GGAXis49r1T4UvOLemAhwKPKQbMkr/J8Uola52z9Z+eV8dPRRoZu+OiwDIQs6hfhDKoQimElLsR5CFjAU2+RPiwMzMPGR7e2xOWpd7gG702/3YkM3Xpol5YxGXUNZ5hg/HLv8FIO4kyqnUzfEdUjZD+a12FANYHPri098eDLFpEDDx1t2Jjq6aXGZAwgY1nMnLVdetkKkinBdFBVkYFlgylEjYiiXnt0MSKzJpSF0AJZbOCB7UECIplY9I6auuhADVg2eSlRzZ0kGrHauHvkm3CIpujAES63UWpLI7ieWfc+uJcPiu51Yxbk2TxacuURoVRu1tIf6QtQxXdlV9rds45Y25K6e/ezw5GhnbpXHyl3he06+GTJUL/99TTMpBM52vzst3E1jqmvVsyNhvX/AhI7FDDFB5SDQNhkjHvLpJGldkuZDtk1fY6CHcXJFu15IeX/fpGwbUywvKMmPLMo7t/OQZ5G31rLU6u6jCPBJouHF/uSbUEiiWGtnl8Cv20MuGuEGS3RBgRee/Xw4BC9kHRY78dC9DIB4IK6bsxyf74Ajx/+iw+sISX7PkqGAGzJ7Fw1Rflsbj/G8E4RNp0UJczglUgx1xvXDQa6q9XmwxBjDhFjEkJct5UnvsPvUQtdDfdHLMtwd4R97DMZ945u4k5NQhLxsslgf0fj7EzzhEmGdnVpt/Z/5V5sFCRXPA6VWxTrTZreSbfnmB8MCGdrvUbfOnMLS+B84rdyRsvImpoTOkuDzobG1OUob9HeiEr X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 00044e0f-3a37-4b3e-a1c6-08da74f7e38b X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Aug 2022 02:28:45.2638 (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: eIn35qM3+CknkGKf1evZhQUCwt0MUR0ju43HPOIQ8bGl184NI1nNC4xJkOGPnMGIUW1iG6cPKE1xfK/stPinSQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR04MB3077 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org decoder add support for contiguous formats V4L2_PIX_FMT_NV12_8L128 and V4L2_PIX_FMT_NV12_10BE_8L128 Signed-off-by: Ming Qian --- drivers/media/platform/amphion/vdec.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/media/platform/amphion/vdec.c b/drivers/media/platform/amphion/vdec.c index 48ab664fa7ef..9c3324717cbc 100644 --- a/drivers/media/platform/amphion/vdec.c +++ b/drivers/media/platform/amphion/vdec.c @@ -72,12 +72,28 @@ static const struct vpu_format vdec_formats[] = { .mem_planes = 2, .comp_planes = 2, .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, + .sibling = V4L2_PIX_FMT_NV12_8L128, + }, + { + .pixfmt = V4L2_PIX_FMT_NV12_8L128, + .mem_planes = 1, + .comp_planes = 2, + .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, + .sibling = V4L2_PIX_FMT_NV12M_8L128, }, { .pixfmt = V4L2_PIX_FMT_NV12M_10BE_8L128, .mem_planes = 2, .comp_planes = 2, .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, + .sibling = V4L2_PIX_FMT_NV12_10BE_8L128, + }, + { + .pixfmt = V4L2_PIX_FMT_NV12_10BE_8L128, + .mem_planes = 1, + .comp_planes = 2, + .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, + .sibling = V4L2_PIX_FMT_NV12M_10BE_8L128 }, { .pixfmt = V4L2_PIX_FMT_H264, From patchwork Wed Aug 3 02:27:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 595208 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49985C19F2B for ; Wed, 3 Aug 2022 02:29:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234779AbiHCC24 (ORCPT ); Tue, 2 Aug 2022 22:28:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234895AbiHCC2x (ORCPT ); Tue, 2 Aug 2022 22:28:53 -0400 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130057.outbound.protection.outlook.com [40.107.13.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE2F85467C; Tue, 2 Aug 2022 19:28:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oWA25vHrVCuEyJl18matP0mowD6bDjtIqmdFlBl2AG+VvkBeWu4xsKmWbOzPcnHpy0nHK1muBnLqclNbdAZw0ML1izhBalH9D2Q5GAQNz3YS/s+t/Ieg9QutQlrtu1Otsf5GVFgKtX/xg8XQJXoukiyAqQHM4nK3Eejszc9QdbDAvvRJHpIZ73T0PwJrULvmMGuADDbsHe4UdYjOg854HYVgv3POT0HLvkYq02a00hWRySJfnDK+tzYiTvscM4ZehQChHyUTZe51WIzZxPSrEPp23jpUPUn4N3KVi+Qde41upLMd+LwTFpfcloySLm//EbO4aHo+bF0A7X9P22aNhQ== 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=kN1Qwcq9eoWUxIJU9Yd2T4IGLMbZMN7Zb5GLCZFJBrk=; b=B35z5IPVN1D0IuKVq+3SDYGDN/R/VPFMo2fQpX/pNuuMd12MJ2hBTRt0v8k4x1DgUP43BmDuF3KaVXLlQUHj/BIZm7fZGX361IPB8h4TxKTBn0G8t5FIDy1HGHIPZG20dM+CHW6LoPRPhP+gofsnauWeRmHOxPjwOdJap1/Q0WXMK3BSTpMHW83AagB0RvI0FePZEUS5qPLyiXHps9OTCDfT3blNFRECHyAVhT8gu1BOevkhcJKtzshe+RYgRsFAqbY+KeQCcTVBurREgHG23WlOE4zz3B/4ZDMpnQ0/2JjUIc3kaseMrhViEXqJ19FoK9v7gWVuN1sWafrva4Y6Bg== 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=kN1Qwcq9eoWUxIJU9Yd2T4IGLMbZMN7Zb5GLCZFJBrk=; b=fjf4pP9vLzJDSYQas0cSNV01iwrE/OTihdpaL/Ny80+I2gkJlbECnCdguiK4Rz/lkg1FNOyITBnfQzUpCNVtiYKzFX51l4ts8z5NqWz8KYQXThM+H2RxxnmtVXkrvY6KOjd+oz0MsBD7NPWcB6JcwyeicCTfioLuJoF11A/+JK0= 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 DB6PR04MB3077.eurprd04.prod.outlook.com (2603:10a6:6:8::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.13; Wed, 3 Aug 2022 02:28:49 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::5db6:3f08:2e04:33c]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::5db6:3f08:2e04:33c%4]) with mapi id 15.20.5504.014; Wed, 3 Aug 2022 02:28:49 +0000 From: Ming Qian To: mchehab@kernel.org, hverkuil-cisco@xs4all.nl Cc: shawnguo@kernel.org, robh+dt@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, xiahong.bao@nxp.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 4/4] media: amphion: encoder add support for contiguous planes Date: Wed, 3 Aug 2022 10:27:22 +0800 Message-Id: <9d563ad6ad660414e433a1197125b57b1ce8906d.1659493105.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: References: X-ClientProxiedBy: SG2P153CA0022.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c7::9) 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: 1586e37c-32cf-449e-95d9-08da74f7e5cc X-MS-TrafficTypeDiagnostic: DB6PR04MB3077:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kXi1YvNSxzkRggry4EY2pRRMg6do0mF0hdCxvfCuoRpx2peWlkn3dPLzoGK8EACAlfk1Pba8Cd8HHMug3Ongxxs33Nx/EGhESYtYxuKXgzCDvIEuB9BlEep+sh349wpUWlsfz9fwXNxt29yLdKXPWP6YuDVIu7hSIhalVhyPk3vl44BQDANuGD3HveHjC0P3S/xwfe7z5SSASiA2NCtY9da2uL+h9rc6N2teLi7kT5i9goF0QxWVqswkK61BuEZyDfEVfKDEZL7iFXtgGZUQBZb3F97OHrZHpjcUG5BacRZT67XfpcHLACT3peYalYrbKaTULTih5g+V1oFbOnWru7PAUcMzX0/ubliYHRGY1TDt+p7xsGS5wz/Nn/lwWDcQqTvGoue3jBcgmykv93QE2HfOlgZOn/u8QdweWdwKrqQ48VJMNQvA6pkpORyVHX8kTOlx7mSC6g1DRncJWh51ofisV6CZ2lrP+VvEnGyk0eQrJMOo053ThA1763+XPDdPkjreIrCw95CP3wyjQJ6RdDoNIheceTgQYhgjLzLBSbLEKG5dKpAYad1MoDPqbex7+iZKopMePbkPi2HRi5+m/ZS4zVwVsG1hi52N7X36jk+C8DPX/gBwwr0Prjsf/9AOrUIOmM1T4VDrKhOFPwZuuccA2BZTlqPZQa6ldMkEswF6xY32/LUOgB0UtPtXei2Q4nuq8Asv/zBmxv24XyH3ChKgqfanyfIacaJPF8IoW1Ifsul52sRDWWSQi/vijdRhQLPObZ6v3/b4yCPShQrUvkJoltZgPKzSfqjPiMbFyL5dk65Zx9KVwTD+FsR/+yYy 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:(13230016)(4636009)(366004)(376002)(136003)(39860400002)(396003)(346002)(44832011)(5660300002)(8676002)(4326008)(66476007)(66556008)(66946007)(8936002)(4744005)(7416002)(2906002)(36756003)(86362001)(38100700002)(6486002)(478600001)(41300700001)(38350700002)(316002)(186003)(2616005)(26005)(6666004)(6506007)(6512007)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BcKvHULpYAM90ye5Mi5EKIdt4u/q5kgpfq1YFWXW0kn0sh/54zhqgUDOGLMXEG3/qlWrqGR90MGC7ad5Ceq74aVOuH6BsgcaV4CPLb8xjnacWpIoDMThJiMYydfo5Jd/xLZrYO7dRYERn4a5uUciGpBDzcXD9+Q7reFqfXaUqTyqh2JSIfD2RxBPvOZc60rLM+EDRJgJn+w8H+1jp9WMO217gX8ggy9KMcVpwb8yNRs/hpMfhl/L47rUFI61rnBY4ta76UWCNLMQES6zpmBXR8kObT/q2ZtP5L8AcJogR7NsgJDsGd+692g/hB4f9aKM5CtmIJI1TZOgbv7AU3DLJPaCyGkhrUaYL9j00leB1TUmGP29wayh2clVspxrGHbwIrj3weHqjgFlJCjlnr92n8qJUu85zH6XtDtdrsv5MDHmx1b0vHhGPnfDNc0T6xc8bpyDo4JlBvK0eloshNiHKsjto22K6+7oyRCFIPmYtQjRHDQr2RxB9qnPxjuMuXVTCKASfbDvwUDXcJstZ+i5IwdgJhkXz7rq4YbtpH0FAwrGJD3ky2CAGc46ROJObCqeQSkYvnWJOx3g0Ar9y1FoW1GR2wluJTNcjNkjYN1PpuiPkV7l/X1EQpOAtod2IZ46FBoPkbWDqFUdoU7ELKm6nw+UqrNXoh9Pdo57ENFMag19fayFh8Dd3HdJ328U2nlPy3exHeuxFK73TyylZcqfEEt1rqbe6mO+uWgFdvfQE5RcI31ymxboXK/9ywwNRY9iRQFe0VzBxJqpPuNvFdOyLJFLFWtLiWQMNZYxmYztTu9K5tC70vO8XwPbrSX7xFkO/VZx5P57oe13lnCeQikHkcGB3HTAmYb7B38owxVgJeTMgwgdPdtO5FstwWvoFYw2TvrN2xXZ8Fpl0q/u682v/cajrSTWSM5bS+Fze8H1fYoPtw9HRZ3E0IvJglK906MMrqJfzGjbAgnm3HiMBn03nQRB+OAiUaV2b0kJovjuq5MXp+0xtIlhN9s0U8GD+/5OEBqgVhiUp/Z+nLEKYsilqevoFqiA0/ogysHr2bFkjD161UXj/HdC4cRK2B2x+EJc03kByZYSTd9Fwt3Q/dad65xnba9Pcrz4qL4RS5cLSNIyy11/+Yxp4iEzcUVbIPIUCmvxxWSX9fokCk6MwzmgmqofpuyOG5Pd77IiGQFvBEWf3XWu+vM3uaqhcD5yLeTyDt12seh3ElQKYQBWe/HtI1TPQpwxxm/Ia7crOgi4JOtoN82I4o1TVKwjmYT+pFeuuKsKh6nntyThJ9H8mgOjwWCNgt0i4CgedxM3xUcSlxnOD/LYFYdYvjmqpIim4raO71wq6r7AEd2CjQLzrb3j27p0wOw00E9UtDuh4i6oYr3vlr0WwX8x5SM9yHGoU405J99QPfi6R6Y3vtg3bDMovA/a2bLeLeVD9e8kBhEtYtV2KqnUxseH1u22tTJrEfShKpRWpYU+rJOrLZitLJwVqas3FfddNfxKHAxgi8QWVenQ+ivfMDjvBgfvsB8WSqphK4cxuJZAw5Wn13A5pyX1J+1mtQysDnMkEooSaM4kEfFuxNOW8Cwqke9dkKd1LeZQ X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1586e37c-32cf-449e-95d9-08da74f7e5cc X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Aug 2022 02:28:49.0293 (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: tbTwy5wJWqcOHjH2ezG0VyHEAtKRNiqbhE4PUVawiNOVXp0TpCyVVi0MroYouIwmdC2dQ3Rd5TMzqXHGWdA+Vw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR04MB3077 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org encoder add support for contiguous formats NV12 Signed-off-by: Ming Qian --- drivers/media/platform/amphion/venc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/media/platform/amphion/venc.c b/drivers/media/platform/amphion/venc.c index 060a1ee78b17..3cbe8ce637e5 100644 --- a/drivers/media/platform/amphion/venc.c +++ b/drivers/media/platform/amphion/venc.c @@ -72,6 +72,14 @@ static const struct vpu_format venc_formats[] = { .mem_planes = 2, .comp_planes = 2, .type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, + .sibling = V4L2_PIX_FMT_NV12, + }, + { + .pixfmt = V4L2_PIX_FMT_NV12, + .mem_planes = 1, + .comp_planes = 2, + .type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, + .sibling = V4L2_PIX_FMT_NV12M, }, { .pixfmt = V4L2_PIX_FMT_H264,