Message ID | 20230914133323.198857-45-benjamin.gaignard@collabora.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp750584vqi; Thu, 14 Sep 2023 19:09:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH6W4s6fLeiAm9+viYJnkJ9uCig1YBZm4yCnWkEOc7IDmGYoY2kOax0o5do68v+7jehAD4p X-Received: by 2002:a17:903:41c6:b0:1bc:4415:3c1 with SMTP id u6-20020a17090341c600b001bc441503c1mr4746121ple.7.1694743758908; Thu, 14 Sep 2023 19:09:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694743758; cv=none; d=google.com; s=arc-20160816; b=e+v5Zmz5eGN3Ut9JsKZoGioYLHdTcQA9mWFrz7OFBeKWcacK9ZWJBORP7rMsmrL3Vs 4BvKRp8wdhe2GtXuvjGJzPCQuiLRxJD+2CwEiMuHSl3BPr3lFZAZ8RKHVMMy3+C/96hi MPNryR83ZHw84xONy3YcoFYYude6KMcvMYZHkA6gEK3w3fp4+PUhG0cXu6j8yVtOhDMW 9blir2j0dFhb1TnIBHoZ9w8e/30nXg++Zo5/3xHEadoO9WkeSshtlcYnIGwWqywO/EWg d6qfrZJDEK78Ug4/x/B1pUQ4keYFrZcF8ggh3+HZQE6eW+PhSPJo2m5FDLSLPh9Z1DKi 6Jig== 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=JTqy2pC04+lk+/eoSQ19afzHN9WljXx7c9EzRlHGO24=; fh=ceA81l8d2hZW6pWH7VE5TwJxtgXUzAubfWIMcikPA1M=; b=rk6sopFMh3Xa8f7tijxLWyQQwpYDmYhrewOn2t3ndG2rpPba3EFnTKaaEjyPTRtUZA p3Rl9jS+On9LMS5Kj4D9fB/zmJ3zB6WcgOj1Znwa2SzWMBBocZVSP2qYkZoH/fW1n1ss SZB0gIqtZbAh/BI5vYZmNneZpEIRzuza5FktJ0wxplb0CfBTrdufnZbmDIldrdC4Q1IO n2f18f4+Yfy4OOQPSi+3YKZZyKr+AmxjOIbJtS5TGniwtY3ermHWB+5ezYF81FobrCwu 0LmlFJBWYM+DbnK6uZidB9WWmxg3FadYlAUFzQll8qb3S+glDgIGB/cVQuD7PTzHwMLU +0hQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=EN1kyPC5; 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 d26-20020a63735a000000b0057745d87b4csi2375209pgn.526.2023.09.14.19.09.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 19:09:18 -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=EN1kyPC5; 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 4566E8523B72; Thu, 14 Sep 2023 06:35:59 -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 S240094AbjINNfv (ORCPT <rfc822;chrisfriedt@gmail.com> + 35 others); Thu, 14 Sep 2023 09:35:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239567AbjINNfJ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 14 Sep 2023 09:35:09 -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 AAC1D1FE5; 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 2AD386607397; Thu, 14 Sep 2023 14:33:54 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1694698434; bh=yoC4Zwhq5KTur5ZjSqFZrMNs6UvSbNFXWhR9MCqzlE0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EN1kyPC5ZKZ0JvmFCHlIc1mglG9qMNrLetcPCcD67N4xE1hTklCKDCBTvVfTSBYtU 4VNAqqLMDJojsiDBr9PfSg4Kt/L5wOkzMHIp7Usvkg/OS+8DY4qa1pvR2N7afmXPyC NPow5YjSKRGIxTyvDgTgfOMCCa1zzZFqt6bl9BATFAck5lp7Bimj7Aas9Pf+8xC0Tq 3NLcbDX6LdHM4Xmh6JOa78HIpfZYGLmJWaZHRQGjuXwOpDpMKaH5y5+d9U+DCk+m8K 9ABes+Pt0cxXhdedx+kGDyyVz/RVHpy946pJKhtX/sNhAZUv13kdwss33nLLep2094 cH5Qa5D0y4jKg== From: Benjamin Gaignard <benjamin.gaignard@collabora.com> 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 <benjamin.gaignard@collabora.com> Subject: [PATCH v7 44/49] media: cedrus: Stop direct calls to queue num_buffers field Date: Thu, 14 Sep 2023 15:33:18 +0200 Message-Id: <20230914133323.198857-45-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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> 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]); Thu, 14 Sep 2023 06:35:59 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777067632094675199 X-GMAIL-MSGID: 1777067632094675199 |
Series |
Add DELETE_BUF ioctl
|
|
Commit Message
Benjamin Gaignard
Sept. 14, 2023, 1:33 p.m. UTC
Use vb2_get_num_buffers() to avoid using queue num_buffer field directly.
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
---
drivers/staging/media/sunxi/cedrus/cedrus_h264.c | 4 +++-
drivers/staging/media/sunxi/cedrus/cedrus_h265.c | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
Comments
On 14/09/2023 15:33, Benjamin Gaignard wrote: > Use vb2_get_num_buffers() to avoid using queue num_buffer field directly. > > Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> > --- > drivers/staging/media/sunxi/cedrus/cedrus_h264.c | 4 +++- > drivers/staging/media/sunxi/cedrus/cedrus_h265.c | 4 +++- > 2 files changed, 6 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c > index dfb401df138a..bbe5802ea861 100644 > --- a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c > +++ b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c > @@ -649,11 +649,13 @@ static void cedrus_h264_stop(struct cedrus_ctx *ctx) > struct cedrus_dev *dev = ctx->dev; > struct cedrus_buffer *buf; > struct vb2_queue *vq; > + unsigned int q_num_bufs; > unsigned int i; > > vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE); > + q_num_bufs = vb2_get_num_buffers(vq); > > - for (i = 0; i < vq->num_buffers; i++) { > + for (i = 0; i < q_num_bufs; i++) { Shouldn't this be vq->max_allowed_buffers? > buf = vb2_to_cedrus_buffer(vb2_get_buffer(vq, i)); And continue if vb2_get_buffer(vq, i) == NULL? > > if (buf->codec.h264.mv_col_buf_size > 0) { > diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c b/drivers/staging/media/sunxi/cedrus/cedrus_h265.c > index fc9297232456..533a38316686 100644 > --- a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c > +++ b/drivers/staging/media/sunxi/cedrus/cedrus_h265.c > @@ -865,11 +865,13 @@ static void cedrus_h265_stop(struct cedrus_ctx *ctx) > struct cedrus_dev *dev = ctx->dev; > struct cedrus_buffer *buf; > struct vb2_queue *vq; > + unsigned int q_num_bufs; > unsigned int i; > > vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE); > + q_num_bufs = vb2_get_num_buffers(vq); > > - for (i = 0; i < vq->num_buffers; i++) { > + for (i = 0; i < q_num_bufs; i++) { Ditto. > buf = vb2_to_cedrus_buffer(vb2_get_buffer(vq, i)); > > if (buf->codec.h265.mv_col_buf_size > 0) { If this driver starts supporting DELETE_BUF, then you can't use vb2_get_num_buffers(vq), right? Hans
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c index dfb401df138a..bbe5802ea861 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c @@ -649,11 +649,13 @@ static void cedrus_h264_stop(struct cedrus_ctx *ctx) struct cedrus_dev *dev = ctx->dev; struct cedrus_buffer *buf; struct vb2_queue *vq; + unsigned int q_num_bufs; unsigned int i; vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE); + q_num_bufs = vb2_get_num_buffers(vq); - for (i = 0; i < vq->num_buffers; i++) { + for (i = 0; i < q_num_bufs; i++) { buf = vb2_to_cedrus_buffer(vb2_get_buffer(vq, i)); if (buf->codec.h264.mv_col_buf_size > 0) { diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c b/drivers/staging/media/sunxi/cedrus/cedrus_h265.c index fc9297232456..533a38316686 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus_h265.c @@ -865,11 +865,13 @@ static void cedrus_h265_stop(struct cedrus_ctx *ctx) struct cedrus_dev *dev = ctx->dev; struct cedrus_buffer *buf; struct vb2_queue *vq; + unsigned int q_num_bufs; unsigned int i; vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE); + q_num_bufs = vb2_get_num_buffers(vq); - for (i = 0; i < vq->num_buffers; i++) { + for (i = 0; i < q_num_bufs; i++) { buf = vb2_to_cedrus_buffer(vb2_get_buffer(vq, i)); if (buf->codec.h265.mv_col_buf_size > 0) {