Message ID | 20231031163104.112469-23-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 t15csp363592vqg; Tue, 31 Oct 2023 09:33:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFUWlkyZydrkfZdj2H7Nl6ITs7UIItvsiDitSYmdKKrASYXmHnCM5OvbQcJELJz+6eR0+8r X-Received: by 2002:a17:903:11c4:b0:1cc:6fa6:ab62 with SMTP id q4-20020a17090311c400b001cc6fa6ab62mr1412615plh.29.1698769988022; Tue, 31 Oct 2023 09:33:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698769988; cv=none; d=google.com; s=arc-20160816; b=vre735As1JRJm92v2LFTlcIG9b7RLucDRP1yc25rke9p7XhJ+rGv67iKJKKDek6fdm d2fDH0FHnhhK/hyqjddxeIc6oPFjD+VzXO7DSZqg9LEdHhbhWCV7rMZVufitnXfBMh7A sgwwG8yUiXLpqSr5wX2Cc+9eYXMs44v/jmyewMNeNH+D5l4YopBs2hSAop7CeH+1th60 vsgd+OT3vnY/OjiVW+6HHEkscw7dCW7MkL5OTeby6XK9BexjJ5q93W6px1bAjxMFr0RW rIocDrp0k15M9jaTGIZCVL6j5v6e3T+FqThvIblYVefFs5zIOLeqbode5RKzCmOZT6TS LswQ== 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=Ts99oHtPdgNsMvrVJzeWI3ReICZfm5oisnFd3nbTPcA=; fh=ceA81l8d2hZW6pWH7VE5TwJxtgXUzAubfWIMcikPA1M=; b=iDFxBTHShx192i5uRLGNsuCS5Se2g4wVKDvXqGG1zz8Vr85GlYoqGnnl8GnrRweVfx Bqa3e13iRgMSGOl6CDsHK+OMLqYllX//HYKbdkwO7EnE9qaUIZkK/ZAY2bwhrIttJq7O xE8brvRc/gNru9tJaNuwnR2x4ekT0sD4F4idWZr4GavgijYV7lY6Bpb5upJ8PGCGBJla JDoT6d6PWB2FwdUqDSZGDJkMqTebJ9fk/s0LIURcDdamG07IM7vN0DsMc+AoXMZs2jif MOE8Si4mUigp5gb65ChikLijpZCWzKy3bJ1iJvZkfz2wCh6LMvN6vk9pJa/xXQx3L1ow diww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="aOLb/kZi"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id n15-20020a170903110f00b001bbdb34628bsi1215359plh.289.2023.10.31.09.33.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 09:33:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="aOLb/kZi"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 26B93801B1A0; Tue, 31 Oct 2023 09:33:07 -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 S1345451AbjJaQc6 (ORCPT <rfc822;chrisjones.unixmen@gmail.com> + 33 others); Tue, 31 Oct 2023 12:32:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345979AbjJaQcK (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 31 Oct 2023 12:32:10 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09D9CD46; Tue, 31 Oct 2023 09:31:48 -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 AA99A66073CA; Tue, 31 Oct 2023 16:31:46 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1698769907; bh=E5t1fwehdK/+tA+H+9HRw8QC5ks/Zk2E0Mm8Cosvu64=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aOLb/kZi84KwygRqKPOTlZTb8hehC2pipcTIVM4XC7p4yzcFYVasbGADTTfDNl6LN Fbhms33tFrb17yu2BwejjQ6Qe9qasy/Ty2iseT8B5j958MDVwMZJnwgJLR8zflO1ZY iSEQuPzjuOuOg6rMQruhMv1IM2ABUi410FwFca/l5ZylPitJuPaY7eGp6l/ySqg7Eu P+tDHT8C+Gu3yhy3Sk4O5XEzWMrLS3k2h9xMtgbsxWxFj5VMCqcjlCs7nFRiDF0aZe wWByhFzn7U6UibrAq/9nSPp4UfEnTefMFSjxkoScGLwHkw8WgTc3Q9eXueErIOVvCv zWzUOhLREPfrQ== 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> Subject: [PATCH v14 22/56] media: pci: tw686x: Stop direct calls to queue num_buffers field Date: Tue, 31 Oct 2023 17:30:30 +0100 Message-Id: <20231031163104.112469-23-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:07 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781289438813108332 X-GMAIL-MSGID: 1781289438813108332 |
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: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
---
drivers/media/pci/tw686x/tw686x-video.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
Comments
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> Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com> > CC: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> > --- > drivers/media/pci/tw686x/tw686x-video.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/pci/tw686x/tw686x-video.c b/drivers/media/pci/tw686x/tw686x-video.c > index 3ebf7a2c95f0..6bc6d143d18c 100644 > --- a/drivers/media/pci/tw686x/tw686x-video.c > +++ b/drivers/media/pci/tw686x/tw686x-video.c > @@ -423,6 +423,7 @@ static int tw686x_queue_setup(struct vb2_queue *vq, > unsigned int sizes[], struct device *alloc_devs[]) > { > struct tw686x_video_channel *vc = vb2_get_drv_priv(vq); > + unsigned int q_num_bufs = vb2_get_num_buffers(vq); > unsigned int szimage = > (vc->width * vc->height * vc->format->depth) >> 3; > > @@ -430,8 +431,8 @@ static int tw686x_queue_setup(struct vb2_queue *vq, > * 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 (q_num_bufs + *nbuffers < 3) > + *nbuffers = 3 - q_num_bufs; > > if (*nplanes) { > if (*nplanes != 1 || sizes[0] < szimage)
diff --git a/drivers/media/pci/tw686x/tw686x-video.c b/drivers/media/pci/tw686x/tw686x-video.c index 3ebf7a2c95f0..6bc6d143d18c 100644 --- a/drivers/media/pci/tw686x/tw686x-video.c +++ b/drivers/media/pci/tw686x/tw686x-video.c @@ -423,6 +423,7 @@ static int tw686x_queue_setup(struct vb2_queue *vq, unsigned int sizes[], struct device *alloc_devs[]) { struct tw686x_video_channel *vc = vb2_get_drv_priv(vq); + unsigned int q_num_bufs = vb2_get_num_buffers(vq); unsigned int szimage = (vc->width * vc->height * vc->format->depth) >> 3; @@ -430,8 +431,8 @@ static int tw686x_queue_setup(struct vb2_queue *vq, * 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 (q_num_bufs + *nbuffers < 3) + *nbuffers = 3 - q_num_bufs; if (*nplanes) { if (*nplanes != 1 || sizes[0] < szimage)