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: 147431 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp1626088vqb; Mon, 2 Oct 2023 11:53:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHQK8Cyr80R2iGIJM5eS+X+ntFJU9tN/sPdRXAInJeUKhKz/PWaVezdu7ufLPQeo8vIHDUb X-Received: by 2002:a05:6a20:96cc:b0:143:f4dd:dfae with SMTP id hq12-20020a056a2096cc00b00143f4dddfaemr10262390pzc.43.1696272798291; Mon, 02 Oct 2023 11:53:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696272798; cv=none; d=google.com; s=arc-20160816; b=PDKk2I3vvX+vd+8TUJZnyldVzu6SCWJom9Rl3s//rzHTBtflC2yORot2CsitnU3Rb4 6Zx0LXyxSfHb/pHndjF7J+fe+l8fxrRud5xQrW3vSggWM9ZZfg8SR9yR51/OwpcfEZ0L hWyvZBdd9ZdMM5CtNXEe1iMuVjzXDBL26RQeGpgi/ZtvOfZdNAm1MQGBzVgaAfT8Z60Y /BkgExHJ4qu3nroIz6m6Y5KDoefxybnDHRrkYtD+dIwGK0KoO+IC0/W2DA201IFdPdoR 2dyDrQrtAKR89EwR9qXMQ9ariWij3LhdRbiQ71UUeQj++aMzl3Xum8oNnwPI6k/Ef/Ou sblQ== 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=U9d5SZ0hDOUSyqscRstSQnC4dElea38Uzve02Thdm10=; fh=ceA81l8d2hZW6pWH7VE5TwJxtgXUzAubfWIMcikPA1M=; b=LwIvwQ3EmX7GGf52jKQ50aZjJ1KIxZPxCQevApE4Y+zOaJ3WkbtS8QrCyHYnw4AKgF +I/uSzKIjxgfswpWWXMTjx8z6MbHTAfSqQDhUHmPPmLpYj6OnViMTL37XWW/nPhlTo0p Z7x1/ih+Bl7gZ1enP4+hYjX8RlQE2KIOJoyF9L7LPLJpVzbMpR+hZr0yEK6vZpd5YOgt JqM1lTAUm2rg0bVp1f4VfIAtOz3j+/TbEfDgFfmQ/k+3/y8FakYL3+2fcB1bdOxOQ7jG 26GIECwegIgufH9isjAf1JDn2wJuZ5MtOyxmKuM5+B7dAU0DBp0dqkhhfhfl9ybVAxkC FO4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=PARCf0B9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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. [23.128.96.37]) by mx.google.com with ESMTPS id lk6-20020a17090308c600b001c6139bf846si8180034plb.394.2023.10.02.11.53.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 11:53:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=PARCf0B9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 2CA1A8135286; Mon, 2 Oct 2023 05:08:18 -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 S237234AbjJBMIH (ORCPT + 18 others); Mon, 2 Oct 2023 08:08:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237027AbjJBMGw (ORCPT ); Mon, 2 Oct 2023 08:06:52 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09412DA; Mon, 2 Oct 2023 05:06:42 -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 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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 (snail.vger.email [0.0.0.0]); Mon, 02 Oct 2023 05:08:18 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778670946094388029 X-GMAIL-MSGID: 1778670946094388029 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)