From patchwork Wed Jun 8 08:42:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 12873060 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 75A4FC433EF for ; Wed, 8 Jun 2022 08:56:26 +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: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:In-Reply-To:References: List-Owner; bh=0Y8xXSF+Q7wyCjRXj4GHLSTk3T6OMLLxJBOUExnZU9g=; b=RNxKGiCHhCrtSq NFJDYdklVdEGajiO9PXhrhrm3cxAtoFRtAfCJtE8A5uQIAqGPtxcEvI6Y4ScVjZaq36enfmnVa3nN nl3NRKS8niPsCTi8d1sn+eEpL8bMBeNvUsfEA4fLJCzKCNoZyoZ0Y3jjeRNoDcvKqrHiSFqvj5UsH b+Le3fUHuaq+xLAX6O3v90j93MI5lqlaTJkuUqeeHYVrffQ9kzpI22Lo/zpOuDPvlx3wYhy3Q+MjO bJHXQnQ7gHumzyeSG7vdqGpzKV+NHPMbOi7kkhOOT/Jiuif1aiyacQBQclHw2Ia2Ye2JUAo4tu8ms aWA7M9BNx6didKH6NiNw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyrSg-00C8Cj-A0; Wed, 08 Jun 2022 08:54:47 +0000 Received: from mail-he1eur04on0623.outbound.protection.outlook.com ([2a01:111:f400:fe0d::623] helo=EUR04-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyrGt-00C350-8n for linux-arm-kernel@lists.infradead.org; Wed, 08 Jun 2022 08:42:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LnUiopSb4MG9xPg+Sf63ez6urxM59jaxjHnyBh7UsyuXUGacFcU9lvbp1W6HQQe+on8l9Ct02W65eDKJ4pqe7q1jCAwOybAsJyGcmqZI1JWfsUZ2pC/T3mIaUmW1BqsJsgZUuh2uCoYBmMEzRPyY6YxvTWrVkxKDEUTM31/ytfTxMAjL8aKulgs3T2EBjarh7NBwva8tSnR89jMLT32HwEAbfzCOTMVFhE9jxSplUEMCXU8h/oRAHhvj7fqkFOunkx0skcLc8j9SEh0dZ5CRGvAImpqyMzubxgvyRqvCssSAX/ndmVfl1dddehk51ZiQPRneUSCB6+afnGV3UDCPwg== 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=WnjUaKZ1geFV/gFOxTjAsxUJdZJfCybrS2o+Dffdpzo=; b=YaNRhwUIMwfM+H6U2/L/bRtvs1F7D/nzUhdMR9VSw2hFc8xI3xXlXnKWmphuqfn1MiBLUAmkJhxPfEwpv+/sLWBa9R9+2IbmoR+A2CF64ZqV9Pcm8u17KVPEpduJ0kPwf//tT/zU1Ksr2dZXr4+zZyLtUwz3T8+YSXJgfo/V5iIw3KEstGV5d52NlRsut/q5fuMNIi5Jei6HaHjoaEeE0W2904S6fRVRE/DVuUXZpNTAcn8qVr8To9hcyjw8w43r5lXRRBvhkxyXTAEogdWiUWA/Olxb9R0ujRafmDVr2buzL1GwowhYpAErFXwLqrpV56Meb8f15XiIavrjsTks6Q== 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=WnjUaKZ1geFV/gFOxTjAsxUJdZJfCybrS2o+Dffdpzo=; b=S696UaW90x+Q7oWL+uEnnzcdU+wl6ko1cZorx99zahtudjVeC6bD2aSyto/dJrmxbfy9ZIHog/Y5igmDWb308hdo2wJoQFfnZLv9hJYWncTaee0Er7P9KVFwL6nkavTHbQgJkDneNId2DOrc3L/GMsRvHrP8K32hIN3k2IIchK8= 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 DB7PR04MB4860.eurprd04.prod.outlook.com (2603:10a6:10:14::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.19; Wed, 8 Jun 2022 08:42:29 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::bc48:7565:c619:62c3]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::bc48:7565:c619:62c3%7]) with mapi id 15.20.5314.019; Wed, 8 Jun 2022 08:42:28 +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, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v3] media: amphion: return error if format is unsupported by vpu Date: Wed, 8 Jun 2022 16:42:11 +0800 Message-Id: <20220608084211.24369-1-ming.qian@nxp.com> X-Mailer: git-send-email 2.36.1 X-ClientProxiedBy: SI2PR01CA0023.apcprd01.prod.exchangelabs.com (2603:1096:4:192::17) 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: 53151127-1514-43ef-ebbb-08da492ad1f5 X-MS-TrafficTypeDiagnostic: DB7PR04MB4860:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9+NnX6Jzl0XvcEX0am+QXBxWwT4qYdb8J5Z8vwMkkmDw9xyH5Z7Z1pfOGlCHStto7WdwFot8LvDgbjwKjKc9uu+zWfBqD23Vkrvr7wZ7hr5J0UiqQNuP7soDHNrSuu43vyho03ddcvAee3qkDUppPEaB8dYH5Cdp7DtjSPO4QF0X2ZlgHpOPNWMvFktozyjkcrriaWkk5YcW1S4AAnXVNFy6e3XNUVRGOQ0WFBV3blUXGIGHne7yoShg36ISDVElIEZTQeLZdgZY4qXhqyMyZv2Hdl+13rgYGliP3Go4I5haM2ZQ0nvHFAJeTumOyLPxY+ya3ZFLoFhfRnyog6FsozXhGREaUnFmtD5hC+73FXTR2JiwgS8ifQTqU9csUbl0xDqVFqvRhI5jEBxA4onRuER+oXoQXAxYkoQaSFW8cbONh3s9vIdYmPAb0VvX4mxyNW8R8GYgO1svnjj64y+JIVsmfAmPGKCmQ/Sn//lc7Kb0wBLrfkiQD93PvB8wMiaxaiPIDf8PoIy9QPzBjpm0Vw+nIzngQrApEpXna6MDc+xKNgN0liQO7u4ZIZo72btPrm/fXu/JoIs9mKdPb1Vqw5RZmcyq9PfxRPsFz0pH6ghOUbyC0SjhFsyDSBHNExRitcxdeo5M+AxuHr0A4e+SXve6+00pC+AwxBnQte/auSGlLSkXxqgOSYH3CmclAwtHk59oythJLTSvmV+ug2+xEw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB6341.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(6666004)(66476007)(38350700002)(36756003)(66946007)(2616005)(38100700002)(26005)(5660300002)(6512007)(86362001)(52116002)(8676002)(4326008)(7416002)(66556008)(186003)(6506007)(316002)(44832011)(8936002)(508600001)(83380400001)(6486002)(2906002)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: kcGTVmjthDxmP/uLfc+cH8VccrQo0+Eh48HKe9xihrCIeqCwCAGYOC+FqyK1ziFG7T5zElu0SYrB8bM5QoSGjQB+N9x8IoQvErPIh70WMgkwY3uNaSL51Mpeahm8Kp3gNOsoaaFvzAiqv9nqKdWLb9A6VLYKV5kTzK7w0Y8oPwGfGeqgjiRzGmQ4mC8yQCEJmE+L0U9vmdQYfHy9WbdDBV1GRGN0LelCZh4biGX1buKErw73MvVMAKSmQzcl6+Q0a8tkuGBb3idSbMQujySSl4Y6wigFFqvOFwa6pio1a2dkJ6YmEpp9e/lfPU4b6mnGKU4XNl8mo2PEs99p6r07kvFdXp/oYFiZYKbiAK+1ER8OpPiIi9YU1qhDmLqv+C4pvfHvNRqmFOMz6z6QrZrCcJs6yleg9CzoxjvGa5qI3Ox6tZMrNPc++oQCsLYNSuQP8qplsUayk413M4xnnpY6Y2jNsSx+Ad0ki9xokOcvJPIRCX9yjc78djMVMcv6U/uX9uXIct7gBKcnDjEAeXALpWrfIi/jzwAsh0OdUn6pXgRd5PGqkdRCI8A07QsRPXeuRwATpg1zi62VmCDOIyovWu57vwXS0/A/gPNPzHw24W75hnkyWUoVEUcmqOhrreEsbugJfC0nd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G4+Jr4wz5w== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 53151127-1514-43ef-ebbb-08da492ad1f5 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jun 2022 08:42:28.9011 (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: 3M/lFXRiWWfHAOwAc+5SWCX6soRLK9YzSWzpnDfBQpp0x0RaELx87/wD6xZlPr7nvgUjt3bLINWjGQsgjsxzDA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB4860 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220608_014235_559933_67BE50C6 X-CRM114-Status: GOOD ( 10.17 ) 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 return error if format is unsupported by vpu, otherwise the vpu will be stalled at decoding Fixes: 3cd084519c6f9 ("media: amphion: add vpu v4l2 m2m support") Signed-off-by: Ming Qian --- v3 - return buffers if start fail v2 - warn on failed to remap pixel format to malone foramt drivers/media/platform/amphion/vpu_malone.c | 2 ++ drivers/media/platform/amphion/vpu_v4l2.c | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/amphion/vpu_malone.c b/drivers/media/platform/amphion/vpu_malone.c index f29c223eefce..40267c73b1f9 100644 --- a/drivers/media/platform/amphion/vpu_malone.c +++ b/drivers/media/platform/amphion/vpu_malone.c @@ -610,6 +610,8 @@ static int vpu_malone_set_params(struct vpu_shared_addr *shared, enum vpu_malone_format malone_format; malone_format = vpu_malone_format_remap(params->codec_format); + if (WARN_ON(malone_format == MALONE_FMT_NULL)) + return -EINVAL; iface->udata_buffer[instance].base = params->udata.base; iface->udata_buffer[instance].slot_size = params->udata.size; diff --git a/drivers/media/platform/amphion/vpu_v4l2.c b/drivers/media/platform/amphion/vpu_v4l2.c index 446f07d09d0b..70980cb4e803 100644 --- a/drivers/media/platform/amphion/vpu_v4l2.c +++ b/drivers/media/platform/amphion/vpu_v4l2.c @@ -500,10 +500,12 @@ static int vpu_vb2_start_streaming(struct vb2_queue *q, unsigned int count) fmt->sizeimage[1], fmt->bytesperline[1], fmt->sizeimage[2], fmt->bytesperline[2], q->num_buffers); - call_void_vop(inst, start, q->type); + ret = call_vop(inst, start, q->type); vb2_clear_last_buffer_dequeued(q); + if (ret) + vpu_vb2_buffers_return(inst, q->type, VB2_BUF_STATE_ERROR); - return 0; + return ret; } static void vpu_vb2_stop_streaming(struct vb2_queue *q)