Message ID | 20231031163104.112469-26-benjamin.gaignard@collabora.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b90f:0:b0:403:3b70:6f57 with SMTP id t15csp363791vqg; Tue, 31 Oct 2023 09:33:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEs97IqQWdL//FpG+6WNqkUjeaWlSlUneQxTmiI4VM7tgOuveD3XrQ3jXzBcAOi1M60V25J X-Received: by 2002:a17:902:ccca:b0:1bd:c7e2:462 with SMTP id z10-20020a170902ccca00b001bdc7e20462mr13395145ple.11.1698770004040; Tue, 31 Oct 2023 09:33:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698770004; cv=none; d=google.com; s=arc-20160816; b=wfwjfpWP0kD8qPNWjn4lBb76Rkd1+3qrZlBcFZvQWS1VncvZ5fmr3Z6X6cDtu2icU7 YB9nDBN8muE568hw7vNz/5PmgLQqJaWSlmwIEZeuSwpFoq5yveJDmT0nBo8FBpTflW3Q shv9bHH4JUAX/z2Ztpv2S9k3miWzLV14ZXo18ABF/lNey8om1jGKBw6EMzRZMaSYOTa8 uGggF6SAYa6Y2OICBseXoskZsT28sHrIh56xgiPdsH2Qj4gESMQAjgG7NY0E/ocuKQO5 8NTmW65POZfusKE3u9zrP3FSOAnrE/dO6EPnaQf2YQx7fbglp9yjU0+F7rkm1kBLDAC8 uvag== 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=2rHvdHyFGT8YUTP5lBNMszn2pbzYaUtIyUsvYA8bYfQ=; fh=px7ZZE7zN+iLImfXStSrbDHf67f84nNBK9ImQdNvxt4=; b=x1pdRP3w5shzd4NnIV9Y9jEIsArP+jO9wY6k/EkQtsUKOODogn2MSbFbVAdezvt1Bj tONNthFHH7oo3f2A/vkSdtmlt5UOS52TcsW+3GZ0L0AZKuQNls4dOvdqb1a9nERyr2Qj HrzM5aikxq8E4L9wxBXC7ROa2OgSB94EAtfZ5BzL7cycLBsBuGWP3CHfWQmRNgfnHYpD ojdEuMLImpYaUbLWN8+Zs0mTENp11S+McdyVy/3dwKtGg/uwXTB5QxXZtpUIOjUT22Lb 88T7rMHMjQSaYWmKDfbjDs1Qp8tqSuk1LHzO6M4j1XkyEAgV25B5kae7rMWvYw1zVAeq AykQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=bHurycj6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id kh4-20020a170903064400b001bc74f6a951si1194101plb.250.2023.10.31.09.33.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 09:33:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=bHurycj6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id D7665801B9E0; Tue, 31 Oct 2023 09:33:22 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346364AbjJaQdK (ORCPT <rfc822;chrisjones.unixmen@gmail.com> + 33 others); Tue, 31 Oct 2023 12:33:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345498AbjJaQcX (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 31 Oct 2023 12:32:23 -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 3395FD5F; Tue, 31 Oct 2023 09:31:54 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:c562:2ef4:80c0:92f]) (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 EE9AF66073CB; Tue, 31 Oct 2023 16:31:51 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1698769912; bh=ABio7Fn7k/+8wlqN/VSwa9bzp38ffNKUWzBFOmL8pwM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bHurycj6oOxTsICCTaItqgiiZNkfVeiMnGOnBiF8GUU5195C5kmVnYc5yxEfJWjm3 7pxDOZhlCAIUdI2/Mb9LKuJPdK0Hgi0WLV3R62F+/Yyjqin7Nla6VSTEu4FGSDLZjO gbP4xdltT8HsGHvX8jRL5I6ATzBXT7tHAeBz2RdZphH/HxYPRdGMGQ9uSc3DdyV9S0 Tuo6uGZudwWFFq3G7qlc7zkxzsKZ8dU4bmz/Tc0aH+DSFZF6Z4/VCNz3Ko7vLC6Suu CUGitVZqBvZApf8KHZWxno93t0nwtk5Nz+wQeZDOhQApExh1jtxO/wKIXj3RqcGBZF kTWJARDwBMqlA== From: Benjamin Gaignard <benjamin.gaignard@collabora.com> 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 <benjamin.gaignard@collabora.com>, Fabrizio Castro <fabrizio.castro.jz@renesas.com> Subject: [PATCH v14 25/56] media: pci: tw68: Stop direct calls to queue num_buffers field Date: Tue, 31 Oct 2023 17:30:33 +0100 Message-Id: <20231031163104.112469-26-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231031163104.112469-1-benjamin.gaignard@collabora.com> References: <20231031163104.112469-1-benjamin.gaignard@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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, T_SCC_BODY_TEXT_LINE 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 31 Oct 2023 09:33:22 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781289455912524221 X-GMAIL-MSGID: 1781289455912524221 |
Series |
Add DELETE_BUF ioctl
|
|
Commit Message
Benjamin Gaignard
Oct. 31, 2023, 4:30 p.m. UTC
Use vb2_get_num_buffers() to avoid using queue num_buffers field directly.
This allows us to change how the number of buffers is computed in the
future.
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
CC: Fabrizio Castro <fabrizio.castro.jz@renesas.com>
---
drivers/media/pci/tw68/tw68-video.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Comments
Hi Benjamin, W dniu 31.10.2023 o 17:30, Benjamin Gaignard pisze: > Use vb2_get_num_buffers() to avoid using queue num_buffers field directly. > This allows us to change how the number of buffers is computed in the > future. > > Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> > CC: Fabrizio Castro <fabrizio.castro.jz@renesas.com> > --- > drivers/media/pci/tw68/tw68-video.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/pci/tw68/tw68-video.c b/drivers/media/pci/tw68/tw68-video.c > index 773a18702d36..35296c226019 100644 > --- a/drivers/media/pci/tw68/tw68-video.c > +++ b/drivers/media/pci/tw68/tw68-video.c > @@ -360,13 +360,13 @@ static int tw68_queue_setup(struct vb2_queue *q, > unsigned int sizes[], struct device *alloc_devs[]) > { > struct tw68_dev *dev = vb2_get_drv_priv(q); Why not unsigned int q_num_bufs = vb2_get_num_buffers(vq); just like in other patches in the series? Regards, Andrzej > - unsigned tot_bufs = q->num_buffers + *num_buffers; > + unsigned tot_bufs = vb2_get_num_buffers(q) + *num_buffers; > unsigned size = (dev->fmt->depth * dev->width * dev->height) >> 3; > > if (tot_bufs < 2) > tot_bufs = 2; > tot_bufs = tw68_buffer_count(size, tot_bufs); > - *num_buffers = tot_bufs - q->num_buffers; > + *num_buffers = tot_bufs - vb2_get_num_buffers(q); > /* > * We allow create_bufs, but only if the sizeimage is >= as the > * current sizeimage. The tw68_buffer_count calculation becomes quite
Le 09/11/2023 à 11:13, Andrzej Pietrasiewicz a écrit : > Hi Benjamin, > > W dniu 31.10.2023 o 17:30, Benjamin Gaignard pisze: >> Use vb2_get_num_buffers() to avoid using queue num_buffers field >> directly. >> This allows us to change how the number of buffers is computed in the >> future. >> >> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> >> CC: Fabrizio Castro <fabrizio.castro.jz@renesas.com> >> --- >> drivers/media/pci/tw68/tw68-video.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/media/pci/tw68/tw68-video.c >> b/drivers/media/pci/tw68/tw68-video.c >> index 773a18702d36..35296c226019 100644 >> --- a/drivers/media/pci/tw68/tw68-video.c >> +++ b/drivers/media/pci/tw68/tw68-video.c >> @@ -360,13 +360,13 @@ static int tw68_queue_setup(struct vb2_queue *q, >> unsigned int sizes[], struct device *alloc_devs[]) >> { >> struct tw68_dev *dev = vb2_get_drv_priv(q); > > Why not > > unsigned int q_num_bufs = vb2_get_num_buffers(vq); > > just like in other patches in the series? You are right, I will change it to keep the same pattern than for the other patches. Regards, Benjamin > > Regards, > > Andrzej > >> - unsigned tot_bufs = q->num_buffers + *num_buffers; >> + unsigned tot_bufs = vb2_get_num_buffers(q) + *num_buffers; >> unsigned size = (dev->fmt->depth * dev->width * dev->height) >> 3; >> if (tot_bufs < 2) >> tot_bufs = 2; >> tot_bufs = tw68_buffer_count(size, tot_bufs); >> - *num_buffers = tot_bufs - q->num_buffers; >> + *num_buffers = tot_bufs - vb2_get_num_buffers(q); >> /* >> * We allow create_bufs, but only if the sizeimage is >= as the >> * current sizeimage. The tw68_buffer_count calculation becomes >> quite > >
diff --git a/drivers/media/pci/tw68/tw68-video.c b/drivers/media/pci/tw68/tw68-video.c index 773a18702d36..35296c226019 100644 --- a/drivers/media/pci/tw68/tw68-video.c +++ b/drivers/media/pci/tw68/tw68-video.c @@ -360,13 +360,13 @@ static int tw68_queue_setup(struct vb2_queue *q, unsigned int sizes[], struct device *alloc_devs[]) { struct tw68_dev *dev = vb2_get_drv_priv(q); - unsigned tot_bufs = q->num_buffers + *num_buffers; + unsigned tot_bufs = vb2_get_num_buffers(q) + *num_buffers; unsigned size = (dev->fmt->depth * dev->width * dev->height) >> 3; if (tot_bufs < 2) tot_bufs = 2; tot_bufs = tw68_buffer_count(size, tot_bufs); - *num_buffers = tot_bufs - q->num_buffers; + *num_buffers = tot_bufs - vb2_get_num_buffers(q); /* * We allow create_bufs, but only if the sizeimage is >= as the * current sizeimage. The tw68_buffer_count calculation becomes quite