[PATCH wayland-protocols v7] Add zwp_linux_explicit_synchronization_v1

Pekka Paalanen ppaalanen at gmail.com
Mon Nov 26 09:21:50 UTC 2018


On Fri, 23 Nov 2018 16:26:19 +0000
Tomek Bury <tomek.bury at gmail.com> wrote:

> Hi Pekka,
> 
> > I presume you have a driver stack that relies on the opaque EGL buffers  
> and not zwp_linux_dmabuf any time soon?
> Yes, exactly. I've added a protocol extension for sharing those buffers and
> our eglCreateImage() implementation can import such buffers into the driver
> on the compositor end. The buffers are carried by an fd to the compositor
> that's the only similarity. They're not dma-buf.
> 
> > Yeah, support for opaque EGL buffers could be added, just need to think  
> of a good wording, since acquire fences do not make sense for all buffer
> types.

> Isn't that renderer's and/or backend's decision? The GL renderer can accept
> fence with any buffer it can send to the 3D driver, so, effectively,
> anything backed by available EGL image extensions. Someone may add a custom
> backend and/or renderer using whatever hardware or API they have at hand. A
> Vulkan renderer could potentially use fences with anything a Vulkan driver
> is capable of importing. A renderer that does the CPU wait could be useful
> at least for debugging. So I wouln't block the explicit sync at the
> compositor level based on the white list.

Hi Tomek,

fences do not make sense to all buffer types to begin with, today. My
objection is to allowing fencing buffer types that cannot be sent to
the 3D driver, e.g. wl_shm which is usually copied through glTexImage2D
and friends. We cannot ignore those in the spec language.

A renderer (a compositor really, we're not talking about just Weston)
decides what buffer types it accepts, yes. This is communicated to
clients through which buffer factory interface globals are being
advertised. Each type is a different protocol extension. The fence
extension OTOH is just a single extension, and currently there is no
protocol to negotiate which buffer types are usable with acquire
fences. The first attempt is to define in the spec language what will
always be supported, provided the buffer factory exists.

The opaque EGL buffer type is really just one type in practise:
compositors and clients use it through a well-known, single API: EGL.
It does not matter that there are multiple incompatible EGL
implementations, it all looks like just one opaque buffer type to
compositors. I think this makes it easier to extend the fence spec
wording to require opaque EGL buffers to be supported.

Either the fence protocol spec needs to be clear on what works, or we
need advertisement events to let clients know in advance what the
compositor supports. A client sending a fence that the compositor
cannot use must not be possible; compositor, client, EGL, driver, etc.
bugs notwithstanding.

Btw. I just realized that if client-side EGL uses the fence extension
internally, that means the client app code must not attempt to add or
request fences of its own, because the spec disallows multiple acquire
fences and multiple release notification requests. I suppose that's
fine?

Alf, can you come up with changes to the spec wording and Weston to
require opaque EGL buffers are supported?

On one hand it is actually a little strange to couple opaque EGL
buffers (a private, EGL implementation specific protocol interface)
with a generic fencing extension, but maybe that is necessary because
there is not enough compositor-side GBM and EGL API so that the EGL
implementation could handle it all in an EGL implementation specific
interface?


Thanks,
pq

> On Fri, 23 Nov 2018 at 13:47, Pekka Paalanen <ppaalanen at gmail.com> wrote:
> 
> > On Fri, 23 Nov 2018 13:07:37 +0000
> > Tomek Bury <tomek.bury at gmail.com> wrote:
> >  
> > > Hi Alexandros,
> > >
> > > Sorry for a delay. I've finally got an end-to-end system to test it out.  
> > It  
> > > took some time because Weston backend I wrote a while back needed serious
> > > rework to catch up with latest changes.
> > >
> > > There's one thing that didn't work for me. In compositor you reject
> > > anything that isn't a DMA buffer and then in glrenderer you put an extra
> > > assertion. Why? All you do is use an EGL extension in order to import
> > > external fence_fd. There's no dmabuf dependency there. As long as the EGL
> > > implementation exposes EGL_SYNC_NATIVE_FENCE_ANDROID extension this  
> > should  
> > > "just work" (tm) for the GL renderer. It certainly did for me. CPU-based
> > > renderers can poll() to wait.  
> >
> > Hi Tomek,
> >
> > with Weston it was decided not to implement a poll() based wait at
> > first as implementing that properly (not blocking the compositor) would
> > be a big hassle and no-one could see the benefit of it given what
> > clients could actually produce.
> >
> > Therefore the acquire fence can only apply to buffers which can be
> > pipelined to a GPU. Mesa EGL is using zwp_linux_dmabuf, but the support
> > could be extended to opaque EGL buffers very well. We just chose to
> > start small and bring up the infrastructure around fences first.
> >
> > Restrictions on buffer types etc. can certainly be lifted in the future
> > if there are good use cases. I presume you have a driver stack that
> > relies on the opaque EGL buffers and not zwp_linux_dmabuf any time soon?
> >
> > Would anyone ever use an acquire fence with wl_shm buffers? That sounds
> > fundamentally wrong to me as one cannot create fences to be signalled
> > by userspace AFAIK. Therefore buffers whose wait cannot be pipelined to
> > the GPU or the display device do not make much sense to me.
> >  
> > > The type of buffer used is an orthogonal problem. The
> > > EGL_WL_bind_wayland_display
> > > extension takes care of GL clients' buffers in GL renderer, for anything
> > > else the renderer needs to know how to get pixels and use whatever means  
> > to  
> > > put those pixels on screen.  
> >
> > Yeah, support for opaque EGL buffers could be added, just need to think
> > of a good wording, since acquire fences do not make sense for all
> > buffer types. A compositor must be allowed to raise protocol errors for
> > fence+buffer combinations it cannot use, which means that clients must
> > know in advance what they cannot use.
> >
> >
> > Thanks,
> > pq
> >  
> > > On Tue, 13 Nov 2018 at 09:33, Tomek Bury <tomek.bury at gmail.com> wrote:
> > >  
> > > > Thanks!
> > > >
> > > > On Tue, Nov 13, 2018 at 9:08 AM Alexandros Frantzis <  
> > > > alexandros.frantzis at collabora.com> wrote:  
> > > >  
> > > >> On Mon, Nov 12, 2018 at 12:39:58PM +0000, Tomek Bury wrote:  
> > > >> > On Mon, Nov 12, 2018 at 11:15 AM Daniel Stone <daniel at fooishbar.org>  
> >  
> > > >> wrote:  
> > > >> >  
> > > >> > > On Fri, 9 Nov 2018 at 10:48, Pekka Paalanen <ppaalanen at gmail.com>  
> >  
> > > >> wrote:  
> > > >> > > > I can add that while pushing upstream, if there are no other  
> > changes  
> > > >> > > > coming.
> > > >> > > >
> > > >> > > > Reviewed-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
> > > >> > > >
> > > >> > > > You have ensured that the C files generated from this revision  
> > build  
> > > >> > > > fine in Weston, right?
> > > >> > > >
> > > >> > > > David, Daniel, since your name is in the maintainers, can I  
> > have  
> > > >> your  
> > > >> > > > R-b, please?  
> > > >> > >
> > > >> > > The protocol is:
> > > >> > > Reviewed-by: Daniel Stone <daniels at collabora.com>
> > > >> > >
> > > >> > > The Weston implementation looks pretty good so far, though  
> > there's no  
> > > >> > > full implementation of release yet.
> > > >> > >
> > > >> > > Cheers,
> > > >> > > Daniel
> > > >> > > _______________________________________________
> > > >> > > wayland-devel mailing list
> > > >> > > wayland-devel at lists.freedesktop.org
> > > >> > > https://lists.freedesktop.org/mailman/listinfo/wayland-devel
> > > >> > >  
> > > >> >
> > > >> > HI Daniel,
> > > >> >
> > > >> > Where can I find the work-in-progress implementation? I'd like to  
> > try it  
> > > >> > out with Broadcom driver which doesn't have implicit cross-process  
> > > >> sync. I  
> > > >> > can add the explicit sync protocol implementation on the driver  
> > side but  
> > > >> > I'd need a reference to test it against.
> > > >> >
> > > >> > Cheers,
> > > >> > Tomek  
> > > >>
> > > >> Hi Tomek,
> > > >>
> > > >> the WIP implementation can be found here [1]. I hope to push an  
> > update,  
> > > >> including some zwp_buffer_release_v1 correctness fixes, in the  
> > following  
> > > >> days.
> > > >>
> > > >> Thanks,
> > > >> Alexandros
> > > >>
> > > >> [1] https://gitlab.freedesktop.org/wayland/weston/merge_requests/32
> > > >>  
> > > >  
> >
> >  

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20181126/a2dc7189/attachment.sig>


More information about the wayland-devel mailing list