From: Daniel Vetter <daniel@ffwll.ch>
To: Sakari Ailus <sakari.ailus@iki.fi>
Cc: Daniel Vetter <daniel@ffwll.ch>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Tomasz Stanislawski <t.stanislaws@samsung.com>,
Sumit Semwal <sumit.semwal@linaro.org>,
Pawel Osciak <pawel@osciak.com>,
Sumit Semwal <sumit.semwal@ti.com>,
linaro-mm-sig@lists.linaro.org, linux-media@vger.kernel.org,
arnd@arndb.de, jesse.barker@linaro.org, rob@ti.com,
patches@linaro.org
Subject: Re: [RFCv1 2/4] v4l:vb2: add support for shared buffer (dma_buf)
Date: Sun, 29 Jan 2012 14:03:40 +0100 [thread overview]
Message-ID: <20120129130340.GA4312@phenom.ffwll.local> (raw)
In-Reply-To: <4F25278B.3090903@iki.fi>
On Sun, Jan 29, 2012 at 01:03:39PM +0200, Sakari Ailus wrote:
> Daniel Vetter wrote:
> > On Thu, Jan 26, 2012 at 01:28:16AM +0200, Sakari Ailus wrote:
> >> Why you "should not hang onto mappings forever"? This is currently done by
> >> virtually all V4L2 drivers where such mappings are relevant. Not doing so
> >> would really kill the performance i.e. it's infeasible. Same goes to (m)any
> >> other multimedia devices dealing with buffers containing streaming video
> >> data.
> >
> > Because I want dynamic memory managemt simple because everything else does
> > not make sense. I know that in v4l things don't work that way, but in drm
> > they _do_. And if you share tons of buffers with drm drivers and don't
> > follow the rules, the OOM killer will come around and shot at your apps.
> > Because at least in i915 we do slurp in as much memory as we can until the
> > oom killer starts growling, at which point we kick out stuff.
> >
> > I know that current dma_buf isn't there and for many use-cases discussed
> > here we can get away without that complexity. So you actually can just map
> > your dma_buf and never ever let go of that mapping again in many cases.
> >
> > The only reason I'm such a stuborn bastard about all this is that drm/*
> > will do dynamic bo management even with dma_buf sooner or later and you
> > should better know that and why and the implications if you choose to
> > ignore it.
> >
> > And obviously, the generic dma_buf interface needs to be able to support
> > it.
>
> I do not think we should completely ignore this issue, but I think we
> might want to at least postpone the implementation for non-DRM
> subsystems to an unknown future date. The reason is simply that it's
> currently unfeasible for various reasons.
>
> Sharing large buffers with GPUs (where you might want to manage them
> independently of the user space) is uncommon; typically you're sharing
> buffers for viewfinder that tend to be around few megabytes in size and
> there may be typically up to five of them. Also, we're still far from
> getting things working in the first place. Let's not complicate them
> more than we have to.
>
> The very reason why we're pre-allocating these large buffers in
> applications is that you can readily use them when you need them.
> Consider camera, for example: a common use case is to have a set of 24
> MB buffers (for 12 Mp images) prepared while the viewfinder is running.
> These buffers must be immediately usable when the user presses the
> shutter button.
>
> We don't want to continuously map and unmap buffers in viewfinder
> either: that adds a significan CPU load for no technical reason
> whatsoever. Typically viewfinder also involves running software
> algorithms that consume much of the available CPU time, so adding an
> unnecessary CPU hog to the picture doesn't sound that enticing.
>
> If the performance of memory management can be improved to such an
> extent it really takes much less than a millisecond or so to perform all
> the pinning-to-memory, IOMMU mapping and so on systems for 24 MB buffers
> on regular embedded systems I think I wouldn't have much against doing
> so. Currently I think we're talking about numbers that are at least
> 100-fold.
>
> If you want to do this to buffers used only in DRM I'm fine with that.
A few things:
- I do understand that there are use cases where allocate, pin & forget
works.
- I'm perfectly fine if you do this in your special embedded product. Or
the entire v4l subsystem, I don't care much about that one, either.
But:
- I'm fully convinced that all these special purpose single use-case
scenarios will show up sooner or later on a more general purpose
platform.
- And as soon as your on a general purpose platform, you _want_ dynamic
memory management.
I mean the entire reason people are pushing CMA is that preallocating gobs
of memory statically really isn't that great an idea ...
So to summarize I understand your constraints - gpu drivers have worked
like v4l a few years ago. The thing I'm trying to achieve with this
constant yelling is just to raise awereness for these issues so that
people aren't suprised when drm starts pulling tricks on dma_bufs.
Cheers, Daniel
--
Daniel Vetter
Mail: daniel@ffwll.ch
Mobile: +41 (0)79 365 57 48
next prev parent reply other threads:[~2012-01-29 13:03 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-05 10:41 [RFCv1 0/4] v4l: DMA buffer sharing support as a user Sumit Semwal
2012-01-05 10:41 ` [RFCv1 1/4] v4l: Add DMABUF as a memory type Sumit Semwal
2012-01-05 10:41 ` [RFCv1 2/4] v4l:vb2: add support for shared buffer (dma_buf) Sumit Semwal
2012-01-14 20:38 ` [Linaro-mm-sig] " Sakari Ailus
[not found] ` <CAB2ybb83ub=A45-m6o+RXqFOTUmXCgeFqs03WZDHeWeLe2+29w@mail.gmail.com>
2012-01-16 5:35 ` Semwal, Sumit
2012-01-20 15:04 ` Laurent Pinchart
2012-01-19 19:07 ` Pawel Osciak
2012-01-20 10:41 ` Sumit Semwal
2012-01-20 10:58 ` Tomasz Stanislawski
2012-01-20 15:12 ` Laurent Pinchart
2012-01-20 15:53 ` Tomasz Stanislawski
2012-01-20 16:11 ` Laurent Pinchart
2012-01-20 16:20 ` Tomasz Stanislawski
2012-01-20 16:28 ` Laurent Pinchart
2012-01-23 9:06 ` Marek Szyprowski
2012-01-23 9:40 ` Daniel Vetter
2012-01-23 9:45 ` Daniel Vetter
2012-01-23 9:48 ` Laurent Pinchart
2012-01-23 10:35 ` Daniel Vetter
2012-01-23 10:54 ` Laurent Pinchart
2012-01-24 0:26 ` Clark, Rob
2012-01-24 9:34 ` Laurent Pinchart
2012-01-24 10:52 ` Daniel Vetter
2012-01-24 13:03 ` Daniel Vetter
2012-01-25 8:09 ` Daniel Vetter
2012-01-30 14:44 ` Laurent Pinchart
2012-01-30 16:29 ` Daniel Vetter
2012-01-25 23:28 ` Sakari Ailus
2012-01-26 11:27 ` Daniel Vetter
2012-01-29 11:03 ` Sakari Ailus
2012-01-29 13:03 ` Daniel Vetter [this message]
2012-01-30 14:33 ` Laurent Pinchart
2012-01-30 22:01 ` Sakari Ailus
2012-01-31 15:38 ` Clark, Rob
2012-02-02 10:19 ` Laurent Pinchart
2012-02-02 14:01 ` Clark, Rob
2012-02-02 14:40 ` Sumit Semwal
2012-02-02 20:23 ` Daniel Vetter
2012-02-02 20:49 ` Clark, Rob
2012-02-04 11:43 ` Sakari Ailus
2012-02-05 15:08 ` Clark, Rob
2012-01-20 14:55 ` [Linaro-mm-sig] " Laurent Pinchart
2012-01-05 10:41 ` [RFCv1 3/4] v4l:vb: remove warnings about MEMORY_DMABUF Sumit Semwal
2012-01-05 10:41 ` [RFCv1 4/4] v4l:vb2: Add dma-contig allocator as dma_buf user Sumit Semwal
2012-01-16 7:57 ` [RFCv1 0/4] v4l: DMA buffer sharing support as a user Kyungmin Park
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=20120129130340.GA4312@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=arnd@arndb.de \
--cc=jesse.barker@linaro.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-media@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=patches@linaro.org \
--cc=pawel@osciak.com \
--cc=rob@ti.com \
--cc=sakari.ailus@iki.fi \
--cc=sumit.semwal@linaro.org \
--cc=sumit.semwal@ti.com \
--cc=t.stanislaws@samsung.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.