Message ID | 20231031163104.112469-33-benjamin.gaignard@collabora.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b90f:0:b0:403:3b70:6f57 with SMTP id t15csp427410vqg; Tue, 31 Oct 2023 11:16:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFAd4MeHox7rI5NDUYuoia1topWur9D4VKMrEtbm93i4KmXayT5VczArgrFWVmcbvDTk4Hn X-Received: by 2002:a05:6a00:2350:b0:6b4:6b34:8ce0 with SMTP id j16-20020a056a00235000b006b46b348ce0mr17186540pfj.31.1698776207864; Tue, 31 Oct 2023 11:16:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698776207; cv=none; d=google.com; s=arc-20160816; b=RBiOyXTa2eWq7rIOdrJfHnQfjwmBW42PNaDb+QQ1x77+iHGNTLLEzGBqgDg7fcZJqd WRHK48ZMYHJDcpHYjUWIN86DCiQxZ4W/keHRaivfo0OYjPaM92KuPLnY/vTJeI7WdqfI dUHMwlt2MyQ50gE1OA7LuAgwZwXE2XTg7kQhX1xh5EtTKba2op3n6+d8DjLyGQlpSyIy JtOd8srCDqrT/5kXl37JHlzQRWd+wdhpSpVGgJeZ3dqiwejyLpGxF43oJtJPWRxYZbUD f+qH5LvKVtbTHnFBJ2k+jSZaytvBiaNMBy5L4fSB7ouSghB7EqF6kjA0q+ekvF8xjm6L 2KNg== 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=jjcU1EdUHaOuvWhjBZZmhLhG4kfrsiodV6MICT8E4Rk=; fh=htjdJE4hfcTI3Ydhhcx4l9rF1suJMuuEBK7FcgcRZDc=; b=U8XU0GYYqWopFW5iN2lkJ2flVL4H7lBvmKnt7oTM/g4uG5BKGI71yXLGsKx+SILkVV 7LHOQGwEM5jXQ2MyfKr5JEv7tBpABGS6ULpyBWCfoptOfwjC2emvOhj6fFpuZ7UcoNmQ MCMPHdjqF9bVpANY08B0Wfj50DV/hC3GzxJ3dytP8ZPFGq4aOBeD9drvpmdzxHLSdqbW tcQGOET2izsoj70prh0bWhDU0IhNvIXfjqmAvCxR9iOOsqto9cpxHnZrq2ODdHJFqh19 EH/TzVI3AkNnHo/DBcugVl5tAqMcMN3Xc2okFcMG72HD6taCOx7cvVPVA0GzMNQRPtny F4zA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=SIELL1Tw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id fd1-20020a056a002e8100b006bd82e2d31dsi1290052pfb.384.2023.10.31.11.16.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 11:16:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=SIELL1Tw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id A85AB8097899; Tue, 31 Oct 2023 11:16:09 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229881AbjJaSP5 (ORCPT <rfc822;chrisjones.unixmen@gmail.com> + 33 others); Tue, 31 Oct 2023 14:15:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346360AbjJaQdJ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 31 Oct 2023 12:33:09 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B99A0170A; Tue, 31 Oct 2023 09:32:06 -0700 (PDT) Received: from benjamin-XPS-13-9310.. (unknown [IPv6:2a01:e0a:120:3210:c562:2ef4:80c0:92f]) (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 412F466073CE; Tue, 31 Oct 2023 16:32:04 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1698769924; bh=YJA2RlY3um15cd7mOHDvbbcCRQ1eLCd2aFKgKqMHmxc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SIELL1TwSFMjgnGqZRTIHKJoUddzjjYuppvaqHS33rEgno1Phgu2lmg+F4OsaSISm stnv4OXC3KfCgQvg2MSl0Cv6n4skiiHP4qizoOAS4gfQbPbSc5dKK/jMP2pp2l3EAP acj7n/uNSyzWg0lK3HU0AX34Q5XCgpH6YLl9vX4MyvclsK3kPuvRbYwRglEVQVNH1Q sMcgIJZVMSC3bve39VezsYnxofajsT1JywPd3YX98Snrom5yyWebt9qK/Hwu/wsqnh /pZnRO4piDOqkSbFk9dZtyiNyXUvf/fVpMYXkGYNmDn6mg84qAzKQUeOf08sgU93wQ mz0PsDLV/ys3w== 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>, Neil Armstrong <neil.armstrong@linaro.org> Subject: [PATCH v14 32/56] media: meson: vdec: Stop direct calls to queue num_buffers field Date: Tue, 31 Oct 2023 17:30:40 +0100 Message-Id: <20231031163104.112469-33-benjamin.gaignard@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231031163104.112469-1-benjamin.gaignard@collabora.com> References: <20231031163104.112469-1-benjamin.gaignard@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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: <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 (snail.vger.email [0.0.0.0]); Tue, 31 Oct 2023 11:16:09 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781295960768005261 X-GMAIL-MSGID: 1781295960768005261 |
Series |
Add DELETE_BUF ioctl
|
|
Commit Message
Benjamin Gaignard
Oct. 31, 2023, 4:30 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: Neil Armstrong <neil.armstrong@linaro.org>
---
drivers/staging/media/meson/vdec/vdec.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
Comments
W dniu 31.10.2023 o 17:30, Benjamin Gaignard pisze: > 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> Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com> > CC: Neil Armstrong <neil.armstrong@linaro.org> > --- > drivers/staging/media/meson/vdec/vdec.c | 13 +++++++------ > 1 file changed, 7 insertions(+), 6 deletions(-) > > diff --git a/drivers/staging/media/meson/vdec/vdec.c b/drivers/staging/media/meson/vdec/vdec.c > index 219185aaa588..1e2369f104c8 100644 > --- a/drivers/staging/media/meson/vdec/vdec.c > +++ b/drivers/staging/media/meson/vdec/vdec.c > @@ -167,22 +167,23 @@ static void process_num_buffers(struct vb2_queue *q, > bool is_reqbufs) > { > const struct amvdec_format *fmt_out = sess->fmt_out; > - unsigned int buffers_total = q->num_buffers + *num_buffers; > + unsigned int q_num_bufs = vb2_get_num_buffers(q); > + unsigned int buffers_total = q_num_bufs + *num_buffers; > u32 min_buf_capture = v4l2_ctrl_g_ctrl(sess->ctrl_min_buf_capture); > > - if (q->num_buffers + *num_buffers < min_buf_capture) > - *num_buffers = min_buf_capture - q->num_buffers; > + if (q_num_bufs + *num_buffers < min_buf_capture) > + *num_buffers = min_buf_capture - q_num_bufs; > if (is_reqbufs && buffers_total < fmt_out->min_buffers) > - *num_buffers = fmt_out->min_buffers - q->num_buffers; > + *num_buffers = fmt_out->min_buffers - q_num_bufs; > if (buffers_total > fmt_out->max_buffers) > - *num_buffers = fmt_out->max_buffers - q->num_buffers; > + *num_buffers = fmt_out->max_buffers - q_num_bufs; > > /* We need to program the complete CAPTURE buffer list > * in registers during start_streaming, and the firmwares > * are free to choose any of them to write frames to. As such, > * we need all of them to be queued into the driver > */ > - sess->num_dst_bufs = q->num_buffers + *num_buffers; > + sess->num_dst_bufs = q_num_bufs + *num_buffers; > q->min_buffers_needed = max(fmt_out->min_buffers, sess->num_dst_bufs); > } >
diff --git a/drivers/staging/media/meson/vdec/vdec.c b/drivers/staging/media/meson/vdec/vdec.c index 219185aaa588..1e2369f104c8 100644 --- a/drivers/staging/media/meson/vdec/vdec.c +++ b/drivers/staging/media/meson/vdec/vdec.c @@ -167,22 +167,23 @@ static void process_num_buffers(struct vb2_queue *q, bool is_reqbufs) { const struct amvdec_format *fmt_out = sess->fmt_out; - unsigned int buffers_total = q->num_buffers + *num_buffers; + unsigned int q_num_bufs = vb2_get_num_buffers(q); + unsigned int buffers_total = q_num_bufs + *num_buffers; u32 min_buf_capture = v4l2_ctrl_g_ctrl(sess->ctrl_min_buf_capture); - if (q->num_buffers + *num_buffers < min_buf_capture) - *num_buffers = min_buf_capture - q->num_buffers; + if (q_num_bufs + *num_buffers < min_buf_capture) + *num_buffers = min_buf_capture - q_num_bufs; if (is_reqbufs && buffers_total < fmt_out->min_buffers) - *num_buffers = fmt_out->min_buffers - q->num_buffers; + *num_buffers = fmt_out->min_buffers - q_num_bufs; if (buffers_total > fmt_out->max_buffers) - *num_buffers = fmt_out->max_buffers - q->num_buffers; + *num_buffers = fmt_out->max_buffers - q_num_bufs; /* We need to program the complete CAPTURE buffer list * in registers during start_streaming, and the firmwares * are free to choose any of them to write frames to. As such, * we need all of them to be queued into the driver */ - sess->num_dst_bufs = q->num_buffers + *num_buffers; + sess->num_dst_bufs = q_num_bufs + *num_buffers; q->min_buffers_needed = max(fmt_out->min_buffers, sess->num_dst_bufs); }