Ergot vs Wayland #69
titaniumtraveler
started this conversation in
Ideas
Replies: 1 comment
-
|
Wow. That got longer than I expected. I hope it is useful. (In any case thinking about this topic definitely was useful for me) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
A Short Wayland Into
Messages
(See Wire Format)
Messages have a header of
Arguments are 32bit padded bytes which types are defined implicitly by the object id.
Messages from server (compositor) to client are called events.
Messages from client to server are called requests.
Datatypes
(Copied here from the spec as reference)
int,uintfixedIt is a signed decimal type which offers a sign bit, 23 bits of integer precision and 8 bits of decimal precision.
This is exposed as an opaque struct with conversion helpers to and from double and int on the C API side.
stringA null value is represented with a length of 0.
Interior null bytes are not permitted.
objectnew_idGenerally, the interface used for the new object is inferred from the xml, but in the case where it's not specified, a new_id is preceded by a string specifying the interface name, and a uint specifying the version.
arrayfdInterfaces
Interfaces are defined as
xmlgrouped into a "protocol", with the bindingsusually being generated by tools.
As an example, here the interface definition of
wl_displayfrom the corewayland protocol:
(Human readable version, Source XML)
Message flow/Main Protocol concepts
A session usually consist of:
<object_id(1) as wl_display>::get_registry(registry: new_id<wl_registry>(2))request to the serverwl_registry::globalevents with the globals of the interfaces it supports (for examplewl_compositorto create newwl_surfaces that then later can be rendered to)If the client needs synchronize until a certain message is processed,
it can just create a
wl_callbackviawl_display::callback()and wait on thewl_callback::doneevent.Note that in almost all cases the client is responsible to create all
resources that the server should manage and that those resource are often local
to the client.
For example:
connection. So a nested compositor that is a client in the outer compositor,
has completely independent IDs, so the nested compositor has to translate the
inner IDs to the outer IDs.
Comparison to
ergot/Ideas that might be worth stealingAddressing
Waylands object ids are capability-based, while
ergotare device-based.For a protocol for multi-device networks like
ergotis, being explicitlydevice-based is probably the better decision, but for highly dynamic networks it
might be useful to allocate a address (or maybe even a whole segment_id?) to
some "capability".
Lets say we have a standard interface that lets you open a TCP connection to the
outer internet, and have a smartphone and a normal internet router in the
ergotnetwork. It would be useful to just make a call to that address and a"capability router" then decides through which device the request actually goes.
Codegen
It might be useful to (in the future) have some "external" format that defines the interface of a
endpoint, which then also could be used to generate bindings in other languages.
In wayland the C bindings are generated with a program called
wayland-scannerand the
wayland-rsimplementation uses its own implementation using proc-macros.Address translation
When a network segment leader temporarily looses connection needs to manage the network/a subnetwork, and flushing + reassigning the device addresses isn't an option at that point;
It might be useful to translate the inner and outer addresses of messages
going through the router.
That would basically be done in the way wayland does the translation with a
simple lookup table. Or I guess in IP where a router might translate MAC
addresses.
A potential problem with that, that could come up if a device is connected via
multiple sockets to the network, is that the local addresses the device has
might vary.
Possible resolutions to that would be to either have the addresses be scoped to
the socket inside the device, or to have a request that it can send to ask the
network leader what its address is. When there are different answers, the device
should have a clear resolution strategy of who the real leader is and also send
that information to the device that thinks it is the leader.
Beta Was this translation helpful? Give feedback.
All reactions