Message ID | 20231017144756.34719-32-benjamin.gaignard@collabora.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4187450vqb; Tue, 17 Oct 2023 07:49:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFuSzZptF7FPlqr9GZAaGJjLKGFGUl8cxHRjUXSY1PkUcHetMM7ltCUh+qiFk4PkxdO4p0D X-Received: by 2002:a17:90b:1b44:b0:274:60c7:e15a with SMTP id nv4-20020a17090b1b4400b0027460c7e15amr2580530pjb.4.1697554199422; Tue, 17 Oct 2023 07:49:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697554199; cv=none; d=google.com; s=arc-20160816; b=P8uvAILwZhlhyAaDddvchE2LG1wurVufumTHqVigqtH7KXC0mzB5ntxKPLW1VDsjMD n/Zs6G0+7gvSESsXk6rD7eBFqxXS5AYdxr+6C7VmiiR8KUe1Y2Kowrnx2RNlARfyJjHX Yym/JPLQF8mbfglmLhDLjszIafFQwra6XPvJ3vGIHsMqF3ZJ3fVli7/iTLqU10KFsgL7 Tuem9jcZd1ai/ISciR4De4Nj8woOG+EGZPWgWXhKihGUJyg/Kwcu+PYeEcnu5nktjCkb x+Gjt0zi0YRMyQ9DvPJrzc3WdVMRQzq+pj/0kjRMKNPS7k1L/Gvp1FXachpOVpYMARXw kaqA== 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=ZM1ZrlyEXT6KmVtU8B/ERNJgi73GQ2zEJz0UKzS8ZC0=; fh=171ZbtLkqTQvfc21XcAM+Vd/toNFohdADskHHVOkNqQ=; b=SpK9N4v337tljOmH45NXY2mC1jSCQswNKjX0/kMJV6lcaWpAGPnEgzMe2k38AGAEy6 jgTpRxndjYGGrmIoZHhkiJOAsIatCQK3DhN7PKgoGJ6xDmr3stXKt6AR/FIR8glAhnRZ 1uCXoAVhRLZipJ8ZVAQFNFZSnWL+P6CbJrmwOVjOXkGUVyPBCYRW0Md+QpJKnL1xsPhW AQjIQ5iJUY96BVTC4fiNekLgk456UamRFbM5VTCaaUNQ9UVcQgEzfvvjd1xroe4F4ULW sam1AvbCsytE11XlKD6uK+6ZxGPl9vwln7j9XcQHQzNAFLk0/xaxJGGCu1FSEgY+JAeZ 0Z/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=FN6buOGC; 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 x13-20020a17090ab00d00b00276c22ca6a4si8543963pjq.147.2023.10.17.07.49.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 07:49:59 -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=FN6buOGC; 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 D3CF980E65BE; Tue, 17 Oct 2023 07:49:58 -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 S1344144AbjJQOtu (ORCPT <rfc822;hjfbswb@gmail.com> + 20 others); Tue, 17 Oct 2023 10:49:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344264AbjJQOs2 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 17 Oct 2023 10:48:28 -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 34E4418A; Tue, 17 Oct 2023 07:48:21 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:7205:da49:a7e8:59f8]) (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 9B9CC660738A; Tue, 17 Oct 2023 15:48:19 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1697554100; bh=ze9f+cre4KJ3jK+K5LOLyXDpAuzmOF8maDRtpzPpmEM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FN6buOGCmPgo7C1/uY3KX+cjipls4tcrv3RocJG6vj3PFHrFt7eOHa0PLN82jRAZE QeJ0Pv+f+jo3tANFU/JcnAqrzfli0MFQV65woJfDxqiORs1JpW8t5DgKZ/1Eku32zn Af4PPVqhaDIe9h3Qrmcy9yP8ILKg5BFvXX1BXugh1huxZgVr1TMCxO9dvqJXe2j+8Y y+PYcb6wDaPSA+N9J+p2S28foEl4JJcpXQ0bD7uZwxDpi/f3ytiFNbVDzGEXTvDLlo KSkljeZ15XU8V37YVFfUeLfWWWj4MXRxMOBIgQVO7Y0ivVg6vOYWVo1SsSx9jBykdu mNSTlytwxEfBw== 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>, Steve Longerbeam <slongerbeam@gmail.com> Subject: [PATCH v12 31/56] media: imx: Stop direct calls to queue num_buffers field Date: Tue, 17 Oct 2023 16:47:31 +0200 Message-Id: <20231017144756.34719-32-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231017144756.34719-1-benjamin.gaignard@collabora.com> References: <20231017144756.34719-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,RCVD_IN_DNSWL_BLOCKED, 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: <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, 17 Oct 2023 07:49:58 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780014592215374227 X-GMAIL-MSGID: 1780014592215374227 |
Series |
Add DELETE_BUF ioctl
|
|
Commit Message
Benjamin Gaignard
Oct. 17, 2023, 2:47 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
futur.
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
CC: Steve Longerbeam <slongerbeam@gmail.com>
CC: Philipp Zabel <p.zabel@pengutronix.de>
---
drivers/staging/media/imx/imx-media-capture.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/media/imx/imx-media-capture.c b/drivers/staging/media/imx/imx-media-capture.c index 4846078315ff..ce02199e7b1b 100644 --- a/drivers/staging/media/imx/imx-media-capture.c +++ b/drivers/staging/media/imx/imx-media-capture.c @@ -605,6 +605,7 @@ static int capture_queue_setup(struct vb2_queue *vq, { struct capture_priv *priv = vb2_get_drv_priv(vq); struct v4l2_pix_format *pix = &priv->vdev.fmt; + unsigned int q_num_bufs = vb2_get_num_buffers(vq); unsigned int count = *nbuffers; if (vq->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) @@ -613,14 +614,14 @@ static int capture_queue_setup(struct vb2_queue *vq, if (*nplanes) { if (*nplanes != 1 || sizes[0] < pix->sizeimage) return -EINVAL; - count += vq->num_buffers; + count += q_num_bufs; } count = min_t(__u32, VID_MEM_LIMIT / pix->sizeimage, count); if (*nplanes) - *nbuffers = (count < vq->num_buffers) ? 0 : - count - vq->num_buffers; + *nbuffers = (count < q_num_bufs) ? 0 : + count - q_num_bufs; else *nbuffers = count;