Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4459448ioa; Wed, 27 Apr 2022 04:28:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySctZZvNu0WCbF04q7uGs3ddkY+J5THR9pDNRsZvuYLXlD09CM8QEaXNR5ypjUbU32bUXZ X-Received: by 2002:a05:6a00:849:b0:50d:4069:60b with SMTP id q9-20020a056a00084900b0050d4069060bmr15238987pfk.76.1651058907680; Wed, 27 Apr 2022 04:28:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1651058907; cv=pass; d=google.com; s=arc-20160816; b=G1mfnXJ0GuRYoIg6jRM5HEjkFgO6mJeuTZrhvDj4s0dziUqUf1ezKLkfcONqpoj91v Bb/h2ri+v59+izFIhXVxomNp9BUkkVDTtAOhjVOBqS3gA6+m+kYvJ5rxdpzFuzh/1iAN epLJlaqGJIw3FYJDvXaRsfn0a0xVPWr3otQx7QTiXbZ4SyWXK4k8qcyLiBv8QbtZvPxu 2rvFfpDA8OOx017Yl9ZvFx6frfdMxDy0pMgrfn7C5Fs6JZjM8cOMY8xaM7gvqaYgJsFO QDrJOVPVg1I2NiH20hP5K5ip0Vr/fdW4V8pqf47B6ulEAJf0nYFzjr+jNt0WpN2PTyIu tkaw== 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=ubbCCIcAPd3Nnxk+w7wyfBdzvZkHXxXsz1AGw66Qndg=; b=OyEwYUCHIwq2KnCxZJ5l/J0o9SdDB0TvyZ836paTxNd7OKfF/yAuLy271BG6kNmwbZ E0jyq63Jnj1/FV+dUWnghXj6KM0WxgAEw2s0tJ1yBeozzUetBe4V+upyUfR6vkgnZh1U bLSDcChe60dGgU1ecX46tS+8OWuI1uU8ItWO+VlNLb3LQCF/9p+c7tNKxkeUlifS1H3C aPam6kNfnV9EZvZ16qgL7vaaltmFs9CTonuIW5TYw2Xv8c9CaZM/+ULRGLO4CrAkRNq6 VmsKJFJE/641eX720ijG5ZYjuIhSAT5FYAFAxpgs6qA/0riHPVO/ohZ0vVV4498BKKpM Ddzw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=F0Asm6Bj; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id j8-20020a170902da8800b001568acea014si1550635plx.261.2022.04.27.04.28.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 04:28:27 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=F0Asm6Bj; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 92644458EEE; Wed, 27 Apr 2022 03:26:43 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233715AbiD0JDW (ORCPT + 99 others); Wed, 27 Apr 2022 05:03:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231799AbiD0JDQ (ORCPT ); Wed, 27 Apr 2022 05:03:16 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2051.outbound.protection.outlook.com [40.107.22.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52ADCCC521; Wed, 27 Apr 2022 02:00:00 -0700 (PDT) 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 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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: =?us-ascii?Q?1MzNgUKwQuSOFKfBkoQHEMApGE4XcccS62C83/fW3iR1zO//venY8d8HkFXj?= =?us-ascii?Q?t/XivbwPrG5kM9STApzPW3KaI69ZxAAr3NvaO65AnKeaF0eoFWLT3oiRpK7z?= =?us-ascii?Q?FIytw2V0JIvXnQ7lQe+ZEbKiqZVtySDQa2RREvMKYgC3lsbVx/f1yvNgDQFW?= =?us-ascii?Q?JBBT43FOVybzvLNQGEEJe85w1Um7qOpbX9OUG9kOB1bKmLHMOyMiDREpLPf4?= =?us-ascii?Q?x+EULAzBjurM56dOiX8gZ4Ikx5P8HBo0G039YcsAM0fwij85SCzLs3WH/XUo?= =?us-ascii?Q?CV/aZGjvRWICY8V1EXGqASmW/yTU/H/cfebWhdgRy/zYNxC8xfm+DNKDkRH+?= =?us-ascii?Q?Vy/eFr87jlWP7IR5lVtkf3zaVT/DyAokYKRR1PdrwxsAP1JTpM2fq1kd51i9?= =?us-ascii?Q?pMWnGF/5f3swfGN+4Oj+WIe9ykf4g0mp3+8vnx92LDDBW1k2lL/zmR9inky/?= =?us-asc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o2AdOVNPlhH2v9Ja?= =?us-ascii?Q?Zqx0AE1sBl7mtBeWtLXBdwr/z9GfNlcndG2paxmjXxQ71Ab7idmHU24/ED4B?= =?us-ascii?Q?RVW33jP1VdsAx6YFjodTxoPSAydrWA6Juluw33skg+RTOtNEe3SUbs9eM6ZV?= =?us-ascii?Q?6/wX5NJtRjwWYGhcgDpbMjYmDM/nPrlSbxJWVa7T1Pi5BM1CvZIZYJxrCdE9?= =?us-ascii?Q?wgZO47iQa8zgADwKw7SS/i0iswbdKJ+EcdMbd2MjwYdRywyvOsdOYG/Cb0L2?= =?us-ascii?Q?VmLpjRc4h8PyJjEfAo+85KJHbt17JzK2W5QmIBxJv1H48qBICUMK/DneQe3/?= =?us-ascii?Q?4TB4bQhhy13GzM23D/C9qGGFQQyBRYZ5EHdD9l7fpjGnStXXPrVxyJM86SiO?= =?us-ascii?Q?varZ8QApKA=3D=3D?= X-OriginatorOrg: 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-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE autolearn=no 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 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]; -- 2.36.0