From patchwork Thu Sep 14 13:33:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 139891 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp681048vqi; Thu, 14 Sep 2023 16:11:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF34yR7oU7xyFguAP3AyWFYoW3qLfnJVKUcjAqv3+qiv2o2keqURzTaFqxR46l3txaZd1Xk X-Received: by 2002:a17:902:f68f:b0:1c0:bf60:ba4f with SMTP id l15-20020a170902f68f00b001c0bf60ba4fmr12664plg.4.1694733102411; Thu, 14 Sep 2023 16:11:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694733102; cv=none; d=google.com; s=arc-20160816; b=TqewwgNOKnVPplOBSV+ddTjPpXgUYtN+yf3s3kNNsapPDM6UnZe4JSE9iKke4PJk5x Vxi9B2UIY4fjYX/+88NMAnykq25Hpoj7gh1GFEdhbb9LXerHQRWFJcigyGztFCYJL+uj ttQ2Mg20h4uPyXeRd8iFANw5Fd/mINeI4M+U3P6Rw1r1dqSyG1SZvaG4y2irBO15vNdp 5rF0k9YlJZ7oUh7+QPBQokygIGgJGFaxD0VaIAQHtt8oV+oZRGBcu9ptObKLomK99W6q TgzUlj4Yr3z5mv3BUG9AfQgcUKRcPnTZpXsZBJfL8fs4J2KpwQNvriclwg1IUWchmJ6E sbeA== 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=tmQ8B48fS653lsNUZPmdnMwdIC6Yd6jLqjKhmYRUJKw=; fh=ceA81l8d2hZW6pWH7VE5TwJxtgXUzAubfWIMcikPA1M=; b=EVwbwlteEmB8JtfJRjNaHq1EDfmua2I284rI3v2K04Kkw6WbRpr9KnWZ0618FNu6Yu L8HORr3eQKtG9/QD/K3MjViiIk8xD6GJoJtN2k6nLPkLRxFHyWiVkeGJAqUnM5nhWRkF 7JokqA2/xK5ktWz9iff6HVtmojggIw/CRzHCEy0rZ9QREx0OIDjrQcBpJ3RX3aT3ihH8 YlOdrXKowbs15P/IFUIHFosmbdUJjBofbADefE5qlXRvHuo6dG6bFRj3YcKNtKYKxCxP Q4h6q43sG+cVgn8YUhY9qdMwvON4bQchorRj5hapT3HGLgtc4xEfcz/DXNgGXtfviHrH IH1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=eX9HPb3F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id h7-20020a170902b94700b001bbfbe6bf3esi2159155pls.504.2023.09.14.16.11.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 16:11:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=eX9HPb3F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 322E982F7F80; Thu, 14 Sep 2023 06:35:55 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240076AbjINNfo (ORCPT + 35 others); Thu, 14 Sep 2023 09:35:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239594AbjINNfA (ORCPT ); Thu, 14 Sep 2023 09:35:00 -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 280FA2D4F; Thu, 14 Sep 2023 06:33:55 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:36f2:37bd:ccbb:373f]) (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 A69746607394; Thu, 14 Sep 2023 14:33:53 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1694698434; bh=qUxQMObFxpiy3pFolAat/Lsgv4wZ2hZHcdle7SRl8Pw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eX9HPb3F0XG0gWIqEzdqo1JuCQk+1T5cSP5loYaPm2hT3jBZ4pf1li6gLpqSo5LAm BlwGFyX3ssHkT1LNdS858TgUdf7Lj6vRz5qWet4kfA2XqtPD4GDHlwejGuNN//FPlM etgV1owR/w4SyjHd3eSsf4Dab3lrPTGat9OZCFs6J9WWAZ+XXVXuI+FCMmWh8we3eU hdwqMxk5k/sDDBmthNK5ADpwGcIzkuOav0X4YWogslj5ukliigIfgy5ICXLz5wBdct 5evWbWUGrEv0IL8bdW4pD8Z3GOZ6cYuRzwAHYxn3J5jkIukKI8hhdnA+sbr25kDMW2 7kEBNEOLNMQ4A== 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 v7 43/49] media: meson: vdec: Stop direct calls to queue num_buffers field Date: Thu, 14 Sep 2023 15:33:17 +0200 Message-Id: <20230914133323.198857-44-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230914133323.198857-1-benjamin.gaignard@collabora.com> References: <20230914133323.198857-1-benjamin.gaignard@collabora.com> MIME-Version: 1.0 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 (snail.vger.email [0.0.0.0]); Thu, 14 Sep 2023 06:35:55 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777056457586125933 X-GMAIL-MSGID: 1777056457586125933 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/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); }