From patchwork Thu Sep 14 13:33:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 139665 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp455975vqi; Thu, 14 Sep 2023 09:07:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHRgIdGN9QKYifkAwKNmqt7kg13XDZ8W8+3kw7r6QSnfq7guzu6wigTgjhq1vivkxBqSyqk X-Received: by 2002:a17:90a:db41:b0:271:df08:6024 with SMTP id u1-20020a17090adb4100b00271df086024mr5953456pjx.17.1694707619946; Thu, 14 Sep 2023 09:06:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694707619; cv=none; d=google.com; s=arc-20160816; b=s8eM+BGKwbhtTTTpl0ftILzoBXn5xqyJDZ0FcSzaA/vLaJzhOVJy9PFVSdXevamtg3 2uUQf5sYh1cCnfBun//iBcKWPU+NO3b7NiAS/WkUysnlZb02BIceZmd7EUC8zz8KoMgN 9UiS0JtsFM3Rtj9eCQcAVQj2eGiVkDpBMea9pR3Xz7Guv8vhkeEIbV6TMMjdoBXW0QZs wScm+VOLTSUs6t5JZXUSnmgpVKq5KbvchK+PpeaTZuothfFvjqNVNrJo8dMSlsffyM17 JPpCvZlOjzxt0tuVz8To0/36SRSIk7BwBpjrX1L8SudPTdBlXLvd2b36d/UgSaWUC6hL 6iag== 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=FQ5F4xfO7mIkMqtItWWZDGjXEjnB/2LPnEMxgf06HOQ=; fh=ceA81l8d2hZW6pWH7VE5TwJxtgXUzAubfWIMcikPA1M=; b=U8jFuDm09EnWiv3B+jDh8njGSzQyK7u1nlYiNGvFGVmWgU3zXryHCNqxWK0rOfQ8+I 2Mz5d6Ps1ClTPQl5Zc2k9xcKp/AKkLaXN+urN6635H1uWhY3JGG0Aff8DcOgjHb1Kp95 M4f1zei38ky0sdbPzTDf3logUMBpncEgqPE7YUwTfMlqqg8fbmrvakfB1k3IvgMy4C6p U4a6V/ac4BsPsJR4g94iPRlqg4Zr/0LdS2kpbkIHEkY/poc4DHtHpn5gv3fjh2cyT1dg KgN91tOtQ8iHNu7J89jkizIna8oUFnzPkpwfGME4llnZQamK8Mn4t+s9EHr6sdJjxOEv d39A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=YvjvRTk2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id p2-20020a17090a2d8200b0026d4adee541si4010153pjd.150.2023.09.14.09.06.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 09:06:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=YvjvRTk2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id EB08E81BFA99; Thu, 14 Sep 2023 06:35:59 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239147AbjINNet (ORCPT + 35 others); Thu, 14 Sep 2023 09:34:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239229AbjINNeD (ORCPT ); Thu, 14 Sep 2023 09:34:03 -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 4CBD1211E; Thu, 14 Sep 2023 06:33:47 -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 BADF56607354; Thu, 14 Sep 2023 14:33:45 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1694698426; bh=r/+dARFgLlqIYPCNsTNg9ylalWpmLzdptnRKI8OWLEk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YvjvRTk2FQuuuUs3HNGiHLDrwCbLyrYMWAL9JKval+qun6XwuAj6wgBBBfYt4IfYc xbmXCiUoxGZ4dVyag8AP0dCKYveSLx8N/9qEJjjg7/AK+32irfARE5BXXCdaPQ8C5q eGm/YqgIEkTHpr2n7umROLKbceFmejEHZwmhe+YMQAbkP64MrVDmu7NcqXZqiiff9W gVkhsgGZ27DQpJjT0kvrPuk/Hz8Gqd2Apyrf407pV8PK+uLskqE/XxU8YrO4ActwJl Rgku5Vrd3E+aZf9DjbXETUSohr6bM123BAC87DsXQcitdM/BcaI8PjCHJvYVe/Z4+1 7FpdiNtI5tZ0w== 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 28/49] media: amphion: Stop direct calls to queue num_buffers field Date: Thu, 14 Sep 2023 15:33:02 +0200 Message-Id: <20230914133323.198857-29-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 (lipwig.vger.email [0.0.0.0]); Thu, 14 Sep 2023 06:36:00 -0700 (PDT) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777029737709003681 X-GMAIL-MSGID: 1777029737709003681 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..61530ef92ff0 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_allowed_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_allowed_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)