From patchwork Tue Oct 3 08:06:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 147737 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp1930044vqb; Tue, 3 Oct 2023 01:11:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG9wGvJ5PXZLMo0xAGp/+x9xXcFkYe+Q0aa/DjbNbdFh1c56BZPnwdlFkAJW3MU7HO2O0E7 X-Received: by 2002:a9d:67cb:0:b0:6c4:9ca1:f13a with SMTP id c11-20020a9d67cb000000b006c49ca1f13amr14363602otn.35.1696320717146; Tue, 03 Oct 2023 01:11:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696320717; cv=none; d=google.com; s=arc-20160816; b=CgR7gHNIjGBH4I5K5Z2QioqnZDAKF2UdVAqEbyZc1MBzzzj06m1scZxClIWHwWxEF3 2lqyyPFMHKvUsfl0VPRe1l+5AIqNW1ylQYx03+yi8qsuShQgoNQQyEF5qdx9CZlWh0JO 7LuB9PBfcsKk5TMm46TOztqEjGPTrFw1pX8xyP9s7ryvMPofWXjal2/rRbXV2d+bKyow EfXR+U3Yv1qRIjmIOWvqVWtXchSl39sIPWIBscY62bukbAUCAvvZz+WlTiG703CWLxoT xb3eiAZHnbLeZBF3jJ4igd58TdpgjOQXHZwxFTuTtIRNbY5h+BChSbXfSeBhPG4WRibK 9DLg== 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=SO/5YMLEx27n+1dMpaToDiDOXkzTfj9EXlddDQjAh1I=; fh=ceA81l8d2hZW6pWH7VE5TwJxtgXUzAubfWIMcikPA1M=; b=RGzclUKoc1sIF4nml0UkRXLUOAMxKFgJCTJMWdx+t7EZXMpsPh5+/AEK4kg2F+9Wt+ P4ATmZfoVz4YWDEVSWbgFq2/eXcxJG41Zj+m7Dc+SwdQM0Vvs0gntmaGph7rfexsFHtO Ab5PdbsxdpiR/J2iV1l2YBOQ9OelcRqqSBdOVgYweZR0X/xtj9ou8ezzDIcjvFbsEniS SVrO9P8gdFwHzcJsqUHEVtIk/HmOzwSYbFTIPdClBxsGGG1+yKFc5jhCvUTP1LON9JKL oOoQu3ISuHwd7Xbust/GoN0LbeSx3UVYz2XKLW7KBE0a+cFFmILRE/QY4XNR212jj8JU SohA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=iynotduX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id x4-20020a654544000000b00565eccbc52fsi950486pgr.303.2023.10.03.01.11.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 01:11:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=iynotduX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id B730E80A1442; Tue, 3 Oct 2023 01:10:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239792AbjJCIKd (ORCPT + 18 others); Tue, 3 Oct 2023 04:10:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239341AbjJCIHr (ORCPT ); Tue, 3 Oct 2023 04:07:47 -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 7327A101; Tue, 3 Oct 2023 01:07:37 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:b6df:b784:6a0f:8451]) (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 C8ED46607382; Tue, 3 Oct 2023 09:07:35 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1696320456; bh=2yNWC1m2r+gRNh8g1TSEbdzG2+a2rAX6C09uBWYHlio=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iynotduXom0mnVSjzfCHN7eq8AlnPICk9dX9zUHVH3dkMwRUfDgFzoyokKtbgeGcp ofDBwNYui3KxYsdWHETWADoZzPCNPYVZhuSkATaXzpYgUIChLXIUxAsTlzCF1tJ0PE AQV6fLGjdl+rlvasdByqDp0czbNbE+lb+g7AeN1jYOUC7apYfrYNB8xV4/CjlKtq4T 0BOe/3XAy+Zdb5l66aaNGTFZMyETQrTUbHjbQpBVQT+2jc1NxbneMdx9C+qoPP5hvo t3drbsv4lELBNNXoVqcgjzNCAnV5nwyl2dmaDjjLhq4Sc3jMyI/C28xrArJfaGB4Va 8cfhcaS7e90kw== 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 v10 44/54] media: meson: vdec: Stop direct calls to queue num_buffers field Date: Tue, 3 Oct 2023 10:06:53 +0200 Message-Id: <20231003080704.43911-45-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231003080704.43911-1-benjamin.gaignard@collabora.com> References: <20231003080704.43911-1-benjamin.gaignard@collabora.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (howler.vger.email [0.0.0.0]); Tue, 03 Oct 2023 01:10:53 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778721192067522274 X-GMAIL-MSGID: 1778721192067522274 Use vb2_get_num_buffers() to avoid using queue num_buffers 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/media/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 = sess->fmt_out; - unsigned int buffers_total = q->num_buffers + *num_buffers; + unsigned int q_num_bufs = vb2_get_num_buffers(q); + unsigned int buffers_total = q_num_bufs + *num_buffers; u32 min_buf_capture = v4l2_ctrl_g_ctrl(sess->ctrl_min_buf_capture); - if (q->num_buffers + *num_buffers < min_buf_capture) - *num_buffers = min_buf_capture - q->num_buffers; + if (q_num_bufs + *num_buffers < min_buf_capture) + *num_buffers = min_buf_capture - q_num_bufs; if (is_reqbufs && buffers_total < fmt_out->min_buffers) - *num_buffers = fmt_out->min_buffers - q->num_buffers; + *num_buffers = fmt_out->min_buffers - q_num_bufs; if (buffers_total > fmt_out->max_buffers) - *num_buffers = fmt_out->max_buffers - q->num_buffers; + *num_buffers = fmt_out->max_buffers - q_num_bufs; /* 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 = q->num_buffers + *num_buffers; + sess->num_dst_bufs = q_num_bufs + *num_buffers; q->min_buffers_needed = max(fmt_out->min_buffers, sess->num_dst_bufs); }