Message ID | 20231017144756.34719-8-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 ib8csp4186936vqb; Tue, 17 Oct 2023 07:49:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFp7oCpy0K+qca5jGEoDaDnAQFaSq7GujzcDGaBQMzHWcJgwtCqPTxtwzUW/Mwuu6Wx7QmB X-Received: by 2002:a17:90b:1812:b0:27c:fbf8:6c43 with SMTP id lw18-20020a17090b181200b0027cfbf86c43mr2615610pjb.1.1697554143754; Tue, 17 Oct 2023 07:49:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697554143; cv=none; d=google.com; s=arc-20160816; b=ELgTDl4ulIugdORyj+tTXutkhebaJkCpczUn4620aJHITUiucV4Jl1CTzZswxi4Abc sU1KYutfrgPIqTrnrfG9LRJZC0imzOLGrqXh0Yn1M8wwp2xq8Z+BODEHLjlKl3FkNuSO kZ2IVjLax4oZgSZgsdY207TMSWNt2uGnNj3KXauskQqXmHVaPAxVGE/UGwDIZxDFRGgG 45aWRBALeJE06+ZqJ652J80TbaCp9ONewI95iHbJkInlnrEyrQHtV1ZD9hCOPBIji/RX W9eEtvon4LU1iMHovu4Yq/7X/pSjooUthB0xOZYz/4IPXGkkLFtzSmfy3hexS0sL5j8o ve2A== 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=UcK1M6ba+qPsIpOiLnurj5VZil6Dh9wjABNphkn5ocE=; fh=ceA81l8d2hZW6pWH7VE5TwJxtgXUzAubfWIMcikPA1M=; b=V0Le6Lp3YRaOfHiGIeLgt+xmYHYk9cr40E4oN5byyfvvsWbAw5MgLmS2opQB0O1erv KKrHaXPW98L2Qw2gkfPHrK73xS+Snnd+OQDJmKRWDPOySh///p4TMD4l5wnlpA1ITR6L ArMKm8DEXi7uSYTdq9Oh0lV/eTbRBISRBG5Zd60mx1cCcPDb2R7t/pc/SDCT07i2BXGr xRHCbo+6Uw32DBR/3DhZF5gYEnbtjJfKKCfgiQ3YGcn9Nf3ZmZiamNc1GMUvEaJqUBZf kq/rWMfa3vxuH6RKFA0kg+6EknO6Bc+Vy+r6KFcZfu8V2x8V93CkH3a+7i0Vy+9u9O7Q CHKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=PP81loCK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id ep8-20020a17090ae64800b0027d37d5dff9si1800351pjb.56.2023.10.17.07.49.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 07:49:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=PP81loCK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id 40E8B80C60FD; Tue, 17 Oct 2023 07:48:52 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344108AbjJQOsX (ORCPT <rfc822;hjfbswb@gmail.com> + 20 others); Tue, 17 Oct 2023 10:48:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344126AbjJQOsK (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 17 Oct 2023 10:48:10 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D18BF5; Tue, 17 Oct 2023 07:48:08 -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 CEF7B6607319; Tue, 17 Oct 2023 15:48:06 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1697554087; bh=lM3wXK65Q+RBpyeYExb53Y3bnLmIcGL+rErhrVO2B80=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PP81loCKWTKjK1+86vofkXTFXVAYLuvXUxc2qiOq6ZbJxkmBuzwNywJpBOBjwpX6S K15xrXVhtCZVQQkfZL5NteMhulqFfwp6Xv8IYe47CF09oCq/ObVt+FHoVz42o8kDxy YE0PNW11wXoMycJcWPlQt/8zQg4IqIzAuVdaW33Ej6LOpIWNeXU9kdMITSpmnK2plq d4eumTeYlbGQBWI6987sNj3EmzWFa4iuPGlKfLqO1f+0LWxKML7UCKDcw+bBnVnBwg Pm198/OLU4bHey09mYxgqY/bUOFBEGD9FubmdpPUihnoRSYQpcZm7R2Lqy5cph7hmR jIX60IFJOSNCg== 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 v12 07/56] media: videobuf2: Add helper to get queue number of buffers Date: Tue, 17 Oct 2023 16:47:07 +0200 Message-Id: <20231017144756.34719-8-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=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email 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 (agentk.vger.email [0.0.0.0]); Tue, 17 Oct 2023 07:48:52 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780014533638826532 X-GMAIL-MSGID: 1780014533638826532 |
Series |
Add DELETE_BUF ioctl
|
|
Commit Message
Benjamin Gaignard
Oct. 17, 2023, 2:47 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>
---
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; } /**