[RFC] protocol: Introduce logical surface protocol

Bill Spitzak spitzak at gmail.com
Mon Mar 18 13:45:14 PDT 2013



Jonas Ådahl wrote:
> A logical surface is a special kind of surface that never gets its own
> buffer attached, or opaque region set etc. It is obtained by using a
> surface handle that can be shared in some way between clients. A handle
> is a server wide unique identifier retrieved from the server given a
> real surface. Currently a logical surface is limited to only be usable
> as a sub-surface.
> 
> A possible use case is:
> 
> There are two clients (A and B) that can communicate via some IPC
> mechanism where A is the main process and B is a render process. B
> renders to a surface and A decides its visibility and position. Below
> follows an example how logical surfaces can be used.
> 
> 1. Both A and B connects do the server
> 5. A creates a main surface
> 2. B creates a render surface
> 3. B acquires a surface handle
> 4. B sends the surface handle via IPC to A
> 6. A receives the surface handle via IPC from B
> 7. A creates a wl_surface and a wl_subsurface object given the surface
>    handle
> 8. A positions the wl_subsurface accordingly

In this example you did not use the term "logical surface". Is the 
"render surface" the "logical surface"?

I don't see how B can attach buffers to the surface since A has the 
wl_subsurface handle that is needed. I am guessing that the text "never 
gets its own buffer attached" is misleading, what really happens is that 
B *can* attach to the "logical surface" but all that happens is that it 
is redirected to A's wl_subsurface.

I would think an api like this would be better:

1. Both A and B connect to server
2. A creates both the wl_surface and wl_subsurface
3. A calls a new api to get a "key" for the wl_subsurface. This is an id 
assigned by the compositor that identifies an object in a 
client-independent way. Probably it has a table of recent requests and 
they expire after a minute or so.
4. A sends the "key" to B using IPC (one possible method is to 
text-encode it and put it as a switch in the argv sent to exec).
5. B uses the "key" in another new api that turns the key into a 
B-specific object id that means the same wl_subsurface. A possible error 
is that the object was destroyed or the key expired.
6. A and B then can mess with the subsurface in any way they want. They 
are cooperating so they can use any rules they want to decide who 
changes the buffer and who positions it, etc. Both A and B get all 
events sent to the subsurface.


More information about the wayland-devel mailing list