Buffer sharing between processes

Kristian Høgsberg krh at bitplanet.net
Thu Aug 18 13:14:42 PDT 2011


On Thu, Aug 18, 2011 at 3:07 PM, Daniel Nicoara <dnicoara at chromium.org> wrote:
> Hi,
>
> I'm looking into buffer sharing between 2 processes, but can't figure
> out how to perform it under Wayland. I've played with sharing an
> EGLImage which worked just fine, but I was wondering if there is a
> better way to do it under Wayland. The only reference I've found is on
> mesa-dev (http://lists.freedesktop.org/archives/mesa-dev/2011-February/005294.html)
> which mentions that it should be done through wl_egl_pixmap. Is this
> possible right now?

Right now, there isn't a way for the compositor to share a buffer with
a client.  The buffer sharing goes from the client to the compositor,
as the clients create buffers, render into them and then shares the
with the compositor.  We do want a mechanism for the other direction,
for such things as shared icon and glyph caches, but the blocker there
is how to expose it in EGL.

There is no plan to enable direct client to client sharing planned
though.  In general, Wayland clients don't know anything about each
other and there's no way to pass objects between clients.  You can
define an interface that the compositor can implement and then the
compositor can act as a middle man and pass the buffers along.  But
that again depends on the feature of passing buffers from the
compositor to the clients.

For something like the cross-process buffer sharing in chromium, an
(more invasive) option is to make the toplevel browser window a
special-purpose wayland compositor itself.  The out-of-process tabs
will then be clients of that compositor and take input events from
that and push buffers to it.  The toplevel window process can then
render the chrome and the contents of the tabs and then push that to
the "real" compositor.  The Wayland client EGL platform and the
EGL_WL_bind_wayland_display EGL extension on the server side is what
enables the buffer sharing and is available to clients as well.  Check
out wayland-compositor.c for an example of a nested compositor.

Kristian


More information about the wayland-devel mailing list