From patchwork Fri Jul 29 08:38:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 12932193 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 90FFFC00144 for ; Fri, 29 Jul 2022 08:57:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=EliqRHUga99H3Ouu5eBhqo3wN1LuS5vUxZhoh5kvKVo=; b=hXc1XzkLnbWe6H 5cwP3kZfATS4UrwNWMkTQQKmE9/kshZt5Nm1gzJXVaEzZD8TaI5ilFtA4P4sLAunZfP2/615aFY/w P5nX0r5SRSGWsh4PYT2PfUA1kXvUYG8JVCy6JeI9+DqX3w3+R1bUJN9tscYqVdopTvtuMGWIgbByq una6HlFO48WhxoVpqP6LwBqbBzDIGHqSM27aITcpXUWAv+aaD9I3DDbX3VzdQVQN/phMmFR+9sXmc jir5SvBSXrbxHpY4mffA1FuGrHR/GtcF31WajZW91hxffol8t6GqKBITzFU3c+a7nl5VvZsIsMndl Ma1ZpXaf2ivE8sTzFPOw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oHLnL-003Xu5-Kz; Fri, 29 Jul 2022 08:56:31 +0000 Received: from mail-eopbgr150074.outbound.protection.outlook.com ([40.107.15.74] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oHLWe-003NIu-5a for linux-arm-kernel@lists.infradead.org; Fri, 29 Jul 2022 08:39:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z6UvgAncUh2aCraEhG6Oj0w+dLk82QZVWsvW4TP+6bMWd7tz7fwsJNbl/fkrRgfYuPeHpYjzgn2Kd5oKUSUyrOUaLj+7q756axJiSqNOvA1zvqPxj1Mwj/oXPoHXRwj4zzi3s/Qg4xvEk34FEVNEL38TAAICq2oGYbzLA02smKFAgH44hAlTU1K10iNUwnwO3A9q+zr2OhgpyvyfXkuDNPfbBd96PxRCMTr4gVlzJHKbOgacJE2go4uBIitGJj9JLPz6MDteYvt2TDLli0Z3IZ83mH7IHIVCpwtMkioyCVrIkLZpDeqi2hYtPlNSf8Ugj6iI0N4y3zaNKkDAbLjKgA== 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=7cmFWcegIqFsEp+zCmcaHGqlwv5r14rBLXWuV+mA72Y=; b=C8Bi7zN+H3hsvFpmQ2SvpnGkzvZLmRb++8p8sej1UbEo9L1rQgBWpZP+5KFENEu5stc4nuJElLT3Zl4oJaMzGsXDx19ffVei6/3dez+oFWkQwK+/U6aR5hu5I6m4Ip8mu5t2ocmX5Rm5ipP0FOs+iaqe2w+9knrpbuPjKyYOvKdhCqLKctisC00diEmJ4AWaPbeEnufNwm17Av5xg/xQ1PpJD0LvX3p9wzEAw7ByqqQbMno4QoIohbp0vVQ3TwsbgN2ZRu1CDS6gETvBaV5pUGeanOcbH/2afiiTQ+V26/Pp9NlQ2tY65N+8BpCPIJFbjG1adBMnrkDSCPrxaCRjpQ== 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=7cmFWcegIqFsEp+zCmcaHGqlwv5r14rBLXWuV+mA72Y=; b=OulLBG6Lzbk+NvFzYWr2no6btj0WLp9wFXkp7ydA9YSkWUXwiApBOkNtFKCyZ1LLxnM/lvBwCecn4BfnAF29tKQ6hLWSYBJAmEYpmlOgmBmFFeutJzp2SyURMXVMRi7q8PQNkxNS+K8L1Qb5TQKPkZvPnlLlGtd17I3mWxIBBRc= 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 VI1PR04MB3039.eurprd04.prod.outlook.com (2603:10a6:802:b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.25; Fri, 29 Jul 2022 08:39:11 +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.5438.023; Fri, 29 Jul 2022 08:39:11 +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 1/4] media: add nv12_8l128 and nv12_10be_8l128 video format. Date: Fri, 29 Jul 2022 16:38:12 +0800 Message-Id: <687fb73b648b897426899c6a313f35a5e2451d69.1659082839.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: References: X-ClientProxiedBy: SG2PR02CA0028.apcprd02.prod.outlook.com (2603:1096:3:18::16) 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: 0b307778-cc72-4114-c24a-08da713dcf7b X-MS-TrafficTypeDiagnostic: VI1PR04MB3039:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EV4e+IJZffVT+ki8lo6ZnYUg46mw0CU3HfOMsUVd1oKFGZ9YcJQkf3bSRFGqK6fggjBDvLp/O43rLfJ225fbA/9yJqNXYRaMIg85S7gOOM3jLsHnoDlgWS18lzr+D56hawzH4+UWKeXbIvuVYEWf/rJVeons8ZKHhUPDop0c/OIgkO099/DQbw6RGuodLyGfVJmMslEuN8621KBCO2CDaIobevQyDWhuNl8/HyYLZ0nNr49CZKYan2qHF1uhg3l8k07sHIgaJH1IqD9ORI8j+iygLrNsfPLvvvl21pLuyRGyhmHkPwqOsDCEbl1iDhvUaO4J/puUtKtwiJWQPOthAyeHt1qJP+PBmlfTWHqYVCWBfpEGRBSEAhthcxBhZKfkhLvSXxB5sI/3yN59VKOGWjSz8ZHbyMXZW81hKaCwrJ8o+3jrMy9w1GZrCviWQAmicGSAiPmWpEvKpgS9fgsJf+UeDL3RU4NcLDFXyEXN6nk/LDMauAj7kZ/tGSlHShYKCSzFnl3za95OFd5V954NH5I5TaXzcrzegnYIJ2slSRhVFhJH7as3WBobwqK1EdK0/WdnZYj6vcHN87ojZbsgQnXUVAyd1ASwA4TGaymQSF0qyqiZdb7swgtDLQhTUhDIlUEyWNTTMzyZA1fE7m78Ftd2ZL667A0SdcrSSF3ZGJPvylNK6M03R/ybilPzBt00eJRe0g2uRMz5zELoJPa46x/wYCxXPqQxsdIMTC/y1uLKup0io6A1cbOovjeZRSvMmATdrirkZNGlNv4wQ4KuoryCdMi34p96kaqjg8JefEE= 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)(136003)(396003)(346002)(39860400002)(366004)(376002)(8676002)(5660300002)(52116002)(316002)(83380400001)(26005)(44832011)(8936002)(2906002)(7416002)(66556008)(4326008)(66946007)(36756003)(66476007)(86362001)(6512007)(6506007)(186003)(41300700001)(2616005)(6486002)(38350700002)(38100700002)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HlM9b/brA0oGqn4ln8iiWNOprFAMU33Isk7R2cjYwUfhS16mKAfaiPt7IF/rXYrdK2qH3zgrPc4BmX4BQG8Y6nhJ9QR9HFvuRU0uLlTgosl4r9MUdSByFuHlpWT+Q/UvrGVfZY/XIfALTNWpLri8azrfyT9KtMhm432eSfWmrwXAz/YhLihRnfYKRRICQZTmLGSZeRMV0X+eMjSU5MXAngmTkO6Ro03abBYuA5qAjHyLkZVIMi8ErHh1e0k7XgomkLmUxZZ9sofg+aPcGyUGww2RkC/SubYnsHfrKuNoJ1ymSib3Q26jzIOex0rOpBBp5u9iIZaM4SLmuXGrRHLKhzXJQ7xxICVKTIwHYQKOYoR3DXoYT5euiaHrKP1aAp1r808QfrxzrbtBZR3byKwUipWzx/UKCAKjt1v5qHxXU36lBSux4r2IzluTvJTSS+WGUxnR3PRIX8DWIY7wE5Mqu0dx4h2cxWTNHZQ75Q+QZLQU80P/VHUMQt4YCne4JPG5yOcPtD709nrgPhLNxlVHQ45UO/7DKTX1d5BiHerhL13veuf89fTL9YmQM2e0naxGgB0xFK+dLFIgQArdiWh7xry7j5scefMaVp8GEbR1sMSuVe2eN3BmlhwgWME9BmYyQ0yjmQMi+wzGsBJ2tV2fWKj9wLBEhFq6N3BZBfqaHZw3YU3PBHwu9zQ6ZY4uogXJ30BAa+Pksr1aMpF/9FdgLZF832oZKZEnDBIo3C1f82QucJkEl3tCuiEGTxILjJL9ycJOgzDUmT7L/PYMsotnV16pI3VUAXDEbfwxtmjQ/rafV3COx+SGyH9sFE99huqr+OGO1LcQjb5gHywwo7HCQ9tjz34JltQo5eysBkTTmaNiFFZDITKX0QXE/UEzEnijyKcPRVNmBO9xz5ZQjqIwJ5gQAEmz84TFtU8YTeyHfW2o2U9E+1DNKzuoZ6frO84TYYRt00zTH02WiiPRKh3b0tXzPW+mmMJX4/FHH6WsPlKjDolWc3qIyNkEum8of7HW98WlGu3Rz6gbKWdSNHOIEQrU27hZQnEoRshZBR7gXoELLEJ/Y5CUMkfSUfw0gSnGM6qJtASJcaFRJ2rQA8zBK3Z1bRk/xptXYnBrqnXxhlkOjuWIA0YqpChwXK2CG9cWzCFg/9lkly6y0BBDS2NzGAjzuNkc5Otwtns9DaZtNG8vOFhShigf0/mDQ1698GShlRkE8o6wdmA5/V1rjd/Cc7tobcC6raThaqY2xrFAww4eZwTF3ADx5zqtpYqcqbzbTx+9BZZ6pEyUYBk3s32qsvIju4d1GgWrzC74YVI0fkjyDQ+ove3x4Pr8izGPgEvxsHW0hYYqfpGEYuy0yW3gS1Wp8+1z7V0UQEDNqVg/5JDxI6pCNJRQk485u6xsmD/bPQprcriIUjXb6IxIMuTg6dpytKhp7tbgOnYr0BQ2bMsDGP/lQmS1NPqfwRmQp5Sez0MkxcyyUWYdkAgDhRNHcy4j0jFCpWjfY3ZZwrUXWYJUZ3SiMv2V0tSiI5KDE00lLKFEdKKb5mk07U8sUkTTPlCYVbncsozyk+9c38za9vsQbMSFDJcqQFZCJM87orTA X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0b307778-cc72-4114-c24a-08da713dcf7b X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jul 2022 08:39:11.5846 (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: q/IcYnZLetReJ1oe/vj4s2B3XrG8VbJQLaWErf6r9C1OksL90q6f4xuBpdL2m3Kgrn+hBwl/8h9XaFh+0yyfgQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB3039 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220729_013916_251205_03FFE489 X-CRM114-Status: GOOD ( 10.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Fri Jul 29 08:38:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 12932194 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A150BC00144 for ; Fri, 29 Jul 2022 08:58:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=U3xkv1KreCub73f1XnoG8qIX4RrkRkbQ+V5x0vDXje0=; b=wzDHaZx2OzDGHZ Ppl5I3UrloewzV9AJJrD/fZqVKb3IJX1cLg/0bHUwSVsIqJQz7sdCzjjGbB1yxMfyZGxPhfkvivV8 DLQTdw8h0R9Z6pkHuogBQ3zvMSEiHEWbZaUEiEqPDdWfW3Y2LAu6vpZhIFUZMaWvdQzC5WIOAeI8d km4Lt8VKsuZGA5a/9yLXfIHX7PcT9sqROQtE0gXJATbDX+/HNnvJ2AjNjYw+1ersUfxx+h/MtfBYV RA1vK/DgIbKL6pMg/xFYisvD3k5ZtrFGtmYthnSCLbMTbms8PI/vHIvsyHJ2kFz/fOFjKWTTTkZPo 6wrx9Ov1BKZt4jioOMDg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oHLnt-003YF2-CX; Fri, 29 Jul 2022 08:57:05 +0000 Received: from mail-eopbgr150074.outbound.protection.outlook.com ([40.107.15.74] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oHLWg-003NIu-5c for linux-arm-kernel@lists.infradead.org; Fri, 29 Jul 2022 08:39:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FoR4wxxMTonEGTu9JoNMcsoHzWt0Z5YFoBXZ+Pf23mzNUOpBY2tH990D9XwOo/6RjsjZWLF9IwgMZC789FBJvqKMTY6ZjW3FaJUN9C0DBEZhI2RnkI5lCqDAMYgUMJYnhegOgcvb8ZVYERuUIpWXIwbjTJwG4ootJc4ttlSBnn+iJnEZc6r8jcSPP6WwQyqlQ06ITOQR/HVWIjhvAADXIHc79h0iv4tY7lVgIXQ8PnIvQSPNkAME6LHnPvapzrguomxv23jpgILDOkkyWlzkHYTgCMl+IMitsY13RAMK/709CqUGCHeXdNzlSJR2aT68mTcyvc3GmInI29CpUC3yBw== 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=OTBcQp1xMVJ2zeH+pqibKXQgpaQ6sdUCpJOKAS1Ktqc=; b=RJMxIeYhRkfEhcAaXO8+QW4I0RP/YDm3pe9OVy9SEbfwbReqEZpV9nbT/sooavObKVl7V4IM4oSztTydkoTrypNaXW6/X+iJfJ3hIZfHpCpVWiwCZ15/spxTRPvGYgG1anKfuEKiPB4jpaxc8uqFRCjGHKCz4JUilusyocuQCrb6fBcrQeJ+EvdtPXtstKfsTHj4SRKhDLEbtyzjQTtJkwmfvYPeZl6XMXOB8C6il6v7jiHgKg+DYDgTmUEHEwB2YdRJhISd1PpnPVyyca3FEdyviH3eLlXrtDndTgJJ1E/AbKCz2Vqp7emHqkbX/7/h/xHhs8bn9zTGgBPxLS57dQ== 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=OTBcQp1xMVJ2zeH+pqibKXQgpaQ6sdUCpJOKAS1Ktqc=; b=HeH08oF9ljU4pEpP2FaUPTchc4hiI/gSkfWSjdALIPxZQdoedss5XVDzGgToNWG7j8FIhJYPaUOX40fX35rcv8PdgZ9UzBSNVuJuxIRUstowoKKNSCFpLaj7HzCxnnB89bdGOtmS3NY5VyxOs/FdBOM0ZGmoPZCJ9T1wqyBEDGY= 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 VI1PR04MB3039.eurprd04.prod.outlook.com (2603:10a6:802:b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.25; Fri, 29 Jul 2022 08:39:15 +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.5438.023; Fri, 29 Jul 2022 08:39:15 +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 2/4] media: amphion: tell and handle contiguous and non contiguous format Date: Fri, 29 Jul 2022 16:38:13 +0800 Message-Id: X-Mailer: git-send-email 2.36.1 In-Reply-To: References: X-ClientProxiedBy: SG2PR02CA0028.apcprd02.prod.outlook.com (2603:1096:3:18::16) 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: 1cc9397f-79ef-4c00-79cf-08da713dd1a2 X-MS-TrafficTypeDiagnostic: VI1PR04MB3039:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1GvLBhwVMT3+mDEb1yYSDzsmmSaQtzlC4LzCWKCVsSVLUTjuDi3FD0FILt8Cp7eRtHHVIo9hK+dXHVCUv+VNlorKvBFluoHhMZl1bU+wRM0K3kNDBwvUeD4kVwtRQD2RkeFFrkn1AElPUdOlKx9y+Hz/ZgaXt6Cx7hagmx/eorst+leMpiSWiREvYa+AnR8OYAR2AKwaNB2hS/gCUsKZpJo0XFPOmx5+g0qq3zl4DhgexlfJ8VlVZTHezxmyp6MEbHEYy/kQmppncS+oKr3i7Qr2sQxamcBg8JTodj7RnvaFOEd0662SH72LRdF4Gc1BhkVKQz5zJ/nhXHkhoV0puG/WZbYVFyEJPtQ4X869Fb/zjo1ijEqadO6JidYIMcMIZ+dKvqoXF3IVl1H6g0H64vS+ShVp2rDyEGeH2cQj0omn/KdJ5R/Xc48KJbYuzOGoUe9GVtl8EMylUJzzkz75rT3smnFfrC0oUTJlslWeGbaYkOeO5XZXrcmDi+uGe0bOf4ETe1G3kM8efvqrlYCcAHF9Zaylps+MNwbgHMptwVy+bSlAJazXK72nYw1TI041P58q1MVMGzyUpwnq7A6CyLzY1gtwMbRggDjzcAZ0tMhLdwnuv0InGlH8OuXYYTbn5sW240/HMn2SXbRpyxgCj0cM5VfSNgsPEiaLNKNmL219poPoAeNMsQ5FKQ77Xk0C1T4FQBpqmT0vXxGj/lh+Tf+Jcx8VdvWvReduOEhqAGNucN6T8Y/OnTXiMSgn9xt1GYo/SgHOrsfTFq0r4XnnpAV7AHmnbv9x2gZryKdA6c0= 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)(136003)(396003)(346002)(39860400002)(366004)(376002)(8676002)(5660300002)(52116002)(316002)(83380400001)(26005)(44832011)(8936002)(30864003)(2906002)(7416002)(66556008)(4326008)(66946007)(36756003)(66476007)(86362001)(6512007)(6506007)(186003)(41300700001)(2616005)(6486002)(38350700002)(38100700002)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: o7X/qqY6LpYfhUZZsVNLJOu0Hvt7I2syW+puB4Qc0yauSfn4gRctp1leEXOeFQ3NLH/uSddpnh0L/iVH0e60vrVZV5tiC0GHVaxGHboBp8Ff/qPHxPjRmdJNH2RfBOadHp9zyDMBliN1OuTSU2Q6KNOmDxfPTQujNTlBGiH+VqK6Nnur3NBf3Rhdip7TNuwZ7UiJEzO0PIF/XMX811iDhzXCnXgNxw0dJn6qulyTV4mXVVo08714hGNhO6gHIvJv5AC4nx0ACS818LEKld0MZ/BDo7hb10c1BxjYqYUIaV1hotOeXvCDXMr186q8e+aQU4QB0tKStdSqUxigMX6bEXm1nYSq6muq8SRJTjyCrMZl6TPa9nQZ3w7Eij+/TfAM46ioCy63BMr3cQQIH3C80V+5z3fOxO/XlRP7ozJOo9vU3XJk81xQ+a0/NkDZ5P1iW3hcuwUNvO/hnvbi6b5ViZDET2un6PPw8u1nsVRpzgT1J8a1NKu80zGCiO64sswDQQN8JO4KtShDutXRG6BccNkUcDWv5La2wfi5ePLh6pr4E5vEPRH3RDlfV709rJh/UFmTUHEAwUQuqAuOWCGd95qFxlecQEhKkrd3RyEnNKIXLbjMSdKtvAmN4bmbfKUTizYqpKW7RI3FklZtHlG0H7/McqoZ21P53iFumMLHgeSPBqrjSK4ZPs+J886T0yxPmV9T20jayWa4WM4dy6itcv+AQcQenl8FxLF43o49809zT4ahaRJwU5/lPQ+rhRZIBuLqN4y1a02rEl/GUCzglLyOlqj8oCKiP/gPBRFgyYJ/kaqVNtvxaxmcSG9kH3L4DUADll4oQ7FCW9sZPNdbERRVr+5QUsLRjOZoglabDgSRiK8LFyBm82nQK/p9AqWTkOjQ3kmr4hq2dDWSYKmC7ToJriVh5hM/UkAoBrKAWkVg8wUgORTS2PC5DZKl2cDjRLGFST63K1OK1dYgNunNBHENlTQZoQIJqNsEoAGPnYuNefhng2SQ9bioKUoiqMF6fg89G1ceZ537ZsZCE3v/qDynmfg0UDdEMJcl6Pbj68WlOmmcycK3nYTZnDUqRpqb7/4HrjucFSvRPu3xEMzfh7l4Vxhm8wdc0Q6I2y1w2JcoFI5IeEw1u8zSUL1Qg3uzckUhhOZP44PVfCuaatZ2uNsIA7/9ZzUZ0ui7pP+XOJ6qUZHNI5aeazW9vNLXkCmJE4GL7zfpxdzO3XqF1Ilu7R3Hz+qJ1s6Q3m0TPSrntCe3XXos/qvw00/pnLCJmwwkJPIgINg1gV1pw7bZiXG7+PmwoY095ZljoIhyWDAfDEE70v+q/230kSEZp0fKxk98hNRkHL03ogukYVw3R0s8tCbcI/EK5R/0zDxb+46KAgSql/FGwZ3wEPuIz4wJsP3nVe8XSLho4oMxm+ESa/8cAh4KL0kJwhpfpeD8QV/kFGXLcrRTPmullecZ+vYIEGXMrrREA4mSAoVe2RRPjfmZ/SIRgp7OZ4rkg/oFVahpHSUGu2Wwl7spSHvfPkXl/eQnZ+gDZ/13dNNZno0CSKWaNO/XjFxa7esvZ/d9sir4s1k+7ty2wkiWcPkxlHJ47tOg X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1cc9397f-79ef-4c00-79cf-08da713dd1a2 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jul 2022 08:39:15.3657 (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: shW2ztWL0smE+GYbaX/QknbN691qZPnUphLgmm/kE2jTc3D9DVIc8sR+ccdhv8o/fMN8NXLz3uJ2yu+Oq6Rojg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB3039 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220729_013918_422772_9673ACD1 X-CRM114-Status: GOOD ( 21.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 | 40 +++- drivers/media/platform/amphion/vpu_helpers.h | 2 + drivers/media/platform/amphion/vpu_malone.c | 3 +- drivers/media/platform/amphion/vpu_v4l2.c | 134 +++++++++---- drivers/media/platform/amphion/vpu_v4l2.h | 3 +- drivers/media/platform/amphion/vpu_windsor.c | 8 +- 10 files changed, 262 insertions(+), 160 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..b2c34424e261 100644 --- a/drivers/media/platform/amphion/vpu_helpers.c +++ b/drivers/media/platform/amphion/vpu_helpers.c @@ -59,6 +59,41 @@ 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 *fmt; + const struct vpu_format *sibling; + + if (fmta == fmtb) + return true; + + fmt = vpu_helper_find_format(inst, type, fmta); + 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; @@ -148,7 +183,7 @@ 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); @@ -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..e18aaf35bffd 100644 --- a/drivers/media/platform/amphion/vpu_v4l2.c +++ b/drivers/media/platform/amphion/vpu_v4l2.c @@ -24,6 +24,8 @@ #include "vpu_msgs.h" #include "vpu_helpers.h" +#define MIN_BUFFER_SIZE (80 * 1024) + void vpu_inst_lock(struct vpu_inst *inst) { mutex_lock(&inst->lock); @@ -140,51 +142,101 @@ 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_sizeimage(struct vpu_inst *inst, struct vpu_format *fmt) { - struct v4l2_pix_format_mplane *pixmp = &f->fmt.pix_mp; - u32 type = f->type; u32 stride = 1; - u32 bytesperline; - u32 sizeimage; - const struct vpu_format *fmt; const struct vpu_core_resources *res; int i; - fmt = vpu_helper_find_format(inst, type, pixmp->pixelformat); - if (!fmt) { - fmt = vpu_helper_enum_format(inst, type, 0); - if (!fmt) - return NULL; - pixmp->pixelformat = fmt->pixfmt; - } - res = vpu_get_resource(inst); if (res) stride = res->stride; - if (pixmp->width) - pixmp->width = vpu_helper_valid_frame_width(inst, pixmp->width); - if (pixmp->height) - pixmp->height = vpu_helper_valid_frame_height(inst, pixmp->height); + + for (i = 0; i < fmt->comp_planes; i++) { + fmt->sizeimage[i] = vpu_helper_get_plane_size(fmt->pixfmt, + fmt->width, + fmt->height, + i, + stride, + fmt->field != V4L2_FIELD_NONE ? 1 : 0, + &fmt->bytesperline[i]); + fmt->sizeimage[i] = max_t(u32, fmt->sizeimage[i], PAGE_SIZE); + if (fmt->flags & V4L2_FMT_FLAG_COMPRESSED) + fmt->sizeimage[i] = max_t(u32, fmt->sizeimage[i], MIN_BUFFER_SIZE); + } + + return 0; +} + +u32 vpu_get_fmt_plane_size(struct vpu_format *fmt, u32 plane_no) +{ + u32 size; + int i; + + if (plane_no >= fmt->mem_planes) + return 0; + + if (fmt->comp_planes == fmt->mem_planes) + return fmt->sizeimage[plane_no]; + if (plane_no < fmt->mem_planes - 1) + return fmt->sizeimage[plane_no]; + size = fmt->sizeimage[plane_no]; + for (i = fmt->mem_planes; i < fmt->comp_planes; i++) + size += fmt->sizeimage[i]; + + return size; +} + +int vpu_try_fmt_common(struct vpu_inst *inst, struct v4l2_format *f, struct vpu_format *fmt) +{ + struct v4l2_pix_format_mplane *pixmp = &f->fmt.pix_mp; + int i; + int ret; + + fmt->pixfmt = pixmp->pixelformat; + fmt->type = f->type; + ret = vpu_init_format(inst, fmt); + if (ret < 0) + return ret; + + fmt->width = pixmp->width; + fmt->height = pixmp->height; + if (fmt->width) + fmt->width = vpu_helper_valid_frame_width(inst, fmt->width); + if (fmt->height) + fmt->height = vpu_helper_valid_frame_height(inst, fmt->height); + fmt->field = pixmp->field == V4L2_FIELD_ANY ? V4L2_FIELD_NONE : pixmp->field; + vpu_calc_fmt_sizeimage(inst, fmt); + if (fmt->flags & V4L2_FMT_FLAG_COMPRESSED) + fmt->sizeimage[0] = max_t(u32, pixmp->plane_fmt[i].sizeimage, fmt->sizeimage[0]); + + pixmp->pixelformat = fmt->pixfmt; + pixmp->width = fmt->width; + pixmp->height = fmt->height; pixmp->flags = fmt->flags; - pixmp->num_planes = fmt->num_planes; - if (pixmp->field == V4L2_FIELD_ANY) - pixmp->field = V4L2_FIELD_NONE; + pixmp->num_planes = fmt->mem_planes; + pixmp->field = fmt->field; 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); } - return fmt; + return 0; } static bool vpu_check_ready(struct vpu_inst *inst, u32 type) @@ -389,10 +441,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 +454,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 +486,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 Fri Jul 29 08:38:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 12932195 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 33E30C00144 for ; Fri, 29 Jul 2022 08:59:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BsZxD527/TvliHo5KoBhMcHMBs9bikjavqk8Wmr/MCM=; b=SFNxaLsO9xP+wZ wGn0OXis4TOlGKT0c9BjbgW2WXFLtZdsHld++yCvkRuW4F5cr1ZeGhEWSNDgOWm7bgvBWpOPsOf4N ToZAPoth0+2juHxbUiZs7cqotjF+ARvlj5PPP8SmHwR56TpXVtc8W9PsPErMp3Wtx54ZavEpL8eVL Wsgk5L2b02G0kX1VZT9RgSpTjeIAYJ5o7urWm2PEFB+Wt6+phgGZoH+RjS53l5OSNg9DlnSxa/jz9 5uScQT8DmqrRDnvcnlcHnkyxssDMHQqEx5qn2PpRPAhK8J7m7ZHdQo2hazQqMl9Q4SFOS7uvQTIE3 zzSmGQROfFqk7gcGtSvw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oHLoZ-003Yac-U7; Fri, 29 Jul 2022 08:57:51 +0000 Received: from mail-eopbgr150074.outbound.protection.outlook.com ([40.107.15.74] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oHLWl-003NIu-SD for linux-arm-kernel@lists.infradead.org; Fri, 29 Jul 2022 08:39:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QvYhlPTn9WussMfcMShPe9KwSmxpe2GsJ/zK+hEvURWKIXOHO9R+72yD+pP/qt/EoXUHpXlV2aDNf4NovWgMrMfmz3mQAOxiuZeXp98gzJN6qfDtSZ8wLsFej3zHg5B3+pkrsdA5penjERanML3Lsy0Nh7Nbyu3ex1pK2JD6H7bab9AV23Hwq/n0wetqd/0YwIBp2IgHWb3kHgPKed6Qt86Fr936aBEEiiGJ/EdSS42UbO8cxn0RKfERNViZaPBPJdjrCU5XJ/ujxIvQ1QlzzuFo1tuJhFU3HCyAMNlvqd/hhaHZWxCsAutrCXXxPAmWxLu8Z+NFsNWteE21UEzMfQ== 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=XPZPsjVK4KkE82rZlmw4T95v9YAmy+iU2EebdwQloo0=; b=EoMZxYQnLyiAMLMwBLHYQrESo6vs7VQ6MhsASwmra5YDt0og+/r/yofGmKxkSMcFJMnx1UWAgyDVypp0JZz+rC+xHSKKkZH9KRkozgh5Wfy2VQov3/E3711Y1iwsWpluktNK4cX98EGRnz6qq6KEOGBQY7bQNedvuYplQQFrtAJC5nZmDAQKyuzTWLxxmuCxCMref5xpm+Y8WU4Ocist3DazZyffCesWGITTa3u5uRZqNGRAvpIZgVx6BrgWxgIn9yAY8BHkqT8W3wkpIPVuzae8R2Uf/gLdOW0nnS1Tm9OhfSYXdMVDyOrnLp7DbOwVSU1DUwfZyweQlLsah0+7fg== 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=XPZPsjVK4KkE82rZlmw4T95v9YAmy+iU2EebdwQloo0=; b=U6OnNQL/klC/mlp9PrUNuncdRgFXyMmLGTK9MaPbmHLrod3CvvpP+Exvg5BLOb0Zd/AmyjNb9/RrRe+QAftGr2n2D54Q95w6bhsUfNsaHqbatd/cJpVFbexaXg4uQlLJp30CJX0Bu8Jw1kYyfCrmSls3UjjncRhZ++wMpQa1Z68= 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 VI1PR04MB3039.eurprd04.prod.outlook.com (2603:10a6:802:b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.25; Fri, 29 Jul 2022 08:39:19 +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.5438.023; Fri, 29 Jul 2022 08:39:19 +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 3/4] media: amphion: decoder add support for contiguous planes Date: Fri, 29 Jul 2022 16:38:14 +0800 Message-Id: <2d0cac861e771a0c5f30c00f0159b7387a623407.1659082839.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: References: X-ClientProxiedBy: SG2PR02CA0028.apcprd02.prod.outlook.com (2603:1096:3:18::16) 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: 2cc9e1c8-7cc0-4bf4-cd55-08da713dd3e5 X-MS-TrafficTypeDiagnostic: VI1PR04MB3039:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2HD1tiQLgVCawHmDzmJj1kvPX5P3nwcU+PrE8EQfPcRKBFF/mUFWZanl7IKIUJh1+oMcRxcbjMnq+yMsZpBdbQ/mvV90+hDJxtJ05rgzHwnczijHFW5pa7rh8H5WS1RaQh0EqGOIKlTOLk4H6XcI8ngLu8TIbAHDM33PSjQOWWkRPNGYHhSAg8memsBWLZi8AnPj0I99CgFAVr16PHjgkVbbAh85h19Hqt4oc7ugtXeR5UqjWjWvBlBAjhsxAa1r5XmToFFQCHMhGlYq2wnvwCp8rHGnkUiIVLdpC6PViEVgQXitsOOTKvW9CYtDw98HeU0kU709vcxEykhP1EQl3jkihnzRcoMYur9x104Pv7UX+sW1+PkfQatjAtHBh8LX0dvrk6wCuSnXHIAw4yXG7vlqgZvWyhYVn2ffsS0QTGXzDUy0dCkjZHCWFz0Blwf7fark3XuOT9xrQgrivSQzX+Wca9j/Gq9t/QrISC0rGpu7T1B4czsmNQ7O1XTjPKmWXu/aQ7B0PiP8TklyczkzWrqJWzs8WAevfK8DDYjyw1CQEodW/P4ViF3XIytDoYchc9djVxS1covl3vC4LLFbcbWPMR+iN7AKT9eFLJUP/0PgOOI6qOwBgrxTwxMhwp3lxv9p3TtafladQWoX/rGEJIWix3+BC8NmVNmlc5Tq4boP4mos8iai2XK55o+KqrquCD/6pg9lfFOl1STyfSRZoe5tmaYH4n3MqPn4tY/T+w2W4vV4fuy7Z6k3CrwHi7cJ7JS6OE/S0uw/P98NFvoJp8MrQTjeW2Skc2qB15Gq+sI= 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)(136003)(396003)(346002)(39860400002)(366004)(376002)(8676002)(5660300002)(52116002)(316002)(26005)(44832011)(8936002)(2906002)(7416002)(66556008)(4326008)(66946007)(36756003)(66476007)(86362001)(6512007)(6506007)(6666004)(186003)(41300700001)(2616005)(6486002)(38350700002)(38100700002)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: TY1frztoe0truGV2pfX3j8P+M4pvs7ZFpjWft72JZ3mAJkGcGuH/9tQ0DsO/SG4JgRQeDAmdS+2UPcuQ2cXIZfvEgOAoycgQ18VeZs1BD0PbVhjrtd+C88ChPTnFM+DRHx+COrE/HTUXmZEGZHmaZzMfS6kdK6zvLKO6i1pthha/pykYBDy997INKx69M4h6jiZdqcbJ80YoPspUH7EKbLSr+xbJUXbGfOrtsUY/NVFGLoSslUk+Ic9ePM6rMAlr/AiGSmId+iPMQk7875zERMvrmtdZDxcaN5k0pfN7dppbcVD2xog3mJJ4mZPGiT0dJKiQbBJthG5H3jaueUa2TuuGbYPPh8OlRgZuY9KAK95rjqPmzvCwVtRbCv5XkJ8SQ3K6GThswjrAHCp+fjDq75JhdRH9nxUGbwJ5DZUVJ5Rgs0TqD7qIlIHz79TFLwKTA3uI1AznrU6d550mu9FiZBLAVUlwPnAaR1nTI4MPp/xGksyuEBlh3PmueCBZdgdYBBekmRMA+1B8H5xaZo63U9ewm0CcY/9lLXThjFXxJK12Sd9ob7d7J+Lsn+GZG25mALedyFpwJSjm/vPO3FP4yQzKUCHxcWDReqKPK2zuugJclyA+gFk5ryMlWqjIgfbrBxvV3TqRQQhKwGqVglNFU14YXsw+XSI/6Tt9dvJvSFH9uz48O1WGfqs6ixab9GuU/NDBLUz0u/awpOx9njs+v7MC+QAozD43jiwijvJQvlIs/ykliw9KKvS4G7SJ9aJq4j+LN4f2XcYGmZYNsxvmZ8OqGVZDSJ05o4LYmpD63TGofHD1YGGecaEZqycrV6gS6CZfgvr8Wfn8bDkxz1ZxWbcW8o3e4OAaRLCSG3WxFTGLRiSokDz+P4ig7kF/0a2uwPi1IYZTJ5MJslOQ7pjqQVzhq287zd2DrT9D7nEP0cLzqjJpjgV9hjPAigR0UY6ufTZqW/YfwSAj0Oqv/awmbRW3JD/+YHds7UZxvd34avJ35gKwFDn3GqVQg96Sdld8zHmC+h0gT0DZ8Sl2pID1Ms1q39Fjns+SYVyrgs1ddLx3zh0DI9hzGCEqLmODhD+OE29/BXDF39UuLp5W0p1KBW1w+EzBo11ukGgdawSgQqtD/Cf0npDGdRPtai6P0QiYRUfNWPYTzCY+IPRfD3l3lfDZD6wnHU3wrbFz900rz0EyA9TOMukDOoA/rVuW6DzSqI/pud5VHmP6vVlRhF3i7PKiKvAhSKYlcUCnZlAIFtsg9rYSKe+MbdljFM9NMvIonmWg8MMLEoTdydNUnu+RlPS8yxnOd8TNlrAZZcEcMZLnG8ebLsz4ftq+jejHsYnz574TRryVLyc4NgNG7o1WTEKJseTljLHlbws+78uSElxlZBoZvqE3Pryw0hlbtwrZpasEP7enRTdFkf/sG8/hl2sP/s3fF6GKUMT3gOFB8AOX0gXyfv19oQDG9Cfb+hN05xLoMn84aoowR6YJtkgLMj2ouecR2a1+Y7jzTRhJCDKaDi6e2bjbAXQYjMOogGAlEyPFepbVQZwCu/M71IJmQ3ih5Sotj6ZX5FihYVxXDxaWG2CSPq1kx7LFIk9/0OXK X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2cc9e1c8-7cc0-4bf4-cd55-08da713dd3e5 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jul 2022 08:39:19.1155 (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: q9NIPhHI+RV2P0iC1PhHXHiswTxnQDZJg4uZtGYQFsfHtLCgnR1L6tKmjW9nq5aSyf3zxRkz1xgkaydHpm1qlA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB3039 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220729_013924_057433_2B13D477 X-CRM114-Status: UNSURE ( 9.54 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org decoder add support for contiguous formats V4L2_PIX_FMT_NV12_8L128 and V4L2_PIX_FMT_NV12_10BE_8L128 Signed-off-by: Ming Qian --- drivers/media/platform/amphion/vdec.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/media/platform/amphion/vdec.c b/drivers/media/platform/amphion/vdec.c index 48ab664fa7ef..9c3324717cbc 100644 --- a/drivers/media/platform/amphion/vdec.c +++ b/drivers/media/platform/amphion/vdec.c @@ -72,12 +72,28 @@ static const struct vpu_format vdec_formats[] = { .mem_planes = 2, .comp_planes = 2, .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, + .sibling = V4L2_PIX_FMT_NV12_8L128, + }, + { + .pixfmt = V4L2_PIX_FMT_NV12_8L128, + .mem_planes = 1, + .comp_planes = 2, + .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, + .sibling = V4L2_PIX_FMT_NV12M_8L128, }, { .pixfmt = V4L2_PIX_FMT_NV12M_10BE_8L128, .mem_planes = 2, .comp_planes = 2, .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, + .sibling = V4L2_PIX_FMT_NV12_10BE_8L128, + }, + { + .pixfmt = V4L2_PIX_FMT_NV12_10BE_8L128, + .mem_planes = 1, + .comp_planes = 2, + .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, + .sibling = V4L2_PIX_FMT_NV12M_10BE_8L128 }, { .pixfmt = V4L2_PIX_FMT_H264, From patchwork Fri Jul 29 08:38:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 12932196 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 05B51C00144 for ; Fri, 29 Jul 2022 09:00:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=VO8X5pBa7OQde6b4WWG/jiL6bHNqfOVCLmjOj3EnF4s=; b=Ur/GkaMIQ7gpEc qCEGTJmWC9t3CmypNJwpo39Zu3LWG8i80tw0josP9e2bvV+8+k2Gab25Z3iGz9S6VWpHVDqU2Rk5p XpZRS2Pix/gKK9WzpDgJ6ML58MSJlKOPrtSXvvUq+rAljXaYvKM50TSyoDCNVVF2fvB0FyiLRMz/f HctLPgm/aCfawpm8eWxbK7BYYQ0c10lr4sAabtiNjPbLyNrkMAp8T/ZF8qf2fsA4/PMhC4EFWSo/d KfxLyybUyeOpAiOQnJN33m5PNgXhXIJd8tdwvC+13fO16GlVR/ZMChNLghsT7JwvE8o7+m6Wcj+Vr AZDQ6yV1SOazzA5XW4Ow==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oHLpH-003YxV-Hp; Fri, 29 Jul 2022 08:58:34 +0000 Received: from mail-eopbgr150074.outbound.protection.outlook.com ([40.107.15.74] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oHLWo-003NIu-1m for linux-arm-kernel@lists.infradead.org; Fri, 29 Jul 2022 08:39:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ke+O9YQ7QKL88QrwCVLIMJRzgbVNZRS8GUmHd765FkVVYg7HnHKfte5csuP3VOjzxOKNKHIqqGe1mGbOy8XcOO88+lqJqVcOrTXQM2u3SzCQd//ZRtAHYySLjqO9adrZ/S1lsnOK8FfFx21bhqgKKk62781DQlC4Eik9ia2ndC3EjizNOlr3FTx2+ed/yyVkHUf+cf6s3iTXRMwHtGS8CjMrMqeNQQ0NzbX+3HGQ5NTgkC8jYCL8V7k4liW2GzM+rrd9T+wdTD9vfVulEuBANMzCDvSp7pVTPDmO9e5z3YjpWUoGGRbMSDZJD1BxSdNprVJ2YgwnMNvItM261+5jIg== 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=TBttICur0Y0q9/qXOVqRA9P0MD5zSZxqwXPSaoXuvHc=; b=Jg2Oxd7lJLJdbohFikfzLp7QbT8kuLFbzUrslVyePueK3sbCDlyRInQvQNlgsu+5gr8VHfU+jzc96wRFBrQZqirwdMuWrYkN50d/C4XsQ2EwVCBqcyRzcyH9Xv1xXReslBOV0v2tN4UkuHfYb51T9WNcb7dnc/6ltPSuZRZue+2cxY0pgt4OIV5hDDMISzJKd/QK+Oqz4oKJfLTYNkfBIH+vu891ADVS0jYHWp/LIFEf0qntaBGerSg60HZRCDVcFQR7FlMa8eA2EssZcUf0b4R6A2MoTiYVeQL4rloJ7jE3j/3jn0F0m1pd+/SZHKN2mlxBnnB9gd+FP1CAhU21eQ== 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=TBttICur0Y0q9/qXOVqRA9P0MD5zSZxqwXPSaoXuvHc=; b=U6YdUX07zORHL9F/N3d0tt4hWn5CAtS+UHpU1hvqEe8Y8BRRS42UDdLtRpvj97PMEH+naLQRfikcv012jAy6p6hL5S16FA4JMClnp01OMd1u3UlchKuISmpSStgJPRc1WXvQVhnvCtiU07vWFzbRH1RkieD9+1t8W3zkSe2w9Ns= 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 VI1PR04MB3039.eurprd04.prod.outlook.com (2603:10a6:802:b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.25; Fri, 29 Jul 2022 08:39:23 +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.5438.023; Fri, 29 Jul 2022 08:39:23 +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 4/4] media: amphion: encoder add support for contiguous planes Date: Fri, 29 Jul 2022 16:38:15 +0800 Message-Id: <07ed4b29871ccec0eb1bcf497f7cebdc94d5aac6.1659082839.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: References: X-ClientProxiedBy: SG2PR02CA0028.apcprd02.prod.outlook.com (2603:1096:3:18::16) 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: 632ec358-0417-42af-d10d-08da713dd639 X-MS-TrafficTypeDiagnostic: VI1PR04MB3039:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oCOzhqJx63ISfF+whxrkGV8yKMpU44RPz5P+7icMZt24zQpKTdRG2wrSeuQ/1g3GEL9uVPkYXI04ov4+hVVe5m13Jlf1AbBSyVii1fXNrHHIcOE64e1rXaWtjAE/mu2hyx9kv2c9hFwiCJQsGWVpr+RClEDbbLVLR8netATZIb7LDmKjC+hVYh5QrbWja7qy1ibYOQ7dE/sE7XHCMcbcOCo0PYwp4zwE5RVZ+ISj4W01/j604uoEzPkBbXODWwFO5QM4Jlv+2I6Yj6FQ++44b+x6K/VoPaWADsmg+iHsEKc2MmZsK99TUoRM/gg53ZzHMXBkvK6KopH3q7oF4TA6v5MPsbW3XLBcIbtyI7FuEmPBaodn0duzd7+zqF4+Sn7MnURqhVBItX0PascROGSwb+qTbHBidzwL/UIF8tjOfZroGCDJ/lRzWoV73PeSpx3LfSSAV9+O3+nizodWliKWvl3yT1no7aQZ4eWHhwqVF7cWIO2r+lNdT3QgEE1c/kNmsOZ6KwyVuxbXeimiJ31q6tOZHNuvZBq1rQh8spFq3cCvsEyCy2x22Ssh0DaS5zRTnrrhKqihnWOtCIg9mEcBNBo5b9uLPpicLd5aW+7C54RS5yUo4mEfXNQ4nZ8PMTxEqBSJEih/IzbORcR8ahuLQGGUXFUHrTgZ1XPXdC1jNAeRbq5SBiQxPvUAPBl++ISdnD/UcLCbqtp124rdxhKQR35yHtsv6ApUjwlOQSEp/5aNGsbAVejWElZDEvHTLTckpx/sTnybzuBknBK7BfU76sihPB+ah8zXJKeFwytEG1k= 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)(136003)(396003)(346002)(39860400002)(366004)(376002)(8676002)(5660300002)(52116002)(316002)(26005)(44832011)(8936002)(2906002)(7416002)(4744005)(66556008)(4326008)(66946007)(36756003)(66476007)(86362001)(6512007)(6506007)(6666004)(186003)(41300700001)(2616005)(6486002)(38350700002)(38100700002)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: UBIKi3voGfpZjlBgD4S8InX+v6zA8NNANOmItLiJbuqGY0q8BsSLbqqzjJ5k1q6Q/E8OZW6mwYHJtEZCID6ERGBZ+xYKz63iLbzAyol0kIZMJKHB5IMQQIhaIyCVEvou60LRaRzaUXsACVaRUVFLam8zIm6oyLjae04AVhS53ZNAy28wiUKDKt13TXeR442pJISpN2at5fAGrdNLg07zZ9Tz3zRZP0qzqglJ9J/CnEX2pYC09Aidusunoa7o7aGdTektyWDd17wcizwJHFHe0R6Rw7k/b99IXyNTC4p3THYeGzpZlYCFw5F4bx0BSSllfAB1kze5DzPzD3kUmnEhepDXhcDFFV/15/W2CV/wcaATDru1ykX3mbrwF5AgVZQ/wQTixOTcZtIPv2bFZ5qOjmOBRqccUHhUqysHlqE8Rf5Q8dnRhhlqHHOako78cMkiQmyY2vhwv5myDSlFwAoOJbKd+R52QA6cr1FonwMgMSzfF0MUS7Ur9mv7cobVocyU26J1dEzH83OzBI5GITi5+9uoYaydQnyN0NlyFlpMTKzuRbpwl6V2tjA/g+5Ci9d2pEoTOp4J7GLFjiIWSGqR3sjItYjg/herVDdApbT48I2P9zD2YBmoPA1psj94mhpTNWW+PQYNt4vlJbFHtcdjbjxwnV85z9Yolng93m2bpCBjcfkr9tQH3r4+5yus8ysuP8RVPOyFjxz0l5X0wmLrPVnDYV5TgZDUvU/a8QVXSZTE9HuiPc/9EOKwvEvw0XbEuAajriv1MmuKGVmlUYJJWt7mUuUyZpove9u4EVbbqVJX745x/n2npgef+3QRbLEQq0+2jTZMYNw07rctwXqROWraNfybaRbV5WNm8psswOetHUOJr8lVXGhzrGvTjFEL10ldsKyFIgBZCSSggZN8hWDj+fNFR6dWpcPZsRuuiy0ssAhfK42870jVgURybrb7itQPg5TtTqVCh8J0jv69fkKN0dA3elUGlIXtrkezp5/HDWXs3RhpXGi2AszMvVCnLJXrkJ83HT6jMiGtZAp0D03WoyIatU77lR7sLMJOGbY7LG8Bl9tY3CXL3956jlzCVaInAH01cgRamVDf9yy7JSOTnKWJBV8jyHS4IfSRy4b+Sehw15kMDVun/HFDvAvO2Uzs7rptU/1A6yWomh7wG/oD3oAQ3ZRdzgdqw/Nzxz2qiph4J60elvSOoVb4qI0Yb9x7YBvRu+SBrPNZt467tapq3JPF+PNPbxAci8W0x93xvZ3hXl1WrV6J4t7I0tqA+Ko8JRcEkuBcHjPBTUfNjhdDO4YuI0ufTTYWFO7Am6Z+sTjQiCZYFxApKK8MPKgzuSjTLJm4n2fFjaM928otVCzBYoHwVR/sLc3GN8GnfmOXayztkM+iNnOHUSy6Ujxz40PGokpR9bDevcCXv6gkBlnx8GteGJwgvTr1RBG0kVub25smrKq71cnmtC//gx0+kh6o9a8oB+5NfZ87p9pE+lc36lob+ADK5EsY1XnmgRZNluqeq/gzYPEVb4hk8hBECw2whgDcIfhR6DK/cRiZHTS95WbxFMjWFjmo7tfVXbFYf9JSArGCnNTgG1XAmGn8 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 632ec358-0417-42af-d10d-08da713dd639 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jul 2022 08:39:23.0215 (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: Rd44vUCFFbU1ld1T+jvTdEYeP/5kFal2huT7yfvvijk4wzh3OPbM2x2P/QZbgaV1D4TLpkXgbR0D9dthNMwiwg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB3039 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220729_013926_162603_0CB7BB03 X-CRM114-Status: UNSURE ( 9.63 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org encoder add support for contiguous formats NV12 Signed-off-by: Ming Qian --- drivers/media/platform/amphion/venc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/media/platform/amphion/venc.c b/drivers/media/platform/amphion/venc.c index 060a1ee78b17..3cbe8ce637e5 100644 --- a/drivers/media/platform/amphion/venc.c +++ b/drivers/media/platform/amphion/venc.c @@ -72,6 +72,14 @@ static const struct vpu_format venc_formats[] = { .mem_planes = 2, .comp_planes = 2, .type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, + .sibling = V4L2_PIX_FMT_NV12, + }, + { + .pixfmt = V4L2_PIX_FMT_NV12, + .mem_planes = 1, + .comp_planes = 2, + .type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, + .sibling = V4L2_PIX_FMT_NV12M, }, { .pixfmt = V4L2_PIX_FMT_H264,