[Feat] (MG_Remote): the in-process display server serves unix endpoints too

mobilegl_server_serve_inprocess refused anything but tcp:// because its
only supervisor was the TCP one's thread hand-off. A unix endpoint
(@abstract name or filesystem path) now runs a supervisor of the same
shape minus the TCP exposure machinery: AcceptPair pairs a client's
control and SCM_RIGHTS connections by arrival order, there is no
DataBind to route and no pre-auth gate, sessions run on threads one at
a time with Busy for a second client, the latch resets between sessions
and g_inProcessStop ends it. That gives the on-screen server the
on-device fast path: ServerOwned windows over a unix socket with shm
data, no TCP copies.

The control screen's tcp-only guard for the on-screen mode goes with
the refusal it mirrored.
This commit is contained in:
2026-09-27 07:43:56 -04:00
parent e3e890ed5d
commit c16fb5a8ac
3 changed files with 123 additions and 19 deletions
+8 -6
View File
@@ -32,12 +32,14 @@
extern "C" {
// Serves `endpoint` (tcp://host:port only) on the CALLING thread until mobilegl_server_stop_inprocess
// is called and the live session (if any) has ended, then returns 0. Other returns, all logged by
// name: 64 / 65 (the environment preconditions above), 71 (not a tcp:// endpoint), 72 (could not
// listen - EADDRINUSE is retried for up to ~5 s first, the previous server may still be dying), 73
// (the listener failed), 74 (a server is already serving in this process). Re-callable after it
// returned.
// Serves `endpoint` on the CALLING thread until mobilegl_server_stop_inprocess is called and the
// live session (if any) has ended, then returns 0. The endpoint is tcp://host:port, or - for a
// same-device client - a unix @abstract name or filesystem path, whose control+data pair and
// SCM_RIGHTS shm segments make it the fastest on-device shape. Other returns, all logged by
// name: 64 / 65 (the environment preconditions above), 71 (empty endpoint), 72 (could not
// listen - EADDRINUSE is retried for up to ~5 s first, the previous server may still be dying),
// 73 (the listener failed), 74 (a server is already serving in this process). Re-callable after
// it returned.
__attribute__((visibility("default"))) int mobilegl_server_serve_inprocess(const char* endpoint);
// Asks the in-process server to stop and returns at once (it does not wait: call it from a UI