Sharing wl display/surface with another process.

Pekka Paalanen ppaalanen at
Fri Mar 2 13:37:03 UTC 2018

On Fri, 02 Mar 2018 15:12:40 +0200
Maksim Sisov <msisov at> wrote:

> Hi,
> I have a question about a proper client side of implementation of
> wayland with egl.
> The idea is that we have wayland ui related stuff on ui process
> (creating wayland window, managing mouse/keyboard inputs and etc), and
> have egl related stuff created and rendering on another gpu process.
> That gpu process creates an egl window, but it has to use an wl_surface
> handle, which is available on the ui process side.
> What would be the best way to achieve that? Can I just pass the handle
> to another process or is there a better way how to achieve that? And how
> I can share the wl_display across the process? Or should I better have
> another wayland connection established?
> What is the best approach in this kind of cases?


you simply cannot share a wl_display or a wl_surface with another

The usual way to make such architecture work is to have the GPU process
send rendered buffers to the UI process which relays them to the
Wayland server. You can use a completely custom protocol for sharing
those buffers between the GPU and UI processes, or you can make the UI
process to be a Wayland mini-server.

The Wayland mini-server approach is nice because it will leverage the
same infrastructure that Wayland normally uses as well. I call it
mini-server, because the portion of Wayland protocols you have to
implement is very bare-bones, nothing even close to what normal Wayland
desktop applications would require. You can also have custom private
Wayland extensions for your specific needs for IPC, so you can run
everything through Wayland IPC if you want.

Another benefit of having the GPU process go through the UI process to
the display server is that the UI process will always know exactly what
is on the screen, which helps to avoid synchronization issues like
sub-window resizing glitches or window content not matching the window

As an alternative approach, there is
but you need to consider which Wayland servers actually support it. The
mini-server approach does not need any special support from the (host)
Wayland server. The mini-server approach is usable even if your UI
process needs to run on X11, I believe.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the wayland-devel mailing list