Files
MobileGL/docs/Disaggregated/notes/p5/prompts/c1-round1.md
T
swung0x48 aba329cc53 [Docs] (Disaggregated): P6's plan and contract draft; the working notes move from a local directory into the repository
Two things land together: the plan and contract draft P6 needs before it starts, and the
working notes that until now existed on exactly one machine.

1. P6's plan and contract draft (neither started; not one line of code)

     docs/Disaggregated/P6-SPAWN-PLAN.md      the package plan
     docs/Disaggregated/P6-CONTRACT-DRAFT.md  the contract draft (moves to
                                              MG_Remote/CONTRACT-P6.md when c6 lands)

   The three findings that mattered, all written into the documents:

   a. P6 is SMALLER than its roadmap cell suggests. The transport primitives are already in
      the tree and already tested: SocketDoorbell including hangup detection and the two
      lost-wakeup fences (Doorbell.cpp:211-360, four cases in FdPassingTest), SCM_RIGHTS fd
      passing, ShmSegment::Adopt, and the SurfaceOp / WindowKind schema already defined in
      protocol.fbs. inproc uses a real second shm mapping rather than an alias, and
      SessionRings.h:22-28 says that was done so today is not the first time it runs. P6 is
      assembly plus a control plane plus a process, not "write a socket transport".

   b. The evidence for "P6 is only a transport swap" has EXPIRED. It was bought by P5c, whose
      audit found 59 direct memory accesses in a tree that already looked clean. P5e changed
      the tree again. So the first package, a6, is a read-only audit that writes no code, and
      every contract row that depends on it is marked PENDING a6 rather than decided in
      advance.

   c. P6 does not get a game running on the phone. ANativeWindow* is meaningless in the child,
      and protocol.fbs:186-196's own comment says Android transfers the window out of band -
      that band is P12. P6 lands pbuffer / surfaceless / offscreen, which is what HeadlessGL,
      the split-equivalent lane and trace replay need, and which is exactly what P6's own exit
      gate measures. A real window reaching the server is a named refusal. This gets its own
      section because "P6 is done" would otherwise read as "the game runs now".

   The contract adds rule G: a role may not name a process-local handle. It extends P5c's
   rule E (a role may not name the other role's memory) from memory to identity - EGLDisplay /
   EGLSurface / EGLContext / ANativeWindow* / fd number / pid / mapped address either cross as
   a token this contract defines or they do not cross, and a descriptor crosses only through
   SCM_RIGHTS, where the kernel renumbers it.

   What P5e left for P6 gets its own section. The latch semantics are already designed
   (ARCHITECTURE.md:504) and are copied unchanged. What is new is that after run-ahead the
   client no longer waits while the peer process can DIE: the client holds records that were
   published and will never be applied, and Android's freezer suspends the child without
   closing anything. So slow and dead must be distinguishable WITHOUT a timeout threshold.
   That is P6's only new design; everything else is carriage. It shares a predicate with E1's
   outstanding re-specification (ID-122), and the two should be designed together.

   Two gates carried over from P5e's lessons: G2 requires integration-spawn's test-name set to
   match integration-split's name for name, because a differing set means the lane is quietly
   running less; and the arm-proof gate requires every entry to record the child pid and
   transport=spawn in its OWN private log - ID-124 established that this kind of false green
   really happens, and a spawn lane that actually ran monolith would pass every other gate.
   S2's shape must be settled before it is written, and the document says why: E1 is the
   cautionary case.

2. The working notes move into the repository (docs/Disaggregated/notes/, 415 .md files)

   ROADMAP / CURRENT_STAGE_PROGRESS / MEASUREMENTS cite ruling numbers, audit line numbers and
   the provenance of gate figures from ~/w7/notes/, a directory that exists on one machine and
   is under no version control. A record cited hundreds of times that lives only locally is not
   a record, so it moves in whole, with its directory structure intact.

   Only .md moves. Scripts, run logs, census and gate result JSON, patches, APKs and nm dumps
   stay where they are: they are evidence DATA rather than documents - large, regenerated per
   run, and mostly carrying absolute paths and device serials that mean something only on the
   machine that produced them. The mapping and this split are written in
   docs/Disaggregated/notes/README.md.

   Two exceptions are recorded there too: P6's BRIEF has been promoted to a first-class
   document and keeps no copy under notes/, so the two cannot drift apart; and recovered/ holds
   material salvaged from failed workflow runs, which may duplicate the like-named phase
   directories and is kept because a few of those were the only complete version at the time.

   CI's citation lint takes docs/Disaggregated/*.md only (non-recursive), and notes/ is
   deliberately outside it: those notes' file:line citations were written against their own
   code heads, and resolving them against today's HEAD would fail wholesale - which is not an
   error, it is their correct state as a historical record. To check one, use the revision it
   declares (--rev).

3. Inconsistencies fixed in passing

   - README.md's status line still said P5e was in progress while the stage table already said
     closed.
   - CURRENT_STAGE_PROGRESS's next-step item 1 still listed the exit gate as pending, though
     (a) and (b) were run in the previous commit; rewritten to closed plus the one item that
     actually remains (E1).
   - ROADMAP's P6 row still had the pre-phase plan in three of its cells; it now carries the
     package order, the scope boundary and the two new gates.

Checked with check_doc_citations.py: 125 citations across docs/Disaggregated/*.md, 0 problems.
2026-09-18 23:31:39 -04:00

7.8 KiB

You are package c1 — the client role, the 71-slot emit table and the verb barrier of phase P5 on the MobileGL disaggregation project. You and package v1 (running in parallel, owning the server and the apply thread) jointly own the milestone: "the first IPC frame on the reduced path".

Read first, in this order: ~/w7/notes/p5/PACKAGE-PREAMBLE.md (worktree setup, the two day-one traps, build recipe, the four self-tests every package owes, the iron rules), then MobileGL/MG_Remote/CONTRACT-P5.md in the tree (authoritative — it outranks the brief; §7 is yours: R-15 and the three classes of the 71 slots, which you must not re-derive), then ~/w7/notes/p5/BRIEF-P5.md §2 (R-1, R-3, R-4, R-5, R-8, R-12, R-15), §4, §5 "c1", §13 (R-16 — read this one twice), then ~/w7/notes/p5/verb-census.md (measured, not estimated) and ~/w7/notes/p5/scout-caps-reply-reverse.md (your subject's 661-line survey). Then skim ~/w7/notes/p5/INTEGRATOR-DECISIONS.md and the wave-1 reports under ~/w7/notes/p5/p5-results/.

Base: feat/disaggregated @ 32563993 — wave 1 (c0, w1, s1, p1, b1, t1) is merged. Slug c1; worktree ~/w7/p5-c1, branch p5/c1. The full gate is running on that commit; I will tell you if it turns up breakage.

What you own

MG_Remote/Client/*, and the remote side of MG_Backend/BackendObject*. Not Managers.cpp/BufferObject.cpp (b1's), not MG_Backend/Init.cpp (v1's — the hook is theirs, the table it installs is yours).

What you build

  1. BackendObject_Remote — 8 pure virtuals + 9 EGL lifecycle virtuals. Three traps from the scout: GetRendererInfo() returns a reference, so the object must own a RendererInfo; GetFormatCapabilities() is non-virtual, so you must fill m_formatCapabilities rather than override an accessor; GetBackendType() must answer the server's backend, never a new "Remote" enumerator, because frontend branches switch on it. And LogBackendInfo() reads GetRendererInfo() at Init.cpp:21, before any surface exists — return a placeholder and accept one imprecise startup log line; do not restructure MG_Backend::Init().
  2. The emit table: 71 function pointers, not 69. Present and SetSwapInterval have zero MG_Impl call sites — they are reached through the EGL path — so a table built by mirroring GLImpl covers neither, and Present is on the reduced path. No slot may be null and no slot may fall through to the driver. The three classes are already decided in CONTRACT §7: class A answered locally from the caps mirror (GetIntegeri_v, IsTimerQuerySupported), class B emitted (Clear, DrawArrays, ReadPixels, BlitFramebuffer, Present), class C Fatal{UnmigratedVerb, "<slot>"} (the other 64).
  3. The cross-cutting rule that is easy to miss and is written into CONTRACT §7: 41 of the 69 slots are null-checked at their call site, and several of those null checks are capability probes, not safety checks. Since no slot may be null, every one of those probes would answer "supported" and the fallback behind it would silently disappear. A null check on a slot may never survive into the client under split — it becomes a caps-mirror read. Three named cases are in the contract (GL_Query.cpp:481/:785, GL_Query.cpp:534, the SubDataResident op-table slot); the rule generalises to all 41, so walk them.
  4. CapsMirror — the client's copy of the snapshot, answering the 56 caps read points. Re-arrival of a snapshot is the invalidation (R-12), so there is no separate Invalidate(); Generation() is the only thing on the client that can see a server context death, and a client memo must key on it.
  5. The verb barrier (R-1). Publish, then wait appliedSeq >= mySeq, spin MOBILEGL_IPC_SPIN_US then park. The barrier's wait and the reply's wait are the same wait — that is why ClientSession::EmitAndWait is one call. Splitting them is how a package ends up re-deriving an acceptance answer locally, which R-5 forbids: the four Bool acceptance entry points and MapPersistent's decline come back through the reply slot (c0 has now given those four rows kReplySlot, so MGPipeCallFlagsFor is the single source of truth). Do not re-derive acceptance on the client, and do not "always accept" — that is ID-39's 66 lost DirectVulkan uploads with a wire in between.
  6. R-8: the liveness gates read the caps mirror, never MGPipeGetResourceOps(). MGPipeResourceSubsystemEnabled() and P4aFamilyHasItsConsumer() must ask CapsMirror::ServerConsumes(subsystemBit). Under inproc the old read answers correctly by accident; under spawn the client has no backend at all and five families silently stop emitting while the client clears its dirty flags anyway. s1 already made the server end Fatal when nobody sets the mask; you are the client end.
  7. Blocking read_pixels — copy the pixels out of SEG_REPLY into the application's pointer. The PBO destination half (fire-and-forget + client-side MarkGpuWritten) is b1's design; wire it, do not redesign it.
  8. Wire b1's three unwired entry points. MarkGpuWritesForDraw, MarkGpuWritesForDispatch and PushPersistentMapsBeforeVerb are written and tested but have zero callers — deliberately, because the call sites are yours. They must run before the verb record. A push deferred past its draw is the C-1 regression re-committed at the transport layer. b1's report ~/w7/notes/p5/p5-results/b1-v1.md has the details, including that its own B-1 fix depends on the rising edge publishing a real one-block record.
  9. Two debts t1 filed against you, both in ~/w7/notes/p5/p5-results/t1-v1.md: E2's emitter-drop negative control (drop one Clear emission and prove OpenRA's SSIM falls below the threshold — the control that proves the split arm is really split), and the fact that whoever lands the last stub arms 21 Split. ctest entries plus two negative controls. t1's arming condition is behavioural — transport not monolith, a live ClientSession, a non-zero ImplementedVerbCount(), and the client encoder's record ordinal actually moving during the case — so it arms only when the path really runs. That last clause is yours to make true.

Acceptance

  • DirectGLES.Split.TriangleScenario.* and DirectGLES.Split.ClearThenReadPixelsScenario.* green under MOBILEGL_TRANSPORT=inproc (jointly with v1 — coordinate through me if you block on each other).
  • The four self-tests in the preamble on all four build dirs plus split. G1 must not move, and you are touching MG_Backend/BackendObject*, which is in the pull build.
  • A death test on the UnmigratedVerbFatal arm, and a unit case per caps-mirror read path (glGetString, glGetIntegerv, glGetStringi).
  • One case proving a client whose caps mask lacks a family emits nothing for it and says so — R-8's negative control.

The discipline this wave produced — R-16, and it is not optional

Five packages each shipped at least one check that could not fail for the reason it existed: a self-test control that tripped on another control's message; a persistent-map test that wrote the record field by hand so deleting the producer still passed; a lane probe that armed against stub source text — the reviewer renamed one string and 8 of 11 split lanes went green having run monolith. So: no test may construct the state it is meant to observe; every control asserts its own failure string, not merely that something failed; every gate ships with one line saying "I made it red once, by doing X". Break it, watch it fail, restore it, and put that evidence in your report. ~/w7/p5-w1-redcheck.py automates exactly this and is worth copying.

Write ~/w7/notes/p5/p5-results/c1-v1.md and return ≤200 words: commit range, acceptance numbers, whether the first inproc frame renders, and the three things v1 and the integrator most need to know.