From patchwork Mon Oct 2 12:05:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 13406117 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0E568E784AC for ; Mon, 2 Oct 2023 12:09:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=VsGAK/wPmWnIcmt/pv66Yu9wY+y0ICpmHnGSDwDPR3M=; b=qcM/YAImHY4tWp gBbMLPJFFheegsRm0+vXCUxqOf81+vuIOybN4gt2hyuBW32D48hJDrrh+WcjdgcNf5/72T73jJfP0 tbovIeYZJ565hvZAnOsQykCKy12iDR8Xp1Dkz3KAoFtF/QszlXEA1hXf0Wwb4hY7duFFMpzNW7nzy /wJSsJhi0NpaYfSPYCBi8xzmIo2XhtmOaz8Djel5/vogGDqCJejfTj30NdtW/vZEy+i8hkkREweZH 9BYWvEZyOtx5RskE1DTr35w8hm6ZlnNrw3o8hi9NSEhr4ELJqzEQex9va5I/hXhy8PX6p2frKU86k 78EjrAkMSXgjt74peJiA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qnHjo-00CeWn-1S; Mon, 02 Oct 2023 12:09:24 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qnHhN-00CbTP-2T; Mon, 02 Oct 2023 12:06:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=U9d5SZ0hDOUSyqscRstSQnC4dElea38Uzve02Thdm10=; b=djDkg/wxNDc79n4rQ4VhwbRCvq MczKkm1v5ADwpSRBNoypOghvuVIh2UhJZ2W0O/RBThrw2cvqaRaBbGQGNxJhKhaf3Bc6RFhhvt1H5 1bqJt2VcDKoOMiCa3KRVSerqsVnh+d3KSCmgkBqWWN9BFYFdj3fwrviWnZOn2eBPXbebZXjjXZGl4 ArSLpgu7aBrOXFBu/QFa6axN5rNy2UjAppaOaHqvkQwD/bO0gLHHR9/gUzw1PJw0h/vBiaiSjBbGL +uVLQ0ObfuB7Bhi1RQuWUfOkKTUTh9E1i3y819qOZOVPDjFh5ZSS4To1dqy1kzt6AuMk820aZt9lV W1zy3tyg==; Received: from madras.collabora.co.uk ([46.235.227.172]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qnHhC-0090NF-25; Mon, 02 Oct 2023 12:06:51 +0000 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 76CDA660731E; Mon, 2 Oct 2023 13:06:40 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1696248400; bh=k8fwhTVoe5kIQmLsGjDDN8wml/hPJ1hmU1xyPTJsqEE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PARCf0B9LgiYmbtqADJdguJUUIOFN31OIzmQ5KPJ/bUlX9bv3vie3MCLREjmkvfbB 1EJvsIs7RPf/1f+buALl68xAbyy4DbkjdbHFBmVQ0tlUVWM68KF/tiHYZey+iGjcuc hh64EghSFjSnek1YDfa2EmhXuxum+MV5uDcJwNHGKSOnvLto3P96dhWq3lTQwTTqf3 z1gVRSUrjTHSWBe2mye0ITBUmyxBNQhhWhk/kACkS55tRXwHyQFk8XjqRJqrzaAyNk cFpgsL1ZoX4me24DufQ+Ms3/XoEtizoAF6JTcrireRJZIAr8PKAF92nuF20tWs3wwL DVw3kfFSWI7Qg== 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 30/53] media: amphion: Stop direct calls to queue num_buffers field Date: Mon, 2 Oct 2023 14:05:54 +0200 Message-Id: <20231002120617.119602-31-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231002_130645_475184_EACAA46D X-CRM114-Status: GOOD ( 12.61 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org Use vb2_get_num_buffers() to avoid using queue num_buffer field directly. Signed-off-by: Benjamin Gaignard --- drivers/media/platform/amphion/vpu_dbg.c | 8 ++++---- drivers/media/platform/amphion/vpu_v4l2.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/amphion/vpu_dbg.c b/drivers/media/platform/amphion/vpu_dbg.c index a462d6fe4ea9..49d641f60cc9 100644 --- a/drivers/media/platform/amphion/vpu_dbg.c +++ b/drivers/media/platform/amphion/vpu_dbg.c @@ -87,7 +87,7 @@ static int vpu_dbg_instance(struct seq_file *s, void *data) num = scnprintf(str, sizeof(str), "output (%2d, %2d): fmt = %c%c%c%c %d x %d, %d;", vb2_is_streaming(vq), - vq->num_buffers, + vb2_get_num_buffers(vq), inst->out_format.pixfmt, inst->out_format.pixfmt >> 8, inst->out_format.pixfmt >> 16, @@ -111,7 +111,7 @@ static int vpu_dbg_instance(struct seq_file *s, void *data) num = scnprintf(str, sizeof(str), "capture(%2d, %2d): fmt = %c%c%c%c %d x %d, %d;", vb2_is_streaming(vq), - vq->num_buffers, + vb2_get_num_buffers(vq), inst->cap_format.pixfmt, inst->cap_format.pixfmt >> 8, inst->cap_format.pixfmt >> 16, @@ -139,7 +139,7 @@ static int vpu_dbg_instance(struct seq_file *s, void *data) return 0; vq = v4l2_m2m_get_src_vq(inst->fh.m2m_ctx); - for (i = 0; i < vq->num_buffers; i++) { + for (i = 0; i < vq->max_num_buffers; i++) { struct vb2_buffer *vb; struct vb2_v4l2_buffer *vbuf; @@ -161,7 +161,7 @@ static int vpu_dbg_instance(struct seq_file *s, void *data) } vq = v4l2_m2m_get_dst_vq(inst->fh.m2m_ctx); - for (i = 0; i < vq->num_buffers; i++) { + for (i = 0; i < vq->max_num_buffers; i++) { struct vb2_buffer *vb; struct vb2_v4l2_buffer *vbuf; diff --git a/drivers/media/platform/amphion/vpu_v4l2.c b/drivers/media/platform/amphion/vpu_v4l2.c index 0f6e4c666440..87afb4a18d5d 100644 --- a/drivers/media/platform/amphion/vpu_v4l2.c +++ b/drivers/media/platform/amphion/vpu_v4l2.c @@ -439,7 +439,7 @@ int vpu_get_num_buffers(struct vpu_inst *inst, u32 type) else q = v4l2_m2m_get_dst_vq(inst->fh.m2m_ctx); - return q->num_buffers; + return vb2_get_num_buffers(q); } static void vpu_m2m_device_run(void *priv) @@ -587,7 +587,7 @@ static int vpu_vb2_start_streaming(struct vb2_queue *q, unsigned int count) fmt->sizeimage[0], fmt->bytesperline[0], fmt->sizeimage[1], fmt->bytesperline[1], fmt->sizeimage[2], fmt->bytesperline[2], - q->num_buffers); + vb2_get_num_buffers(q)); vb2_clear_last_buffer_dequeued(q); ret = call_vop(inst, start, q->type); if (ret)