From nobody Thu Nov 14 05:18:56 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3F59E784AC for ; Mon, 2 Oct 2023 12:08:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237390AbjJBMIs (ORCPT ); Mon, 2 Oct 2023 08:08:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237133AbjJBMHB (ORCPT ); Mon, 2 Oct 2023 08:07:01 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 937291AB; Mon, 2 Oct 2023 05:06:49 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:9537:67ca:c85e:d0ae]) (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 0DDBC6607388; Mon, 2 Oct 2023 13:06:48 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1696248408; bh=qUxQMObFxpiy3pFolAat/Lsgv4wZ2hZHcdle7SRl8Pw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IwJTge2L/P3ziSGIw+PX0oIbrMWIxPy+E8aTlnT0qvTXj4YqMEmlusgGfo1c/z6i7 b68TcDJOpNETsBlXk7gBjmGUG8RYEzUuBYhAsK2zf6kBj9wupKxJL909RV1N5R9v4v QJKYuOmj8dqVwaJh9mNDP1pnG0ug3pOdF6yjkol8BnP0VRb9ORA4oXuWuSDCyjWSNR Lpo0tUXk11qclAvkvznzqieCY0MKqXfYjuP63YKZo/LlquSG1YUlWf+H6rCBNn30Q4 76bsu/FE2zo7df8BN+FWmPBxSHJJ72TGgLp9f3cuDryQUNxv7z2Wezbl8XdZXB1KSw p907xEV5uGRQQ== 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 Subject: [PATCH v9 44/53] media: meson: vdec: Stop direct calls to queue num_buffers field Date: Mon, 2 Oct 2023 14:06:08 +0200 Message-Id: <20231002120617.119602-45-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231002120617.119602-1-benjamin.gaignard@collabora.com> References: <20231002120617.119602-1-benjamin.gaignard@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use vb2_get_num_buffers() to avoid using queue num_buffer field directly. Signed-off-by: Benjamin Gaignard --- drivers/staging/media/meson/vdec/vdec.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/staging/media/meson/vdec/vdec.c b/drivers/staging/medi= a/meson/vdec/vdec.c index 219185aaa588..1e2369f104c8 100644 --- a/drivers/staging/media/meson/vdec/vdec.c +++ b/drivers/staging/media/meson/vdec/vdec.c @@ -167,22 +167,23 @@ static void process_num_buffers(struct vb2_queue *q, bool is_reqbufs) { const struct amvdec_format *fmt_out =3D sess->fmt_out; - unsigned int buffers_total =3D q->num_buffers + *num_buffers; + unsigned int q_num_bufs =3D vb2_get_num_buffers(q); + unsigned int buffers_total =3D q_num_bufs + *num_buffers; u32 min_buf_capture =3D v4l2_ctrl_g_ctrl(sess->ctrl_min_buf_capture); =20 - if (q->num_buffers + *num_buffers < min_buf_capture) - *num_buffers =3D min_buf_capture - q->num_buffers; + if (q_num_bufs + *num_buffers < min_buf_capture) + *num_buffers =3D min_buf_capture - q_num_bufs; if (is_reqbufs && buffers_total < fmt_out->min_buffers) - *num_buffers =3D fmt_out->min_buffers - q->num_buffers; + *num_buffers =3D fmt_out->min_buffers - q_num_bufs; if (buffers_total > fmt_out->max_buffers) - *num_buffers =3D fmt_out->max_buffers - q->num_buffers; + *num_buffers =3D fmt_out->max_buffers - q_num_bufs; =20 /* We need to program the complete CAPTURE buffer list * in registers during start_streaming, and the firmwares * are free to choose any of them to write frames to. As such, * we need all of them to be queued into the driver */ - sess->num_dst_bufs =3D q->num_buffers + *num_buffers; + sess->num_dst_bufs =3D q_num_bufs + *num_buffers; q->min_buffers_needed =3D max(fmt_out->min_buffers, sess->num_dst_bufs); } =20 --=20 2.39.2