From patchwork Tue Aug 9 06:50:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 12939379 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 83263C19F2D for ; Tue, 9 Aug 2022 06:51:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236007AbiHIGvf (ORCPT ); Tue, 9 Aug 2022 02:51:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235010AbiHIGva (ORCPT ); Tue, 9 Aug 2022 02:51:30 -0400 Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10041.outbound.protection.outlook.com [40.107.1.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C8E5205C9; Mon, 8 Aug 2022 23:51:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A3W1GjaJcQ1EZB8SvfxjZlTCsYLVo58NJot5+U/L/v53jCFIzZ8SiIlQe+YdfSapwXq9Le8ZHxJDsVGCdjr77V17yLQFTgHnd3XZK6L78+ZB4xtrmE88yo6YwOui1Jl+Or+lSPU4wbGPQDdndhwRzEeeqxUlnT3nQhOm/ChtenevbPlul2x0mqClsoXZL9OgKCzNXogcUYdAyvQfjHEPIUrqFeWsPAWh82oX2vcxRQa/MdRlpGF2PXZhE8sjMahIQKXbT3lHCVqMT9VPrrS46+Ozu6SxJsIQKCoJxqEdKOV7yXFP2JX4AyMRTDdp3kFvbPHL1UtUO9Gx3lwBjIz70w== 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=LJVFbaaDMgxG65olJdkqKExb68/Qbkk5ebeV2CwzoGZR7UNrmeRBuDMlUVNC5JYIXMm11+Ubr+miUh6OdBurZwdcrIzIo524k4MQJyLnftMhvF8ecx2fTBnnNs5UUI1MhQJBWRea3WimCyvblq+sru+QAV5fhHC23R7Wle+rtmGR36GeNwGk20F7aPKgLQm+yvp6/OzyxTDdk0GS5wn9clTQRqJuJbv/7kZc+0qeJrofxi3awTdvfceYBG+gLBA8sW7XS8+l5jD5cheLHFEYgiZ677uH0wmlVdVA3sZcafeabqiJAIVjm1ZZvXLS3asJaM+uSqjCy7K5PKhv28aoLg== 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=bx5vAc97GImcx0uS1ykW98toeKQCJWQTuOX7jfCCGFWdTo2zG4citnW4Af5dzs0F9t575XtK7mCN5f87SGruhGJhfftZ5hztO7R6R22j77MLjQ+yekgE63W9gS67eKQ18WXvWhRQRYBTwPneBlCZj8U6ak7vUv2Q9w3TbqpbZPw= 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 DB6PR0401MB2438.eurprd04.prod.outlook.com (2603:10a6:4:33::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.21; Tue, 9 Aug 2022 06:51:25 +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.017; Tue, 9 Aug 2022 06:51:25 +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 v4 1/4] media: add nv12_8l128 and nv12_10be_8l128 video format. Date: Tue, 9 Aug 2022 14:50:38 +0800 Message-Id: <84842bffb432884a0fd84de96c6e64ee2273e511.1660027440.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR01CA0038.apcprd01.prod.exchangelabs.com (2603:1096:4:193::20) 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: d209edba-c5fb-40f5-e0de-08da79d39404 X-MS-TrafficTypeDiagnostic: DB6PR0401MB2438:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wW8SNu1eOAj7A4vmda7etEqwO7ufCkUKMY8B/0nOzAAZbQSNjaJ9xjFKEXa9VL0Iy3hxTjEU0xS//U/AkBIHFNF4o0R6Gn8HjWqzJTN6Ly1wpzSP2ab5x8Q7LgyCRxStusR/gRUTkWsng9/Qk3dxKjpYbEHLsTkvu0SmOT1/Q+9hHV/pdvC8PFSpPIduO4tAjfNpheXmN5duIcBa9pK7fHyHj+z7LmnLODpucB435fSR0U8CHU9JsX3uc6vgmIjeebP4OFjW5APeDJrrulBiAu/AqPGwfBmcSnLmMlIN7Tr0es+iwljO8R0eEnRAAMvb9ID86FSK9FDaUBe7es1VJf8qmgezgtkc12Sg0LrVX5DYt9sPwZtteFJFwf2rmK9RqMKGNmQvt41/rfqSo8z7W/9799fKcODwpqsBp48au8oT/IAc4nGOMoncVzISQb4tV2oknW/zJ4705hZrd69IWhpzRKlyYEjqKnjIPP91LhuVnB9nqB1FVO2YD32LwrGA0EyordpC0Y3ZdIwC94/eRT6A2cJxTVuMxELhZzLPDn74A5qhXUc7+rCBKcCgzGsZU65mhRxh1N+Cg0gVYsx2NJb8eiN/FrmcIizvS21U4oqTDIfvb6f1LITPcfvv7+KmEjCEJWavkCllNbEzB2qYLjpj99eXwekJu/Ufx8MU0jjAYZRBOIHWDkUkUD5LK8ZmjSSVPt9rzA3Zjj1N5Cybj0ajhKyK8RcwjYILLKSV709NDXErIn07e9gTdJKMYiqAhxMVifitvl8tNSNkUB2y4yR5whjW+cemeGQYsEiTwQyofpPV7w9Yo9AUFC0bLDYj 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)(396003)(39860400002)(346002)(366004)(376002)(136003)(6486002)(478600001)(52116002)(6666004)(6506007)(41300700001)(36756003)(86362001)(2906002)(6512007)(2616005)(186003)(26005)(83380400001)(8936002)(44832011)(316002)(4326008)(8676002)(66556008)(66946007)(66476007)(5660300002)(7416002)(38100700002)(38350700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4Y2j8AEG1S7kG/5jMUlPBbuY8+9x4ree3nUSEoONBSgeI8HYMx5jGF/Z9U3TuVtLzDCYvvBPS7cLUBWR9n7OS5g5iG/9KWEAgr8wFAh+ZOlDGhmp7bkSrDxuuxJA6kd4Grp9bZgp3TTdrJMCqsccGPyjLIal6jWBl333+R33IF93Qpw8QfHOKqlZmMQKLXnuJ4LcNW0exeNeZs3P855hQ0EqF5OoDQ24I+wZc39ABXYnEVLr5eGNeiNR3OowKHg8mPUB3IQkcX/MtZn0FlQFP4L+9pJXx25hwKJmZrJTKgdPjUUYHRIYBdG9PGt10OuBw9aw8svM/9Cb9nR/cN3IeJnEc/VqNVo9tDiKzVRV80XLBxnp2rHv9udmeS5WhdF0pI6HLlqbEEHNrvlw/OyIWA9Vf6Cj5721q4U12f9WMvBuiIkjdZvtY43TK9DiuHRun2bGusAodszr7KbXrXa8YQ6vp5LxZwoWy/H1+WmR4Na6qoanBgpu5547MjPuC8aBNEBOk7ZVW+jt1SaYcUv9I82APpTPzVwGVb5wJSEKCqoaKg1z6NdImLm8TrXkMo0KMbtYkFyvk9Dx8el+QdFbo0HE6TpviqSi4hiq+T5ZWE7J39XsOLsdQX8J3P2QM0wXG3419SASVYCS8oSgfb77FhEEK0ZuyqpCfoTiM1D9DvOezsgfFYi5tTd3ZjBZsL2DdoE0gAcvBk8Kfik6LvEv1UVWwsNFd7X1VoQkyvu0HcIWNAnzwx1dY7WVuFlLT1FZiSjfg3uUDUUEAvwNKVL2iVdiZAgySYOFbZ9FVx8cILkZRKjjOQ/epz74Mt46ZQoTrjQ9HdM1AjfjyzSr74qoT5/bzFFYpQvjiEBvhfFF7MC2zzNJFDz1GuGp/NaxzD3W9f7bYkh3wQR5P+mZfpCztaeFkLTB8a0p7907PFS3DnaAMsvu+hiFGhE3qH8sw+yc5RPuV6887FMEfbRayTRICfZuBkT9rhgriwZcbAwHFFkugWE+6LI5/fJhPjLgLurN6fEv96cmD8UcSuUCEmVicUkY9UOk25lwDXMhVOCMVU3Ccmu+5iqnv+kLJhaZWYq8jmjZvuPyk9bDs6oD4C/iA2Y6DjstIAASQI6QK2rrAx+MpsdKxtTp+DAxMeir1GKtGCnZ0bG4DyYh4rcLnqd4IbzFQdVJo1gArskN5FTqvkM4Ho+gLvCR+nSeZ0EYO7I1jx1/fm6hzpo4VNer02y8NITF7zH/f/c55dxgojrMk4Z+aTFRtIQpnDxERJHjC0ni+fuPTc0u4C2QRBXdWxd64fnluLEAmGDGWQaI2TJKSYwycfhCp4JcLls7qLo9OeZMVnkVzcn9Yp6y783rhRmZJpFtw2/KyDxfjy6RdEfG2LzM61LVXvkY65RSjop5RT3HGmFiU0UrPgM1LnixJ2MorZNxVpKeLp3JAj0ntQW+htN7RGRbchOI3jiN3n2hqENwGWq4ZGSKpV8CTGcBjEwzuJ+C4AdwI9LOIR+qqsLbYm9wMQkPbZA8Bey7fL8o8zjhvCm3N1EXOR+XVgmDXaLvCo7tr5N9KtBKTzt09EFNjjCG7Lk15xeciET5ZNmDPmY3 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d209edba-c5fb-40f5-e0de-08da79d39404 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2022 06:51:25.6160 (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: HdeSs1oNL9DPWnOxbPMuetKLvaDja7lAJ8OJJvqMbiAhUqg/dE4A7teDP2OolPhoo66GeQ+AbRfee/4vOH3pAQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0401MB2438 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 Reviewed-by: Tommaso Merciai --- .../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 Tue Aug 9 06:50:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 12939382 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 E92DAC3F6B0 for ; Tue, 9 Aug 2022 06:51:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238685AbiHIGvn (ORCPT ); Tue, 9 Aug 2022 02:51:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235046AbiHIGvh (ORCPT ); Tue, 9 Aug 2022 02:51:37 -0400 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70058.outbound.protection.outlook.com [40.107.7.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC297205E3; Mon, 8 Aug 2022 23:51:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V7Y9OlGSRJf40sfwJu93kH/5AREUYouQCOzhEdHmwbZRLc71X/AnEdeYdZEpyR5XTci8G9eMbWnS0oqyKZuDPONY7WE2TJ4RZuCrE4ZQB/OIjVkDOGJW87kqHluzyS/tKqinhKcicatYarw+hTXY9i6xMsoKVE96jWJcREHURqF03jhocvJWrUJWi9fg1V1lpZixgkd8zxVF6zn9PJIJqM/wgMiQ2lgaTmLygaNQk6FP/Wpm7v3WYfH/Bz9Ua740E0whTHEjNjieNVQl2tCBee9y7KvMSsaFU/YWnMWi2rxx5JSCJts3LscBiGJIh5w7wDLv1q5RPQnOvYGDH2nLXg== 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=IJYhZrcRoC1KxJoTFrpUAz7bIxwoJsSJXdJ3vCcbV18=; b=O/mBHPcJBa5Gt1L8jgqmxXNVupjblLyUIjt1u0YOvWOsmNOeuTQdXHf21tsDnShWgR3j2N96ybboQ+203DasE7A9RoNd9lAIza5+2WxAwEJzu/msrWrCIaTxKCsxZ+7MjZ3/trZxn0OPyOd9EtdbfZVU28i0nlu0fHhgt924J8XO7hLKwG7BSPiLk7k99Hf196nseJ0+1H+KQNrIWYeqKO4yd+Hx7Ku7M1sFX6Hb3Zy+y0jRSnLjF5mclIGp3aIDwwxJTOQUZP6mYPt6OzUydW5Mmfk5wkY0ADEsDK7grOAG/DiwSy2ckLo04wQwKZqKyvfN5Y/BvCHLX1gg6hbb0g== 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=IJYhZrcRoC1KxJoTFrpUAz7bIxwoJsSJXdJ3vCcbV18=; b=VgX6a6Y0nUtUtS2C9xm2oUUqLY6w1fWEXendkvNFkDVrMsoPCoBiHunSD4a94gNkjbbS4ElBFuft875vXkEjQe+QGjRYpcGUwKlQ3JxJYI0eDyxrIO1BcEUR7lvIkrkCUSU1gwLEQWfHfiMg5o/qcYubiEryZDAuC32lHgOgmQg= 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 DB6PR0401MB2438.eurprd04.prod.outlook.com (2603:10a6:4:33::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.21; Tue, 9 Aug 2022 06:51:29 +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.017; Tue, 9 Aug 2022 06:51:29 +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 v4 2/4] media: amphion: tell and handle contiguous and non contiguous format Date: Tue, 9 Aug 2022 14:50:39 +0800 Message-Id: <4af9766eb664a02d1c5884cb48fadef24dec142f.1660027440.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR01CA0038.apcprd01.prod.exchangelabs.com (2603:1096:4:193::20) 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: acddd6ef-2f3b-4a69-21c7-08da79d39635 X-MS-TrafficTypeDiagnostic: DB6PR0401MB2438:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TQMQQe1LzFpnOUWeOm2bq9THnIP6V4qdvplp4PQ+wgz+8BvdaBRej+KP5viEI1YNIuxIxXtD9fN2Kpd4BrCz8OUT9WpDRvqbcyxjFXQ+IYhMzGQyEsZF4VxrgfEhU744+an0TUw8evGCmGvHao4934VVebxlzMghq8HAFmjams+kXnlFQdBAQBI7YJBfrxsaeyFik4U1mCQcawaqLYC05E/pqW23HYjUmxGaUSVBdjiiyNfor4itcR1hHksaVhIhbrQ6D2VPzuF0iQ5V3m3fagv3HzoSMy8oIA7EMwrvMjl6QXbV4/wagmEjiGhq89Lss+wU1nDJJqroSKa9Zk/WIgpw4csLyIqlv5mS/JzDY50oNl3cSkRRHx20ob3LvHxaAtoWTMb1FNC4RDqqIKSyIrblMwUpV161/quOJ0Gf8iITWDrucNJryYWHVeCJzvcfGiwdNOqltW1vG96PIEguLaa4T4jmpo+Wl6yY1XWLnYsdn4b5F8KdYtnNp9NJZmGT6BxPThfz8I7zkgZmKB1gUN+uyR9qQA/ipkFcrj4ObZO9FVyqAFIGU1WsiSdAP08cfUJj4X2COZBHxWOSoTlt5iTbrLTT0wVIpZUXQgNGUPGxOf6Y6Q3ToCeZpRpY7aEO6NiKFyDfCo0dDHRtDejFCtY5qru6EKjLQb1A1vCsjIozmIqV3FCHgRYUhMi9BRjgAINsqglBapJ+MhLziEBJZzpG7QIQsuWz35HQD+Hi6ZPVUoFamrQmk94czS9sTiEr17Ec1x7nU099dw4w0A6tj3bC9j21qfIWzasE+6zwVIg= 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)(396003)(39860400002)(346002)(366004)(376002)(136003)(6486002)(478600001)(52116002)(6666004)(6506007)(41300700001)(36756003)(86362001)(2906002)(6512007)(2616005)(186003)(26005)(83380400001)(30864003)(8936002)(44832011)(316002)(4326008)(8676002)(66556008)(66946007)(66476007)(5660300002)(7416002)(38100700002)(38350700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4MZhE5GKrqRE7Z2kgP1zJKmo0T34HdCS9zbE4f91vc4Vo01e6XZcfYKCd1+E6Naeyi8b+JvSYLhz56MLJH3aviQ9ER3GT4xDYOfQOSrOldGkXvbSws4clWDo1HTiKLfFm4rkexOE4NqCXZfqGI2TQCodQNL/O5yztI/Eu/kspjw+UtaWWqWJWZ0EliO7DhS8lqv1Lo2fyupMRGaJdWllIXxE2DbUvT6DTEdOdEX6Ty5zeUdVQd12vfe46tkP0RSICk8Zf+B55dLf6Svc8EY6UazTBlJ4uEQaUNNCPeXQ+vRXSgd9cwfW3iVWobTrqGHHr87dj8NPv9oU3azCp65JBZNKcGedSMCLrDbIW6mWnNRcg/bsFi8Jch7jJrPfjcsmdrN/5NWe7PUN5jGa4ZzXUXOxC1SkXH1JODK3MIguhjeiYXRJYeoDyl4EZxnxTpReUOXP5Br9tbgy+Jn7S1RD0pPZN6QMHU0Xh5jcyPuE7dw1e5OLTfrDJEEqfeIc2Oe33r9fVi+H03/nSm3YyhS6mDcJZZBh6BhRRyHnbE+wSq6NN+lCIcGzR7oO8bkchJU9HV1zLbqbKx2ENP29zqCKdH21K2MbhfDYOUr4gKzj0RGAFfmWy8P6VsNIEGLaaOv4T/IghMIoYBYudl8VfdiVlCufhTnDlVG9RNMyK2WEO5WCU34j3QVoy9citxU9m9VwGJ9VgV8e9q/BOgVsVTjD5gN8mJx8AZYajGhlnFBYlmNpODb/By7HqIEifZSZRI7VKi5TjCvRwzxHDHoOsfAEj8Zc/oDdMGYtAwcTr1HXKIPXdmBHzVkNnVUxZCno4sMw5XgI/srSDCLU3PQZ53i3z8e/ddnlcT5rDMr3Pftljr5jW6+qua4COY0F4b/j2XEWLuWKw7KJycvQzg498z1yRi4eqFpxCw11U3MUdSwDjIIWB0RWXqO9L9+HdWkr3I1Y0YlPg/px/Akli32UEojD1nuz5OEI6QWZmWJK+etE5A005/Ge9OR8gKKAhm4gM3W+gVjll6/wJ5/GoFCz100CsVrwDDDO4xqcnLEwUfbL6Gd/J2UYKFYISaV0LofnEHzHfA+LGhtpsL1i3Ko2aWfAZrTlxnKRdMRaRY2+IbrIuvHBkv4BqzPQfe8MswIdQRiu0uWbWW+ABNwxDMKd3JqXCLaVHLmJ3JxoaNxutU99+NRRN9lmVELq61Y4kjBzD6TnFzIlqeubP08rhc/oqSy4iorG6o50fiiWwcSBKdYODhJHut68bcdmA53REwhFrLvc295TiKF0IureazhHeNJbpxlCPG3+IUVYXvDgQsASl2AXQK2F82O2swDG6MFruASqBSGc6IAE4RxVD8Y4j+9rmdl/co7Uob0Spuo/fXffDIPog/xPEjREjiCd10DbsvKKw/CXAEXzufWMkmiz/CnrGEwgnoytU89x/mFL2xgmhNp28q8h85i3NoGHM/pf1S/gyXQeKwL/qciDDRJJXHiPK+SIn9sniKQ8vOAPeCsJaRxT5g+rR5TaHqj7LLKdL4I3QsXyj0IU/Y/wsj+whLJzXWAFpkRwu3O3vZSOHOEs9PI/lz+cRJieV0QeyJ9NT04l X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: acddd6ef-2f3b-4a69-21c7-08da79d39635 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2022 06:51:29.4596 (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: SNtNLSD2THysWZqYtA/KQ+JqpjEcOiuZWxJHXA3rTW56uY3q1ngRr9UWBEbxpX8CJLi4aJswHlqQbNJjGj6Xsw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0401MB2438 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 | 168 ++++++++++++----- drivers/media/platform/amphion/vpu_v4l2.h | 3 +- drivers/media/platform/amphion/vpu_windsor.c | 8 +- 10 files changed, 299 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..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..87cce552e906 100644 --- a/drivers/media/platform/amphion/vpu_v4l2.c +++ b/drivers/media/platform/amphion/vpu_v4l2.c @@ -140,51 +140,135 @@ 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 +473,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 +486,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 +518,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 Tue Aug 9 06:50:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 12939380 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 A1FEEC19F2D for ; Tue, 9 Aug 2022 06:51:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237760AbiHIGvj (ORCPT ); Tue, 9 Aug 2022 02:51:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236322AbiHIGvh (ORCPT ); Tue, 9 Aug 2022 02:51:37 -0400 Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00062.outbound.protection.outlook.com [40.107.0.62]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEFA9205C9; Mon, 8 Aug 2022 23:51:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OHbj26kaLOhQkDwtWaGmiy8EHywHmPmlo5cRhguwq5TUsKNVg+78c3yOT5MFJ4j/fZQLunttiird3UEyKKXPCNY+w2qmxPWzWbCsHNgSMgg2F0jwxx6pJzGEcrcflce6hel+n1JmRGN5aqfdr3RNlq81TEyskBa7sRExm+NOxJHt7hPJnJ0aRLEFchsaczWpz7374Yz2qVlsT+xTUwVgBlgfduBN9bjEWSynoLg0XuKHxanS+QI/4TkEXtsxV6TA/9pk0SH1hXlLw1dj2wRr8mD/fmKwiXo2oGW9nKYsDEQxZRVzpdEkU4MFCSZTOX/m+QatxnCiJXFAW5xNizNGNg== 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=aodOJuHFxMqUUsNk2zo9WTk3jLY0ecot6a2XwbdgGBax+Q8YoKGiUqaTcPj+ugQCQBWHnReeKf+OD1aEW1yLq8jJM48d5CuEhr5N5bhB1b0Y6T+UNrw5ZXZYPbdxlFHdWEvtrE264xjO+OpCVIVUMUxjcoOjzmWR4LEbqNE0bn2w8f7HSXDak5sNsQy10+4rwNT00i0lpeXzCuZoK2on3hS1pRGgsFg8oP6QptG3It9y3bz8mmKW5XTPFh+lm9Lj4jLSoKVSwrw217qtAMYIer2qHOQUoTeLgle/+IySQmvyO0Mxqs7mLKqLNCFahQsZT8j+DaZhcKZRHO0aj5USyg== 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=ChXeilC34RqpVEcLCHrtv27e/DJmQ2E+uuiOKwDavmDCTdPQEfCB0ZzPAh264uKNnCNSPzkauATntH5/ZfVUq6L/x34AYSi8c4841rELFoIQ63o/aMhsDN+8jFdGKBk4HXLsbXwetbsTDpIrHlSaiWmtmFsofxEr19dBfm15NdU= 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 PAXPR04MB8991.eurprd04.prod.outlook.com (2603:10a6:102:20e::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.20; Tue, 9 Aug 2022 06:51:33 +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.017; Tue, 9 Aug 2022 06:51:33 +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 v4 3/4] media: amphion: decoder add support for contiguous planes Date: Tue, 9 Aug 2022 14:50:40 +0800 Message-Id: X-Mailer: git-send-email 2.37.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR01CA0038.apcprd01.prod.exchangelabs.com (2603:1096:4:193::20) 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: ac55b891-3508-4f3e-131f-08da79d39876 X-MS-TrafficTypeDiagnostic: PAXPR04MB8991:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MnOVxiwtLJoX0IvPmCyX6yJHOeSLYIWo41GhkmDv34V3t8S6pewsho7dMir88I2uwh9MaUTzYFn83pASw70zptScKjjORaRuZKJPTyPo9puOncMC5WevjdMEYdO7+BSkhDxl/6+ItF9xN/0AgV5Z7dJIS14VTIRTPiLIXhwXIAXbxbTzpT4IZBeQvNBWWfejMJ0VCfmxCBg7Wne4/1zVH0w2U6CE33Q8KWiCmF3gqwI2vWHmy/nVrzTH4gz74os/pREkNSeKULoMQAbETBjNLVD/myUQVIJyh5vF14HEJElK8Tx0rO8Cq2ELO8wBta4/HQbC+4lcH38bxWC+JiY1A4xZVwTxEgOWOmMp/hos1CWZN8M84wO86rnANstDtoY2id4UCzaqMK8qwQTCz1DqTP2LxujxoAhcUZ7lTvwGUtLzD9iJYfyWIrk/x1GMGWo+c+WL5dLQWm/vdTRFPJtPnnivOun+/Cu63UgWFmwgU3oElb2Lc4qMiWvxHadvWxM3OXBnIBhoI5DhhxK1EKUNbpd0SjoqD3586EqOlDOn8V/45FWmUesMPnVxBSndJ3uf/p5imbegbM8lZw6slh0Gw/pjWNPgtnWOIbvShXxdjnofy2rwVDm5aRTZt29V45ZVAwUau8Q0w/03yO9deMsoFSQ0ZWt944srbw0g9Q57Yy4bOduKdPeu5Udknjea/buJAMirqdIPRJ/cZu25K+j/phB8f56gnJjxn8+FMBLTStlRkWlVnHNEmjPD1QAVCvavHSucawlf4zjXgkqdQ95hTgBbshrVSB1Yc6A87KrUQpsTAa0SOAKIQBzu2avXr3xD 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)(396003)(366004)(376002)(39860400002)(136003)(346002)(7416002)(36756003)(38350700002)(38100700002)(2906002)(86362001)(66946007)(66556008)(66476007)(6666004)(8676002)(52116002)(6506007)(6512007)(26005)(4326008)(316002)(6486002)(478600001)(41300700001)(186003)(2616005)(5660300002)(8936002)(44832011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: tf9+eFokNDz0IA99vozIlX+iGu5EZuB8ztF2o5uYQUEcAIFskFZT2UH4jKfcknwdZVi+83QfyALZNK7Wo7a4rhCBvzcq/aQmOLaYKaZLqEahYZKrl71NTnWp8Bfej/Y8WPBMJhE4VjHrzW/ybP7Od1aBgp+fVuaBt2ksQQRTZTtJIIMKZZjnkftwfiVnAl8q6scXZVVguYhunffqb4ZdeznmCY+LRIF7ccW10PRWIQ5hjbeCBJ7ARhOSrZv9ieT6wjGZUVcOQj3DT/StKxD5tCH1kaEY7a3jqLiVZgFk6pddhHMcSG9+lsf2HWHtCmRjwfoX5ez096Zl/sq4RNWpNhp2oW1lm6eLHBrqLXKVpbhbBMgpCxI5FT0zS2OndtOb0JQtpHtIXC69CVgeJU923zI4M/mnDJmVN9ZY+Xe6VuRP7ps0x3zvQqc8L3fbO2lVZ1+67TZfxWnsrN2o7HoSO43PoxkBpb13GKhQVJOz4PjX9bDXYVUsV3STkyp4WWXI+JuyIrGDf93xxRAupc84QkONs9Yp36W5xw7XhiPgr74llzfNDb0vN/UkBJEvU4jJrCWu3spo0jdPMUpvYT5ekzGtchm6p6ozqiWCF+e9aBpWShzMMw/ONqqcSuFPKHBnDxUirWQKuFtWZVNWp3tCX/YOpHk1tUwrOyx8sSbYoVfmzKQ0/c2dSqacTKunOLwBP6aMFDPnW/IJlfQrwU0PZ6CpB0jYbTS7u2mqm4Hi3xnmcTMqjf0mMwaNKW71l3Zmz0fnlbdiXA+0nPcAGmnrBKg4pfEAeGMV1+V22PRZPeXmqMup7JxYcaRoDITbda9rdmzR9+CMhxOGiQBrXVvgSxB3gp9gHGFGbGNS6ehvdI9caOyIdbFgqdxUX1WGuQug8lVxzO3Il3EIVwBy4+Q/p5GwpjSZcl7xZV0E2YEg5YwH9YAsu7RVfsclBrnX7GW3N+ZRY+ivLJ3dGARZQ3xSnc2Xv3eisTY8DB7Cqrxx168ieogqzJqEmtVkvpf0Z63QtDYDZdiYfyOLzHwD6Mvbl7QXw68pam5Th9bIAjiGfn6QC4evzziLbuaRy+LIgtLocW/T1rWqY/BVeTaRgn16rIWIPqzIwDtvqOxXP6cMmv1CvHjwITJhpUt/mOA/QHo0GfpKf+hKihgIZoUzYRsQQpc4hSxeuclUnWf2urb7jGQ1RqqoNkTlW6OXk4xWIwK/NHThCDuWMSIaMqsMnQd+KxgwZfcehjC205R77PxtFGClTbM+X+ZoR2/Xn8NHFGOtB7R5MvVxqxukttp9GHVxXcWhDOfKRoYX5lfOOK/w7PXy83/GAuZoesrS6ywoBH76l1r3pqrcxUT4s8KOxHqzThFDPcTB3EJLQJOEaZqkAPAKzTso8zQP+rveIxp17LkwY4Is6WCZimf+i6ycjl/paZFsTnk19OyZC8uT5d5WWMUU6s1IvCSN0a+9k12H7HO49XsjJdQVdmokBMZoqGKIxzQjvkz5+PMEnSpVoTBxBvigGY4gXrBIJVCK2FnddakrB/byni3Mi+czl9+PMdRAd1qsyh+US3ugbOUaQS3dV89dhUeI2Zpzn2AD+tBhVMmu X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ac55b891-3508-4f3e-131f-08da79d39876 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2022 06:51:33.1937 (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: 1oeUskWQg/XMpPILP+1kI8xQ1zsN/jGwyUjoIsNBBxH1kgc2AkHvSlttPA3VCqXqJhb/GqNS/OeTp7D/V9j4ZA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8991 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 Tue Aug 9 06:50:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 12939381 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 29A8AC19F2D for ; Tue, 9 Aug 2022 06:51:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238705AbiHIGvq (ORCPT ); Tue, 9 Aug 2022 02:51:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238518AbiHIGvk (ORCPT ); Tue, 9 Aug 2022 02:51:40 -0400 Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00082.outbound.protection.outlook.com [40.107.0.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C695D205EB; Mon, 8 Aug 2022 23:51:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IPfzgGG2dUbbX4pG8QniLQLUJPOZE8Vdnv3ZJPZB1jaTK4RtZWY3AANbLQG+BR/ESchpKPgMiarO5YLZGludRSXymO6E54xvY0AVNkhiDaR/J30NJNn8BL4vd719VAQ1DEJgBsTyKNJLeJXWxeCmc9kI8FwlVJyQYCn4IQ1XoWw5IuAyfgLdtb8UekyG2OMmLNMImeB0fuSaQSwLJ3iD1L9qGFBXbaeIPdoZ5kz48GskuU79DNSXfYU1c+1ljQi4xjIKiBH2ucno5Bk1OrC8Kkc1LRqcVgT8aCHE8xXP4JoYaADq6fAcomhyqVI7nJnkNOXhqQhbRjITzNpO1leDUA== 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=LrD3DJQnFftDXf8pVBgyWm3QTYU9EWkUjlcgyCm+XgOMId5JiE15xuKFPTz4V+bT1nm2hSjqvxL6w6g7vRtcKhzCfDOheNncpjtghbZBpIllMNwEleMe3rHn7kFMGBAakm0No992hNSUmA077J8Abva9pVbSudFeWsEVGVh80vPf9mamhQdZ4bIyrkB/FS4x/oaIidAXeJ4s+jbUhUDQP0pk68gREAocpnCATW7aj8z3a3b6TWVssnHkNRi0iy+n+RafevwY368jmI255zhjFRiYFrB0c1MhHz2VinVl0h5xH/OCrBjed47oRSTxsSXcNJr3rz5VmRdR1o3lUNPEgg== 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=Nl9GDmC9boj5p8QpO8SVRniVbtZp++BkQ94bpdwwhB/8BTqsLzi1PQObL0D+k/M4vLTLsCL4FZ4FfN9PaXa32Q/Einj+NTq1Fwqbah4NIlfMrVSP5hPyW0JcIs0mflV5o65jj2sf5mbiT9CZXpbEPUEgco5Dzy6bm3FQQR+HzDo= 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 PAXPR04MB8991.eurprd04.prod.outlook.com (2603:10a6:102:20e::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.20; Tue, 9 Aug 2022 06:51: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.017; Tue, 9 Aug 2022 06:51: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 v4 4/4] media: amphion: encoder add support for contiguous planes Date: Tue, 9 Aug 2022 14:50:41 +0800 Message-Id: X-Mailer: git-send-email 2.37.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR01CA0038.apcprd01.prod.exchangelabs.com (2603:1096:4:193::20) 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: 05bb977a-1be2-49a7-7b24-08da79d39aad X-MS-TrafficTypeDiagnostic: PAXPR04MB8991:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: K7Eyr6jSz3kPGQTkTYzoW6uVnViAsHJt5ZjQ8OKW6x0f9CRJ5nnDgTqfSjE3fIzAAzLuHettHsU9Ylsogwffb0tfaVcjMv/o9JppiqroKTviVNj2ACkCDj1BR6z7CUJOkcRIYw/71NTkPep2BEB7Yp2HD+I9GKZrHaxLPl5hcHeq3n8pFXScLe3OQezD8RzWOZMX6aPH7PFxY/Hou1PC8t/Jve3BHrPBJs5bc3T1UeYthsenXb/LRDc1l/8I8VVaKv35VuHtQxcv8rtTmWKAPGvX5/TcPnZ/3R8bw2F07JZUCuGCPVRtM82QFMr+ylTafrswHgV1OKzFNVwXxCWOMXfP103IvK3tzJz6IIYwA7MFFTMCDESUTwxKJ8/n9usjNiWahFhPe+uVk2WbYSvAqf9bHhBlopca4qZR/mwn18DmV8DDySqKHCvNWia9enDwEGGRABSEq+E0ovOqk37yqL8/pMkFJzAakX3OkwIsP4ZiSrIQk6PnlHp9OdKUN7ZVjFCgShHGTWpEFlyKrhe/Gi7xDFsHuRBQ90OyyARe59hpn60PMeYUHenXaGrYVs5DMq6dIt5FnM6r/YPi00vLiCXP9+s6VWC0sYp59DepT1YyvJPkQS3XRGcvnDIRj0TNs5c1Exn8uGSp+Fs/nk5FGzBl97gad/EHaMCeIWsZGn7yVZaLDW07igKEp241Zsp+tl9JJIc6ATxFxsDkIE2kYXBA1RpguKDRLPNE5azwXCHpZzcxLcejpd8XudxZdNYxw5tuwVk6qilVa197cCAqqztTFmK7t7rCCZN70+ejU7E6AJXXzk31ClAGqpEDhOPG 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)(396003)(366004)(376002)(39860400002)(136003)(346002)(7416002)(36756003)(38350700002)(38100700002)(2906002)(86362001)(66946007)(66556008)(66476007)(6666004)(8676002)(52116002)(6506007)(6512007)(26005)(4326008)(316002)(6486002)(478600001)(41300700001)(186003)(2616005)(5660300002)(8936002)(4744005)(44832011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MsgfvROzR8j/VpYypPEBc8zW0m/BaU/zF5o4l7bMf5cBTilc+JVflE5u9JIz5dpZvmy+lX+9q/N0H+sbn7iE5rIANSrL9RGXv7lNESnJklYAsQFxyfxbO+TCfbJ2E6oTI59Iy/2TXe60jwYH26+X2ynW9eH1lsQzs+naoatvy/IuC4qg+YlEQyBrRTWG3uIfOPGAAnwERfo6qLSMCwCAXn9lnSkj0366663cKnihqk8lC5nriPbRqJRP6rvPJwFS3m0iGdwj6dwOYkv4nVnu4Ox6qyrVaXHS1XOrvfECzY17LxJTzeVT3q3eJP6mYVsbOlJJXeEYomqBYem7V2o0QR4v9a8E63U9umTsuS+PRmM3MAyxXIeBJTXA9saYQL/VvSrJ7oeLvS3ZkfPOAqE+JCL2XqFPPtWhsWX4vUiFnahYY3qATgfPj9M6MZTTHoJa3bVdBlCOUoEZOPcdrbIydLnYvebVh6qoEob+E9A5hHsdlV7k4CHAkgXk9XsKAUFkbiCUuc8vkcCwF6g/pUhn7PLeAObTEZjbdlYevv1fE4kYvm9G/avEUeMTQT4xtWQJLcBieR5vE6Jrd9t1a5rf2N6K4HH2p/G5S1DLkFIWJzfI2LZ8x8p8EjK2Wff8mUqCXM93LmRR204rrAXQu5E+6aOOssuskFTOQo3gfeJ8KxpfN9Rte+vzAu3TbjTrdQBw+gJiT5HS4wd459PsXFEy0I+FpH9tO3qSAKqUOVflTzysXegoYHNoUvXChiWn5D4MG5E9xEMpEc0+S0T7gtSuLi3DuhqS/W182hfVUY84PQcmcaPe2GlNO2752wJRH01AWLfMyyGgUgBx9nLdmwZxqpXqseRASMaspTNm8kNYd6hEKYGiYoEyc3pjHGlrnFvTBVo/k10yzey3xW4rSUDI/fBeKA8NGL6FvaDQDaJCXzTkiT6DUBOK64Qj4wuEQJR874MfcMJq/2rNq7h7jeTqYjY0EI4Isl0ZDwaYgXwwDZDD5R5XmKSUplRhyg1w9OljxFDP2c0xWhEZNU2kKmmgYX64wua7RQrFTyCLbG4841pQORyrHt9Qp3/IP4mKt3LyM9RCI2GeCNjnHkWFswkOIF3DMZam0WxoALheMV68WxIg6x2rBQxIJeYvTo62Ql1bQPsYoFm31XzyrU71VXAJ8by4E+hYcKoJuCRZCKMy6yBtHElFDWB08nB1xQf0XMEuaDIxeEpJZqGp89N6wwTdOkHqaTudxcOoadEDSAXrGLbff0cfvtFF9mIbUqsnASOhofs4nMheqsN0CAQlxa3wzDiVSa84aQxKoIS/AdlraRXqvkLeh8Q0f0CTQLiTZ6TcDkaiXALhkMMOMTEUMI+XJ2io1+VBYk0jlbkPurbVuLMJvKFqYqS4C0bsw5na5WkzuVA9WG7xvvmWHi/dyP6/P5NzumTbhbgzJU0rf5AJv0nNriMjtF9KkPWJTZIYtmGIXLKeRc8P/PNMwGn6A0iFjFjPxyqcyGTyAqkQLQB2I4pPVTsH/ZdKOBgNy8NcpnQUe++1eK9o/nJc9EPNhQ0gDucbzRjjTZL2Abz8S6Wj04V6zzx+fM+kpclANAO6qVOS X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 05bb977a-1be2-49a7-7b24-08da79d39aad X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2022 06:51:36.9279 (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: +oXwmDzdXa6Ic+cPa/+1ig//laDteLIkrauuXv0CvENjBifnBR1i8Wreh/hsirASy0PQpxj1nV+LC9TLe98uYw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8991 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,