Message ID | 20231019125222.21370-36-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:2010:b0:403:3b70:6f57 with SMTP id fe16csp360867vqb; Thu, 19 Oct 2023 05:57:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFkymRg91+fYGELxjZni5JV6h2econDglnB3KvN1Zjlc+HdUPvo8dgKpSOrvUtsDWd6uMUS X-Received: by 2002:a17:90a:bf09:b0:27c:fd8c:7d28 with SMTP id c9-20020a17090abf0900b0027cfd8c7d28mr1962604pjs.39.1697720231948; Thu, 19 Oct 2023 05:57:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697720231; cv=none; d=google.com; s=arc-20160816; b=Glk/RvOokTYrgj8Sm3d3JUJbY0wC7jh7heQmmJhhPv/iel57aXRGJD0+CW1cCJiCsL jrV71GKQ9IIhn1foff8/yis8NKrBG5vGlXiTi1Vl19Uu3233gB/uktrX1ZjvwzjHnriU +9OciOB+kEYm7knbBk9EGQCWsRJgezguZxvLmOzZ3IlN/L6Wh9QcCQ78Mgs7UPs5T585 YIdtWkHoD0xAGPbJm64CaDemIVcvtOz2ahBAZHJNmcSMuHga7UfzsUKWtj7Zs5tzbPcZ 0AH+xrbLV717xKUOQqiTvK4Mc5zMzz34thFhp/r8xjBUkYR6kKlMdDduEpL8oJKEjMD+ m2IQ== 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=qa0gGpZNMAqHQmNMLRw2KJGOdZocq9+DqAJPNBVbPVs=; fh=aVUrqUP+Ljv+BSkNtX805Xk8KRvk/poCiUhiRUDoQMU=; b=OtGRxYQEtzByHACfmt3tXQqW/K23C9DhQydIDN5CVjyB6noC8PY8vW1K4tqoDSxHLc lIC6mC+FSJGZgmgCwZFhfhQm/6SoOZcxmuD8+mavPGhWvNjQxE/ZmEgo2yOaIDfFDIuQ 2p+/5CFd1fZh4A/MitM4oeaJa7/kFTBW8oM6eKKe0Q9KJaX86ux8WolRjeXxjNXWtkgX GITxvM/i1OPXQ6+X43cqWpPZf7dZcfqj7fugShbb9LrFvQMS4HVOYrg+wJwRzFVZv+QO i80U50t+zqC0UehnmT6okXwrjstNy4pwkZajbJoSORbJty/mCFQgkKbOJ0uIj3dR72FB HO5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=XV5FLo+T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id lr7-20020a17090b4b8700b0027ce7a59589si2260605pjb.142.2023.10.19.05.57.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 05:57:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=XV5FLo+T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id 2304D8198C70; Thu, 19 Oct 2023 05:56:42 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346137AbjJSMz2 (ORCPT <rfc822;lkml4gm@gmail.com> + 25 others); Thu, 19 Oct 2023 08:55:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345930AbjJSMxQ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 19 Oct 2023 08:53:16 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1FB6D45; Thu, 19 Oct 2023 05:52:50 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:ccea:1fb5:34eb:239b]) (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 DB9DC6607377; Thu, 19 Oct 2023 13:52:48 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1697719969; bh=+N2NXYHRMMiyUC0gb7VJb1oDXBrovxuB6Pt09SJAcIk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XV5FLo+TUzvHfEOAgrj0IPsE6R7ebKhE3JzjZP4OY+sTIgxJTPxko5wOXx50hnXls NqugT+P4wtk1gmWU5nuLD0pLQnasBGBaYjg/FtdRiHoPRfFLYDSzySZGwBqduZBpc8 jY9jSlxqfpp2M8x73ZtB+UYLBGIbO+bXNuf3/WX7z89WE3LqhgB8Gpv4xAHdPUwz89 OTZeo2ZfhFQA13BoMs6gGoKxovJ4ruEaHX+u80ccL1EyWTPHJDgucdOQe806WMKfJR mWF3xVcx9IriP1g+Z8ikgWz+OgUol9SWOOJZSIrW8qa1AZ5766UELHR2yfAnu3CREm PsC6YgDIff9qw== 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>, Paul Kocialkowski <paul.kocialkowski@bootlin.com>, Maxime Ripard <mripard@kernel.org> Subject: [PATCH v13 35/56] media: cedrus: Stop direct calls to queue num_buffers field Date: Thu, 19 Oct 2023 14:52:01 +0200 Message-Id: <20231019125222.21370-36-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231019125222.21370-1-benjamin.gaignard@collabora.com> References: <20231019125222.21370-1-benjamin.gaignard@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 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 agentk.vger.email 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 (agentk.vger.email [0.0.0.0]); Thu, 19 Oct 2023 05:56:42 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780188689488611624 X-GMAIL-MSGID: 1780188689488611624 |
Series |
Add DELETE_BUF ioctl
|
|
Commit Message
Benjamin Gaignard
Oct. 19, 2023, 12:52 p.m. UTC
Use vb2_get_num_buffers() to avoid using queue num_buffers field directly. This allows us to change how the number of buffers is computed in the future. Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com> Acked-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com> CC: Maxime Ripard <mripard@kernel.org> --- drivers/staging/media/sunxi/cedrus/cedrus_h264.c | 9 +++++++-- drivers/staging/media/sunxi/cedrus/cedrus_h265.c | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c index dfb401df138a..3e2843ef6cce 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c @@ -653,8 +653,13 @@ static void cedrus_h264_stop(struct cedrus_ctx *ctx) vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE); - for (i = 0; i < vq->num_buffers; i++) { - buf = vb2_to_cedrus_buffer(vb2_get_buffer(vq, i)); + for (i = 0; i < vb2_get_num_buffers(vq); i++) { + struct vb2_buffer *vb = vb2_get_buffer(vq, i); + + if (!vb) + continue; + + buf = vb2_to_cedrus_buffer(vb); if (buf->codec.h264.mv_col_buf_size > 0) { dma_free_attrs(dev->dev, diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c b/drivers/staging/media/sunxi/cedrus/cedrus_h265.c index fc9297232456..52e94c8f2f01 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus_h265.c @@ -869,8 +869,13 @@ static void cedrus_h265_stop(struct cedrus_ctx *ctx) vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE); - for (i = 0; i < vq->num_buffers; i++) { - buf = vb2_to_cedrus_buffer(vb2_get_buffer(vq, i)); + for (i = 0; i < vb2_get_num_buffers(vq); i++) { + struct vb2_buffer *vb = vb2_get_buffer(vq, i); + + if (!vb) + continue; + + buf = vb2_to_cedrus_buffer(vb); if (buf->codec.h265.mv_col_buf_size > 0) { dma_free_attrs(dev->dev,