From patchwork Tue Oct 3 08:06:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 147715 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp1928816vqb; Tue, 3 Oct 2023 01:09:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFynQaLFGpqSsRNvZMImttOr6uvGjyf4QxuOP/TKzX+0HhoMRGDORivkZZu5faD/L8H4DmZ X-Received: by 2002:a17:90a:ce8c:b0:274:67d0:f57 with SMTP id g12-20020a17090ace8c00b0027467d00f57mr9290708pju.48.1696320544722; Tue, 03 Oct 2023 01:09:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696320544; cv=none; d=google.com; s=arc-20160816; b=m38lDfg3sP7YnBMplBqAk7dz8RHidDw5vQgGTchv1lc6hbUCcIjln35dpHBSRH4Ja0 3UclNxs4ub7M/n2FK4Q0ei9Muhj5G8V5LndUxOdgI7p4LKUR4ugbZ/1i7h//ZD8H8P7J yefygUWy2W7tjTQ6Q3RZ0TwEX2KvrcX1enkpqwuKXWS3+K2Oi9SCMBFIszSnVMmT6uXe EVHvLYPSGIkuvllRGcDF+qlo12w+Q/cznLSELmm5Fixx2Ze+/rdE7xw9WOHqN39W2Frx 23yLu81OQBIRnDfbxwquSJT8K4yqaIz82ouxER8FfrS4j1I0JA9RA1Z1+vRfWAcSWH3L dSDg== 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=UoodlCaxuTXcklmCtS5aPdZ4FPUFAVvmvcbc+ooGj9g=; fh=ceA81l8d2hZW6pWH7VE5TwJxtgXUzAubfWIMcikPA1M=; b=Nr8biaWD/9VzONbCcpm1fZXLEFg01m68m5CRk9Cun2cPpy5Fqt72wLb82nAXxtxP5z SoOIMOV9ohclq7fzuECjtzsz40skm2YDwInU9VxIoXyz8FUBIV56HzIW8/8c0M1lG3Cn W4sAUO42VbKhM1Pth436bkkXQGRs1nY8GPIbTPxGXn+tPGW36jSvLSrCNX6KwinHNmGH BxMoN92IAilvQoFxdlfFjGIv/HL03+a6J+Nkvbsym/e/kFq5YGk1/bypqKCnm3RbEwMn TkdTFAvAyjNnLTV7PbyxRQT++CGerszrRVoN1XimuHXTxBBozkMMprswhugST0UicWFj T7Uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=AqDc1rt9; 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 126-20020a630084000000b00553813c2df0si892082pga.513.2023.10.03.01.09.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 01:09:04 -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=AqDc1rt9; 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 67CE0822C608; Tue, 3 Oct 2023 01:09:03 -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 S239767AbjJCIIt (ORCPT + 18 others); Tue, 3 Oct 2023 04:08:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239461AbjJCIHg (ORCPT ); Tue, 3 Oct 2023 04:07:36 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 070BB111; Tue, 3 Oct 2023 01:07:30 -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 740EF660731C; Tue, 3 Oct 2023 09:07:28 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1696320448; bh=e/xfKtsVji2TnuFJG4XtWU3Pf3eRSMy1R65/FhNyyWI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AqDc1rt9htd40mROtzfmBxcUyoXL3yt7PGxwKlNU5HKuKyZ2hoCk99rBpBZ11qgWp Q+3y1f22lolc8nnICwmFtb6ExZDZ7RztK4TfYtq1o3XePzj+ftjtwL6KhAql+/lqHM f5MCqr79kuPypDA1ZeaI5Ul1jmhdIY48gnpV1pCIcuYZBTRfVsHchXYIQVtrnyOx4x hniExmmA+dK6kqe0xJxkNGY6TMFWVF3yNOvoSTGpUk2UKZTqNZklwK37pZlOSFYVP6 pvpXU8qJ5SCkC+2PdMm6BQpAnw+kV1N1JjBSb/ztNyzjR/Y3OmYekRD1Ei3O/O5JyD NI7hRwY30a8uw== 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 30/54] media: amphion: Stop direct calls to queue num_buffers field Date: Tue, 3 Oct 2023 10:06:39 +0200 Message-Id: <20231003080704.43911-31-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:09:03 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778721011112906286 X-GMAIL-MSGID: 1778721011112906286 Use vb2_get_num_buffers() to avoid using queue num_buffers 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)