Message ID | 20231109163008.179152-8-benjamin.gaignard@collabora.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp555439vqs; Thu, 9 Nov 2023 08:33:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IGRUzVLPIpjiwjqbFHGnt1axqj50tBzXAvU3hg+Ehd/eWMRkEuniljCEuIQcS421XxdqzIo X-Received: by 2002:a9d:75ce:0:b0:6b9:4516:7d1e with SMTP id c14-20020a9d75ce000000b006b945167d1emr5434937otl.30.1699547586729; Thu, 09 Nov 2023 08:33:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699547586; cv=none; d=google.com; s=arc-20160816; b=Es4fMK2jQsY42/A+RcKO+43YqmyYuceGaSe7xB3QJClaVOUA6SRrdFzKW0LNDdbtnC qUH6WHv0hW+aYseeWHSAKQYIYKMeVYSLHv1KtxxDfCCT+c2ntouLMtiFxQV2jyokiLsR teRM3qhsHRawF9qYoyPkS8FLh9fzc0crFSE49ivXIBNmrXJO4U3itBWnuaMv4wSZHTys z7SciTxXuDCwfmhBgFLFTHLv3hQsDHyuk/I8zjKlA+nE/Ljj7vstRWzyK0AhKlsH3ckQ FgJdw2GWl2BnWfF8L17aMDaKkANKirBve6yBE/a/SJlOw/7bz8PM/wZYy2b4hGKbnCFl cbvw== 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=ZOQzCbND2JSm2GohspKmZG21WHsLiH0p+sLIJJEjRjI=; fh=t4h1l+tS8anPNnwyX0PglXAWKg/D9M9NAbc0AP3vdGI=; b=0USi12SAorcNHRETEMLfPY7miP+Vy2ghty8OVPqRWr41u4L9mZ4nuesy4Xa7IvO2Nv CZ5ruvBpJvV+LChJ3YVrfTMQdL7S0yc6ZkxrCV9MX6UHOA0i7qK/IswpZlpa2SRCwtj8 05cRyOdnIt+RElAqECtonOYC4Mc/jkSkLyG4r2b3g/Tck6q0uQMHHn3Qet5k0rrYFyWj kPzQxO11TFvgTaz5loOxF8eaulrkjSRDbEudLe32wmuafhz0Qgqly6gTtJ+EFA9jCDCU 5eLP4+WY0e7tagy4MzEGbACGfecL0zNEyNh6Mr8TH/k4TwF15o3DxKxhtuz4xUaWhizi c5+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=Xa5JRmxU; 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 e10-20020a63690a000000b005bd335981e2si7005483pgc.678.2023.11.09.08.33.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 08:33:06 -0800 (PST) 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=Xa5JRmxU; 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 92B5D832A75E; Thu, 9 Nov 2023 08:33:00 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344005AbjKIQc5 (ORCPT <rfc822;lhua1029@gmail.com> + 31 others); Thu, 9 Nov 2023 11:32:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344183AbjKIQcn (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 9 Nov 2023 11:32:43 -0500 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 87890384B; Thu, 9 Nov 2023 08:32:40 -0800 (PST) Received: from benjamin-XPS-13-9310.. (cola.collaboradmins.com [195.201.22.229]) (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 693E566076A9; Thu, 9 Nov 2023 16:32:38 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1699547559; bh=3dHbSEoCAE8TNazfsdZMoLFeola9+rHhDkBlniM5am8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xa5JRmxUyJcdA0Me7XsF/vb0VtA7AhcMDt460tSff/LQji6lR9JoJvFCtAxdfgIhW v+OUBJb1jrPVO9KryVa0VP5JFvPjbYhaNyAMaulx6fu3bZbzYE3OXxhqwxrekQBySy BSdgL3TwHmBi6VkMAfcXmkPRlYKfyoKitFWXHrh3N5DkVoPlfE6rcmhrsR4Zx4SUBA MVcTJo8HvKdfXPM17kEq0jUX0ICnOqMpnZbcOGFTwfzT1F+aYPtFkcsziMmpXVW3xK tobPV3IdN1WF0Ow+IdMQ7gMPzl96ahBtiRxI/ONf9VTh4Xy5xn/6+fXpbnM0g62n2Q AuaQL1KUDiY3g== 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>, Andrzej Pietrasiewicz <andrzej.p@collabora.com> Subject: [PATCH v15 07/56] media: videobuf2: Add helper to get queue number of buffers Date: Thu, 9 Nov 2023 17:29:19 +0100 Message-Id: <20231109163008.179152-8-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231109163008.179152-1-benjamin.gaignard@collabora.com> References: <20231109163008.179152-1-benjamin.gaignard@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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]); Thu, 09 Nov 2023 08:33:00 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782104810450982472 X-GMAIL-MSGID: 1782104810450982472 |
Series |
Add DELETE_BUF ioctl
|
|
Commit Message
Benjamin Gaignard
Nov. 9, 2023, 4:29 p.m. UTC
In the future a side effect of introducing DELETE_BUFS ioctl is the create of 'holes' (i.e. unused buffers) in bufs arrays. To know which entries of the bufs arrays are used a bitmap will be added in struct vb2_queue. That will also mean that the number of buffers will be computed given the number of bit set in this bitmap. To smoothly allow this evolution all drives must stop using directly num_buffers field from struct vb2_queue. Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com> --- include/media/videobuf2-core.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h index cd3ff1cd759d..8f9d9e4af5b1 100644 --- a/include/media/videobuf2-core.h +++ b/include/media/videobuf2-core.h @@ -1139,6 +1139,15 @@ static inline bool vb2_fileio_is_active(struct vb2_queue *q) return q->fileio; } +/** + * vb2_get_num_buffers() - get the number of buffer in a queue + * @q: pointer to &struct vb2_queue with videobuf2 queue. + */ +static inline unsigned int vb2_get_num_buffers(struct vb2_queue *q) +{ + return q->num_buffers; +} + /** * vb2_is_busy() - return busy status of the queue. * @q: pointer to &struct vb2_queue with videobuf2 queue. @@ -1147,7 +1156,7 @@ static inline bool vb2_fileio_is_active(struct vb2_queue *q) */ static inline bool vb2_is_busy(struct vb2_queue *q) { - return (q->num_buffers > 0); + return vb2_get_num_buffers(q) > 0; } /**