From patchwork Thu Aug 25 01:38:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 600527 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 E726AC04AA5 for ; Thu, 25 Aug 2022 01:44:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234614AbiHYBod (ORCPT ); Wed, 24 Aug 2022 21:44:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235158AbiHYBoA (ORCPT ); Wed, 24 Aug 2022 21:44:00 -0400 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80087.outbound.protection.outlook.com [40.107.8.87]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C9419E0E1; Wed, 24 Aug 2022 18:39:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j4zlrvBP7YDa05IgInEdnwYjL5rV0KIUVf4GZfFNCgRy6h+jL/SuRod0fhZjOYqboXJyIIA1hW7xRD6Az+wkxA+HvfQ6VHXyHcgE/Na+9oee4osjuNUpnn9zIwzREopG57kl8wtjvMYTMKQgiGG9CTWsgrhm0srOCW3Dxh7IObydLUmYSde9gpzD3zMkofEF0BwPzQb9FDcudLQyNcAmcn0k8VesKa1CDNEpMfTd7UKGvAgMrNvxxS3vLy1LF3hPKhpV93qaSs1HNuUmuHMWMzYlacxZzMTWqaZRBvexJU8LJ90sjMj5iN2oVLjDOsD114DXzREpCqfTDr/1VFrxEQ== 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=TWevhLm6FphMSJGwk4iDDas3lC1ODIo0JebZSLlxlVg6F/w4viCNoQ991frjoJvYc+HfmDCWLaJQU5GgjmJpr3CVXhjD9FuM6up24by7t8iuku7zPaHkxdsqXb386uixUwEEY1rbviNAaWCTsxC24ImCNSZmFG/s1HjuPCa4gI1/s85otllzWPLGDhn5AFyE92eYNkZ8iPgCzNavGJ/T8o4WdPL3ReEECEgFtS/y4cT+SjI2BRiRUf1GrtzPl8HnyuudguewAUIW9DRIs3w7SLBTaZZO1WPPUTw7FqEetRGKFI9wRAI/jEF+Bx82v66dmbuUVY5pxymteqFclvV2OA== 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=iT4a2bB3aL5qnSMnnUekRI6mSu9V/Eid+LLqsGp5jXq1cSPYAfv63aJ94IytVTMG1sB3vK0in4cuZ1o1aEhum9HeZE708qVsSqQsVc1TRaFLTHHgMRlmY2HLzmmNSaJgmGmNnq22zPdXzq0GceJsDVNfAmCM4C8JWkaYycdPwp0= 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 AM0PR04MB6162.eurprd04.prod.outlook.com (2603:10a6:208:147::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15; Thu, 25 Aug 2022 01:39:16 +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.027; Thu, 25 Aug 2022 01:39:16 +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 v5 1/4] media: add nv12_8l128 and nv12_10be_8l128 video format. Date: Thu, 25 Aug 2022 09:38:29 +0800 Message-Id: <84842bffb432884a0fd84de96c6e64ee2273e511.1661390673.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0020.apcprd02.prod.outlook.com (2603:1096:4:195::7) 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: 10c01fae-7c80-4d2d-43d0-08da863a9f22 X-MS-TrafficTypeDiagnostic: AM0PR04MB6162:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wfXtEtd9BedWycLWi715RDJ2RRQoFAfmyTd0E/ksxpZFp6q7DdUeDAqWuu08BaFmI3BpWm2lzSrF4Uugs0apiJMzV5ybIKu3i+wM3BoS3flEoTatHHMZQcqmAyHf6jfVkXUPYX5qomrCRFcKykEgeYQNWU9mjN6N9B18wOujQmlYqZt/6+U7LFTHTJ26ber9yl11PimtPVVqzzL00HhfDk1MJa4G4NmND8Cwhy54kzhAc86tTGegNXe+EIT8byAcZ3T+OVrj0sGgLmjhiF7SoSWYCXfyGyo/rIHKlyXd0jynKxg+4aJUHCn3RTv0GltwFpRwL1EgfkPc3ndjcB6n6Mr1+aKc6QJxqGCySeXEPPr6QsyydCHPYwdi5+NFR5xFLKY/4Lb+Y+OrrkuM0AC/wTyv2eU1m1oLfl9T2s5pzU3RsFKze46/qmRbsfS9TrSTcLYbzoKX8f+wYHqSnnV1cReK4RaLy20M2489vWWVV5qu6x9Z8cZv64PFLNsQXWVK9CScHudp4ufr9FhUngtcO4g5urMJ9ADsHeKcblQIohDzwYcuUDgUPK3cDH8EjUosJ3AsuOKvj7jKiEFpsiBL0uyXq0hI4A1V3WDoEt55y6S1DGjzuRSaZRGQfCu7Chc2fsQfZQLIeP9NEv+bMMMJynVnxiGUwfC9a7QZQXTM8JXgrzVZfkcEYXZcOjx6PXmtccbMRexlAqnWbZbtXU4Lq7Q57Wnwwl/9+xwSVqIl8zxh6RBF/FzIzBm1qTNrsWbk6sQg7VcFVX9G6ZtmnUbLqg== 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)(346002)(136003)(376002)(396003)(39860400002)(366004)(6512007)(66946007)(38350700002)(38100700002)(6486002)(86362001)(6666004)(26005)(478600001)(6506007)(2616005)(52116002)(83380400001)(41300700001)(186003)(7416002)(8676002)(2906002)(4326008)(66476007)(66556008)(36756003)(44832011)(5660300002)(316002)(8936002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Zy8hqJxgbayd9s0NdMJiuzlL81xILohnC4p6/wGuUknufK3vyJYoPgdB4O5iTKVXCrQc6+p6NS8BCbMnfywp2NcSszEwj/8V5pqlyf3BHwLpkxebjFo069QLFW1+t6pxG0haoCbCGqKg1qQdX4SCorBYtwnMIi73Guk/dKFZkMq9lid5KEZQV6TpeUf/VKY3glKdc8ZENbpsdYk2Xioby2He+przEbXDTZW2AZ6ASjS3J0oOm8iMk03CsE7UG9pxIYiAEsiD28FjDl2NdrALACEBc2B8Y0SQdsjctQLXa1TrazppDdn3s+Nm+p9WqAxtMWYG/bHOtBgo7XddHHNJL9Dv+sElCVt0Upv/7g0vRDZQx+7DeKMXjYz9nYyf2BmpueFaBvgDfA5UBvimhxoQH0Krh1gM2DfCUnir+tNlO3fW7l1tZ2+RnKvM9CyaryX4j+XOvXUWWf6+2QJyP1TmbZ3dZLLiqYNzOSjFhaFqnhVkpuy2bLQSRoNbjgp2plBb4aGzqBsRsEWp6qXKCbkMIz0POIX2u2MsKp0u/rddWZg1TjswGrvssBwfbYd5y0x4uGzME7jplEXiT7z2ZGZ7Tp3RCrQPqiFhyvJCj5NIJJGex7YHeTHtQgKWMw5BFm4Mc91kYPo9jjJC3Is8wmMc/xaQkY0cQXXz+pnJMamZoyR7mQ+rwcXuWIIdNhv897y3STzROzn1u38OMvlplR2AedHdtbC/AGIj8MWVMPFiGDVzJOHbawvB8qKUCyjWENHsM56f/aEcQc23+DB8/6sx+1j3pKbP3M87eLJgXOAy8RPGoT0NGUoyXKF8MpAoOqbpW4riIZjUxWSB5smqZ4dyQCAXyAXlj+IasFSs/Lb5YwEdvMOd1V9Xah/IB8HdZe/YTe+ciiwVdm+6/I02rsrGRDjbO2sgom3WfrLH6RN6IRISmRhRLxx2Kg0DOtddqtFAaTRGFu1DJS5UyAMdkVPzUqFdIUUx8cG6bfDjiPNjYbHzMo7X3I0Y2gRy468V4lGuALt0P9eIprEwO/3EXnE9SW7lyvz6e/8A2rIkzpsC13TOAxQj8fi9uXMDPtmbDSAtMK0E+og3nbqQci4Ce3zJpjlwWLib5Gf5Q3tr8MvIWnfX7ju8vZUeTfqJyMQq7d1ZgXBVwPo+s5cFZjm8E5nlTgrunEHe5nGTxu2CztkZIk83ElFsWtu2E0Yj7bOqsyslNxlsBxw69hd4NIUu2hquXYGbsyWsMRHC+fToXuVTonnFEuliedbVCgKzfvjYTp8gi4fl5OORNgiAzfe+yMYAJiHeQ41yy7MJ1nslrPlheEidoDhUPonF+AE8foWbwjeJqhOmuivnJxwYo7ccnYPxcTLoXvqyBX7r4foZ46OU9rwQ8rqPx/5fhCyDrz7yh5Nmpdhtw7ymxFdFuw8wTDMe2ibzCZOE8W/vxojDNZePHXWjTjOvw3FiD1h/xGwpVkV1lXrblfokh1kEbyh10rKoFu6C5aqcQ9aPO2B48g0WJ6GcVPBkTvdneBUGYJRSXhl+5+S+OoKAmmQzaJJMIMAY1eLIDvg6uZeUrFubS3VB3mmUezYwUQtmGoWCWDf1DT1X X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 10c01fae-7c80-4d2d-43d0-08da863a9f22 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2022 01:39:16.4269 (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: MCK61SlJRnV96zlvQrN0LYust5f/SC1wthob3JQtZTPEuaCWSzXbrWvzp8tO4h4lGYqBB69cvt+vzfyypoe8Ww== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6162 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 Thu Aug 25 01:38:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 600156 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 C9464C04AA5 for ; Thu, 25 Aug 2022 01:44:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236152AbiHYBo5 (ORCPT ); Wed, 24 Aug 2022 21:44:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234359AbiHYBo0 (ORCPT ); Wed, 24 Aug 2022 21:44:26 -0400 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80087.outbound.protection.outlook.com [40.107.8.87]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF06A52453; Wed, 24 Aug 2022 18:39:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cfgG3eCYPfjEnfhskARwx6OjXwIx39JOkqcgLyWT1k8PqnEDvg0xEcA2jwBMZixPQUnFS/uVknm4Jlsrdn1eDC+ZS5mWHZGqth5sZ5jybSu+lYnHpYwKt/QsF4xtKxNS5kPtmu+ffdrwKWzrZXaMs6/BufVUsdd6FI/GTehhS8UkX9euOoe1KphRVWQG6Miy51IBb6bwSb9ucc2uohzcI4mIpfw2J930MB/EUk3o0gSa9d1JHQNgEbqFDpKMCVwEfXQ7R22CSf4XONo8REwWwiFe6I1zQAV5bwFiHLEOz7i91vA+KMGVC8lgGKvNYd5ymPX7LVWPvZBb5tIurB90qw== 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=n1Uv181gt3Prkr5ubRNH6TDrd7Apz1oNqxY7JVq1Ges=; b=jiktRf7ulAui16qUvgjkTlfhs3t85GCj4nT9m/XZ6fW4QIDUkKUzsIRYE2PIcAPej8TGr+p2s2O0hUKgmxBK2Rpvd+FSHOhs9LATYOcO/pERCIw5leQvbIwhlLaiERszCwRUWCvIW9xaThaXrZl+wLuSfMYUghA6N5oqM2b2KMqK7DZVsxa9fUjP/dpjdYMSc/cGTtFgEZY/nLdKDCRtwHtXGJO0saeqAPN+PTycleEeS3bo+mEDMk+X54GwJN5atbwVgzM/O7jkr+mOcnZCWKJZpwAMCHFy6Hd40R9VtDUVmmUUdPfcsYFmbeuDEdfUash7/oFRuYItSKT3kHUdkA== 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=n1Uv181gt3Prkr5ubRNH6TDrd7Apz1oNqxY7JVq1Ges=; b=M30SyfYUVRztM+5gAk9JRvcCjWeHxmK13P7Jl1b4XA+QjVzLNYCaNG2VZwLrXop4uBk5z/mn7H2PalMGQyGHU/Ij4tVy79MK+lGe+26lMYBfrJS6A3yqhWOW6n0DYDLOs314Db6caJBaoA8v0m9s0eDzZTlJFl7UI8+DtaVmDz8= 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 AM0PR04MB6162.eurprd04.prod.outlook.com (2603:10a6:208:147::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15; Thu, 25 Aug 2022 01:39:20 +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.027; Thu, 25 Aug 2022 01:39:20 +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 v5 2/4] media: amphion: tell and handle contiguous and non contiguous format Date: Thu, 25 Aug 2022 09:38:30 +0800 Message-Id: <7e6a945b898254679bd93e7e001e7c24b5aea0ef.1661390673.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0020.apcprd02.prod.outlook.com (2603:1096:4:195::7) 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: 84d3c9c3-35f3-4f19-83e4-08da863aa152 X-MS-TrafficTypeDiagnostic: AM0PR04MB6162:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sghKVORnP/sGTCb1eNLfvjG9noZwLvGgkd/9mTjlSAHyLx5SzVvdi4XE+8ThZn8JUoIw0aJ7uMc3UomDw6cZV6aBErCige04GbUmlc0STLz1Wl+bqj5Y83EMuLWwWuhwtYUko1N/JgZN+GqNClQTwzTBruSMHfVFQ7UsPmYAnJe7H+gSz3THQlx+asypQsLtLtmfN0s+2rFkiWFzlnH4zn+DmnPZdn57h7mWyJrdcMOqJjXrcE30mnsoXbsRKnzTDxiB3nml+9S2uIfh1SFzAYhJCEEUCsP4FsKdC+Da2v+j2vD0qcj9+SgBx7NpQ5yXPQOlJQeXaVkSAAf3M/3/BiDB7EoSBzrB3UPb1qdhm/35jUG3TsQGJHYC/PVUZ59fIE7ZiKgcthLmLuGC0O6jGFUiFnGUh71hlFoqIPMUsW0C78XPwNOz8u5+FhfQdKK20esU88a6tj31v1b76tBz2oYmrbwhwm3iVzjuA8G5r5XsBdAzvwGvNXKS8EQVqN2nTRDY3NdQtmjExzR6HBPbq50kADQ50SC5BlNELrc88nA0yXSdl2YttrgxF2hdZrCwHamavXVDHWhfXt+5Lct0XI/0Cj9knpYY7PSYL3mJ32mrFmNUKtlQnyYFotR7EMUCiJqRXYXES2DioK3yaAwd7Sbc7R6wgbS0xIrDVpeGmRjGwC4xN2k8YM4HUgMreE/8UjeTs+rtPbnb9/cEz145ukk836O7gZOEksc9SPc4G78KzSGYNBKdbYCOAlpNolsz 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)(346002)(136003)(376002)(396003)(39860400002)(366004)(6512007)(66946007)(38350700002)(38100700002)(6486002)(86362001)(6666004)(26005)(478600001)(6506007)(2616005)(52116002)(83380400001)(41300700001)(186003)(7416002)(8676002)(2906002)(4326008)(66476007)(66556008)(36756003)(44832011)(5660300002)(316002)(8936002)(30864003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: S7XHUcApxzxsce09D7V/GVPEexpQKO6+A9mxpocKMeoehcvohRH+1vwqh/A8OQX8SFGmrfdpQ/Nf8N1sR6wXYJrXDA97FytO4yDW9lN/NlCc/a5UnZdwi0qcIwacbDWyuVhqCnv4e68YTJdIhaJOlD4NWraHuT15Mo+VCEIYHV64GvZkt9Y5I37F6ITttTxozbxJIo5wtpmmTtAep64knYFJe3S93vtr0ABATI5Bj95AThb6VmLHUc+s7+oOMV/Ucy139A9X8KimCIUwKUfJospGTWty7/Z3zkBERdePEX4moKcBBYl52Ta2A13IX35HA1heEqH9p6pXyjYJBwCiXN+QzBIWhMZw2dLf5wqR3UJSllmn1vt6eVZMj+ge8eIJ3KPai4QFhBERL/mT1rQzvU7q+eSY9utEjTQVzn6fRmdAeUVokQsgx1f0WWZX492AOCRMXsdZmLno9bvdkd5LKfM0Q+6ttseRABJxvuoyCWmhX3mrEGnFVWpppl3C38gZaNi5GqRZMpzR5shM2dQr8mfXVIRZG9YZV8S/tbjiCgBDnkJASW2rg9fRkvuHg69CXvmS99db7evEceZ05yaH4yhxUFhZ+m86/DKwDYPpcA9wDvYzIhhGzwTaxzdZy+eoXfht2oCNJI9nfkBT+1FCodc7E9zB78geN4FIXuXasPAgYZORiUSSEX2ZjC5+YVgrEuv6M5Z4GJkgwirAjPxCkxalF4SLBbHOBO9zeRRzZs2rPiBjtSk779+TERYHPn5JIq7P2Tk6JoJDKxcX+fnXPr379Ml/KisYkTcgV3/1SlzpgC+8hHrX1I/MnMSomMUe+roPcOr2n0zClKQT1XKgjJ9/ZfA6y3R3rKteNI4Oyx5NgYI1JwCt1GK5ekC7x7rA8JVqtFxll1vKr06q0K1w4Snx4JGkVw+XLBKWPG2YfxvcyQxka2WKOV7Azkf14IBbym4bJvcGlhA/rDVxLgjb8UuluTECJ9OssVCNR9qQPExHxJWYyoEsO3L14i3oS6+ljzRSVznPI7Gp/AjX+IQ8gBm8IYGowZCaAf1CAYUf/Ote4ikMiStlgEluLseuS5YqWFyPWxcNYz2uObH04Iij74RZGQwVPDu6LPfnhYmAjghOr+qhTDS8RYLRebh0q/H19vDlFXRjWfC9I1abHO8qLE4RJj00Ju8VrKQ2zkQqBCII6wWIMcUDZlVBKROPoOBON9EtLK2b6AZTuYeXId9q1UAZi1bb9M0kvzmt2OKuwHesv7032N7r18unj0zruT/zp4y8DY1LczjlybMzASGxMW/6teaKVYMoQmZH7oF87SLypWDSfzIQm8uA2b7Y97Z+4QtWR+mAIwdeXkyePfkKpwWfDHbNttP2AhiIS7Yhjyo1uNGB5UYEJZrMbDEf7sgO/+tgHbtgrcv3VN81JW4Bgq08NyJlkG9lxo+sYdi5CHpqNBw2j/jgsnW1ZBtVDU8M6KJ1L+OT1WMkasesvfZG8OEHuD3TW7fObOswW9xjO+4+5QhXUAQ+Wr/6nN955jC2f7YDIgTH0buZAFPsRsqm3/qrlu0CB2u6qnfvRRRJGvI3YY1ZXs7kDsiP0bbk2nNz X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 84d3c9c3-35f3-4f19-83e4-08da863aa152 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2022 01:39:20.2548 (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: bm3RRgSzy3vcUbUFtWQQmI2KfDzVH+bux8QLOywdJW9TlAWYAjFAEdeeH8Qw8ULRkKC85IndDY6+1tyNu+wnew== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6162 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 Reviewed-by: Tommaso Merciai --- 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 | 45 ++++- drivers/media/platform/amphion/vpu_helpers.h | 2 + drivers/media/platform/amphion/vpu_malone.c | 3 +- drivers/media/platform/amphion/vpu_v4l2.c | 169 ++++++++++++----- drivers/media/platform/amphion/vpu_v4l2.h | 3 +- drivers/media/platform/amphion/vpu_windsor.c | 8 +- 10 files changed, 297 insertions(+), 165 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..019c77e84514 100644 --- a/drivers/media/platform/amphion/vpu_helpers.c +++ b/drivers/media/platform/amphion/vpu_helpers.c @@ -59,6 +59,36 @@ 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 || !fmt->sibling) + return NULL; + + sibling = vpu_helper_find_format(inst, type, fmt->sibling); + if (!sibling || sibling->sibling != fmt->pixfmt || + 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 +153,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 +179,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 +203,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 +219,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..1f18289aa47a 100644 --- a/drivers/media/platform/amphion/vpu_v4l2.c +++ b/drivers/media/platform/amphion/vpu_v4l2.c @@ -140,51 +140,136 @@ 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; + int i; + + if (fmt->flags & V4L2_FMT_FLAG_COMPRESSED) { + for (i = 0; i < fmt->comp_planes; i++) + fmt->bytesperline[i] = 0; + return 0; + } + 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; - 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 (!(fmt->flags & V4L2_FMT_FLAG_COMPRESSED)) { + const struct vpu_core_resources *res = vpu_get_resource(inst); + + if (res) + stride = res->stride; } - 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] = clamp_val(fmt->sizeimage[i], SZ_128K, SZ_8M); + fmt->bytesperline[i] = 0; + } + } + + 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) && pixmp->plane_fmt[0].sizeimage) + fmt->sizeimage[0] = clamp_val(pixmp->plane_fmt[0].sizeimage, SZ_128K, SZ_8M); + + 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 +474,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 +487,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 +519,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 Thu Aug 25 01:38:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 600526 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 06992C64990 for ; Thu, 25 Aug 2022 01:46:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233004AbiHYBqW (ORCPT ); Wed, 24 Aug 2022 21:46:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235727AbiHYBog (ORCPT ); Wed, 24 Aug 2022 21:44:36 -0400 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80087.outbound.protection.outlook.com [40.107.8.87]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B34199E111; Wed, 24 Aug 2022 18:40:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QppFJpYd2VQ4O7VZc3HIvKWhAiMsOBGFhdlxlOy0fxwp4VWTMwv5dSM36YfqtLSQ6pj3nr8WtCymeEA8i+ciWscqmyKEsn3OvMetGRmpOuuYNMwJrmiZvD/b8nrSxF8hGAl8IphuVg5RWPVD9rFMQG24Wg3WrCqnI/UG7gjs6rwEKgwSU7C/nPJmRcdEdvwP0oDvSUK9dJeAkvigUK4G78aG7q9+N4uZGG77hT2tuPcAG4hQohtRoLe5JWZTU/PD3AU1jEoYK3Q9S6ZQFmqg3cr6B4Snx2szXZPer0DgTSao7KMyEOj0fQx2MfNcUjLbzfccUGxQ1jM7lhWC35P/Sw== 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=rch1E4cmHaaGRNWOPA+W2O+I/XHm8NIZi7EBnWeVgmE=; b=W4CROm5oqE14JEU7bInaEY204wnJg8iuIqBcIW186h6negb2tyL+Nfdm0svpCnvJDRBRtG/IkhxfAPcnAIXo9pYNzEyownZI8yumsip+6uKADxjWqTBkt3smmrebU4U5w7ITPdP8X07fCI6DilCDdWu9v5j5R4FriGH9K63xB5CGzVAeepSmMcwabxn3spdbXn0JYCgVrtrK0bQhjiCM6E/KH42WLBx7WqS1vNnwBMmNkw2FR/T1QojfDIuFQ2ae+rCOK49SRUp7cXuj4396OoD3GZB4Ltipc9stvBQZKCoKCUm+++WJoQNnlSwazM//9OSYhUNkgcjcrKf5/bD/tg== 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=rch1E4cmHaaGRNWOPA+W2O+I/XHm8NIZi7EBnWeVgmE=; b=YBugTwIvIQJrEjZ5lr8LllMobWjGWE8HHZ4WIDpjZ3wm9fJy+iYDxQqjdLvYwLZl8KotN1lkPF7bWQfw9zV6tCjg5lv3c6SA8YhbZJ9NzddYBfOvX7Us2DRYpP1ZZWVADfFI5WJcfyn8V+GqDh1+gvNdbFy7orS/IjISh6Z/rqM= 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 AM0PR04MB6162.eurprd04.prod.outlook.com (2603:10a6:208:147::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15; Thu, 25 Aug 2022 01:39:24 +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.027; Thu, 25 Aug 2022 01:39:24 +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 v5 3/4] media: amphion: decoder add support for contiguous planes Date: Thu, 25 Aug 2022 09:38:31 +0800 Message-Id: <3263e00d9b31f9f4d8621fedbb37a08d7a33a960.1661390673.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0020.apcprd02.prod.outlook.com (2603:1096:4:195::7) 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: e6f95814-98aa-4f60-9b1e-08da863aa39a X-MS-TrafficTypeDiagnostic: AM0PR04MB6162:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nRKGh4SWmqsKJruDwjL4lAddreFSS6FZv53YV76JVYx/OT5Gsmi2GVJCl9CM7yjSbnvvFDhmjTRD5YBVMg2jd2HaI4iaL72F8g0TBLiAPRi15qjMchILQYPAp3rTwGkR+knlFV7WFccQeyQ36j73w0lsGfqdaZfTg8NJIiDz3xgVKw31c3a6y3dvNnpEEsxgVDlf6jbxZo4nqzX+c3FnVR6uMc+Ih93UGkmNb1DNWY2fsvj7ynf0XCs1IdtcokXVLew6smb7fzyvLBRKyP6EjVo+uJt0ZrDj/2iNohWrKugwJmz7TvOLksCpWD4f66T+0wsW4dcKE45vyiWIaiFqX9cbaA2Ummaawp7N9iGmBGgxfm5tORpmobAKcSQzeU8Ao9ipgjrHN2dQt+vwIcBpgjicTRAT01YaCZy935GUe8Ghyh5wyeuj0zGpQUXdoDfYfe/1MV1UuhLywp26S/EfnZjOiwkgQLSFpdGh9Hz3OJhOgVQtvVnD4pTMU2QEEwQWnPk0jVfl4PuDLkJyJ9Qo5M/1AoL0EKKV0UDHoSfV5ej+9or++zc95hX7hSySuP0KZPcik9TH9k2tJKFclu/WAq0cR5TEuDG8m8H1WiKLcYpWs5vNQNUCXskW1NEEYpxrwKF/4YyUL7t0vYaQg+mVjUkbIr2FTSevZ8CQ9Q9HPi8M8UspnJKvvaQremsNYtbM0Evas3Ee6oyuFRexYeYgYKDsPnbu21HTfhn+ACnoX3NtAcD+37LYz//vluAwWOqWXrVF4UZPkb6/vetOLBsLGg== 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)(346002)(136003)(376002)(396003)(39860400002)(366004)(6512007)(66946007)(38350700002)(38100700002)(6486002)(86362001)(6666004)(26005)(478600001)(6506007)(2616005)(52116002)(41300700001)(186003)(7416002)(8676002)(2906002)(4326008)(66476007)(66556008)(36756003)(44832011)(5660300002)(316002)(8936002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 7LlbIGEFz3JPBfoKtBKxAeiNVoae2+4Y4BHw8hqibmjD+sBNdPqOnADoXkaJTrDBVQuw0bTUp3Mvv6d5d2mrY7PzifH/3jB/0xz13HI2RzimvIHcbP5ECP1kKI50AAB6N/ri0rVlgi4dKmNeBqs6FnxIyFqff3QN+2kr9HkWSyGvvNRNChcpHWJwaDqEkj+EDK/3FGqK8j8sONwMeTjoXq4Ywv88Pi4w03Pm0ty5pfNQvacraLZTt2Ig+41PdYuqPQeCu/QxAraH9npTzX87JeIWV4OB9mWU/GZJki5OkdGixRmRsa4NYyNHUz7PBKEy7w0YfLp53xunsAK+xxQknH5qbayR28ZaDCR6qE3j+53wC05rzVwWnVNGcfDpqcydgJ430uabekV+aF3iu+4Aa7hN2ywK7hRd+XoV4Vc+314utKMSiRPjMiRm42SYFq99EZ0aUmkvEXLfIlOWONm6iik+K6DK7Ul9/yNuylqIZjDG+nN24iB+o66MzL8RdKfNm5bvatDAe8v38M7lc4VkudgVrWidgYPSPpdHQGTMMSdH35boXik0i2ffC8G8iV/wrdeqe49VOKqdHldC0InElZKO+xdKv+94uklziQDidPpVoInhLBTMivVNqlHiZ39jODAG4SjutbELrqDXsacDx+EhMdXUF5yBGaEFoAFYncaCCatq/VWLw9I/EmWC+2gDGgTkMfr2qItolipm2ZauzNQcLkGruKtILl/AnXF4cj3uL1tahhU4kgBdYzCqyFWuYnql/oKnxjMkQxgzAzYG+mrrW/rdBuuApC6tyCGf4kd7UdhtBY0IzyvXAOJngD/S+dxRsHuwEHo0BIma4vPlhRbMcclS+JyBUgPIGbwO9omJu7rJwOn8PvnLyRpaCP80NWPgZS1HjqPUq6dn7AyGCdDG4LQd2B8qxnfZtNay/NmJo3JFkz/XMcM8ZYuqRjwtd9e7woR4LLdPQliEwi7q4TesY4OeIhyetS4ZK9eDi8DK9c8yEuj/r/LS3QlP0qpOTrePKaSDXEu3Ciea9QzyzdkuKgsWg3x1CSANXI0Im8jLVCgCoE2YbQFNl7lWhKl8/ZczOCFUvrz0oidnZ5k6H4rhm1b410Kog7Eg92Y8sj3hubCKyeNRShELybcYTQBJJAGlJme109jORdFyKXtf44DpwfknXJyGs3sAKyk7iOGPsNFn07MBNCOmg3lwmuQbIhWUgwYST10K6j6L6q7awlNUoRJt1OPnagY0ahQ3zXjgzDHVHdPE6s3wtIMnnGLVB3PxN9DaXsjNurJ6zjnY4EP+b5LtQ5bdSe0V/hWONj83rPWJ20QegQYQ35lRG4HVd45Qh/Ny4vovDmHpXPJtRLLdgtus56nl3ny9RfdoH49mOLiuMQTokiLumxC7FjiH08jYl6EIAyVCOk07FhPh5T1TdhylDA65vfnO33LDYcZ1k75piod0AVqYJcVWIzAks33B2t+fDoVIydXKEEJGXP7DjCrV1lyuOc1dFvLM7aL2Nv9YjcSe/7uKCiKqkRgmBPy21baKRuZjFoDml68FEhQfpUoLUbnTWOf+HLGeGfpkskDmb51VMmnLccZ7fyDh X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e6f95814-98aa-4f60-9b1e-08da863aa39a X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2022 01:39:24.0202 (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: sD7z8/o8Y5KwsTU7CeR0s5pmaqpvL5PE53nLUPevfLOU/tW4MCcGgD1sYiunK8QOPbnadidsi6KheOhTHaTCCw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6162 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 Reviewed-by: Tommaso Merciai --- 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 Thu Aug 25 01:38:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 600155 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 6A03BC64993 for ; Thu, 25 Aug 2022 01:46:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235106AbiHYBq1 (ORCPT ); Wed, 24 Aug 2022 21:46:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236175AbiHYBpL (ORCPT ); Wed, 24 Aug 2022 21:45:11 -0400 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80087.outbound.protection.outlook.com [40.107.8.87]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 998F69AFCE; Wed, 24 Aug 2022 18:40:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mhxNAC4Zi6Q89IyLvpp0afqRGrsSy2Ku/RyANF07w7HoYL6SmRdqWCMAO9RNwPb40C4Yc2cikeqGGQpMb0qjX3oDW5bKdXYKbc4pWoULJuSnDpswErEXL8P82Cu76I9ot8KoxJLxoj4CLXccbXv+2idbPjsliicJxBkyw9XkJiPQjV5D2AVM6ekpnlGapwm62c0MqW29w+HfKLk3NLrhTjroR3l0N/YruFG3cfCJRzG+UCMZQb21jH2liz3EtVz4/79rk61L3sgjkscco7ZI1KX8hZXjAbfpfQzHtFHXJZLj00gCqhTXPpXDoseBrdoKAKD6bK9WBavqYWOXneS4xA== 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=j+vQZc1Xp+mfCzOKt+qDyO7pbDQ8PP2rP3BBVH+/EOY=; b=AUdtCgqaf/OyuP1o5ekADAfhnD0JkeokFVm0nGDek0oiW/xeJJh/aXyJ7FIfutVtMooQz8AetUky+g6LERH7dBVCAOmhfvvuqoCgksj5pLS88gLswADjPYmCu+2T94SQC6SRhLeioKYaI2AjhdjTIOZ7vyRACbkLyzoOAmwS+VwQR60wDZPtNENkHNpGkdlJWSNQbl+iJ1V/ln/5f2ydB1fCpZHqebeF66hNaeQiOMtMHrv813X604UNe0681Fo1uyW0MiHgOpjUwTJMINHgs25PbadctVCEay/1idYjRe7RFgJYAsB9uS3WKGW2mUq1o+YJBUwCEy6hsT2DNdzSpA== 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=j+vQZc1Xp+mfCzOKt+qDyO7pbDQ8PP2rP3BBVH+/EOY=; b=mKtF7gWp0ZvgG6QN84YRcDMrx6/wRGsy+wlqs1OQElX5YBMg6UmOjq1Bt9qXPVwO2qIkpGFwTMbn5gvM99/6YPFf20w6WtOPySkq/sP2odZIVNuV9rCzKT6OGvbkAM+oc7+n+qZzcYz/K9RzjhN2xVl4kIMvUVgQhWoPRdkoIvk= 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 AM0PR04MB6162.eurprd04.prod.outlook.com (2603:10a6:208:147::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15; Thu, 25 Aug 2022 01:39:27 +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.027; Thu, 25 Aug 2022 01:39:27 +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 v5 4/4] media: amphion: encoder add support for contiguous planes Date: Thu, 25 Aug 2022 09:38:32 +0800 Message-Id: X-Mailer: git-send-email 2.37.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0020.apcprd02.prod.outlook.com (2603:1096:4:195::7) 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: 7eb29b32-7670-460a-8b7b-08da863aa5db X-MS-TrafficTypeDiagnostic: AM0PR04MB6162:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +XnoDQO8xUInRIpvD0MGWMYhIVO/4PXXWUXU9R7Y4z3KC9AykSWNwc1/X2jj3NVrp6cghCFL71zkKlxfVmIp1yryqTggApRv7GfbeohOmoAD0vCW/gtBX6lQH7/5cFrsF3AzaZQYLwupwzFC8TsJ13qLSMA29JHXLXzCYn8c6bq1Va1PoRPeKSqK6lSXBrxgQhARfUV0fAIVhF0HgJzovUY8g8nNpQmQZKkDacD6VSZ1UM2ch5xIzGcP6HZqH+T2tnyvZqt0mlu1AMJ/4sCbmV0NuR0O+fHXEewAb+sy8fzIfBBduH3VjpSZhloKNfASUhZqBwD/2BTmPHrx11/I5trqVegeBXj/qUzHA/IRgooQY5aua5gHxb8XrrYj6HimkF/6jz/+DAB09dHP6eBJIE1X1ASHWDDxA4NIoWXYt2CUsUqskWvArLGh969b53xc0Css39z07psEfnGffqbzgreNDrfb9P8s2Wt2Vp0EA9eBqNSkGBEvNpEc3vFsSN6QO4+fFCgfdjwC7ZAtIUdGMHmkIA+LIsMjNtwi5x/sJcQ2nC9rPIyg19n9gUCFy10ghKb7T5u1H7grEWUQrjS3aNG+GCyZzofzTLrk6oHEXh4Z8C+LJqKGzkcz6A2Lq4xr56Gm2v9IlrOjvzC0elLeG0arl2z/fzMlE1kPqEHF04HVgGni9tKH5fjXXRq7DFlNuIla2Ivsmm/a4rKfuOGBVpGHjIWcv/MqodvOn5ejegHHxDmsfS/E6P2jcT2kbIjYTrnPKelPWht6vuOJhAN9Fg== 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)(346002)(136003)(376002)(396003)(39860400002)(366004)(6512007)(66946007)(38350700002)(38100700002)(6486002)(86362001)(6666004)(26005)(478600001)(6506007)(2616005)(52116002)(41300700001)(186003)(7416002)(8676002)(4744005)(2906002)(4326008)(66476007)(66556008)(36756003)(44832011)(5660300002)(316002)(8936002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: DuHCLr/pV6wBLuvLJR70G81Gsoz/xgvppwGz6yitPxkaXQyJCdSVTGgpcoA6INr1DY8PDKrVAIVqOHUqaaxpKtJw2kQNWFbehgaKseaF8iUujG7MXr4Vlrjr4Us2qqcIrXY31/megSgqRMn6Qwywxb3oU7RSxlgU66Q0OqIBuM6aXUeB8x3pqOR7vZYNEKiJX2HHhOXRC3fcQ3TA8ZzMXexXfOtNzY3Gw9tn9r73H2K/I2tbeqo8HTYTBlrOs3EYo9c01vVobEOzYxVRPQfmsA9EIUGjg5aQfQ4Vua0NM8Z0oDThLgjGz4debMVqaMRomuBtPXnGEbx3g086jZ1Wvgyvqsd0c62MUnOQYCHZCCf4IDetPYQUtL4cfU0TcQ7+1RKG1XY5dTIy7WUFtzo2rvrdwxDR2gYUdZh0CLSrOElgPuBhKsg0to3fMjCZ4M7QMVapzcQf4NRpovG2p1jjy4WN+f2/pvWUl2YRCk/NcV0IkRLSDcuzK7cTG58Xj//44PNhy2sKNWM7MoF6Hp/qss9RHOXC6CsYUCCu+B0/MihkmzQg+sYlySLID0nSHa2vCAasje0CwUnjSS+h12sKUOQavvlsDF02LcE9kgxpUDQhunVe085+T7AQSNrcEj/7gOaR4iGwxdGlG6AqXjsexWxCFunh5Wsuzl51/j+ClZUOfFqS2WpN+/HQG9wWd60ZrSsIQLDaz7v57rAh7sDDGs/OtmwFNGhKBDV+2lzB94hlo07tNlW62NCjZQed13f4Xs7x60R93w7npvgme72+HAJGV/uuyf7pGBGIENgvYYBp2sOutS9ajpwdssWjd905LJYZUP9vmPHBzjt0hUeXlLVpYmk9jY1E/bxI/3kd9NkOMR9XYTKIm2O4O0HEAX9QOLvXuJgbA3eFDiYYu+e7qc0CnM34jNXIITvAR8raOuGzHwMs2SqT3AheZI+17zuylG8JXtvBprCjUN+PLM3bwOVtF0A54DUJqXKNaufia14R7+pAivE3bVFxQPnwlcO5PkIikEMsdqDL7vGN8+74fmkV8PeNrr0GLV24sMmyhwFrZ82WNPyRohTc7ucTTu0TAkICov+29XmJrQsqnLWESCvz/e8BFdi/v5zhoop1Lhbihr+r9ZKKRHumfl0cp8kI76YwXuFruQ6OlfwkhSQ0/TxI9u6lQQDkoP10TJQ6F1aVNHBe6WM9wlPjwIc6+wLYdFp5Tai6HwKiU9WmuFdhYx4Ube79MMyHQdzMIjqxXgI4inS9dZOG1eDGLRC4q43PkQFjJrOBB79KhV3xh1nYd6UoQhWIwmHiIjxnRKoXGtL4DQeO18vUiLZ813oBDblWsFoJu6m2ONDoNzA8iQ7k4m5yhLAfEZgxeIQQ3SOEZdg8CtOrBOI5sNORSuroCMgTZMmqDivRTOFS26Oj1MMoW5k45uTsV1LUx+rP3C3tEndJtSPt7vTD6a9mtymxAFl402KaCPDmGIRbqgcv8m+Y8wgKQ3+hvPsiuilqfQv0b943221d3d1u94JOZzlKDsqv6sFhQsxXY/Kbo4XzIIG/R2ype3dCkuwmovOE8McXLzsgOEJzhOdLnumNometdTKn X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7eb29b32-7670-460a-8b7b-08da863aa5db X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2022 01:39:27.8168 (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: ATtiL7uHCWhrhLroXJfYtAPXsJUAcgN+xoCaVozpIt95D1Bn8ezLBUc4/m9b+y1XXWSnU/G+2tKKBWT8QlZFFQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6162 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org encoder add support for contiguous formats NV12 Signed-off-by: Ming Qian Reviewed-by: Tommaso Merciai --- 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,