MG_Remote is the transport layer that lets MGPipe's two halves run apart. It is compiled when MOBILEGL_BUILD_DISAGGREGATED is on, which is the development default. When the option is off, nothing under MG_Remote/ is built and the library is the single-process shipping shape.
After the split, the client is the side that runs the application (frontend and BackendObject_Remote), and the server is the side that runs the driver (applier and the real backend). MOBILEGL_TRANSPORT selects how they are connected:
| Topology | Shape | Use |
|---|---|---|
monolith (default) |
One thread; the frontend calls the backend through the record arm in the same process. | The shipping shape. |
inproc |
Two threads in one process: the GL thread emits records, a second thread applies them. | The render-thread shape and the main CI configuration. |
spawn |
Two processes. The control plane is fork, a Unix socket or TCP; the data plane is shared memory or a byte stream. |
Isolation, an on-screen server, or a server on another machine. |
A build with the split layer but MOBILEGL_TRANSPORT unset behaves as monolith.
| Directory | Contents |
|---|---|
Protocol/ |
Control-plane schema (FlatBuffers, generated code under MG_Protocol/): handshake, surface operations, log lines. |
Transport/ |
ITransport (control plane) and ILink (data plane); shared-memory ring (ShmLink, Ring, Doorbell, SessionRings), byte-stream link, authentication token, log forwarding. |
Wire/ |
The record codec shared by both ends. |
Client/ |
BackendObject_Remote, ClientSession, emit tables and the capability mirror. |
Server/ |
PipeApplier, ServerLoop, ServerSession, server entry points, ServerDisplay and the embeddable server interface. |
The control plane carries the handshake, EGL and surface operations, and server logs. The data plane carries command records and bulk data. Each plane chooses its own medium: control can be a forked pair, a Unix socket or TCP, and data can be shared memory or a stream. Code above the links does not depend on which was chosen.
- Run-ahead. The client sends records and continues; it waits only for commands that need an answer. A present credit paces it: with
MOBILEGL_FRAMES_IN_FLIGHTof N, the client may bemax(1, N - 2)presents ahead of the server. - Device lost. If the server crashes or disconnects, the client enters a device-lost state: GL calls become no-ops and swapping returns "context lost". With
MOBILEGL_IPC_RECOVERon (the default), the nexteglInitialize,eglCreateContextoreglCreate*Surfacestarts a fresh session. - Authentication. A server listening on a non-loopback TCP address requires a shared token of at least 16 bytes. Malformed input is rejected rather than ending the server.
- Probe. When a
unix:ortcp://endpoint is configured and nothing answers, the EGL, GLX and GBM entry points decline, so the system's next GL implementation is used.
Large buffer stores can be adopted by the server instead of being copied through the ring. The default tier asks for zero-copy import and falls back quietly to a copy when the device or the link cannot support it (a stream link, no hardware-buffer support, or a failed self-test). Images can also be shared between the server and its clients. The MG_Gbm module uses this to give Wayland clients and compositors buffers they can exchange as dma-bufs.
With MOBILEGL_IPC_SURFACE=server, the server creates window surfaces on its own window and the client needs no window of its own. A host application can embed the server in its own process through the C interface in Server/EmbeddedServer.h: it installs a display, attaches an ANativeWindow, and serves client sessions on a thread it owns.
Work is under way to let one server process hold several sessions, contexts and share groups, which a unified compositor-side server requires. Session identity on the wire, multiple sessions per process, per-context frontend state, a native context per tuple and applier and twin tables keyed by session and share group have landed; the remaining phases are tracked in the source repository's docs/Disaggregated/ pages.
- MG_Pipe: the records the transport carries.
- Configuration: the user-facing transport variables.