Inter-client surface embedding

Bill Spitzak spitzak at
Mon Feb 17 16:41:22 PST 2014

Mark Thomas wrote:

> I've pushed some doc updates to the protocol.xml file my git repo.  But
> in terms of Jonas Ådahl's proposal, my protocol works the other way round:
>   A creates a main surface
>   A creates a "hole" on that surface and sets its position and size
>   A gets the uid (handle) from the server
>   A passes that uid to B via IPC
>   B creates a surface
>   B creates a "plug" on that surface with the uid it got from A
>   B receives a configure event from the server with the size of the hole
>   B creates a buffer of the correct size and renders its image to the
>     surface

I do believe users are looking for something more like this than for 
implementing a subcompositor. Subcompositor really worries me as it 
relies on the buffers being passed through the intermediate client as 
fast as possible (ie without copying), and information that clients use 
to figure out how to allocate their buffers being passed the opposite 
direction. I can't believe every client is going to get this right, and 
would seem to make it impossible for a sub-client to take advantage of 
any new wayland api until the parent client is updated.

I think the above description can be greatly simplified by removing the 
"hole" and "plug" objects and just using a subsurface:

   A creates a main surface
   A creates a subsurface for the "hole"
   A gets the uid of the subsurface from the compositor
   A passes that uid to B via IPC
   B uses this uid to get access to the subsurface
   B can now attach buffers and do other actions to the subsurface

I proposed this before but I think I am failing to communicate what I 
wanted. The term "uid" seems pretty good and maybe makes it clearer. 
It's purpose is so B can't just guess at objects and get access to them, 
and to be a simple piece of data (probably a big number) that can be 
passed through IPC, in particular as part of the argv sent to exec the 

As far as I can tell Wayland will have no difficulties with two clients 
both owning a subsurface and trying to update it, as it will serialize 
all the requests and perform them in whatever order they appear. Either 
client can destroy the surface and the other will cleanly hear about it.

More information about the wayland-devel mailing list