From patchwork Tue Oct 17 14:47:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 154317 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4187185vqb; Tue, 17 Oct 2023 07:49:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEXK6H8teg2n6Cx+PybL2M6Q5gxOhROc35VFYTvmPG66+adOfN9ImqdA4oIHj9LPHb6Q9y3 X-Received: by 2002:a17:902:760d:b0:1c6:2b3d:d918 with SMTP id k13-20020a170902760d00b001c62b3dd918mr2581104pll.3.1697554172306; Tue, 17 Oct 2023 07:49:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697554172; cv=none; d=google.com; s=arc-20160816; b=s3e5132S+YiXdHmDL0nMYARqER1MbkHaFiPlqvpPTS5e5QzGX8OlDe2PMPbx+VvMY/ j6I9yd6F76iFAQYdhE/S+3IxjAVTBFEFC0sx8B3wnrdh4lxPGua5mmw/xHvOSl7b+RCx SOMClXay6n1sKM/DKYapbZxRY0o4UYS3Hcb3Rcdn3KfZUC4kjQh7hQb0lwsTV0NpUrWV 3Cgd8MIkPCBgOIBinHPRPPqqnosAIIQLf0QVALPiTgmGkvuhC89skuRpkkMlPZfIrVt5 mpbmeui8tWEkjCF/UhHLq4OPuOj/Rf0HnMo4YqH5AZiMbYa8aRr7E4iWZ9ahmEtDwfvA xlog== 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=Zs8dv6c8Ud6JKHQXTduqTVl/+fB6zhff1vZD6BXwi98=; fh=+NS11/YTnD7GglrGYsYnSnUacC2YXoJUirkP5/1okOw=; b=Nh0LG6NwROQx4Hjg80azo/Chk3Zt2naG4Cy6NNYlMlmixPnub7Duqsk31yUxb6AZuQ yHrld/IuzgVVQi0zz+Iub1NpWPJ/POLqZ42NIGqpWRo7cCzvuLtpq8VckRruwpmzUV1d nJ0wMY/H4dl5JtKqCTi+IHVBEis16QipBvBuhHrzgqj+CtrkUcZLLh3QTeodZgrjKQE5 DE7G8T70VFseWudnYFkwTUo0Mo4SYxyz/YP1HFBaZxRnh5KDrUAVzCqYgFMmpCNzsjIh KdMcrM1EAZaIuGR1UCLHsSIF4nDoCbgBFTcQwAu74oOd3kpFgCCpF50pHS//9/rpOGHy cwyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="X8bQG/uj"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id i16-20020a170902c95000b001bbb175a81asi1968585pla.263.2023.10.17.07.49.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 07:49:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="X8bQG/uj"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (Postfix) with ESMTP id 3107C801C881; Tue, 17 Oct 2023 07:49:23 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344374AbjJQOso (ORCPT + 20 others); Tue, 17 Oct 2023 10:48:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344152AbjJQOsN (ORCPT ); Tue, 17 Oct 2023 10:48:13 -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 86849FF; Tue, 17 Oct 2023 07:48:11 -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 E112A6607342; Tue, 17 Oct 2023 15:48:09 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1697554090; bh=inkOxQFbeFl/3jApDq38BuFHlwsXzpsIkhVd4zRYm78=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X8bQG/ujtbO+zYDfpz/FuSLHoEA3zuhUhvFiSyuKQyjZD+2ruE3cFOWv1ahxAM3p+ 9WDLvThxhBqwfrxN7Dn9A2UHeM5wgceKtNnmvnZiusvtd2m+VcICdKD1zMBLY6YHlS twnQzk9mFgfyN3DPPkATaZYdBkAO7mjGJwZw2hQFEGfUcUA2Y+Vdvn0by1GU8sRFUL MJ1MEPvMBij3i+Yjv0cT6lVv8GDU15uWeEIquxFraZ8XzI8uvq6j7br+IwPbAZYBBh X1IEsqaI10L/FThz5ds+u71IMFlXGystRjgrmdbXsCUdR+jYUznawnrHGF5Je9q280 Fb0yRQkXEBPjA== From: Benjamin Gaignard 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 , Bin Liu , Matthias Brugger Subject: [PATCH v12 13/56] media: mediatek: vcodec: Stop direct calls to queue num_buffers field Date: Tue, 17 Oct 2023 16:47:13 +0200 Message-Id: <20231017144756.34719-14-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 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 morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 17 Oct 2023 07:49:23 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780014563452291240 X-GMAIL-MSGID: 1780014563452291240 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 CC: Bin Liu CC: Matthias Brugger --- drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc.c b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc.c index eb381fa6e7d1..181884e798fd 100644 --- a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc.c +++ b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc.c @@ -912,7 +912,7 @@ static int vb2ops_venc_start_streaming(struct vb2_queue *q, unsigned int count) return 0; err_start_stream: - for (i = 0; i < q->num_buffers; ++i) { + for (i = 0; i < vb2_get_num_buffers(q); ++i) { struct vb2_buffer *buf = vb2_get_buffer(q, i); /*