From: Nicolas Dufresne <nicolas@ndufresne.ca>
To: Hans Verkuil <hverkuil@xs4all.nl>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Kazunori Kobayashi <kkobayas@igel.co.jp>
Cc: linux-media@vger.kernel.org,
Damian Hobson-Garcia <dhobsong@igel.co.jp>,
Hans Verkuil <hans.verkuil@cisco.com>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Stanimir Varbanov <stanimir.varbanov@linaro.org>
Subject: Re: Memory freeing when dmabuf fds are exported with VIDIOC_EXPBUF
Date: Tue, 03 Oct 2017 11:00:04 -0400 [thread overview]
Message-ID: <1507042804.27175.12.camel@ndufresne.ca> (raw)
In-Reply-To: <f0518dd3-ae01-2da1-12ac-1fb041aaa709@xs4all.nl>
I'd like to revive this discussion.
Le lundi 01 août 2016 à 12:56 +0200, Hans Verkuil a écrit :
> >
> > Hans, Marek, any opinion on this ?
>
> What is the use-case for this? What you are doing here is to either free all
> existing buffers or reallocate buffers. We can decide to rely on refcounting,
> but then you would create a second set of buffers (when re-allocating) or
> leave a lot of unfreed memory behind. That's pretty hard on the memory usage.
>
> I think the EBUSY is there to protect the user against him/herself: i.e. don't
> call this unless you know all refs are closed.
>
> Given the typical large buffersizes we're talking about, I think that EBUSY
> makes sense.
This is a userspace hell for the use case of seamless resolution
change. Let's say I'm rendering buffers from a V4L2 camera toward my
display KMS driver. While I'm streaming, the KMS driver will hold on
the last frame. This is required when your display is sourcing data
directly from your DMABuf, because the KMS render are not synchronized
with the V4L2 camera (you could have 24fps camera over a 60fps
display).
When its time to change the resolution, the fact that we can't let go
the DMABuf means that we need to reclaim the memory from KMS first. We
can't just take it back, we need to allocate a new buffer, copy using
the CPU that buffer data, setupe the DMABuf reference. that new buffer
for redraw and then releas
This operation is extremely slow, since it requires an allocation and a
CPU copy of the data. This is only needed because V4L2 is trying to
prevent over allocation. In this case, userspace is only holding on 1
of the frames, this is far from the dramatic memory waste that we are
describing here.
regards,
Nicolas
prev parent reply other threads:[~2017-10-03 15:00 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-27 7:51 Memory freeing when dmabuf fds are exported with VIDIOC_EXPBUF Kazunori Kobayashi
2016-07-27 12:57 ` Laurent Pinchart
2016-08-01 10:56 ` Hans Verkuil
2016-08-01 12:17 ` Laurent Pinchart
2016-08-01 12:27 ` Hans Verkuil
2016-08-01 13:49 ` Laurent Pinchart
2016-08-01 13:59 ` Hans Verkuil
2016-08-01 16:02 ` Laurent Pinchart
2016-08-01 16:16 ` Steven Toth
2016-08-01 16:56 ` Laurent Pinchart
2016-08-03 3:23 ` Damian Hobson-Garcia
2017-10-03 15:00 ` Nicolas Dufresne [this message]
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=1507042804.27175.12.camel@ndufresne.ca \
--to=nicolas@ndufresne.ca \
--cc=dhobsong@igel.co.jp \
--cc=hans.verkuil@cisco.com \
--cc=hverkuil@xs4all.nl \
--cc=kkobayas@igel.co.jp \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=stanimir.varbanov@linaro.org \
/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