From: Pekka Paalanen <ppaalanen@gmail.com>
To: "Christian König" <ckoenig.leichtzumerken@gmail.com>
Cc: Nicolas Dufresne <nicolas@ndufresne.ca>,
Daniel Stone <daniel@fooishbar.org>,
Lucas Stach <l.stach@pengutronix.de>,
sumit.semwal@linaro.org, daniel@ffwll.ch, robdclark@gmail.com,
dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org,
linux-media@vger.kernel.org
Subject: Re: Try to address the DMA-buf coherency problem
Date: Wed, 2 Nov 2022 14:50:36 +0200 [thread overview]
Message-ID: <20221102145036.30c70134@eldfell> (raw)
In-Reply-To: <cc470b3d-a611-044f-2b35-cc827c962f9b@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 4632 bytes --]
On Wed, 2 Nov 2022 13:27:18 +0100
Christian König <ckoenig.leichtzumerken@gmail.com> wrote:
> Am 02.11.22 um 13:19 schrieb Pekka Paalanen:
> > On Wed, 2 Nov 2022 12:18:01 +0100
> > Christian König <ckoenig.leichtzumerken@gmail.com> wrote:
> >
> >> Am 01.11.22 um 22:09 schrieb Nicolas Dufresne:
> >>> [SNIP]
> >>>>> But the client is just a video player. It doesn't understand how to
> >>>>> allocate BOs for Panfrost or AMD or etnaviv. So without a universal
> >>>>> allocator (again ...), 'just allocate on the GPU' isn't a useful
> >>>>> response to the client.
> >>>> Well exactly that's the point I'm raising: The client *must* understand
> >>>> that!
> >>>>
> >>>> See we need to be able to handle all restrictions here, coherency of the
> >>>> data is just one of them.
> >>>>
> >>>> For example the much more important question is the location of the data
> >>>> and for this allocating from the V4L2 device is in most cases just not
> >>>> going to fly.
> >>> It feels like this is a generic statement and there is no reason it could not be
> >>> the other way around.
> >> And exactly that's my point. You always need to look at both ways to
> >> share the buffer and can't assume that one will always work.
> >>
> >> As far as I can see it you guys just allocate a buffer from a V4L2
> >> device, fill it with data and send it to Wayland for displaying.
> >>
> >> To be honest I'm really surprised that the Wayland guys hasn't pushed
> >> back on this practice already.
> > What should we Wayland people be pushing back on exactly? And where is
> > our authority and opportunity to do so?
> >
> > The Wayland protocol dmabuf extension allows a graceful failure if the
> > Wayland compositor cannot use the given dmabuf at all, giving the
> > client an opportunity to try something else.
>
> That's exactly what I meant with pushing back :)
>
> I wasn't aware that this handling is already implemented.
Well... it's "optional". The Wayland dmabuf protocol has two cases for
a client/app:
a) you do the right thing and wait for the compositor to ack that the
dmabuf works (the reply should come pretty much immediately, not
needing the compositor to actually composite), or
b) you just send the dmabuf and continue as if it always worked. If it
doesn't, you might get a protocol error later and be disconnected.
Guess which one Mesa uses?
I've been told Mesa has no way to handle a failure there, so it
doesn't. I would not be surprised if others just copy that behaviour.
I recall personally being against adding option b) to begin with, but
there it is, added for Mesa IIRC.
> > The Wayland protocol also
> > tells clients which DRM rendering device at minimum the dmabuf needs to
> > be compatible with. It even tells which KMS device the dmabuf could be
> > put on direct scanout if the dmabuf was suitable for that and direct
> > scanout is otherwise possible.
>
> Yeah, perfect. Exactly that's what's needed here.
>
> > What the client (application) does with all that information is up to
> > the client. That code is not part of Wayland.
> >
> > I'm sure we would be happy to add protocol for anything that
> > https://github.com/cubanismo/allocator needs to become the universal
> > optimal buffer allocator library.
>
> From what you wrote it's already perfectly covered.
Cool. Now if clients would just use it...
Thanks,
pq
> >> This only works because the Wayland as well as X display pipeline is
> >> smart enough to insert an extra copy when it find that an imported
> >> buffer can't be used as a framebuffer directly.
> > The only fallback Wayland compositors tend to do is use OpenGL/Vulkan
> > rendering for composition if direct scanout on a KMS plane does not
> > work. There are many reasons why direct scanout may not be possible in
> > addition to hardware and drivers not agreeing to do it with the given
> > set of buffers.
> >
> > A general purpose (read: desktop) Wayland compositor simply cannot live
> > without being able to fall back from KMS composition to software/GPU
> > composition.
> >
> > But yes, there are use cases where that fallback is as good as failing
> > completely. Those are not desktops but more like set-top-boxes and TVs.
>
> Completely agree to this approach.
>
> The only problem is that media players tend to not implement a way to
> allow direct scanout because of those fallback paths.
>
> But as you said that's their decision.
>
> Thanks,
> Christian.
>
> >
> >
> > Thanks,
> > pq
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2022-11-02 12:50 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-20 12:13 Try to address the DMA-buf coherency problem Christian König
2022-10-20 12:13 ` [PATCH 1/3] dma-buf: add dma_coherent flag Christian König
2022-10-20 12:13 ` [PATCH 2/3] drm/prime: set the dma_coherent flag for export Christian König
2022-10-20 14:43 ` Rob Clark
2022-10-20 14:56 ` Christian König
2022-10-28 1:11 ` Rob Clark
2022-10-20 12:13 ` [PATCH 3/3] media: videobuf2: set dma_coherent flag for DMA-buf Christian König
2022-11-04 10:42 ` Hans Verkuil
2022-10-27 12:14 ` Try to address the DMA-buf coherency problem Christian König
2022-10-28 8:09 ` Lucas Stach
2022-10-28 8:40 ` Christian König
2022-10-28 11:42 ` Lucas Stach
2022-10-28 14:26 ` Christian König
2022-10-28 15:46 ` Nicolas Dufresne
2022-10-28 17:50 ` Christian König
2022-10-28 18:47 ` Daniel Stone
2022-11-01 17:40 ` Christian König
2022-11-01 21:09 ` Nicolas Dufresne
2022-11-02 11:18 ` Christian König
2022-11-02 11:39 ` Lucas Stach
2022-11-02 12:21 ` Christian König
2022-11-02 17:10 ` Lucas Stach
2022-11-02 19:13 ` Christian König
2022-11-02 19:48 ` Lucas Stach
2022-11-17 9:35 ` Tomasz Figa
2022-11-17 12:10 ` Christian König
2022-11-17 15:38 ` Nicolas Dufresne
2022-11-18 19:32 ` Rob Clark
2022-11-19 20:35 ` Nicolas Dufresne
2022-11-22 14:36 ` Daniel Vetter
2022-11-22 17:33 ` Christian König
2022-11-22 18:26 ` Daniel Vetter
2022-11-23 8:33 ` Pekka Paalanen
2022-11-23 16:33 ` Daniel Vetter
2022-11-25 16:40 ` Nicolas Dufresne
2022-11-30 10:30 ` Daniel Vetter
2022-12-02 15:27 ` Christian König
2023-01-05 11:46 ` Daniel Vetter
2022-12-05 6:41 ` Tomasz Figa
2022-12-05 8:28 ` Christian König
2022-12-06 18:26 ` Nicolas Dufresne
2022-12-06 18:37 ` Christian König
2022-12-09 8:26 ` Tomasz Figa
2022-12-09 9:32 ` Pekka Paalanen
2022-12-09 17:07 ` Alex Deucher
2023-01-05 11:50 ` [Linaro-mm-sig] " Daniel Vetter
2022-12-12 3:13 ` Tomasz Figa
2022-12-09 10:27 ` Christian König
2022-12-12 3:00 ` Tomasz Figa
2022-12-12 11:15 ` Christian König
2023-01-05 20:39 ` Sebastian Wick
2022-11-04 14:58 ` Rob Clark
2022-11-04 15:00 ` Christian König
2022-11-02 12:19 ` Pekka Paalanen
2022-11-02 12:27 ` Christian König
2022-11-02 12:50 ` Pekka Paalanen [this message]
2022-11-02 12:56 ` Christian König
2022-11-03 22:16 ` Nicolas Dufresne
2022-11-04 9:03 ` Christian König
2022-11-04 13:38 ` Nicolas Dufresne
2022-11-04 14:51 ` Christian König
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=20221102145036.30c70134@eldfell \
--to=ppaalanen@gmail.com \
--cc=ckoenig.leichtzumerken@gmail.com \
--cc=daniel@ffwll.ch \
--cc=daniel@fooishbar.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=l.stach@pengutronix.de \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-media@vger.kernel.org \
--cc=nicolas@ndufresne.ca \
--cc=robdclark@gmail.com \
--cc=sumit.semwal@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