From patchwork Wed Apr 27 08:59:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 12828492 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 ED994C433EF for ; Wed, 27 Apr 2022 09:01: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: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=aaoHtOP4asoZMqDisSiCml4QTc4KM5KgySIqhRznJFo=; b=oExu8yRWN2lbRG I8uj586jVLuwfDx5KTgm8xCuiKd5sE5QeU/ajK/xzSax7WgDU81yHIgKnVN206j6mXIJQfnQ1WWJA YArxPH6DuIWvys7NagEZBF7oGmABGtVkil/eB2mkEkc2Ofvo/kpDP61uDSUbM0FUQEvqFairNITNx 3mazEcFSX5dUBRte39H3Nv3wk/rfNGDh1txAh29LbNi8YeIi959sv/wh82BGnKJ8YYtoqY5sGUQdr Z3u8QKTaJ6zhmls2Dqa4CE5U15DmXzk4jokkuMc7fb86AqlECiGWCgkchzchZ0EAeKEvzXtXJm7yC ktvoFncLs8kqBIWZivlw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1njdWm-000dSU-45; Wed, 27 Apr 2022 09:00:04 +0000 Received: from mail-am6eur05on20618.outbound.protection.outlook.com ([2a01:111:f400:7e1b::618] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1njdWj-000dQu-3e for linux-arm-kernel@lists.infradead.org; Wed, 27 Apr 2022 09:00:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L3naTwyAqWLL+TdPveaG2+rooOoKymPkZx1HjQU/Pzu8PPtXb8XatVDE9w0tV+0JiCb4MHNE9FhLDZj6eHjamypY9v0E2gDMiYp3SMPQ8dCmPuMFVcZrfO3htFRYJCQiqwuP5AhpooaJqrkLAl2D2lkmRlWPlTguuYPmaWMgjVHG/GEi+v4cf4jxS48WNrVtmtPNEsoRcQCfbCuzuUBL5QnaJYxUOZDYi5D0MprQtd+jMGwP78915kne7lG8iRLPtjfuBRPxFaHNYwcX202rFqVebDhbDlAXZWlI6DcuJ6UWOasGAzjUzgTwQ1gXOz5ltruRDgExqgj5caW3qM7+RA== 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=ubbCCIcAPd3Nnxk+w7wyfBdzvZkHXxXsz1AGw66Qndg=; b=m03HFrm+JPIz9zWgAspRehMwfkev1L1z1nZEyPas1oGoy8drevw7ntX/aTDrFw8aQZ4PbwnE88hR/AgmHQoLfmo1NOoFJ4zn2rLijE2m828jz+llSi3tbk/0Vo+HpJ0hovUe5n39lt+M68Np2Q7/fjdxAZCw8HgW8B9pquMfGqb8lGgpSEnL7VbysmX5G1UkuZa4mj3HdswMX8UUTIoMkkJ2UMCznDb+mFK/Mo5tu/sj/p+wj+mqyrNPKrJX5P95meQtxUTR4FuZyG8UhIfqLwAZ1JhmIRLXTDKpjtGN42MdKxR0spqSPyMTxw7J5156zomWkdov9tlEFwjA2MW2wQ== 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=ubbCCIcAPd3Nnxk+w7wyfBdzvZkHXxXsz1AGw66Qndg=; b=F0Asm6BjFZn3UKpK3FbglvYjffzUvCuSzXXjb7lhxgtr8nXOIaXCaCpmF/zFXvEUkVnT1V3xaYBDRqP8GZS5LU98LOhLhkBD86a1XYoTneyLvk0A53QpZslfVrNwWmVyeRn05n7d/NdIxPuSZm1Hb+fN0ayLvckVPVTj6eHQjgk= 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 DB3PR0402MB3786.eurprd04.prod.outlook.com (2603:10a6:8:e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.21; Wed, 27 Apr 2022 08:59:57 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::ed87:b085:802d:2390]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::ed87:b085:802d:2390%6]) with mapi id 15.20.5206.013; Wed, 27 Apr 2022 08:59:57 +0000 From: Ming Qian To: mchehab@kernel.org, shawnguo@kernel.org, hverkuil-cisco@xs4all.nl Cc: 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 v2] media: amphion: ensure the buffer count is not less than min_buffer Date: Wed, 27 Apr 2022 16:59:42 +0800 Message-Id: <20220427085942.18159-1-ming.qian@nxp.com> X-Mailer: git-send-email 2.36.0 X-ClientProxiedBy: SI2PR04CA0011.apcprd04.prod.outlook.com (2603:1096:4:197::10) 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: 49babb03-e5bf-41d1-6919-08da282c4d55 X-MS-TrafficTypeDiagnostic: DB3PR0402MB3786: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: vdq+ZZtaYuZStr2+vdxL3D5YzA/7XaOf1LPuiPD6ZQ+dSb2IP+SY0gqj8EatH3ZBKU43mxaZfSNxqu3fw98f/FHAldi9AveNw5T9Ngv6VrqztQZPOoDqRXCRtYFKlD0jkUeExd33ye5tGIpEBti5g/HO7tx7MGo+QAksLMBPRczBeY4+11PBTiPxRI0GDy4GZWp0YkJezxnwd8y1z3qZPllO/tjH5cL3abcFLhTZYcGa+17Wsh2Xupv0jSytf73bA+jAndtrK7mtfzf/OPJL8r6x0X5Ii4EhM7y23UT/jT5Llm9Ms311e4gJPWKce3PmExYeoZX+iOifQWpQ/7ayowbQ2J2aJsfCPEcG/0xP0ltnxX4/0GBDfnuhT4k+8wEl+ttt/VsH/rbEmjB9Ondsfkpn6mlF9u5sDp7v3RRYdlr71xOaaaLjVB5LdPFzarK631ZcuB1BLCpbQm0Efv/iQowzAUKiEk969olrl0MUoqeuGmfy+R/u2M7QzrNr5rGzrEOugXDpaz0KZss1vfy8QutVqtzmX/PhoVvmJAcyCq9gg//yWzEK12GwYAe0h94BxD12nLOXBFRLJRr059bUNrAxofk8vLwyDrYpEebvCr39UlfLyzyFTQTFeYjiJbMiHeGuvNz7zGWouB5L4pFxRk8B7Lbkfxf/nfwOnyAHP/EjTW4KWKKVFTSSWkXvEIxrVtwp4ZW7VRAr4S3QXfSCxQ== 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)(26005)(6512007)(6506007)(6666004)(86362001)(83380400001)(2616005)(1076003)(186003)(7416002)(4744005)(44832011)(8936002)(66476007)(4326008)(66556008)(8676002)(38350700002)(2906002)(52116002)(5660300002)(38100700002)(66946007)(36756003)(6486002)(508600001)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1MzNgUKwQuSOFKfBkoQHEMApGE4XcccS62C83/fW3iR1zO//venY8d8HkFXjt/XivbwPrG5kM9STApzPW3KaI69ZxAAr3NvaO65AnKeaF0eoFWLT3oiRpK7zFIytw2V0JIvXnQ7lQe+ZEbKiqZVtySDQa2RREvMKYgC3lsbVx/f1yvNgDQFWJBBT43FOVybzvLNQGEEJe85w1Um7qOpbX9OUG9kOB1bKmLHMOyMiDREpLPf4x+EULAzBjurM56dOiX8gZ4Ikx5P8HBo0G039YcsAM0fwij85SCzLs3WH/XUoCV/aZGjvRWICY8V1EXGqASmW/yTU/H/cfebWhdgRy/zYNxC8xfm+DNKDkRH+Vy/eFr87jlWP7IR5lVtkf3zaVT/DyAokYKRR1PdrwxsAP1JTpM2fq1kd51i9pMWnGF/5f3swfGN+4Oj+WIe9ykf4g0mp3+8vnx92LDDBW1k2lL/zmR9inky/BmPqQotGB+C/6LsPhpgsjAVAWWm7jExSJWjuBl0hxvqPVskVHUd/9hLMjcowPHRwfvNyn4lcviDsKp3NgSOGgKU9OyRcr0oI7+uKt3N+NL4LP8TQ8TrpLORCyalHMtYHPEKx3uGJTSBdtXCWamklJFmqzQaQqvc930AoYjgZlRUCyuolnrlz6h0ahaWS5iHu0hcb85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atorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 49babb03-e5bf-41d1-6919-08da282c4d55 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Apr 2022 08:59:57.0586 (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: pAviPkJZH05wwXlHIzGri1PE0hjkQOYIZ/2B4P4UVBXWaJRUGTLQNw6PI2wsa0QGSH0W4lS4ihwPTEwPCEvbMg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0402MB3786 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220427_020001_222308_B647F3E6 X-CRM114-Status: GOOD ( 10.83 ) 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 the output buffer count should >= min_buffer_out the capture buffer count should >= min_buffer_cap Signed-off-by: Ming Qian --- v2 - don't mess up the VIDIOC_CREATE_BUFS ioctl drivers/media/platform/amphion/vpu_v4l2.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/amphion/vpu_v4l2.c b/drivers/media/platform/amphion/vpu_v4l2.c index 9c0704cd5766..0d25ba3afbf6 100644 --- a/drivers/media/platform/amphion/vpu_v4l2.c +++ b/drivers/media/platform/amphion/vpu_v4l2.c @@ -340,8 +340,12 @@ static int vpu_vb2_queue_setup(struct vb2_queue *vq, return -EINVAL; } return 0; + } else { + if (V4L2_TYPE_IS_OUTPUT(vq->type)) + *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];