Message ID | 20231019125222.21370-33-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 fe16csp360935vqb; Thu, 19 Oct 2023 05:57:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEiA/Q13FxXYpun8M515pim+Yw7eqVyIQrMXOIx8Y1F8DSR8GSdVz/qQn5OgDpxwBPGo49L X-Received: by 2002:a05:6a20:a10d:b0:17a:4871:63fd with SMTP id q13-20020a056a20a10d00b0017a487163fdmr2437863pzk.0.1697720241580; Thu, 19 Oct 2023 05:57:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697720241; cv=none; d=google.com; s=arc-20160816; b=ef+zQfz2I9tHEookH7G6bX6fvCjT8Dtrag7IaVl4FUf6/ttXvkvx+a8nsa9cpmTZIg NIFJd6vR25dyymqOLhh1c/1fICJHUgcBZ/FZLDSYPC03vETP+BPTQw32icQ0S82vv3J3 ONwCQcYukYiPT/CkIgEt0dcDaRewle90muPaEF+b9xZWaN5MqU5fCgyrXxpLuG379/fd gjCPjKIURs/LMFisLz/09F0Un3rnu/D22r5BaCgEd64t2vBV1sH4NKoiWfwCcNeU29qY JisPjPL/eCh7cUgXN/8USTpr7ho+E2V+rVR+zDQQ2sgnhP2vvAFKagl6TDNKBR9XvfHI lO8w== 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=kw3hKzQB5EYTGQqevMw+okMRYPhJIwQaeiDTNcCZ9J8sJ11bTKcPTAfELy/ShNp1TS lYcU3cm/R7w7NOBpbzgA++TsWOxuMc0uf7o8hkVOq5E4TYHtLhYcA0j6T93V1Sr9c657 Lvl+ptIetXpxNQWnm1V9apBo17zYnSLB8S0qLWuP/T1Y3BwJqSXqXiBSRLZ4Hy07k//L VkAiQB/39QtPd1w2wMpdA1ch6qXdxsANKh/ATiZFyErbrXwj3eRSOYN3ZzRqFnRZAZLs FnVX9McMpIYAZUKL6Z3V9C0K169JY2ZWjfSoQeVwx8v/LQ0rNO695x82NbbISyBMzcAx nHNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=T1BIXVy4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id i68-20020a639d47000000b005783367f97fsi4211169pgd.342.2023.10.19.05.57.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 05:57:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=T1BIXVy4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (Postfix) with ESMTP id 8CE4E80615C8; Thu, 19 Oct 2023 05:57:06 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346197AbjJSMzQ (ORCPT <rfc822;lkml4gm@gmail.com> + 25 others); Thu, 19 Oct 2023 08:55:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345915AbjJSMxP (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 19 Oct 2023 08:53:15 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C9C712A; Thu, 19 Oct 2023 05:52:49 -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 4F5F06607372; Thu, 19 Oct 2023 13:52:47 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1697719967; bh=YJA2RlY3um15cd7mOHDvbbcCRQ1eLCd2aFKgKqMHmxc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T1BIXVy4triCVAt6pjZ/aC6yzjKJJpV0DffsN4QizS6e/PAeJMPLQq5HUJnJ3p+dj WfTmJXlL1D/M0SwDVuU4OheZpUBSgdLx99vxEQA1CoANiwdhAWAt9AKEFq+dzHfBDb ltan1oSRqDFwnGRWsV3fiHaODWhE6Aoj6sRQOZ7517tlmhq+ABMNT+/15KvtzBsaWI if0AVWEH49tgMiDSF7EdF56jcKxYpOT5s0KMKY9K7yLNQoTGsHEk5GFdkP6HO8U7HR dxaqcYdq7D3YTVJwcfcv0VxjTodzzoblUNgF4X5GwRUozhPGou+OtsLtIloS9wthaL BuaBDHYjHcIOg== 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 v13 32/56] media: meson: vdec: Stop direct calls to queue num_buffers field Date: Thu, 19 Oct 2023 14:51:58 +0200 Message-Id: <20231019125222.21370-33-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 fry.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 (fry.vger.email [0.0.0.0]); Thu, 19 Oct 2023 05:57:06 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780188700114526738 X-GMAIL-MSGID: 1780188700114526738 |
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: 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); }