Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp247808iol; Thu, 9 Jun 2022 03:09:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyb8uIcbk0pb91HvqOcTGIJgRCNk0k/Pl6034zZHTCm7DESiY4qejHx9Ty+Ykvl/hPlYVoD X-Received: by 2002:a17:906:72c5:b0:711:d2cb:28b0 with SMTP id m5-20020a17090672c500b00711d2cb28b0mr17040582ejl.229.1654769357413; Thu, 09 Jun 2022 03:09:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1654769357; cv=pass; d=google.com; s=arc-20160816; b=xCLWjowiBDtvCjO0nl3QEWDXIV761WxsN3WWDvyqCmSdqNKwKHZn1w+8wgM38gfAZh MW8U2XmeGLWlW8dWa5rijjBsbh6ilQVR6IdhhxfonP1EzSQ3egt2Ou9RYtc1Fg748v2W x0oiNLoYSOPwU+13rxPW/uYnw4wEDCzX5OU5CbOgffqBg8htAtCZVWyrOeHh7ojHwh/d jAYVK/iH8G5Ca4hPGV46RMkykCMcin2zvg+tNfrzT31eLV6IYDCgOGZHcFJGr+JzTEAw 7JT8ilgnoRo/3e6E/A4HVUPRdmhAGCDIcvuwYpLXW9jGG4+Jk8wU/QBQP2FJLCaidLYF 3BEQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from:dkim-signature; bh=nkLnOR+lAfgLxck9O51tp8TaOaLSXCyvts1tWn7y1Ws=; b=qhxKB/z7OYoUN1k91Lwa5WM8wQx3efzrbf8Kz5vAfKY/sX83Hb+q0SQqaxjkne/eSC wX8eb4K6T+zWppYfSOZ4zt6b56adSymS+nK8hvezznp37Sa0jcJC6ws7tGt0spRzClAi PYtgRGPwsUQInWo5bdTsrGWngXFiyp6nyL+drBLzFOr2/wXu+NKiWT6DQCUpJtr94C56 pf9euZi/LXSYiRto6dMtvB5UHgZHGyxKyPBiCr+292kZP7+tXkkwE4ZAgWGiyd2Tx9ut dx8maZh5ECTAAyTWTyZ71oy1KL/KLUcbUPToxeLnl6O4DlMMDBDD4HUhoNbNHCCPhDUm PCQg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=fBdt0bVL; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f11-20020a0564021e8b00b0043147003320si4191671edf.527.2022.06.09.03.08.51; Thu, 09 Jun 2022 03:09:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=fBdt0bVL; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233873AbiFIJ23 (ORCPT + 99 others); Thu, 9 Jun 2022 05:28:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229477AbiFIJ21 (ORCPT ); Thu, 9 Jun 2022 05:28:27 -0400 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70040.outbound.protection.outlook.com [40.107.7.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC7581F2F01; Thu, 9 Jun 2022 02:28:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F5bZmDT6Ntns8ERuC2g1EP0WjDIdGgBXnnvD1lmPog6/eRHIUahk3HVko2AiVgULSQwq9/RhaaKMt8kv3iKccWluaoVXy1liVZ0FxJMCjAB8jD3QbT8EaUtvYfabfxQyPf/BK9MAf3NoTm6veWS7XNAvz7Z/l8VuZ84R0vrLvbxMa2kycWeVYeGv6OeGPTDoCWbWjIbZwHLRrJgfFN12P/nO9SnRK8uZeRCoQiBhe03ksilcXpzOkWVmCz1D9qOJyJ0eO2vC3QJghlIigsMgsDeQStbBKPzE1M/mdzd75V6Cfq1WIjeWZv4SiUKnRWXnWVBSxUV2CrUVukjlc3MZGg== 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=nkLnOR+lAfgLxck9O51tp8TaOaLSXCyvts1tWn7y1Ws=; b=CT824xfVl1v1doLVRbveU52+XgjUbEFXUVwDiof3FMd4WgVf8rWw8jDFHN8+QglztalDvm2DLTQQYvuEbc9J1J+DIWhkhyn9FI5GlEc4M2JIOvgMIq4DxyYIWRD4Bkr9XWW2KKOgXwDPNIy934jA+MANisyr3fI4GO+w7z79iTaZ14iorl2N2gC+JNXDDzX9y46ywmvzA/mXNGHmLNEPG3kJ/1dpfr00sr4WQA/w/xpNdU2ngKutucDevq2IPXXVqBoUkDkdNMv6uBNbSf7Gt6N7P5QnQ/0SCpF8CIxyw3U7TW2P1vk8+64JcKj+ATFfyzXAvz5HgcJvi3Og2n7UEQ== 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=nkLnOR+lAfgLxck9O51tp8TaOaLSXCyvts1tWn7y1Ws=; b=fBdt0bVL2jG5UsEy1DTy7Geqh2UIIX0N+Nk5otNdw+emZ2ug+pVkzqkdxxiM/hADH/NlIDgpXNa500wunlbEibTfS8J04ethnLig+JfqyVybt72TMdF+BUJiIMgNaZJZyykpNmwfKweIzjd/jGf4RNLOaKf0M1agRar/uCFksnU= 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 DB7PR04MB4955.eurprd04.prod.outlook.com (2603:10a6:10:19::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5332.13; Thu, 9 Jun 2022 09:28:20 +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; Thu, 9 Jun 2022 09:28:20 +0000 From: Ming Qian To: mchehab@kernel.org, hverkuil-cisco@xs4all.nl Cc: shawnguo@kernel.org, robh+dt@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v4] media: amphion: return error if format is unsupported by vpu Date: Thu, 9 Jun 2022 17:27:59 +0800 Message-Id: <20220609092759.997-1-ming.qian@nxp.com> X-Mailer: git-send-email 2.36.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI2PR02CA0028.apcprd02.prod.outlook.com (2603:1096:4:195::8) 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: ab691977-6771-4907-c4b7-08da49fa649d X-MS-TrafficTypeDiagnostic: DB7PR04MB4955: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: De0oGDlNIVFm1+zeenx+n/D22IR9st+phdhBk/nx/eE2JD6jrR+ymZVmucQPbNy0iX8lIHT8Ns0K7GkYAr9Dfy+ShPWnKXGvV+ZMiEhlVof+Qpe2N5ILNp9xlFFt4ib6jxGI0yDMI/a5VeKvIKsdEZAqfMvncrl5VYrXrPlz+tz94y940PXLjKGsGIAByW1TBvfo/SRdqisbVcvZ0jnNwgyrUJfGCsFXmbK+wuK9q9bhqcVQawTzxSMEdz/Mq7jNj3Mvd0Bxn/dgkIDxxdEY833c19BkpGKdOQvgSv7IruwXNNsmNxF+ZXxRgSnrpRNWiJ78Fhl/jRzKE/gzpCj6c1CQefl/nfOnbaxo/C518SOFU2DsrKVUXmfmdyNgC4UXQ7ILELtyxP3mNGu3MAE19Fyl4SxcaVoEwA4FpNS1oUNaA2gBm1W2Dh1O+iL2AmdXwzREteCGjUAw2zXWEYiDBIj1sVBQGVyQqALU96aQowaNI4WkDNrfKJdPFGK70ORQeN4OEkjMjf/bC4qdHBrFceGwLf84NsTdpJm4jg7S4a2QMlYT1PPMb7NBJQJbAMT8MIogPpv0C7Zck6s07khogwvq8gGIwLYLLuds6cpnHqANWrXmK9o70ujbEiYgydUXh0g6NcMWdqST0pEkuaJCxGxK/kRrQtzboo+Qr0WaTIud0M9v+iBBIG5FKgAOJn00UKQUJ/2lKq+Lt/LjqVrDXQ== 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)(316002)(38350700002)(66556008)(66946007)(36756003)(66476007)(8676002)(4326008)(83380400001)(2616005)(2906002)(1076003)(6486002)(86362001)(6506007)(5660300002)(52116002)(508600001)(186003)(6666004)(38100700002)(26005)(6512007)(8936002)(7416002)(44832011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?88WTXu9fswB/89PcYoWH9ne5h1NbW6yFaNZ2HQDvmKcwO3XretFVVvpJxSJj?= =?us-ascii?Q?IoXiBB+gA0QE0G64YOIv7jMBjurGDT7MAVmm84btnwaXRf22t85VSdyqRkUr?= =?us-ascii?Q?9laLxvH9KMt/8Zy06YLx4cVUIz12uPMAVtRxvbV+11THPJdTezz7Wyb55PEf?= =?us-ascii?Q?a7df6ZiIAO3oSbuDbkj1yChhJ0QVW/D11PSiEZxUN660lP3RMEJv6oWplqS9?= =?us-ascii?Q?42/JkrJccUqajsk43GViAExfX0E+VlixwvsjiotTNhgoi0uJnRvLpfgEsO/l?= =?us-ascii?Q?QCnjXMAM7gcC4hB7ZyQPwHSt6iz0bQoHCzejW/hJPCFkx7ilHJ4vnsIqjVvt?= =?us-ascii?Q?k1EQT5O5/wlkgGD8HqY8CKqdUay/l25Z1sS+ydpM8l440ifbjmkaFhPwRwnY?= =?us-ascii?Q?3Q2+M0FL0+SfL0iwtiOKX9OZ6w9XqnGVnyDYgqoh69QOqj0lNtEDY0lTCHez?= =?us-ascii?Q?OOAos8VCWicxBEEEtbZMlaAilw7A0TIwgle5PYl1s890e6uzr8YjFFhBcFvh?= =?us-ascii?Q?2Y6VAY1LVDnErxXh11ewp0vwtw3a3+kvs5of6GWXjv4jjR/V/uXz2X4ThKEG?= =?us-ascii?Q?x34YRl3A4YhY7K2Jzqj5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g/c?= =?us-ascii?Q?cUY0LCGAsAKLEdcK3gA3lMdE3FNK2K1DP6Ii4b6FH5E5l9MzNhxydKYD6yz1?= =?us-ascii?Q?yVF/fONKPgFah/eb4sYZ5aaL0w1JUcEX73mVlO8/Q8jvN5MkvjmE6i01cB5a?= =?us-ascii?Q?XNCBRSg+TXa23ePXXNVkzQzO+Q/wbncKI/kn2Pd2wbasgwju2sIZE7BYBhSu?= =?us-ascii?Q?JRC9EwC/eHM6RgKnU+r7FEya7CfQ6lhw/axVeGVEh2AzcfO/z03aViPvT/Pa?= =?us-ascii?Q?J3kkgaoArg=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ab691977-6771-4907-c4b7-08da49fa649d X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jun 2022 09:28:20.7090 (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: HwFQflxkw4w4c2JC/jkCIQdlGqPMqjs9ETdJLRSGfqcH2Jd9v+1wAztGAYWGfuOeX7eGKQ9YXNnRAY95Lpo7Nw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB4955 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 --- v4 - call vb2_buffer_done(vb, VB2_BUF_STATE_QUEUED) in start_streaming() 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..da455e5ab337 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_QUEUED); - return 0; + return ret; } static void vpu_vb2_stop_streaming(struct vb2_queue *q) -- 2.36.1