Message ID | 20231019125222.21370-32-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 fe16csp360649vqb; Thu, 19 Oct 2023 05:56:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEJ9XwRi1/6adcjbkhrWgU3eIKsscfSsSyJamCvgdU+f/vTjHACsPAuJhpFjbw1i+qPOWjx X-Received: by 2002:a05:6a20:144a:b0:15e:707c:904 with SMTP id a10-20020a056a20144a00b0015e707c0904mr2221247pzi.24.1697720205944; Thu, 19 Oct 2023 05:56:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697720205; cv=none; d=google.com; s=arc-20160816; b=Eesp0ZvYV+m+OpoCMv3iA+P3DBn0CroK6zjV56ma/XtLFdMhYDH+5Fdg2MbGH6zPyr MEdI5RPVMe/Bvl3PbnGah0PR7o5ahDQ4s2fIFV0RMEBYRjYYbehkjR5gPzD0vz3rK8jn w5Ri51rzcCPRbBXbYJlkrz15HJOdNfdX9BKtFWQXcuQ/nlfGeE5LCeg/x2dZZ18sTtt6 ALfk3/9S0DCBaZ61innjIR2EXRvymhbOJ2mtARH2YHtFjuwhme6HTbPYPWfKMSUsgyo/ vqogOeO5HtzhjLjNZPCOfwR/FX32UIrGP8V7rS/RcEqqV16DVsUjQ3WRMvBgGIagBLaD fDMw== 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=Puy0NuCUoizD9tUXGoeztaPEYZUcHsDAGMF7ZhtLfh4=; fh=171ZbtLkqTQvfc21XcAM+Vd/toNFohdADskHHVOkNqQ=; b=tOFdUWK3tEAF8J9OOIwhwSntfrijEaYSvmYqQoAuJs80OIoxmWXwGrpq/YUUyz07lx 2lseMvAnz+Z1N0fU7jUKViXeCZkeE07hn8nf9FCXA4UBXN9TZ1beyIOtvuSzOeJCt0I7 /ykEwnaBUgVCnA35KTSaVR+tYvx9spBk4RhIU3EE6z0Yfz4mzoPJ+VLs0Oq3mzOMoicH sH5Um5FLE6lm8L+86z+rnrGsDrvDY1575JyF0dWN65vx2STAmO94GVHPibCV0IxKKMX3 hQkOLhYBmuHlGzxPw/ndkC4VINloWm2ORG+VMN6o6iOTbRqymMjds44/7dkCuUKiJqx1 H8Ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=NPOhtWUo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id cb15-20020a056a02070f00b0057b55b52870si593189pgb.170.2023.10.19.05.56.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 05:56:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=NPOhtWUo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (Postfix) with ESMTP id 3655480227E7; Thu, 19 Oct 2023 05:56:03 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345962AbjJSMzG (ORCPT <rfc822;lkml4gm@gmail.com> + 25 others); Thu, 19 Oct 2023 08:55:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345909AbjJSMxM (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 19 Oct 2023 08:53:12 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81874194; Thu, 19 Oct 2023 05:52:48 -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 C69DD6607371; Thu, 19 Oct 2023 13:52:46 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1697719967; bh=5BKm2pXhsA2CwROeeB4gGq1coubFRjY0WIZn0P61OpQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NPOhtWUo5OmgNJnQwpf3bAqRLTR7IuEHGa5ERSSJ6I53sOe+9Audkd0UcbpPcva2H ypdN7CzbBA1ZZVB4ZSoUsv9CECXeTUtc7DBBMRctM6NOImiFn9y3W4Ur4xwPQFGBRR G0KgHI78j2ZsLnKTKlzt9dxDqeBL2G997/7DeD9YW+eZS5cjWjdo4vL0FLUDOhvjQN e7gFB3KjHopMIc8aoDaP1vnQ3KGgrDPGLhAbbvTAhGXQjBNpcRaxZ2N5AFuIPJTPK+ o/Y8indILMxG7mWNqns38Z6252TSUPUzcThJFvXDmNK0aRcD/9Y1wuGYpCirAuP6zc qUv+TbgZQH8Sg== 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>, Steve Longerbeam <slongerbeam@gmail.com> Subject: [PATCH v13 31/56] media: imx: Stop direct calls to queue num_buffers field Date: Thu, 19 Oct 2023 14:51:57 +0200 Message-Id: <20231019125222.21370-32-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 morse.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 (morse.vger.email [0.0.0.0]); Thu, 19 Oct 2023 05:56:03 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780188662843188433 X-GMAIL-MSGID: 1780188662843188433 |
Series |
Add DELETE_BUF ioctl
|
|
Commit Message
Benjamin Gaignard
Oct. 19, 2023, 12:51 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>
CC: Steve Longerbeam <slongerbeam@gmail.com>
CC: Philipp Zabel <p.zabel@pengutronix.de>
---
drivers/staging/media/imx/imx-media-capture.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/media/imx/imx-media-capture.c b/drivers/staging/media/imx/imx-media-capture.c index 4846078315ff..ce02199e7b1b 100644 --- a/drivers/staging/media/imx/imx-media-capture.c +++ b/drivers/staging/media/imx/imx-media-capture.c @@ -605,6 +605,7 @@ static int capture_queue_setup(struct vb2_queue *vq, { struct capture_priv *priv = vb2_get_drv_priv(vq); struct v4l2_pix_format *pix = &priv->vdev.fmt; + unsigned int q_num_bufs = vb2_get_num_buffers(vq); unsigned int count = *nbuffers; if (vq->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) @@ -613,14 +614,14 @@ static int capture_queue_setup(struct vb2_queue *vq, if (*nplanes) { if (*nplanes != 1 || sizes[0] < pix->sizeimage) return -EINVAL; - count += vq->num_buffers; + count += q_num_bufs; } count = min_t(__u32, VID_MEM_LIMIT / pix->sizeimage, count); if (*nplanes) - *nbuffers = (count < vq->num_buffers) ? 0 : - count - vq->num_buffers; + *nbuffers = (count < q_num_bufs) ? 0 : + count - q_num_bufs; else *nbuffers = count;