Message ID | 20231019125222.21370-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:2010:b0:403:3b70:6f57 with SMTP id fe16csp359483vqb; Thu, 19 Oct 2023 05:54:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG+EdVkOwzkZSd0YV/hciiJmq+DaOOi5/MAGK+uVZAUt5XBjtWONOzOUVqA2KBIvHcdZKX+ X-Received: by 2002:a05:6a20:4295:b0:14d:6309:fc96 with SMTP id o21-20020a056a20429500b0014d6309fc96mr2189664pzj.4.1697720067576; Thu, 19 Oct 2023 05:54:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697720067; cv=none; d=google.com; s=arc-20160816; b=aJQoTxGzzF/CPTccqER1G6mXqH5i1QUqSxsXh1VON+stpEInwPf5cLl3+d2Tc7i3cM udmYTe3o3Nx6GlMGbiHHA3tg2Q+PvaXaq3Gs4RjrcUAwcsFHh8DIqKI49HnBlvDpU51E lq0UiEL+1zjw5YDGI2jZNNOos36BISdCUFBFornKmukMg1i74EWOXkIRFOvXFYrBIZ7L 9d8mamB32UtrDYALhgkicy81rOGVpRndH8zwsPv5slCakVkRgERqQWnQkdCeHQA9D4ba MA0awkfeT8m36KQdBjTaRX7TzLn388YEjkhUrmmbJl1L6Zo8NYzb++wcQ22jM+gW6AEI dLTg== 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=mNqnimycAE+tFaG7hVMr997zlb6uaLXK7MWVWeAldzV5zLE5rthq1c+PuODQTc1ZbI MqQ8LZdc9MSo1Q/lZCfewU9nJeQAtmNBewz4VbLA0OVaNBANi94Jy/AaXMkDd8LChnw8 ZtLLkKdp6RJfHRLCMhap+v7Fa+j0z8vkaaFt561RTksctgbCkiSi982Fiw56OlEDbFF2 1uLVRVPJjYRAmkTq2bKj+k+V4Gwvy5TgdtSr3ZFG/ljhJ+uhMCL85P45Ruu+4E9ywTVW MoOlwehxNH2kjtJgiSSPJGprbwKwyutrSRm45BEL1IRYaNQxZXJqRoWCBJD4iN/6V0hE Z/Pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=FVNQYpwd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id p17-20020a639511000000b00573fc6de956si3208894pgd.223.2023.10.19.05.54.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 05:54:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=FVNQYpwd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (Postfix) with ESMTP id 589D081ADCC3; Thu, 19 Oct 2023 05:54:18 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345895AbjJSMxH (ORCPT <rfc822;lkml4gm@gmail.com> + 25 others); Thu, 19 Oct 2023 08:53:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345728AbjJSMwi (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 19 Oct 2023 08:52:38 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A47A7112; Thu, 19 Oct 2023 05:52:35 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:ccea:1fb5:34eb:239b]) (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 30B06660733F; Thu, 19 Oct 2023 13:52:34 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1697719954; bh=lM3wXK65Q+RBpyeYExb53Y3bnLmIcGL+rErhrVO2B80=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FVNQYpwdc8DuSqvFyyhSDk4fL8gSr6zFuuBoaMyQuyI8raxmb86EuMNyJyYiaASMO w0xlmdpID1lTgcgb2q8P5/fMHUzPRnHWRoVKp4wUn3J3jJIL4lLIXi92nqfgKTgHzG T6euM+j9iaNxZWt2XKA9GNEP33kwhnVlalGfFBiLMGSUx07i05FkfC51+w1QDLMM2d 68ngutdxllUtGK9SCJ/nOTblUnwOj0oVsbTzpJKUZ3AJAaQqjoJcTXbja1KTv5Av49 7W9VgqnH9p89g3TPNngbgzsRW1imM+gM+bUiTimEUyKFVeDfbWwE9OxSW9FGcReLM6 v+v4Oqqe8KLFw== 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 v13 07/56] media: videobuf2: Add helper to get queue number of buffers Date: Thu, 19 Oct 2023 14:51:33 +0200 Message-Id: <20231019125222.21370-8-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231019125222.21370-1-benjamin.gaignard@collabora.com> References: <20231019125222.21370-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 pete.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 (pete.vger.email [0.0.0.0]); Thu, 19 Oct 2023 05:54:18 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780188517352262231 X-GMAIL-MSGID: 1780188517352262231 |
Series |
Add DELETE_BUF ioctl
|
|
Commit Message
Benjamin Gaignard
Oct. 19, 2023, 12:51 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; } /**