From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: David Laight <David.Laight@ACULAB.COM>,
Benjamin Gaignard <benjamin.gaignard@collabora.com>,
"tfiga@chromium.org" <tfiga@chromium.org>,
"m.szyprowski@samsung.com" <m.szyprowski@samsung.com>,
"mchehab@kernel.org" <mchehab@kernel.org>,
"ming.qian@nxp.com" <ming.qian@nxp.com>,
"shijie.qin@nxp.com" <shijie.qin@nxp.com>,
"eagle.zhou@nxp.com" <eagle.zhou@nxp.com>,
"bin.liu@mediatek.com" <bin.liu@mediatek.com>,
"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
"angelogioacchino.delregno@collabora.com"
<angelogioacchino.delregno@collabora.com>,
"tiffany.lin@mediatek.com" <tiffany.lin@mediatek.com>,
"andrew-ct.chen@mediatek.com" <andrew-ct.chen@mediatek.com>,
"yunfei.dong@mediatek.com" <yunfei.dong@mediatek.com>,
"stanimir.k.varbanov@gmail.com" <stanimir.k.varbanov@gmail.com>,
"quic_vgarodia@quicinc.com" <quic_vgarodia@quicinc.com>,
"agross@kernel.org" <agross@kernel.org>,
"andersson@kernel.org" <andersson@kernel.org>,
"konrad.dybcio@linaro.org" <konrad.dybcio@linaro.org>,
"ezequiel@vanguardiasur.com.ar" <ezequiel@vanguardiasur.com.ar>,
"p.zabel@pengutronix.de" <p.zabel@pengutronix.de>,
"daniel.almeida@collabora.com" <daniel.almeida@collabora.com>,
"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-mediatek@lists.infradead.org"
<linux-mediatek@lists.infradead.org>,
"linux-arm-msm@vger.kernel.org" <linux-arm-msm@vger.kernel.org>,
"linux-rockchip@lists.infradead.org"
<linux-rockchip@lists.infradead.org>,
"kernel@collabora.com" <kernel@collabora.com>
Subject: Re: [RFC 2/4] media: videobuf2: Replace bufs array by a list
Date: Mon, 20 Mar 2023 01:33:58 +0200 [thread overview]
Message-ID: <20230319233358.GD20234@pendragon.ideasonboard.com> (raw)
In-Reply-To: <cbf34cf1-e065-8136-8344-89ca1864f637@xs4all.nl>
Hi Hans,
On Tue, Mar 14, 2023 at 11:42:46AM +0100, Hans Verkuil wrote:
> On 3/14/23 11:11, David Laight wrote:
> > From: Hans Verkuil
> >> Sent: 14 March 2023 08:55
> > ...
> >> Why not start with a dynamically allocated array of 32 vb2_buffer pointers?
> >> And keep doubling the size (reallocing) whenever more buffers are needed,
> >> up to some maximum (1024 would be a good initial value for that, I think).
> >> This max could be even a module option.
The kernel has IDR and IDA APIs, why not use them instead of reinventing
the wheel ?
> > I don't know the typical uses (or the code at all).
> > But it might be worth having a small array in the structure itself.
> > Useful if there are typically always (say) less than 8 buffers.
> > For larger sizes use the (IIRC) kmalloc_size() to find the actual
> > size of the structure that will be allocate and set the array
> > size appropriately.
>
> The typical usage is that applications allocate N buffers with the
> VIDIOC_REQBUFS ioctl, and in most cases that's all they use.
Note that once we get DELETE_BUF (or DELETE_BUFS) support I'd like to
encourage applications to use the new API, and deprecate REQBUFS
(dropping it isn't on my radar, as it would take forever before no
userspace uses it anymore).
> The
> current max is 32 buffers, so allocating that initially (usually
> during probe()) will cover all current cases with a single one-time
> kzalloc.
Pre-allocating for the most common usage patterns is fine with me.
> Only if the application wants to allocate more than 32 buffers will
> there be a slight overhead.
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2023-03-19 23:34 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-13 13:59 [RFC 0/4] Allow more than 32 vb2 buffers per queue Benjamin Gaignard
2023-03-13 13:59 ` [RFC 1/4] media: videobuf2: Use vb2_get_buffer() as helper everywhere Benjamin Gaignard
2023-03-13 16:51 ` Andrzej Pietrasiewicz
2023-03-13 16:56 ` Benjamin Gaignard
2023-03-13 18:01 ` Laurent Pinchart
2023-03-13 18:04 ` Laurent Pinchart
2023-03-13 13:59 ` [RFC 2/4] media: videobuf2: Replace bufs array by a list Benjamin Gaignard
2023-03-13 18:11 ` Laurent Pinchart
2023-03-13 23:16 ` David Laight
2023-03-14 8:55 ` Hans Verkuil
2023-03-14 10:11 ` David Laight
2023-03-14 10:42 ` Hans Verkuil
2023-03-19 23:33 ` Laurent Pinchart [this message]
2023-03-22 14:50 ` Nicolas Dufresne
2023-03-22 15:01 ` Laurent Pinchart
2023-03-24 15:14 ` Nicolas Dufresne
2023-03-24 15:18 ` Hans Verkuil
2023-03-24 15:34 ` Nicolas Dufresne
2023-03-24 20:21 ` Laurent Pinchart
2023-03-15 13:57 ` Nicolas Dufresne
2023-03-19 23:33 ` Laurent Pinchart
2023-03-13 13:59 ` [RFC 3/4] media: videobuf2: Use bitmap to manage vb2 index Benjamin Gaignard
2023-03-13 18:14 ` Laurent Pinchart
2023-03-14 2:10 ` [EXT] " Ming Qian
2023-03-13 13:59 ` [RFC 4/4] media: videobuf2: Stop define VB2_MAX_FRAME as global Benjamin Gaignard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230319233358.GD20234@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=David.Laight@ACULAB.COM \
--cc=agross@kernel.org \
--cc=andersson@kernel.org \
--cc=andrew-ct.chen@mediatek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=benjamin.gaignard@collabora.com \
--cc=bin.liu@mediatek.com \
--cc=daniel.almeida@collabora.com \
--cc=eagle.zhou@nxp.com \
--cc=ezequiel@vanguardiasur.com.ar \
--cc=hverkuil-cisco@xs4all.nl \
--cc=kernel@collabora.com \
--cc=konrad.dybcio@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=m.szyprowski@samsung.com \
--cc=matthias.bgg@gmail.com \
--cc=mchehab@kernel.org \
--cc=ming.qian@nxp.com \
--cc=p.zabel@pengutronix.de \
--cc=quic_vgarodia@quicinc.com \
--cc=shijie.qin@nxp.com \
--cc=stanimir.k.varbanov@gmail.com \
--cc=tfiga@chromium.org \
--cc=tiffany.lin@mediatek.com \
--cc=yunfei.dong@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox