Message ID | 20231031163104.112469-24-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 t15csp363711vqg; Tue, 31 Oct 2023 09:33:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH8DJokOaBbqCFlhFgs/aYwQrXwYvktQd9BZV94DVV2QKJiPM1Dq+3YJLFHHL5VeyFT+x2z X-Received: by 2002:a05:6a20:8f1c:b0:153:63b9:8bf9 with SMTP id b28-20020a056a208f1c00b0015363b98bf9mr17471574pzk.0.1698769998172; Tue, 31 Oct 2023 09:33:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698769998; cv=none; d=google.com; s=arc-20160816; b=fCkji7WbI32I5oQhV6gbXQEeRg/M49cPAi6EM8aL9yoCLdy1tBkBp0auPzR5ykEcCF Fz2dtyvj45iVR6XUfEaiWPGSQjcvgexj0msc9INriVHpsBXou4OWx/nEbNo9vaewSRFg dxXrAzkKD1yuJWzR5PyBbY7bA6w+UZ4LDAbjirOfibTrEBnhIWYsnfBlT5WgL6cExUqk UIxuNgm+rH8C8/lvbKBSHyquxvp2s9EZEdQx5asrnO9jhIp52M+A04F3GoOVbJ0zO1lT cQjqd5T/wfGy/9jUwC0QWg9/0W1bN4QrKjBUPkc7po4GRzoPvlm6vbn8aUVQ1BBAJ+Dr +pCg== 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=0a1kRYp57H3SphvzPRCJ+4HpSpBRT10VyUNQ+iboP6E=; fh=kpy8hnP6Gews7/w8dNjLiYrKq2Pvrz/5/ZgUjYw+mFw=; b=dl+OfNCRmfivFjC0bVeAhPtrzptaj4LY7tTEFE5fW9thsoVO3Jf2kUI3tvwSw7et8/ OIXi4m1xutvAZxRROchWid0RYg9u/JbRu4QeK3baVwK8V36wfYHGkWQLt1Dwna4WUzdM MtzPFY8jvF5/VXikJulmVBds6mLMl/uvUAT89yrQU2Fx6sYV6rqx0LQMOcV0G47IBzHV iTALaPvEtX1S7a/3a06Z8vq5tX1cXJQ64DLzOlIN1j+iWUVhQf6xNyWBRWdZ+1GKT3F+ tv8gFvE1VCs+yLUsToGSHPCQz+J1gCW4qiMPQ8Z9u6S2453WGbCyEJ5w4g6rfXAo9PzL RK/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=X4NFFGAR; 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 s135-20020a63778d000000b005892fd16947si1260717pgc.546.2023.10.31.09.33.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 09:33:18 -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=X4NFFGAR; 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 E18C880E068C; Tue, 31 Oct 2023 09:33:16 -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 S1346125AbjJaQdF (ORCPT <rfc822;chrisjones.unixmen@gmail.com> + 33 others); Tue, 31 Oct 2023 12:33:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346016AbjJaQcL (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 31 Oct 2023 12:32:11 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4333D55; Tue, 31 Oct 2023 09:31:49 -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 F0EE466073B8; Tue, 31 Oct 2023 16:31:47 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1698769908; bh=uLexcsAscd7+q7L/zlCLSkE5WS81tRYkOSdorkQDUyM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X4NFFGART040P4XKzp9TVt1UaGYgm5mhgNJAlDm/rEjNF4bWiA3dyIqndsIwb6SlB E2NWfNsHxiGb2qsVdTXRCmN1vcxxUHfwdq5BGBijt4LjgAr+BPTkqD2zRdLUiE5FO9 evQAamez9FwoFD5/jhM4n4mjZNFqr3KNDOgoSnSIW0PSYgmTqZ+e7mGOIVJQSF8Tif d8LTuO8VouqozgYXOw3lqQgfDw6pSLeLPNUfH4ZxC/GeHnEt3QJMWS5v75Fb+BYRYQ baBsnRVuM0H4uPkhgZzNplsyQzmvyFuYxfq1F5sT+V2VwjqAR3Nre/kwXCEfDaA3fx uIpH2PgUCeGYA== 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>, Sergey Kozlov <serjk@netup.ru>, Abylay Ospan <aospan@netup.ru> Subject: [PATCH v14 23/56] media: pci: cx18: Stop direct calls to queue num_buffers field Date: Tue, 31 Oct 2023 17:30:31 +0100 Message-Id: <20231031163104.112469-24-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:17 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781289449412205046 X-GMAIL-MSGID: 1781289449412205046 |
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: Sergey Kozlov <serjk@netup.ru>
CC: Abylay Ospan <aospan@netup.ru>
---
drivers/media/pci/cx18/cx18-streams.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: Sergey Kozlov <serjk@netup.ru> > CC: Abylay Ospan <aospan@netup.ru> > --- > drivers/media/pci/cx18/cx18-streams.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/pci/cx18/cx18-streams.c b/drivers/media/pci/cx18/cx18-streams.c > index 597472754c4c..cfbc4a907802 100644 > --- a/drivers/media/pci/cx18/cx18-streams.c > +++ b/drivers/media/pci/cx18/cx18-streams.c > @@ -104,6 +104,7 @@ static int cx18_queue_setup(struct vb2_queue *vq, > unsigned int *nbuffers, unsigned int *nplanes, > unsigned int sizes[], struct device *alloc_devs[]) > { > + unsigned int q_num_bufs = vb2_get_num_buffers(vq); > struct cx18_stream *s = vb2_get_drv_priv(vq); > struct cx18 *cx = s->cx; > unsigned int szimage; > @@ -121,8 +122,8 @@ static int cx18_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/cx18/cx18-streams.c b/drivers/media/pci/cx18/cx18-streams.c index 597472754c4c..cfbc4a907802 100644 --- a/drivers/media/pci/cx18/cx18-streams.c +++ b/drivers/media/pci/cx18/cx18-streams.c @@ -104,6 +104,7 @@ static int cx18_queue_setup(struct vb2_queue *vq, unsigned int *nbuffers, unsigned int *nplanes, unsigned int sizes[], struct device *alloc_devs[]) { + unsigned int q_num_bufs = vb2_get_num_buffers(vq); struct cx18_stream *s = vb2_get_drv_priv(vq); struct cx18 *cx = s->cx; unsigned int szimage; @@ -121,8 +122,8 @@ static int cx18_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)