From patchwork Mon Oct 2 12:05:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 147406 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp1592803vqb; Mon, 2 Oct 2023 10:53:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFmp/7aLJGIgVg9dgvsSQuWYyHcfgQ7kYQ4vy37sP1J830LOsy8QmCWtV1AaVPgBXpLo8az X-Received: by 2002:a17:90b:3d7:b0:268:18e:9dfa with SMTP id go23-20020a17090b03d700b00268018e9dfamr11142960pjb.5.1696269209034; Mon, 02 Oct 2023 10:53:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696269209; cv=none; d=google.com; s=arc-20160816; b=Kr1Lqn3hkV5pbbphmKgP2IbFfxdAOkGR2YtQ7N18UMGmHtdtvsYEdSfIr5oa0fDxaU 8vjS7qLVVBKYvXY4ZQ3xYFSCKMf+FPKSgWASJT/7KIDLwLwb4keHe/hwF8Yn09q+Gtwv i/KG43THX/yIqh9H9/S72tMzh/XApfUaBVE1xV3z5DG/IVdEly3uFa1snlBC/rCsCsGc MPquLuRJ2y15N3Q7VoHrYJ78KVBNGcPZ7MXkoPU2BioLA/t1n7eVlmTrFHyjHW0SdBVL k8QnhD8IFZnrmZ4O0LBg6eBsgYcMuCgN8EY5muP7LJqv2qFqThhcc3T9EPLNHQijQM0T uQVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=PmW7Z5NzQBNoTpp+u7NKXF/tYEVc6UqlJQkmg8Bhq70=; fh=ceA81l8d2hZW6pWH7VE5TwJxtgXUzAubfWIMcikPA1M=; b=F5x404ZJ5iWn86e+YMHL8s/f+AwlmaFTt74quEJabCOOUgQAv8bl1bU0jbFv+VADzv 9s7LhcU0Dz7YN7g6d2lCTQkrs9qupCELNU0RPCEEfzre5ealRsBudiLYTckPoVOGJ5ug NfjC+JlzX5lpsTozlCTdegSVGkvbF/IhaAgXgp0W9nfq5Ivh/fui6OkdR8tfuuCi77S9 JPlnsWmNSsXJMJGlExH7nHHELFzz2k9jZ9qQcvvfxmFEm1u/l+47+0CrA9gSADJ/Q6Qz qLr5mmzA0mMIAuov5erabrrYNpmnxZtYvfcUMTHcR5SnmFyVTSA0p0/c3xr9QfoKpn03 2XEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=bRiKkGKI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id p14-20020a17090ad30e00b002680abc3699si7743622pju.115.2023.10.02.10.53.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 10:53:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=bRiKkGKI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 937DD822D54A; Mon, 2 Oct 2023 05:08:00 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237298AbjJBMHl (ORCPT + 18 others); Mon, 2 Oct 2023 08:07:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236916AbjJBMGm (ORCPT ); Mon, 2 Oct 2023 08:06:42 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64BC1DC; Mon, 2 Oct 2023 05:06:39 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:9537:67ca:c85e:d0ae]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: benjamin.gaignard) by madras.collabora.co.uk (Postfix) with ESMTPSA id C3EAC6607314; Mon, 2 Oct 2023 13:06:37 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1696248398; bh=rFkYvrsLIxo1F3JyDJJ7M8J5xfn6Sk0yrCHC7ra2U7I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bRiKkGKIJuhR8tW633Q+S6cmt8zPYV/y99ED5+yb5zkJYu0g/GpVnQSmWnFyOkz2Y bhB7BzB/IjveUq8fucPgglDup4I3eUZsHov9wA612eo2HcnxvazFPWW6Z2m7FHeEpX FbafF2weqx2xU8NOBbDsBIF1xYDxaQQkt37Oi6m9MVZePbzBlysEJW9ldiEXmF/rvh w7gCSXZfLL3DFw1ODQpBOfku2CEsFCZCg+gEaMkMDp5UwmFm5ckf4pa9VhLlr/vsxd yzMkEO07cFYr6w5+g2kZwqAuA+jnRwkqaUxudUlsf6r+iPtE7YiwC2bwo4rHukp/dS Q3eEqxcfyBoUg== From: Benjamin Gaignard To: mchehab@kernel.org, tfiga@chromium.org, m.szyprowski@samsung.com, ming.qian@nxp.com, ezequiel@vanguardiasur.com.ar, p.zabel@pengutronix.de, gregkh@linuxfoundation.org, hverkuil-cisco@xs4all.nl, nicolas.dufresne@collabora.com Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-staging@lists.linux.dev, kernel@collabora.com, Benjamin Gaignard Subject: [PATCH v9 25/53] media: pci: cx18: Set correct value to min_buffers_needed field Date: Mon, 2 Oct 2023 14:05:49 +0200 Message-Id: <20231002120617.119602-26-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231002120617.119602-1-benjamin.gaignard@collabora.com> References: <20231002120617.119602-1-benjamin.gaignard@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 02 Oct 2023 05:08:00 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778667181891313450 X-GMAIL-MSGID: 1778667181891313450 Set queue min_buffers_needed field to 3 and remove the useless check. Signed-off-by: Benjamin Gaignard --- drivers/media/pci/cx18/cx18-streams.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/media/pci/cx18/cx18-streams.c b/drivers/media/pci/cx18/cx18-streams.c index 597472754c4c..6ed2c9fb882c 100644 --- a/drivers/media/pci/cx18/cx18-streams.c +++ b/drivers/media/pci/cx18/cx18-streams.c @@ -117,13 +117,6 @@ static int cx18_queue_setup(struct vb2_queue *vq, else szimage = cx->cxhdl.height * 720 * 2; - /* - * Let's request at least three buffers: two for the - * DMA engine and one for userspace. - */ - if (vq->num_buffers + *nbuffers < 3) - *nbuffers = 3 - vq->num_buffers; - if (*nplanes) { if (*nplanes != 1 || sizes[0] < szimage) return -EINVAL; @@ -286,7 +279,11 @@ static int cx18_stream_init(struct cx18 *cx, int type) s->vidq.ops = &cx18_vb2_qops; s->vidq.mem_ops = &vb2_vmalloc_memops; s->vidq.timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; - s->vidq.min_buffers_needed = 2; + /* + * Let's request at least three buffers: two for the + * DMA engine and one for userspace. + */ + s->vidq.min_buffers_needed = 3; s->vidq.gfp_flags = GFP_DMA32; s->vidq.dev = &cx->pci_dev->dev; s->vidq.lock = &cx->serialize_lock;