mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-19 16:01:57 +09:00
[Docs] (.claude/skills, .github/workflows, CMakeLists.txt, docs/archive, docs/Disaggregated, docs/MobileVA, docs/Performance, MG_Backend, MG_Backend/DirectGLES, MG_Backend/DirectVulkan, MG_Backend/Record, MG_Gbm, MG_Impl, MG_Impl/EGLImpl, MG_Impl/GLImpl, MG_Impl/GLXImpl, MG_Impl/Pipe, MG_IntegrationTest, MG_IntegrationTest/Harness, MG_IntegrationTest/Scenarios, MG_Pipe, MG_Pipe/generated, MG_Remote, MG_Remote/Client, MG_Remote/Server, MG_Remote/Transport, MG_Remote/Wire, MG_State/GLState, MG_Test/Pipe, MG_Test/Util, MG_Test/Wire, MobileGL, scripts, scripts/data, tools/device_bench, userguide): archive the planning notes and agent contracts under docs/archive
- DEBTS.md and OPEN-QUESTIONS.md stay maintained, now in docs/Disaggregated.
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
# Brief: p5c-audit — where the `inproc` split still reads the other role's memory
|
||||
|
||||
You are auditing the MobileGL disaggregation branch (`feat/disaggregated`, head `a79a0af6`), working tree = the current directory (`C:\Users\geekerwan\AndroidStudioProjects\FoldCraftLauncher\MobileGL-disagg`). **This is a READ-ONLY audit**: do not edit any repository file, do not run builds or tests, do not touch git (no commit/checkout/stash), do not touch any adb device, do not fetch git LFS. You may write scratch files only under `C:/Users/GEEKER~1/AppData/Local/Temp/claude/C--Users-geekerwan-AndroidStudioProjects-FoldCraftLauncher-MobileGL-disagg/0614b2e9-9ce2-49e4-a44c-6d023a133184/scratchpad/`. If you need Linux tooling, run it as `wsl.exe -d Arch -- bash -lc "<cmd>"`; the same tree is checked out at `~/w7/pipe` inside that distro (also at `a79a0af6`), and the notes/evidence directories are `~/w7/notes/` — read-only for you as well.
|
||||
|
||||
## The question
|
||||
|
||||
MGPipe splits the GL frontend (client role, the application's GL thread) from the backend (server role, the `mgl-srv-apply` thread). Under `MOBILEGL_TRANSPORT=inproc` (build flavour `-DMOBILEGL_PIPE_PUSH=ON -DMOBILEGL_BUILD_DISAGGREGATED=ON -DMOBILEGL_BUILD_DISAGGREGATED_INPROC=ON`) the two roles are two threads of one process. The intended design is that **everything crosses as wire**: records in the `SEG_CMD` ring, bulk bytes in `SEG_STAGE` blobs, answers in `SEG_REPLY` slots, the caps snapshot, and the one-slot control mailbox for rare EGL operations. The next phase (P6, `spawn`) puts the server in another process, where any read of the other role's memory that is not one of those carriers simply cannot work.
|
||||
|
||||
**Find every place where, today, one role reads (or writes) the other role's memory directly instead of going through a carrier.** Both directions, and the shared process globals that only work because the address space is shared. The verb barrier (`ClientSession::EmitAndWait` waits for `appliedSeq == emitSeq` on every class-B verb, `MOBILEGL_IPC_VERB_BARRIER=1`) is what makes these reads "safe" today — so anything that is only correct because of the barrier belongs in your inventory too.
|
||||
|
||||
## Where to start (read these first, they already name most of the debt)
|
||||
|
||||
- `MobileGL/MG_Remote/CONTRACT-P5.md` §3 (field ownership: RECORD-SUPPLIED / APPLIER-DERIVED / BARRIER-PULLED / FATAL; the sticky forwards; "two sets with no field ids") and §4 (role and thread ownership of every process global).
|
||||
- `MobileGL/MG_Remote/CONTRACT-P5B.md` §3–§4 and §6.
|
||||
- `docs/Disaggregated/ARCHITECTURE.md` §17 (P5/P5b landed shape) and `docs/Disaggregated/CURRENT_STAGE_PROGRESS.md` §5 (open items: the three "inproc dependencies" P5b left — named blit's scoped client-shadow binding, the mip descriptor's barrier-held registry lookup, FBO death's inproc mailbox).
|
||||
- Generated tables: `MobileGL/MG_Pipe/generated/PipeFieldOwnership.inc` (36 rows are `kBarrierPulled`), `PipeFilled.inc`, `MobileGL/MG_Pipe/FieldOwnership.def`, `Coverage.def`, `FillPoints.def`.
|
||||
|
||||
Then the code:
|
||||
- Client role: `MobileGL/MG_Remote/Client/*` (`EmitTables.cpp` — the A/B/C slot partition and the pre-verb hooks; `ClientSession.cpp`; `BackendObject_Remote.cpp`; `CapsMirror.cpp`; `PersistentMapTracker.cpp`; `GpuWritePending.cpp`), `MobileGL/MG_Impl/Pipe/PipeFill.cpp` (the residual fill of `gPipeInputs`), `MobileGL/MG_Pipe/PipeRoute.{h,cpp}`.
|
||||
- Server role: `MobileGL/MG_Remote/Server/*` (`PipeApplier.cpp` incl. `ServerVerbSink`, `ServerLoop.cpp`, `ServerSession.cpp`, `StagedShadow.h`), `MobileGL/MG_Remote/Wire/PipeWireCodec.cpp` (`WireVerbSink`, the segment resolver, `MGHostSpan` decoding), `MobileGL/MG_Pipe/PipeApply.cpp`, `MobileGL/MG_Backend/MGPipe/PipeInputs.{h,cpp}`.
|
||||
- Backends' handle arms: `MobileGL/MG_Backend/DirectGLES/{Managers.cpp,DirectGLES.cpp,Utils.cpp,BackendObject_DirectGLES.cpp}` and `MobileGL/MG_Backend/DirectVulkan/*` — look for `MGB_CTX->`, `MappedData(`, `GetStorage(`, `MipmapStorage`, `SharedPtr<`, `ProgramObject`, `TextureObject`, `BufferObject`, `pActiveBackendObject`, `pDefaultFramebufferInfo`, `MGPipeUnmigratedEmulation`, `liveHostBase`, `RequireStagedCoverageForPendingRanges`, `Fatal{StageSnapshotTooNarrow`, `Fatal{UncarriedInitialBytes`, `Fatal{InitialBytesNotCarried`, `Fatal{UnmigratedEmulation`, registry lookups keyed by frontend identity.
|
||||
- Callbacks: `MobileGL/MG_Pipe/MGPipeCallbacks.h` and wherever the split build installs them — under `inproc`, does the apply thread call `OnGlError` / `OnGpuWritten` / `OnBufferWriteback` / `OnTextureWriteback` / `OnMipLevelsGenerated` / `OnSurfaceChanged` / `OnCapsInvalidated` / `OnLog` / `OnXfbScatterReady` / `OnTexturePullRequest` straight into client-owned `MG_State` objects? (`SEG_EVENT` exists in `Transport/EventRing.h`; is it used?)
|
||||
- Program artifacts: `MobileGL/MG_Pipe/ProgramArtifactsCodec.{h,cpp}` — under split, does `CreateShaderState` carry the archive as a blob, or does the server read the frontend `ProgramObject`'s `LinkArtifacts` directly? (`Fatal{ArtefactsMissing}` / `Fatal{ArchiveEmpty}` exist somewhere.)
|
||||
- Caps: `MobileGL/MG_Remote/CapsCodec.cpp` and `Client/CapsMirror.cpp` — the format-capability table and the renderer string ("the two `GetCaps` blobrefs") — carried in the snapshot, or read from the shared `pActiveBackendObject`? Also `BackendObject_DirectGLES.cpp` / `Utils.cpp` format-capability lookups that CONTRACT-P5 §4 says are backend-internal reads of `pActiveBackendObject`.
|
||||
- Textures: how `ResourceSubData` bytes reach Espryt under split (blob in `SEG_STAGE` → `StagedShadowStore`? or a pointer into the client's `MipmapStorage`?); the mip-generation path (`GenerateMipmap`, "GLES mip storage descriptor"), `CopyImageSubData`'s shadow mirror, `GetTexImage`, `CopyTexImage2D`/`CopyTexSubImage2D`.
|
||||
- Buffers: `Ops_H_*` in `Managers.cpp`, `EnsureBufferResourceForHandle` (its "frontend object held" arm), `HasDefinedContent()`, persistent maps (`PersistentMapTracker`, `MOBILEGL_IPC_ADOPT_TIER=2` emulated tier), `SyncGpuWrites` / `MarkGpuWritten`, XFB capture / scatter.
|
||||
- Process globals under inproc: everything in CONTRACT-P5 §4's table plus anything it missed (e.g. `MGPipeSlots()` and the other `MG_Impl/Pipe` singletons — does any server-side code read them? `g_syncedRenderStateParameters`? Espryt twins that still hold a frontend pointer? `g_rawDepthFetchSamplerState`?).
|
||||
- Client reads of server memory: any `MG_Impl` / `MG_Remote/Client` read of `g_applier` / `MGPipeApplierState` / `MGPipeGetResourceOps()` / backend twins / `pActiveBackendObject` (beyond the caps mirror) under split; `MG_IntegrationTest/Harness/Pipe*Peek` are test-only — list them separately.
|
||||
|
||||
Use grep aggressively (ripgrep is available on Windows as `rg`, or `grep -rn`); then open each hit and decide. Do not trust the contracts' line numbers — they are from older heads; re-resolve every site on `a79a0af6` and cite `file:line` exactly (the repo has `scripts/check_doc_citations.py` which checks `path:line` citations against HEAD; your citations must resolve).
|
||||
|
||||
## What to write: `p5c-audit-v1.md` in the scratchpad directory named above (write it FIRST, before your final message)
|
||||
|
||||
1. **Inventory table**, one row per site or per tightly-coupled family (aim for completeness over brevity; 30–60 rows is plausible). Columns: `#` · direction (`S→C read` = server reads client memory, `C→S read`, `S→C write`, `C→S write`, `shared global`) · what memory (object/field) · reader/writer site (`file:line`, function) · owner of that memory · when it happens (verb class / call / frequency: per draw, per upload, once) · why it works today (barrier / same address space / single writer) · what breaks under `spawn` · current guard (`Fatal{...}` name, `MOBILEGL_IPC_STRICT_ERRORS`, `MOBILEGL_IPC_AUDIT`, `rsp` counter, none) · the natural carrier (a new/extended record field, a `SEG_STAGE` blob, a reply slot, a `SEG_EVENT` event, the caps snapshot, the control mailbox, or "server-derived — no carrier needed") · suggested phase (P5c now / P6 / P7 / P8 / P9 / P10) — with one line of reasoning.
|
||||
2. **Summary counts** by direction and by carrier, and the top 10 by frequency (per-draw first).
|
||||
3. **Already wire-clean**: a short list of the paths you checked that DO go through a carrier (buffers via `StagedShadowStore`, ReadPixels reply, DrawVbo user indices, fence handles, …), so the plan is bounded by evidence, not assumption.
|
||||
4. **Surprises / disagreements** with what the contracts and `ARCHITECTURE.md` §17 claim (e.g. a field the tables call RECORD-SUPPLIED that the backend still pulls; a callback delivered directly; a `gMGPipeSegmentResolver` or `MGHostSpan::Ptr` short-cut).
|
||||
5. **Existing numbers** you found without running anything: any `rsp=` values in `~/w7/notes/p5b/p5b-results/*.md`, `~/w7/notes/p5/p5-results/*.md` or `~/w7/p5b-final-census-348d22a4/` logs (cite the file), so the plan can size the debt.
|
||||
|
||||
Keep prose minimal; tables over paragraphs. Be precise: if you are not sure a site is reached under `inproc` (e.g. it is inside `#if !MOBILEGL_BUILD_DISAGGREGATED` or behind a class-C refusal), say so in the row rather than dropping it. Cite the git head you read (`git rev-parse HEAD`).
|
||||
|
||||
When the report file is written, reply with at most 150 words: the row count, the top three findings, and anything you could not resolve.
|
||||
@@ -0,0 +1,114 @@
|
||||
# P5c — `inproc` 共享内存读点归零(`11ac3de6..b88e8487`)
|
||||
|
||||
> 本页是该阶段的**阶段汇总**:阶段表行、实测与落地形状的完整文本(2026-09-24 从上层索引移入,原文照录)都在这里;上层只留摘要——[`ROADMAP.md`](../../../Disaggregated/ROADMAP.md)、[`MEASUREMENTS.md`](../../../Disaggregated/MEASUREMENTS.md)、[`ARCHITECTURE.md`](../../../Disaggregated/ARCHITECTURE.md)。文中 `file:line` 与"今天""当前"按各段写成时的头理解;文中的 `MEASUREMENTS.md §N` / `ARCHITECTURE.md §17.x` 编号保留,对照表见 [`../README.md`](../README.md)。
|
||||
|
||||
## 摘要
|
||||
|
||||
- 起因:对 `a79a0af6` 的只读审计([`p5c-audit-v1.md`](p5c-audit-v1.md),59 行)证明 P5 / P5b 的 `inproc` 仍有一批不经任何载体、只靠 verb barrier 与同一地址空间才正确的直接读写。P5c 让 `inproc` 成为只经 wire 交换的诚实两角色,从而 P6 只是传输替换。
|
||||
- 落地:server 端纹理 staged shadow(`StagedTextureStore`);`SEG_EVENT` 三个 producer + `kEventGlError`(反向通道零裸指针);sink / twin 按记录句柄解析;`applier_reset` / `object_death` 控制记录(opcode 77 / 78);`set_context_values`(79)退役值类 BARRIER-PULLED 行;双层 `Fatal{RoleViolation}` 守卫;两个具名豁免 scope 承接未到期的债。契约 `MobileGL/MG_Remote/CONTRACT-P5C.md`。
|
||||
- 门:守卫开启下 unit 2187/2187、`integration-split` 111/111,每层守卫 red-once;纹理 `0xDD` audit 零 Fatal;G1 三个认定 resize + `.text` −16 B。
|
||||
|
||||
## 阶段表行(原 `ROADMAP.md`)
|
||||
|
||||
- **阶段**:**P5c** `inproc` 共享内存读点归零
|
||||
- **状态**:✅ `11ac3de6..b88e8487`
|
||||
- **落地什么 / 范围**:server 端纹理 staged shadow(`StagedTextureStore`,句柄为键、整段覆盖、defined-ness 追踪);`SEG_EVENT` 三个 producer + `kEventGlError`(反向通道零裸指针);sink / twin 按记录句柄解析(blit 具名臂经 verb 句柄工作区,Magma 走 G6 消费臂);`applier_reset` / `object_death` 控制记录(opcode 77/78,framebuffer 首个 wire delete);`set_context_values`(79)退役全部值类 BARRIER-PULLED 行,三 shutter 自答;双层 `Fatal{RoleViolation}` 守卫 + `InBarrierWait` 接线;两个具名豁免 scope(通告家族 P4b/P7、G6 registry 家族 P3b/P4b)承接未到期的债
|
||||
- **验收门 / 证据**:角色守卫开启下 unit 2187/2187(strict 下同绿)、`integration-split` 111/111、每层守卫 red-once 按名变红;纹理 `0xDD` audit 在 bsl / complementary 两条 in-world trace 零 Fatal;rsp 按帧实测(bsl 948.5/帧,残留全为钉住的对象类 15 行);G1 三个认定 resize(SwapchainObject::Create / CopyTexSubImage2D / ScopedRestartIndexSubstitution,均已具名)+ `.text` −16 B、pull 构建零 MG_Remote 符号;G5 保护区字节一致;双生成器 --check/--self-test 绿
|
||||
|
||||
## 历史:P5c 计划与审计(`inproc` 共享内存读点;审计头 `a79a0af6`,2026-09-17)
|
||||
|
||||
**为什么插在 P6 之前**:P5 / P5b 的 `inproc` 只把 verb 记录、`SEG_STAGE` blob、reply 与 caps 快照做成了 wire。对 `a79a0af6` 的只读静态审计(`~/w7/notes/p5c/p5c-audit-v1.md`,59 行清单,逐条在该头上重新解析)证明两个角色之间仍有一批**不经任何载体的直接内存读写**,靠 verb barrier 与同一地址空间才正确。它们不是传输问题:`spawn` 换掉的只是 ring 的传递方式,而这些读写在另一个进程里根本没有对应内存。P5c 的目标是让 `inproc` 诚实——两线程之间除 `SEG_CMD` / `SEG_STAGE` / `SEG_REPLY` / `SEG_EVENT` / caps 快照 / 控制帧之外零直接访问——从而 P6 只是传输替换。**本节保留 P5c 启动时的计划与审计语境;P5c 已收官,后续对象类、控制帧、静态量与反向通道的收口结果以 P5f 报告为准。**
|
||||
|
||||
### 审计清单(按家族;`file:line` 以 `a79a0af6` 为准,完整 59 行见报告)
|
||||
|
||||
| # | 方向 | 直接访问的是什么 | 站点 | 今天为何能工作 | 现有守卫 | P5c 载体 |
|
||||
|---|---|---|---|---|---|---|
|
||||
| T1 | S→C 读 | **纹理纹素**:`resource_subdata` 已把 level 字节放进 `SEG_STAGE`,但 `ApplyTextureUpload` 只做门与累积、把指针丢掉,Espryt 同步时从 client 的 `MipmapStorage` 重读纹素;纹理对象的形状与脏区也直接读前端对象 | 丢指针 `MobileGL/MG_Pipe/PipeApply.cpp:989-1008`;重读 `DirectGLES/Managers.cpp:7315`(`MapMipmapData`)、`:6940`、`:7129`、`:7198`;形状 `:7314`、`:7332`、`:6878-6880`、`DirectGLES/DirectGLES.cpp:8502-8507`、`:8528-8529`;脏区 `DirectGLES/Managers.cpp:7360`、`:7371` | barrier + 同地址空间 | **无**:整个纹理家族不在 `FieldOwnership.def`,`rsp` / `MOBILEGL_IPC_STRICT_ERRORS` / `MOBILEGL_IPC_AUDIT` 都看不见 | server 端纹理 staged shadow(buffer `StagedShadowStore` 的纹理半边);`SyncMipmapsToBackend` 改读它,形状与脏区读描述符 |
|
||||
| T2 | S→C 读写 | client 的 slot 分配器 `MGPipeSlots()`:mip / CopyTex / twin 创建时按前端 `GetLifetimeId()` 在 client 分配器里查找甚至铸造 | `DirectGLES/DirectGLES.cpp:8087` → `DirectGLES/SlotTables.h:392-400`(`HandleOf` → `FindByLifetimeId`);铸造 `DirectGLES/SlotTables.h:232`(`GetOrCreate`)、`:418`、`:428`;`DirectGLES/Managers.cpp:2708`、`:4293`、`:5627`;`DirectGLES/DirectGLES.cpp:6706`、`:8185`、`:8564`、`:8659` | barrier;mip 只 Find 不 mint | 无(`MOBILEGL_ASSERT` 在 INFO 构建失效) | 记录已带句柄(`MGPMipPlan::Res`、`MGPCopyFromFramebuffer::Dst`、`MGPBlit::ReadFbo/DrawFbo`)→ `GetOrCreate(MGPipeHandle)`(`DirectGLES/SlotTables.h:278`) |
|
||||
| T3 | S→C 读 | 具名 blit:client 临时改绑自己的 read / draw 绑定槽,server 经 `MGB_CTX` 读绑定槽 | client `MobileGL/MG_Remote/Client/EmitTables.cpp:741-786`;server `DirectGLES/DirectGLES.cpp:7782-7785` | barrier + RAII 恢复 | `rsp`(`GetFramebufferBindingSlot`) | 记录里的 `ReadFbo` / `DrawFbo`,sink 侧按句柄解析(`MobileGL/MG_Remote/Server/PipeApplier.cpp:228-244`) |
|
||||
| T4 | S→C 读 | `CopyTexImage2D` / `CopyTexSubImage2D` 经纹理单元绑定槽取目的纹理 | `DirectGLES/DirectGLES.cpp:8561-8563`、`:8656-8658` | barrier | `rsp`(`GetTextureUnitObject`) | 记录里的 `Dst` 句柄 |
|
||||
| T5 | S→C 写 | Magma 生成 mip 直接写 client 的 level 存储(Espryt 的重推导臂没有 Magma 对应) | `DirectVulkan/Renderer/VulkanRenderer.cpp:1562-1590`(调用 `:11317`) | barrier | 无 | 与 GLES 同形:只按描述符验证 |
|
||||
| B1 | S→C 读 | `BufferObject::HasDefinedContent()`,每个 ensure 的 draw 都读 | `DirectGLES/Managers.cpp:3147-3148`(`EnsureBufferResourceForHandle`;`:3141-3146` 自述为债) | barrier | 无 | 描述符旁的 live-content 位,client 发布 |
|
||||
| B2 | S→C 读 | `HandleOfBuffer` 每次 ensure 读前端 `GetLifetimeId()` | `DirectGLES/Managers.cpp:2705-2716` | barrier + memo | 无 | 记录里的句柄 |
|
||||
| B3 | S→C 读 | 旧 buffer 臂(`MappedData()` / `IsMapped()` / `GetChangeSerial()`)在 split 构建里位 7 清零时可达,arm resolver 只打一行 `MGLOG_D` | `DirectGLES/Managers.cpp:2586-2620`;臂体 `:1012-1022`、`:1119-1121`、`:2944-2949`、`:3281-3327` | 同进程 | 无 | 有传输时具名拒绝(同 `Fatal{PipeLegacyMemosDisabled}` 的形状) |
|
||||
| B4 | S→C 读写 | XFB:`SharedPtr<BufferObject>` 跨整个 span 持有,结束时 `WritebackFromBackend`,scatter 对 client shadow 读改写 | `DirectGLES/DirectGLES.cpp:950`、`:1060`、`:1077`、`:1081`、`:1172`、`:1185` | barrier | 无 | `OnBufferWriteback` / `OnXfbScatterReady` 事件——P9 的题材,P5c 只记账 |
|
||||
| R1 | S→C 写 | 反向通道是 apply 线程直接调进 client 的 `MG_State`:`OnBufferWriteback` 把**裸指针**塞进 `MGPBlobRef.Offset`,client 侧再转回指针;consumer 会拒绝任何真实段 | 生产 `DirectGLES/Managers.cpp:2339-2343`(`Ops_H_Readback`);消费 `MobileGL/MG_Impl/Pipe/ResourceTracker.h:553-572`(拒绝真实段 `:560-564`) | 同地址空间 + barrier | 无 | `SEG_EVENT` `kEventBufferWriteback`:consumer 已在(`MobileGL/MG_Remote/Client/ClientSession.cpp:176-267`),**全仓零 producer**(`MobileGL/MG_Remote/Server/ServerSession.cpp:484-492` 无调用者) |
|
||||
| R2 | S→C 写 | `OnGpuWritten` 直接调进 client tracker;Magma 更是绕过回调直接 `MarkGpuWritten()` | Espryt `DirectGLES/Managers.cpp:2729-2752`,喂入 `DirectGLES/DirectGLES.cpp:568`、`:616`、`:2601`;Magma `DirectVulkan/Renderer/UniformManager.cpp:1075`、`:1231`、`DirectVulkan/Renderer/VulkanRenderer.cpp:11618` | 同地址空间 | `MGLOG_E_ONCE` | `SEG_EVENT` `kEventGpuWritten`(consumer `MobileGL/MG_Remote/Client/ClientSession.cpp:227-236`) |
|
||||
| R3 | S→C 写 | 默认 framebuffer 附件(`pDefaultFramebufferInfo`)由 server 在 surface 创建时写 | `DirectGLES/DirectGLES.cpp:11519-11620`;Magma `DirectVulkan/Renderer/SwapchainObject.cpp:276-335` | barrier;罕见 | 无 | `SEG_EVENT` `kEventSurfaceChanged`(consumer stub `MobileGL/MG_Remote/Client/ClientSession.cpp:242-253`) |
|
||||
| R4 | S→C 写 | sticky forward:`RecordError` 写 client 错误队列;`InvalidateCompileEnv` 写 client 编译环境(在 stamped verb 之外静默 no-op) | `MobileGL/MG_Impl/Pipe/PipeFill.cpp:1753-1756`、`:1764-1772` | barrier | `rsp`;strict 下 Fatal | `RecordError` → `OnGlError` 事件(顺序保证是 P9 的);`InvalidateCompileEnv` 的活已由 R-12 caps 重发布完成(`MobileGL/MG_Remote/Client/CapsMirror.cpp:78-80`),删 forward |
|
||||
| R5 | — | `MGPipeCallbacks` 十个回调只装了两个,且都是 apply 线程内联调用;`SEG_EVENT` 段已创建、映射、握手公告、每个 reply verb 后排空,但没有任何生产者 | 安装 `MobileGL/MG_Impl/Pipe/ResourceTracker.h:606-613`;段 `MobileGL/MG_Remote/Server/ServerSession.cpp:285-301`;排空 `MobileGL/MG_Remote/Client/ClientSession.cpp:836` | — | 溢出 latch 与 `eventDropped` 已建未用 | 本身就是载体 |
|
||||
| C1 | S→C 读 | Magma 四处直接读 client 镜像 `pActiveBackendObject->GetDynamicParameters()`(Espryt 已改走 server 自己的 backend);Espryt 的格式表回落臂在 server backend 为空时读 client 镜像 | `DirectVulkan/DirectVulkan.cpp:713-715`;`DirectVulkan/Renderer/VulkanRenderer.cpp:667-676`;`DirectVulkan/Renderer/VertexInputStateFactory.cpp:249-250`、`:502-503`;`DirectGLES/Utils.cpp:50` | 镜像值等于快照 | 无 | server 自己的 `Backend()->GetDynamicParameters()`;回落臂拒绝 |
|
||||
| G1 | shared | `gPipeInputs`:client 残余填充写、applier 写、server 的 36 行 BARRIER-PULLED 读 | `MobileGL/MG_Backend/MGPipe/PipeInputs.h:806`;填充 `MobileGL/MG_Impl/Pipe/PipeFill.cpp:2798`;applier `MobileGL/MG_Pipe/PipeApply.cpp:1415-1560`;stamp `MobileGL/MG_Backend/MGPipe/PipeInputs.cpp:103-132`;`rsp` `MobileGL/MG_Backend/MGPipe/PipeInputs.cpp:72` | **只靠 verb barrier** 保证单写者 | `rsp` + strict Fatal + poison | 值类行(`GetActiveTextureUnit`、`GetMaxTouchedTextureUnit`、`GetTouchedBufferBindingPointCount`、`GetCurrentVertexAttribute`、XFB 六项、三个世代)→ 每 verb 一条残余值记录或按 `Coverage.def` 由 server 自答;**对象类行**(`GetBoundVertexArray`、`GetProgramForDraw/Dispatch`、`GetTextureUnitObject`、`GetImageTextureBinding`、`GetFramebufferBindingSlot`、`GetBufferBindingSlot/Point`、sticky `GetTextureObject` / `GetProgramObject`)返回前端对象指针、无法序列化,留 P3b/P4b/P7/P8 的 twin 表 |
|
||||
| G2 | C→S 写 | GL 线程在 `FreshlyPrimed` 时整体 `MGPipeApplierReset()` server 的 `g_applier` | `MobileGL/MG_Impl/Pipe/PipeFill.cpp:2654-2656` → `MobileGL/MG_Pipe/PipeApply.cpp:1202-1299` | barrier 的后置条件(validate 时无在飞记录) | 无 | make-current 边上的 `applier_reset` 控制记录 |
|
||||
| G3 | C→S 写 | 六种前端对象死亡:栈上结构体指针经 mailbox 送到 apply 线程(framebuffer 没有 wire delete opcode) | `DirectGLES/Managers.cpp:206-228` | 阻塞 + 同地址空间 | 无 | `object_death` wire 记录 |
|
||||
| G4 | C→S 控制 | 十二个 `Server*` EGL forwarder 经 one-slot mailbox 传**函数指针 + `void*` 栈局部** | `MobileGL/MG_Remote/Client/BackendObject_Remote.cpp:125-264`;邮箱本体在 fc 前的 HEAD 上是 `ServerLoop.cpp:533-568`(PumpControlRequest)+ `:645-707`(RunOnApplyThread)——本行原引 `:543-598`,f0-egl F9 修正 | 阻塞 | `Fatal{ApplyThreadNotRunning}` | **已由 P5f 包 fc 帧化**(原记 P6):`SurfaceControlFrame` 纯值帧走同一阻塞通道(`Server/SurfaceControlFrame.h`、分发 `ApplySurfaceControlFrame`),wire 编解码与具名拒绝在 `Protocol/SurfaceOpCodec.cpp`;报告 `notes/p5f/fc-report.md` |
|
||||
| G5 | C→S 读 | `ServerLoop::OnApplyThread()` 每条 routed 记录读;bring-up 直接读 `loop.Backend()` / `MGPipeGetResourceOps()` | `MobileGL/MG_Remote/Client/WireTables.cpp:71`;`MobileGL/MG_Backend/Init.cpp:100`、`:145`、`:164-170`、`:247` | 同进程 | — | client 本地角色标志;caps 快照的 cap 位(P6 顺手) |
|
||||
| G6 | shared | 前端地址 / lifetime-id 键控的 Espryt twin registry;持前端裸指针的 memo(`ResolvedDrawBuffers::Entry::frontend`、三张 texture sync list);server 读 `pDefaultFramebufferInfo`;`g_rawDepthFetchSamplerState`;`ScopedDefaultUnpackState::s_synced` 从不按 context 世代重置 | `DirectGLES/Managers.h:309-377`、`:1185`;`DirectGLES/DirectGLES.cpp:61-62`、`:1958-1987`、`:2846`;`DirectGLES/Managers.cpp:5806-5812` | barrier / server 私有 | — | 历史移交给 P3b/P4b / P6;transport registry 与 `s_synced` 世代问题已由 P5f fr / fs 收口 |
|
||||
| A1 | — | barrier 的 client 半边断言从未接线:`InBarrierWait()` 零调用点,只有 `ApplyThreadIsInsideApplier` 在 emit 时检查 | `MobileGL/MG_Remote/Client/ClientSession.cpp:880`、`:748-753` | — | — | 接上,或删掉契约里的这句声明 |
|
||||
|
||||
已确认 wire-clean、不进 P5c:buffer 全家族(`Ops_H_*` 只拿句柄 + 记录 + `SEG_STAGE` 字节,`StagedShadowStore::Adopt` 复制,`Fatal{StageSnapshotTooNarrow}` 六处);`resource_respecify` 初始字节双向拒绝;persistent map 仿真档按块过 `SEG_STAGE`,`Fatal{RoleViolation}` 挡住 apply 线程;`CreateShaderState` 归档是一个 blob;caps 的格式表与 renderer 字符串走 `CapsSnapshot` 控制帧(`GetCaps` 记录本身已死,只是卫生项);tight ReadPixels;`DrawVbo` 用户索引;fence 家族;`gMGPipeSegmentResolver` 与 `gBackendFunctionsTable` 的角色划分。
|
||||
|
||||
### 包与顺序
|
||||
|
||||
| 包 | 内容 | 关闭的行 |
|
||||
|---|---|---|
|
||||
| **c0c** 契约 | `MG_Remote/CONTRACT-P5C.md`:纹理 staged shadow 的所有权与覆盖规则;`SEG_EVENT` 记录与 blobref 约定(`Seg = kSegEvent`);sink / twin 按句柄解析的规则;`applier_reset` / `object_death` 记录;角色守卫的语义(有传输时 apply 线程触前端对象表面、GL 线程触 server 状态表面都是 `Fatal{RoleViolation}`);残余值记录的字段表;把纹理家族补进 `FieldOwnership.def` | — |
|
||||
| **tx** 纹理 | `StagedTextureStore`:`ApplyTextureUpload` 采纳 `SEG_STAGE` 字节到 server 侧 level shadow;`SyncMipmapsToBackend`、形状读、脏区改读描述符与 shadow;Magma mip 改按描述符;`MOBILEGL_IPC_AUDIT` 的 `0xDD` 覆盖纹理 | T1、T5(T2 的 mip 半边随之) |
|
||||
| **ev** 反向通道 | `ServerSession::PublishEvents` 接三个 producer(writeback / gpu-written / surface-changed),consumer 的段臂改为解析 `kSegEvent`;Magma `MarkGpuWritten` 改走回调;`RecordError` 进事件(顺序仍 P9);删 `InvalidateCompileEnv` forward;溢出策略沿用 `ARCHITECTURE.md` §11.7 | R1–R5 |
|
||||
| **hd** 句柄解析 | blit / mip / CopyTex / `HandleOfBuffer` 的 sink 与 twin 按记录里的句柄解析(`GetOrCreate(MGPipeHandle)`),server 不再触 `MGPipeSlots()`;`HasDefinedContent` 改读描述符的 live-content 位;Magma 四处 caps 读改 server backend,`Utils.cpp` 回落臂拒绝 | T2、T3、T4、B1、B2、C1 |
|
||||
| **ct** 控制记录 | `applier_reset` 与 `object_death` 两条 wire 记录(framebuffer 首次有 delete opcode);mailbox 只剩 EGL forwarder 给 P6 | G2、G3 |
|
||||
| **rv** 残余值 | 值类 BARRIER-PULLED 行改为每 verb 的残余值记录(或 server 自答),`gen_pipe_field_ownership.py` 把它们改成 RECORD-SUPPLIED;对象类行保持 BARRIER-PULLED 并逐行标注归属阶段 | G1 的值类半边 |
|
||||
| **gt** 门 | 角色守卫(两层 `Fatal{RoleViolation}`,仅 split 构建、有传输时生效);`InBarrierWait` 接线;旧 buffer 臂传输拒绝;`rsp` 按帧进 stats 行并在四条 A/B trace 上测得;CI 加一条 `MOBILEGL_IPC_STRICT_ERRORS=1` + 角色守卫的 `integration-split` 车道 | A1、B3,以及所有行的红一次证据 |
|
||||
|
||||
顺序:c0c → tx / ev / hd 并行 → ct / rv → gt 收口。每包自带 red-once(R-16),阶段末一次 Codex / Kimi 审查(ID-66)。
|
||||
|
||||
### 出口门(E-P5c)
|
||||
|
||||
1. **角色守卫下全绿**:守卫开启时 `integration-split`(107)、broad inproc 车道对 `348d22a4` 普查零回退、79 trace 无新增首阻塞;关掉任一层守卫必须能在一条具名用例上变红。
|
||||
2. **纹理字节不再回读 client**:`MOBILEGL_IPC_AUDIT=1` 对纹理 staged 字节的 `0xDD` 填充在四条 A/B trace 上无失败;把采纳改回丢指针必须变红。
|
||||
3. **`SEG_EVENT` 有生产者**:三条事件的往返单元与集成用例;排空点上 `eventDropped == 0`;把 producer 改回裸指针必须变红。
|
||||
4. **`rsp` 分类完成**:四条 A/B trace 每帧 `rsp` 已测;剩余读全部是对象类行,名单由 `FieldOwnershipTest` 钉住,值类行为 0。
|
||||
5. **Redmi 四臂复测**(记录,不设门):writeback / gpu-written 改走事件后 barrier tax 重新记录。
|
||||
6. G1 0/0/0/0、G2 / G14、G5 照旧。
|
||||
|
||||
### 历史移交项(P5c 当时不碰)
|
||||
|
||||
P5c 当时移交的对象类 BARRIER-PULLED、transport registry 前端键、EGL 控制面、`s_synced` / `g_syncedRenderStateParameters` 世代与反向通道跨角色访问,已在 P5f 收口。P9 的异步化/排序、P8/P9 的协议广度与仿真功能仍按各阶段推进;不要把这份历史清单重新当成 P6 的帧化或静态量施工单。
|
||||
|
||||
## 实测:P5c(`11ac3de6..b88e8487`,同日收官)(原 `MEASUREMENTS.md` §8)
|
||||
|
||||
出口门(E-P5c)实测:
|
||||
|
||||
| 门 | 结果 |
|
||||
|---|---|
|
||||
| 守卫开启下 unit | **2187/2187**(strict `MOBILEGL_IPC_STRICT_ERRORS=1` 下同绿) |
|
||||
| 守卫开启下 `integration-split` | **111/111**(107 + ct 的 4 条 CtWireScenario,全真跑) |
|
||||
| 每层守卫 red-once | layer-1(MipmapStorage 守卫短路 → `TextureMapMipmapDataFromTheApplyThreadIsFatalByName` 红)与 layer-2(`RefusePipeInputsTouchWhileApplierOwnsIt` 短路 → `ClientPipeInputsFillWhileTheApplierOwnsItIsFatalByName` 红)各红一次并复原;tx 的采纳改回丢指针 → 恰 `StagedTextureProductionTest` 红;ev 的 writeback 改回裸指针 → `AtomicCounterScenario.SubDataAfterDispatchSurvivesAnImmediateReadback` 按名红;ct 的发射短路 → Ct 4/4 按名红;rv 的发射门短路 → 7 条按名红 |
|
||||
| 纹理 `0xDD` audit | bsl in-world(100000 调用)与 iris-complementary in-world 全程零 Fatal |
|
||||
| `SEG_EVENT` 往返 | 三种事件 + `kEventGlError` 各有单元往返;排空点 `eventDropped == 0` |
|
||||
| `rsp` 分类 | 值类 = 0(rv 的 FieldOwnershipTest 钉住);按帧实测:bsl 948.5/帧(38.7/draw,123 帧)、complementary 1591.9/帧(151 帧)、iterationrp 286.2/帧(108 帧后止于既有具名 `texture-remint-pull`);残留全为对象类 15 行 |
|
||||
| 普查(integration-gpu @ inproc,对同机 11ac3de6 基线逐名比对) | 基线 253 红 / 收官头 423 红;183 条 newly-failing 中 11 条为三个真回归(默认 FBO 格式时序、大 writeback 溢出、XFB scatter 读前端)——已修并回归绿;其余 172 条全部带 Fatal 名证据归类为设计红(传输下旧臂具名拒绝的对照车道 14 条 + Magma P7 未迁移面 156 条)与 2 条 DirectVulkan CtWire(改按名 skip:Magma 无 object_death 生产者,P7) |
|
||||
| G1(pull 符号恒等,`11ac3de6` ↔ 收官头,CI 同款 sym 构建) | 0 增 / 0 删 / **3 认定 resize** / 0 重命名,`.text` −16 B:`SwapchainObject::Create`(ev 表面事件化)、`CopyTexSubImage2D`(hd 传输臂)、`ScopedRestartIndexSubstitution`(server-shadow 臂);pull 构建零 `MG_Remote` 符号 |
|
||||
| G5(p3a / p4a 保护区) | 字节一致 |
|
||||
| 生成器 / 卫生门 | 双生成器 --check/--self-test 绿;doc 引用、include 闭包、dirty-surface 绿 |
|
||||
| Redmi 四臂复测 | **未做**(记录项,需设备窗口;barrier tax 重测随之) |
|
||||
| 79 trace 普查 | **未重跑**(全集语料不在本机;P5b 的 72/6/1 仍以其头为准) |
|
||||
|
||||
审计的 59 处直接访问的终态:纹理纹素 / 形状 / 脏区改读 server staged shadow(tx);反向通道四条事件(ev);句柄解析全部按记录(hd);`applier_reset` / `object_death` 上 wire(ct);值类残余读清零(rv);双层角色守卫 + `InBarrierWait`(gt)。**未到期的具名债**:`MGPipeReverseAnnouncementScope`(绑定记录 P4b 才发射的 ensure/通告族)与 `MGPipeFrontendKeyedRegistryScope`(G6 前端键 twin registry,P3b/P4b 重键)两个 scope 内的只读探测,以及对象类 15 行 BARRIER-PULLED——全部具名、可 grep、有退役阶段。
|
||||
|
||||
## 落地形状(原 `ARCHITECTURE.md` §17.6)
|
||||
|
||||
### 17.6 `inproc` 仍经共享地址空间的访问,与 P5c 的形状(已落地,头 `b88e8487`)
|
||||
|
||||
P5 / P5b 的 wire 只覆盖 verb 记录、`SEG_STAGE` blob、reply 与 caps 快照。对 `a79a0af6` 的只读静态审计(`ROADMAP.md` "P5c 计划",报告 `~/w7/notes/p5c/p5c-audit-v1.md`)列出 59 处仍靠 verb barrier 与同一地址空间才正确的直接访问,最重的四类:**纹理纹素**虽已过 `SEG_STAGE` 但 applier 丢掉指针、Espryt 回读 client 的 `MipmapStorage`(整个纹理家族不在 `FieldOwnership.def`,`rsp` / strict / audit 都看不见);**反向通道**是 apply 线程直接调进 client `MG_State`(`OnBufferWriteback` 传裸指针,`SEG_EVENT` 已铺好但零 producer,十个回调只装了两个);**server 用前端 `GetLifetimeId()` 去 client 的 slot 分配器查找甚至铸造句柄**,而记录里其实已带句柄;**Magma** 直接读 client 的 caps 镜像、直接 `MarkGpuWritten`、直接写 client 的 mip 存储。
|
||||
|
||||
P5c 的设计决定(六条全部落地,落地形状与偏差以 `MobileGL/MG_Remote/CONTRACT-P5C.md` 为最新权威):(1) **server 端纹理 staged shadow**——`ApplyTextureUpload` 采纳 `SEG_STAGE` 字节,`SyncMipmapsToBackend` 只读它与描述符,`0xDD` audit 因此覆盖纹理;(2) **`SEG_EVENT` 成为唯一反向通道**——`OnBufferWriteback` 的 `MGPBlobRef` 约定 `Seg = kSegEvent`,`OnGpuWritten` / `OnSurfaceChanged` 走同一 ring,Magma 与 Espryt 共用回调,溢出策略按 §11.7;(3) **sink 与 twin 按记录里的句柄解析**(`GetOrCreate(MGPipeHandle)`),server 永不触 `MGPipeSlots()`;(4) **两条控制记录** `applier_reset`(make-current 边)与 `object_death`(framebuffer 首次有 delete opcode),mailbox 只剩 EGL forwarder 给 P6;(5) **值类 BARRIER-PULLED 行改为每 verb 残余值记录或 server 自答**,对象类行保持 barrier 直到 twin 表落地(P3b/P4b、P7、P8);(6) **角色守卫**——split 构建有传输时,apply 线程触前端对象表面、GL 线程触 server 状态表面都是 `Fatal{RoleViolation}`;这是 P5c 的出口门,也是 P6 只做传输替换的前提。
|
||||
|
||||
落地时的三条结构性补充(契约 §3.1 与 §5.4 的具名豁免):审计漏了三族无句柄站点——绑定记录 P4b 才发射的 ensure/通告族(`MGPipeReverseAnnouncementScope`)、G6 前端键 twin registry(`MGPipeFrontendKeyedRegistryScope`,P3b/P4b 重键)、Magma 拆除期的隐藏资源;两个 scope 内的只读探测是具名、可 grep、带退役阶段的债,不是守卫的洞。
|
||||
|
||||
## 本目录
|
||||
|
||||
| 文件 | 内容 |
|
||||
|---|---|
|
||||
| [`BRIEF-p5c-audit.md`](BRIEF-p5c-audit.md) | Brief: p5c-audit — where the `inproc` split still reads the other role's memory |
|
||||
| [`p5c-audit-v1.md`](p5c-audit-v1.md) | p5c-audit-v1 — where the `inproc` split still reads the other role's memory |
|
||||
@@ -0,0 +1,204 @@
|
||||
# p5c-audit-v1 — where the `inproc` split still reads the other role's memory
|
||||
|
||||
Read-only static audit of `feat/disaggregated` @ `a79a0af69de8c6c53ef985dd23be7eab8cd17641`
|
||||
(`git rev-parse HEAD`, 2026-09-17). No builds, no tests, no git mutation, no adb. Every
|
||||
`file:line` below was re-resolved on this head (the contracts' line numbers are from older
|
||||
heads and drifted; §5 lists the drift found while auditing).
|
||||
|
||||
Direction legend: **S→C read** = server/apply-thread reads client memory · **S→C write** ·
|
||||
**C→S read** · **C→S write** · **shared** = process global both roles touch.
|
||||
|
||||
Frequency shorthand: *draw* = per draw/dispatch, *upload* = per upload/respecify, *verb* =
|
||||
per emitted record, *rare* = per EGL call / make-current / bring-up, *once*.
|
||||
|
||||
Phases: P5c = worth fixing now, inproc, before P6 · P6 = spawn transport must replace it ·
|
||||
P7/P8/P9/P10 = the phase the field tables / ROADMAP already assign.
|
||||
|
||||
---
|
||||
|
||||
## 1. Inventory
|
||||
|
||||
### 1a. Textures and texture sync — the largest un-instrumented family
|
||||
|
||||
| # | dir | what memory | site (function) | owner | when | why it works today | breaks under spawn | guard | natural carrier | phase |
|
||||
|---|---|---|---|---|---|---|---|---|---|---|
|
||||
| 1 | S→C read | client `MipmapStorage` texel bytes | `MG_Backend/DirectGLES/Managers.cpp:7315` (`BackendTextureObject::SyncMipmapsToBackend`), also `:6940`, `:7129`, `:7198` — `textureMipmapObject->MapMipmapData(...)` | client `TextureObjectMipmap` | per level needing upload, per validate/draw | verb barrier parks GL thread; same address space | pointer into other process; staged SEG_STAGE bytes exist but are dropped | **none** — not in `FieldOwnership.def`, invisible to `rsp`/strict | the already-staged `resource_subdata` SEG_STAGE run, adopted into a server-owned level shadow (mirror of buffer `StagedShadowStore`) | **P5c now** — the bytes already cross; `ApplyTextureUpload` just has to keep them. Biggest single finding |
|
||||
| 2 | S→C read | frontend texture-object shape/state (`GetMipmapTexelSize`, `GetTarget`, `GetFormat`, `GetMipmapByteSize`, `GetUploadTargets`) | `Managers.cpp:7314`, `:7332`, `:6878-6880` (same fn); `DirectGLES.cpp:8528-8529`, `:8502-8507` (mip gen) | client `ITextureObject` | per upload / per mip gen | barrier | method calls on a dead pointer | none (only the `MGB_STORAGE_*` macros are descriptor-routed, `Managers.cpp:6643-6661`) | applier `MGPipeResourceRecord::Desc` (already server-side) | P5c — same fix as #1: the descriptor + staged bytes answer all of these |
|
||||
| 3 | S→C read | client dirty-region set | `Managers.cpp:7360`, `:7371` (`GetStorageDirtyRegion`, legacy arm when no `pendingUpload`) | client | per level upload | barrier | dead pointer | none | `PendingUpload::UnionBox`/regions already on the wire (`PipeApply.cpp:824-849`) | P5c — falls out of #1 |
|
||||
| 4 | S→C read | client slot allocator + frontend `GetLifetimeId()` (mip-descriptor registry lookup, **named inproc dependency #2**) | `DirectGLES.cpp:8087` (`EnsureGenerateMipmapStorageAllocated` re-derived arm) → `SlotTables.h:392-400` `HandleOf` → `MGPipeSlots().FindByLifetimeId`; also `Managers.cpp:5627`, `DirectGLES.cpp:8185`, `:8564`, `:8659`, `:6706` | client `MGPipeSlots()` | per `GenerateMipmap` / CopyTex / re-mint | barrier; Find-not-mint so no allocator mutation | client allocator does not exist server-side | none (`MEASUREMENTS.md:378` calls it barrier debt) | `MGPMipPlan::Res` / `MGPCopyFromFramebuffer::Dst` handles already on the records → `GetOrCreate(MGPipeHandle)` (`SlotTables.h:278`) | **P5c now** — handle is already on the record; the lookup is redundant even inproc |
|
||||
| 5 | S→C write | client level shadows re-dirtied so server can re-read texels it never held | `Managers.cpp:5638-5645` (`RequireImageBindableStorage`, `MarkStorageDirty(...,true)`) then `Fatal` at `:5650` | client `MipmapStorage` | per texture re-mint (`texture-remint-pull`) | barrier | dead pointer, then the Fatal anyway | `Fatal{UnmigratedEmulation,"texture-remint-pull"}` (`PipeApply.cpp:2947`) — **reached**: iris-photon/derivative/create-indirect first blocker | server-owned level shadow (#1) removes the need to re-pull | P8 per ROADMAP; unblocked by #1 |
|
||||
| 6 | S→C read | every live frontend FBO's attachment list | `DirectGLES.cpp:8177-8256` (`ScopedDetachedTextureFramebufferAttachments`: `ForEachLive` → `stateFBO->GetAllAttachmentObjects()` `:8207-8243`) | client `FramebufferObject`s | per `GenerateMipmap`/`Blit`/`CopyTexImage2D/SubImage2D` | barrier | walk over another process's objects | none | server-side FBO twin attachment table (P3b/P4b) | P3b/P4b — keyed on the twin tables, not a wire question |
|
||||
| 7 | S→C read | client texture-unit array walk + `GetBoundObject()` | `DirectGLES.cpp:2204-2215` (`SyncNeccessaryTextures`); keys from `CaptureDrawTextureSyncKeys` `:2021-2040` | client `GLContext` units | per draw on memo miss | barrier | dead pointer | `rsp`-counted only for the `MGB_CTX` accessor half (`GetMaxTouchedTextureUnit` etc.) | server-side binding table from `set_sampler_views`/`set_texture_bindings` (P3b/P4b) | P3b/P4b per `FieldOwnership.def` |
|
||||
| 8 | shared | raw pointers into client slot arrays held across calls | `DirectGLES.cpp:1958-1987` (`g_unitTextureSyncList`/`g_fboTextureSyncList`/`g_readFboTextureSyncList`: `const SharedPtr<ITextureObject>* slot`) | client arrays, server-held | persistent, read per draw (`:2119-2128`, `:2183-2193`, `:2270-2279`) | barrier + `PairingsIntact` memo keys | stored cross-process pointers | memo keys only | lifetime-id keyed entries (the handle-arm shape already used by `UnitBindingsSnapshot`) | P3b/P4b (ROADMAP.md:30 names the re-keying) |
|
||||
| 9 | S→C read | client read/draw FBO binding slots during named blit (**named inproc dependency #1**) | client: `MG_Remote/Client/EmitTables.cpp:741-762` (`ScopedBlitBindings`), emit `:764-786`; server: `DirectGLES.cpp:7782-7785` (`BlitFramebuffer` → `GetFramebufferBindingSlot(...).GetBoundObject()`) via sink `PipeApplier.cpp:228-244` | client `GLContext` binding slots | per `BlitNamedFramebuffer` | client rebinds its own shadow, barrier holds it, RAII restores | server reads a binding that was never told to it | `rsp` (`GetFramebufferBindingSlot`, BARRIER_PULLED); strict knob | `MGPBlit.ReadFbo/DrawFbo` handles already on the record → server handle-keyed FBO resolution | **P6 must** (docs say so); P5c can already switch the sink to the handles since they cross today |
|
||||
| 10 | S→C read | client bound texture via binding slot (CopyTex paths) | `DirectGLES.cpp:8561-8563`, `:8656-8658` (`CopyTexImage2D`/`CopyTexSubImage2D` → `GetTextureUnitObject(...).GetBindingSlot(...).GetBoundObject()`) | client unit array | per CopyTex call | barrier | dead pointer | `rsp` (BARRIER_PULLED `GetTextureUnitObject`) | `MGPCopyFromFramebuffer::Dst` handle on the record | P5c — same shape as #9, handle already crosses |
|
||||
| 11 | — | CopyTex-copied texels land only in the ES driver; client shadow left allocated-but-empty | `DirectGLES.cpp:8590`, `:8621`, `:8681`; frontend `GL_Texture.cpp:4542` (`TexImage2D_State(..., nullptr)`) | — | per CopyTex | — | wrong readback data later | bounded by `GetTexImage`/`texture-remint-pull` Fatals (22 of the 27 inproc wrong answers are this class, CURRENT_STAGE_PROGRESS §5) | server→client texture writeback (P9) | P9 |
|
||||
| 12 | — | `copy-image-shadow-mirror` skipped under split; destination client shadow goes stale | `DirectGLES.cpp:9042` (early return) — `:9050` Fatal is unreachable under transport; body `:9053-9099` is monolith-only | — | per CopyImageSubData with CPU shadows | — | — | by design (CONTRACT-P5B §6.8), bounded by two Fatals | client-side mirror (ROADMAP P8) | P8 |
|
||||
| 13 | S→C read | `get-tex-image-shadow` body reads client shadow | `DirectGLES.cpp:10676`, `:10684` | client | **not reached under split** — client refuses first: `EmitTables.cpp:1581-1582`, `:1614-1615` `Fatal{UnmigratedVerb,"GetTexImage"}` | — | — | named refusal | `ResourceReadback`/readback carrier | P9 |
|
||||
| 14 | S→C write | Magma mip-gen writes client texture level storage directly | `DirectVulkan/Renderer/VulkanRenderer.cpp:1562-1590`, called `:11317` | client level shadows | per `glGenerateMipmap` on Magma server | barrier | dead pointer | **none** (DirectGLES twin is the re-derived #4 arm; Magma has no equivalent) | `OnMipLevelsGenerated` (declared, never installed) or server-derived levels from `Desc.Levels` | P5c — Magma half of the GLES fix that already landed |
|
||||
| 15 | S→C read | Magma texture-object lookups via sticky forward / registry | `DirectVulkan/Renderer/VkTextureManager.cpp:810`, `UniformManager.cpp:1190`, `:2014`, `VulkanRenderer.cpp:11527`; `DirectVulkan.cpp:271`, `:274` | client objects | per draw/dispatch on Magma | barrier | dead pointer | `rsp` sticky-forward counting | server-side texture handle table | P7 per `FieldOwnership.def` |
|
||||
| 16 | — | `OnTexturePullRequest` declared, never installed/called; `ResourceSubDataComplete` terminator unimplemented | `MG_Pipe/MGPipeCallbacks.h:34-38`; install sites only cover 2 of 10 callbacks (`ResourceTracker.h:606-613`); thunk `generated/PipeThunks.inc:216` | — | never | — | the pull protocol does not exist | none | itself — it is the designed carrier | P8/P9 (ROADMAP.md:33,63) |
|
||||
| 17 | S→C write | `Fatal{UnmigratedEmulation,"generate-mipmap-cpu-fallback"}` body would filter/re-dirty client level shadows | `DirectGLES.cpp:8734` (Fatal), body `:8736-8789` | client | per RGB16F/RGB32F mip gen — **reached** (open item, CURRENT_STAGE_PROGRESS:59) | — | — | named Fatal | needs `OnTextureWriteback` (P8/P9) | P8/P9 |
|
||||
|
||||
### 1b. Buffers, persistent maps, XFB
|
||||
|
||||
| # | dir | what memory | site (function) | owner | when | why it works today | breaks under spawn | guard | natural carrier | phase |
|
||||
|---|---|---|---|---|---|---|---|---|---|---|
|
||||
| 18 | S→C read | frontend `BufferObject::HasDefinedContent()` | `Managers.cpp:3147-3148` (`EnsureBufferResourceForHandle`) | client `BufferObject` | **every draw** that ensures a buffer | barrier | dead pointer | **none** — declared debt at `:3141-3146` | live-content bit beside `MGPResourceDesc` ("client publishes a live content flag") | **P5c now** — cheapest per-draw kill on the list |
|
||||
| 19 | S→C read | frontend `GetLifetimeId()` per ensure | `Managers.cpp:2705-2716` (`HandleOfBuffer`) → `SlotTables.h:392-397` | client object | per ensure / VAO memo rebuild / SSBO mark | barrier; memoised | dead pointer + client allocator | none | handles on the records | P3b/P4b |
|
||||
| 20 | shared | raw `BufferObject*` held in server per-VAO memo | `Managers.h:1185` (`ResolvedDrawBuffers::Entry::frontend`), written `DirectGLES.cpp:716` | client object, server-held | stored once per VAO config; read on memo hit | client `SharedPtr` pins it | stored cross-process pointer | only reader under split is monolith-gated (`IsBufferDrawCleanByHandle` → `IsMapped()`, `Managers.cpp:2914-2916`) | handle-keyed memo entry | P3b/P4b |
|
||||
| 21 | shared | `SharedPtr<BufferObject>` held by server for a whole XFB span | `DirectGLES.cpp:950` (`XfbCaptureTarget::buffer`), pushed `:1260`, read `:1060`,`:1077`,`:1172`,`:1185` | client object, server-held | per XFB span | GL forbids rebinding mid-span; barrier | strong ref into another process | none | server buffer twin handle | P9 (XFB scatter) |
|
||||
| 22 | S→C write | client buffer shadow written at XFB end | `DirectGLES.cpp:1077` (`ReadbackCapturedRanges` → `WritebackFromBackend`), epoch bump `:1081` | client `BufferObject` | per `EndTransformFeedback` | barrier | dead pointer | none | `OnBufferWriteback`-style event / readback carrier | P9 |
|
||||
| 23 | S→C read+write | client shadow read-modify-write in XFB scatter | `DirectGLES.cpp:1172` (`ScatterCapturedRecords`: `target.buffer->MappedData() + target.start`), `:1185` | client `BufferObject` | per XFB scatter | barrier | dead pointer | **none — no transport guard at all** | `OnXfbScatterReady` (declared `MGPipeCallbacks.h:50`, **never implemented**) | P9 |
|
||||
| 24 | S→C read | XFB six fields (`GetTransformFeedbackProgram` → client `ProgramObject` dereferenced `:1248-1340`; binding points `:1250`; counters `:1135`) | `DirectGLES.cpp:1224-1343` (`StartPendingTransformFeedback`, from `PrepareForDraw` `:4545`) | client | **every draw** | barrier | dead pointers | `rsp` BARRIER_PULLED (6 rows, `FieldOwnership.def:119-130`) | server-side XFB span state | P3b/P4b, P7 per table |
|
||||
| 25 | — | `MGPDrawInfo::XfbCpuCapturedVertices` / `kDrawHasXfbCount` | written 0 at `EmitTables.cpp:402`, `:1873`; **read by nobody** | — | — | — | — | dead field | was meant to carry the accounting (CONTRACT-P5B:163-164) | P9 or delete |
|
||||
| 26 | S→C read | legacy buffer arm reads client freely (`MappedData()`, `IsMapped()`, `GetChangeSerial()`) | `Managers.cpp:1012-1022`, `:1119-1121`, `:1901`, `:2944-2949`, `:3281-3327`, `:5239`, `:5274`, `:1740-1917` | client | reachable in a split build whenever `MOBILEGL_PIPE_PUSH` bit 7 is clear | same process | everything | **none — only an `MGLOG_D` names the arm** (`Managers.cpp:2588-2619`) | n/a — arm should be refused under split like `Fatal{PipeLegacyMemosDisabled}` | P5c — one transport check at the arm resolver |
|
||||
| 27 | — | `hostBytes` rule-C violation — **fixed on this head**: server-owned copy under split | `Managers.cpp:2165` (`Ops_H_SubData`), `:2225` (`Ops_H_FlushRange`), store `StagedShadow.h:66-82` | server | per upload/flush | — | — | `Fatal{StageSnapshotTooNarrow}` six named sites + `0xDD` audit | wire-clean | done |
|
||||
|
||||
### 1c. Reverse channel: callbacks, SEG_EVENT, error/surface/caps writes
|
||||
|
||||
| # | dir | what memory | site (function) | owner | when | why it works today | breaks under spawn | guard | natural carrier | phase |
|
||||
|---|---|---|---|---|---|---|---|---|---|---|
|
||||
| 28 | S→C write | client buffer CPU shadow bytes, via a **raw host pointer** | producer `Managers.cpp:2339-2343` (`Ops_H_Readback`: `MGPBlobRef{(Uint64)mapped, size, kMGHostSpanSegNone, 0}`); consumer `MG_Impl/Pipe/ResourceTracker.h:553-572` (`MGPipeClientOnBufferWriteback` casts `Offset` back to a pointer `:569`) → `BufferObject.cpp:492-511` | client `BufferObject` | per blocking `SyncGpuWrites`/readback | same address space + barrier | dangling foreign pointer; and the consumer **rejects any real segment** (`:560-564`) | none on the pointer | `SEG_EVENT` `kEventBufferWriteback` — consumer half exists (`ClientSession.cpp:188-213`), **no producer anywhere** | **P5c now** — wire the producer; fix the consumer's segment arm in the same commit |
|
||||
| 29 | S→C write | client `m_hasDefinedContent`/`m_gpuWritePending` via direct callback into client tracker | producer `Managers.cpp:2729-2752` (`MarkBufferGpuWritten`); consumer `ResourceTracker.h:579-601` → `BufferObject::MarkGpuWritten` `:514-517`; backend feeders `DirectGLES.cpp:568`, `:616`, `:2601` | client `BufferObject` | per draw binding SSBO/atomic/writable-image | same address space | call into the other process | `MGLOG_E_ONCE` only (`:2729-2739`, `:596`) | `SEG_EVENT` `kEventGpuWritten` — consumer exists (`ClientSession.cpp:227-236`), no producer | **P5c now** — same producer wiring as #28 |
|
||||
| 30 | S→C write | Magma `MarkGpuWritten` writes client objects **directly**, bypassing the callback | `DirectVulkan/Renderer/UniformManager.cpp:1075`, `:1231`; `VulkanRenderer.cpp:11618` | client `BufferObject` | per Magma draw with SSBO/texel-buffer/XFB | same address space | direct foreign write | none (Magma registers no `MGPipeResourceOps`, so it is outside the handle arm) | same `kEventGpuWritten` | P5c — route through the same callback/event as Espryt |
|
||||
| 31 | S→C write | client `GLContext` error queue | `MG_Impl/Pipe/PipeFill.cpp:1764-1772` (`PipeInputs::RecordError` sticky forward → `ctx->RecordError`); producers `DirectGLES.cpp:8155`, `Managers.cpp:13128`, `DirectVulkan.cpp:717`, `VulkanRenderer.cpp:1339`,`:1343`,`:1399` | client `GLContext` | per backend-detected GL error | barrier + sticky-forward accounting | write into the other process | `MGP_STICKY_FORWARD_PULL` → `rsp`; Fatal under `MOBILEGL_IPC_STRICT_ERRORS` | `OnGlError` event (declared, never installed); ordering is P9's | P9 per table |
|
||||
| 32 | S→C write | client compile env / advertised extensions | `PipeFill.cpp:1753-1756` (`InvalidateCompileEnv` forward); producers `DirectVulkan/BackendObject_DirectVulkan.cpp:390`, `:788` (Magma only) | client `GLContext` | per backend caps re-run | barrier; **no-op outside a stamped verb** (`PipeInputs.h:265-278`) — silent outside it | write into the other process | sticky pull counting | R-12 re-arriving caps snapshot — client half already landed (`CapsMirror.cpp:78-80`) | P5c — delete the forward; the snapshot already does the job on the client |
|
||||
| 33 | S→C write | client default-framebuffer attachments (`pDefaultFramebufferInfo` depth/stencil/colour) | `DirectGLES.cpp:11519-11620` (`PublishDefaultFramebufferDepthStencilFormat`, from surface creation `:11885`, `:11902`); Magma twin `DirectVulkan/Renderer/SwapchainObject.cpp:276-335` | client `MG_Impl` placeholder | per surface/swapchain (re)create | barrier; rare | write into the other process | **none** | `SEG_EVENT` `kEventSurfaceChanged` — consumer stub exists (`ClientSession.cpp:242-253`), no producer, no handler installed | P6 — surface events must cross anyway; P5c can add the producer |
|
||||
| 34 | S→C write | server's apply-thread-inside flag lives in **client** TU statics | `PipeApplier.cpp:934` (`ScopedApplierEntry`) → `ClientSession.cpp:884-889` writes `g_applyThreadInsideApplier` (`:113`); read by client `ClientSession.cpp:748` (`Fatal{BarrierViolation}`) | client statics, server-written | per applied record | same process | write into the other process | none (it is the handshake) | session-local flag under spawn; fine to keep inproc | P6 |
|
||||
| 35 | — | SEG_EVENT ring: created, mapped, announced, consumer drained after every reply verb — **zero producers** | segments `ServerSession.cpp:285-301`; consumer `ClientSession.cpp:176-267`, called `:836`; producer API `ServerSession::PublishEvents` `:484-492` has no callers | — | — | — | the ring exists but carries nothing | overflow latch + `eventDropped` counter built, unused | itself | P5c — rows 28/29/33 are its first three producers |
|
||||
|
||||
### 1d. Caps, format tables, program artifacts
|
||||
|
||||
| # | dir | what memory | site (function) | owner | when | why it works today | breaks under spawn | guard | natural carrier | phase |
|
||||
|---|---|---|---|---|---|---|---|---|---|---|
|
||||
| 36 | S→C read | client caps mirror's `FormatCapabilityCache` | `MG_Backend/DirectGLES/Utils.cpp:50` (`ActiveBackendFormatCaps` fallback arm when `ServerLoopInstance().Backend()` is null — bring-up/teardown window); main arm `:46-48` is server-routed | client `BackendObject_Remote` | rare (server backend null) | values are a copy of the server's own caps | read of client mirror | null test only | server's own `Backend()->GetFormatCapabilities()`; refuse when null | P5c — one-line arm tightening; pinned by `ServerLoopTest.cpp:848-868` |
|
||||
| 37 | S→C read | client mirror's `DynamicBackendParameters` copy, **four Magma sites, unrouted** | `DirectVulkan/DirectVulkan.cpp:713-715` (`MaxShaderStorageBufferBindings`); `VulkanRenderer.cpp:667-676` (line-width range, per state change); `VertexInputStateFactory.cpp:249-250`, `:502-503` (`SupportsFloat64VertexAttributes`, per pipeline build) | client `BackendObject_Remote` | per draw/pipeline build on Magma | mirror holds a copy of the snapshot | read of client mirror | **none** — no `#if`, no Fatal, no `ServerLoopInstance()` consult | server's own backend `GetDynamicParameters()` (same values, same process role) | **P5c now** — mechanical re-pointing; Espryt already shows the shape |
|
||||
| 38 | — | `GetCaps` record's two blobrefs — record is dead; the snapshot carries the data instead | decoder declines `PipeWireCodec.cpp:1493-1506`; no client emitter exists; snapshot path `ServerSession.cpp:366-408` → `ClientSession.cpp:275-330` → `CapsMirror.cpp:55-87` (blobrefs cleared `:63-64`) | — | — | — | — | open item (`ROADMAP.md:58`) | the `CapsSnapshot` control frame (already the carrier) | P6 (delete or wire the record) |
|
||||
| 39 | — | CreateShaderState program archive — **wire-clean**: one SEG_STAGE blob, server decodes into apply-locals | emit `MG_Remote/Client/WireTables.cpp:470-502` (`Fatal{ArtefactsMissing}` `:478-485`, `Fatal{ArchiveEmpty}` `:491-495`, six `Spirv[]` refs zeroed `:496-497`); decode `PipeWireCodec.cpp:1676-1714`; applier stores descriptor only (`PipeApply.cpp:2780-2784`) | — | per program link | — | — | both Fatals are client-side pre-emission | SEG_STAGE (in use) | done |
|
||||
|
||||
### 1e. Process globals and cross-role control
|
||||
|
||||
| # | dir | what memory | site (function) | owner | when | why it works today | breaks under spawn | guard | natural carrier | phase |
|
||||
|---|---|---|---|---|---|---|---|---|---|---|
|
||||
| 40 | shared | `gPipeInputs` (~20 KB, 63 fields + 7 sticky forwards): client residual fill writes, applier mirrors write, server BARRIER-PULLED reads (36 rows) | definition `MG_Backend/MGPipe/PipeInputs.h:806`; fill `PipeFill.cpp:2798` (`MGPipeValidateForVerb`); applier writes `PipeApply.cpp:1415-1560`; server stamp `PipeInputs.cpp:103-132`; `rsp` increment `PipeInputs.cpp:72` | co-owned under the barrier | every verb | **only the verb barrier** makes one writer at a time | the whole block | `rsp` + `MOBILEGL_IPC_STRICT_ERRORS` Fatal (`PipeInputs.cpp:61-77`) + poison (`generated/PipeFilled.inc:408-422`) | per-field rows: P3b/P4b (12), P7/P8 (objects), P9 (writes) — `FieldOwnership.def` | per table |
|
||||
| 41 | C→S write | server `g_applier` wholesale reset from the GL thread | `PipeFill.cpp:2654-2656` (`MGPipeValidateForVerb` `FreshlyPrimed` arm → `MGPipeApplierReset()`, body `PipeApply.cpp:1202-1299`) | server | per freshly-primed context / make-current edge | barrier post-condition: nothing in flight at a validate; reset advances serials | GL thread writes server state; no record names it | **none** — no role check, no barrier check | a reset control record / mailbox frame at the make-current edge (R-12 edge already exists) | **P6 must**; P5c can add the control record |
|
||||
| 42 | S→C read+write | client slot allocator `MGPipeSlots()` driven from the server backend: `Acquire` (mint!), `FindByLifetimeId`, `Free` | `MG_Backend/DirectGLES/SlotTables.h:232` (`GetOrCreate`), `:397` (`HandleOf`), `:418`, `:428` (`OnFrontendObjectDestroyed`); call sites `Managers.cpp:2708`, `:4293` | client allocator | per twin creation/death/probe | barrier | server minting into a client allocator | none (`MOBILEGL_ASSERT` at `:233` inert at INFO); self-declared at `SlotTables.h:70-77` | `GetOrCreate(MGPipeHandle)` overload (`SlotTables.h:278`) — the handle already arrives in verb payloads | P3b/P4b, P7 |
|
||||
| 43 | shared | eight Espryt twin registries keyed by frontend object address, holding weak/raw refs | `Managers.h:309-377` (`StateBackendObjectRegistry`), `SlotTables.h:138-161` (`BackendSlotTable`), eight globals `Managers.h:858`,`:1385`,`:1780`,`:1897`,`:2494`,`:2632`,`:2718`,`:2773`; legacy memos `DirectGLES.cpp:95-140` | client-keyed | per object lookup | barrier; weak refs expire cleanly | keys are foreign addresses | arm resolver `Fatal{PipeLegacyMemosDisabled}` only when bit 5 clear AND LEGACY_MEMOS=0 | lifetime-id/handle keying (handle arm already the default) | P3b/P4b |
|
||||
| 44 | shared | `pDefaultFramebufferInfo` — frontend default-FBO placeholder, read and mutated by the server | storage `MG_Impl/GLImpl/Framebuffer/GL_Framebuffer.cpp:3457`; server readers `DirectGLES.cpp:2846`,`:3137`,`:4370`,`:4414`; writer `:11520`; Magma `SwapchainObject.cpp:276` | client `MG_Impl` | per FBO compare / surface event | barrier | dead pointer | none | reserved default-FBO handle `{0,1}` + `IsDefault` bit (D-C1, `DirectGLES.cpp:2838-2849`) | P3b/P4b (D-C1) |
|
||||
| 45 | shared | `g_rawDepthFetchSamplerState` — server constructs, owns and mutates a frontend `SamplerObject` | `DirectGLES.cpp:61-62`, created `:269-274`, used `:277` | server-held frontend-type object | per raw depth fetch | same process | a client-type object server-side | none; self-declared "largest surviving MG_State-type usage under MG_Backend" | sampler CSO record fields the applier already reads | P3b/P4b (comment assigns it) |
|
||||
| 46 | shared | `ScopedDefaultUnpackState::s_synced` + six value shadows, never reset on context death | `Managers.cpp:5806-5812`, writes `:5773`,`:5790-5795`; callers `:6925`,`:7120`,`:7183`,`:7287` | server-private memo | per texture upload | server-private **today** (client runs no GL) | latent: a server re-attaching to a moved context skips an owed `glPixelStorei` | none | reset keyed on the context-generation edge | P6 — register it now (CONTRACT-P5 table 3 already says so) |
|
||||
| 47 | — | `g_syncedRenderStateParameters` — server-private driver-state memo | `DirectGLES.cpp:3185`, writes `:3274-3878`, reads `:6895`,`:7061`,`:7630`,`:7946` | server | per render-state sync | server-exclusive | not context-generation keyed (latent, same class as #46) | none | — | P6 housekeeping |
|
||||
| 48 | — | `gBackendFunctionsTable` — client = emit table, server holds its own table privately | client install `MG_Backend/Init.cpp:63` via `BackendObject_Remote::GetBackendFunctions()` (`BackendObject_Remote.cpp:162`); server `PipeApplier.cpp:58-72` | — | — | — | — | re-emission loop documented `PipeApplier.h:94-98` | wire-clean | done |
|
||||
| 49 | — | `gMGPipeSegmentResolver` — server installs, client never resolves; only production resolve is the user-index span | install `PipeWireCodec.cpp:425-437` (Fatal on double install), `ServerSession.cpp:336`; resolve `PipeApplier.cpp:559`; client writes `Ptr=nullptr` `EmitTables.cpp:503`; honesty gate `PipeWireCodec.cpp:521-536` | — | per user-index draw | — | — | `Fatal{ProtocolCorruption}` four arms | wire-clean | done |
|
||||
| 50 | C→S read | `ServerLoop::m_running`/`m_applyThreadId` read per routed record | `MG_Remote/Client/WireTables.cpp:71` (`RunsAsTheServerRole`), `PersistentMapTracker.cpp:38`, `BufferObject.cpp:385`,`:410`,`:440`, `PipeFill.cpp:757`,`:877` | server singleton | **per verb** (hottest C→S read) | same-process atomics | singleton absent in the client process | none | a client-local role flag set at session start | P6 — trivially local; no carrier needed |
|
||||
| 51 | C→S ctrl | twelve `Server*` EGL forwarders → server's private backend via the one-slot control mailbox; payload is a **raw fn-ptr + `void*` to a caller stack local** | callers `BackendObject_Remote.cpp:125-264`; mailbox `ServerLoop.h:216-226`; mechanism `ServerLoop.cpp:543-598` | server backend | rare (per EGL call) | blocking; same address space | unserializable by construction | `Fatal{ApplyThreadNotRunning}` (`ServerLoop.cpp:568`) | transport control messages (P6 `SocketTransport` control plane) | **P6 must** |
|
||||
| 52 | C→S write | FBO/object death posted as a stack struct host pointer into the mailbox (**named inproc dependency #3**) | `Managers.cpp:206-221` (`OnFrontendStateObjectDestroyed` split arm) → apply-thread `DestroyByLifetimeId` `:223-228` | server twins | per frontend object death (6 kinds) | blocking; same address space | no framebuffer delete opcode exists ("Death notices have no framebuffer wire opcode", `:209`) | none on the carrier | a `framebuffer_destroy`/object-death wire record | **P6 must**; P5c can add the record |
|
||||
| 53 | C→S read | `ServerLoop::Backend()` read on the app thread at bring-up (`kCapBackendOwnsXfbCapture` derivation, `SetBackend`) | `MG_Backend/Init.cpp:164-170` | server backend | once | same process | direct read | `#if MOBILEGL_BUILD_DISAGGREGATED` | the caps snapshot already carries the answer (cap bits) | P6 — read it from the snapshot |
|
||||
| 54 | C→S read | `MGPipeGetResourceOps()` at bootstrap honesty checks | `MG_Backend/Init.cpp:100`,`:145`,`:247` (`AssertConsumerMaskIsHonest`, `Fatal{ConsumerMaskLie}`) | server-registered table | once ×3 | same process | — | honesty check only | consumer bits in `CallMask` (already the wire form) | P6 — keep as a check against the snapshot |
|
||||
| 55 | C→S read | Windows inproc attach **aliases the server's `ShmSegment` objects** (`m_owns=false`); client ring/reply/event views are the server's members | `MG_Remote/Transport/ShmSegment.cpp:352-359`; client reads `ClientSession.cpp:454`,`:459`,`:477`,`:502-506` | server mappings | once | same process | — | none (POSIX does a real dup+Map) | SCM_RIGHTS/fd adopt (P6) | P6 by design; note the Windows lane never exercises the POSIX attach path |
|
||||
| 56 | — | barrier client-half assertion gap: `InBarrierWait()` has **zero call sites**; only `ApplyThreadIsInsideApplier` is enforced (at emit) | declaration `ClientSession.h:128`, definition `ClientSession.cpp:880`; enforced half `:748-753` | — | — | — | client `gPipeInputs` writes outside a barrier are unchecked (CONTRACT-P5 §4 claims the check exists) | — | finish the assertion or delete the claim | P5c — cheap, catches #40-class regressions |
|
||||
|
||||
### 1f. Test-only cross-role access (listed separately, per the brief)
|
||||
|
||||
| # | dir | what | site |
|
||||
|---|---|---|---|
|
||||
| 57 | C→S read | `MGPipeApplier()` (server `g_applier`) records/windows | `MG_IntegrationTest/Harness/PipeApplyPeek.cpp:79`,`:176`; `P4aSeamPeek.cpp:52`,`:63`; `P4aFinalFixPeek.cpp:30` |
|
||||
| 58 | C→S write | `ServerLoopInstance().SetBeforeRetireHookForTesting(...)` | `MG_IntegrationTest/Harness/SplitRuntimePeek.cpp:31` |
|
||||
| 59 | client-local | `pActiveBackendObject` (client mirror), `MGPipeSlots()`, `PersistentMapTracker` | `BackendCapsPeek.cpp:29`, `PipeSlotPeek.cpp`, `PersistentMapPeek.cpp:62`,`:76` — no cross-role read |
|
||||
|
||||
---
|
||||
|
||||
## 2. Summary counts
|
||||
|
||||
By direction (58 inventory rows, #57–59 counted once as test-only):
|
||||
|
||||
| direction | rows | the weight |
|
||||
|---|---:|---|
|
||||
| S→C read | 19 | texture sync (#1–#8, #10, #15, #19), XFB pulls (#24), legacy arm (#26), caps mirrors (#36, #37), slot allocator probes (#42, #43) |
|
||||
| S→C write | 12 | reverse channel (#28–#34), re-dirty (#5), XFB writebacks (#22, #23), Magma mip (#14), surface (#33, #44-adjacent) |
|
||||
| C→S read | 6 | role flags (#50), bring-up (#53, #54), shm alias (#55) |
|
||||
| C→S write | 3 | applier reset (#41), death mailbox (#52), test hook (#58) |
|
||||
| C→S ctrl | 1 | EGL forwarders (#51) |
|
||||
| shared global | 8 | `gPipeInputs` (#40), twin registries (#43), memo pointers (#8, #20, #21), `pDefaultFramebufferInfo` (#44), depth-fetch sampler (#45), unpack shadows (#46) |
|
||||
| wire-clean / dead / latent confirmations | 9 | #11, #12, #13, #16, #25, #27, #38, #39, #47, #48, #49 |
|
||||
|
||||
By natural carrier:
|
||||
|
||||
| carrier | rows |
|
||||
|---|---:|
|
||||
| server-owned level shadow / adopt the already-staged SEG_STAGE run (texture) | #1, #2, #3, #5 |
|
||||
| SEG_EVENT (producer exists in shape; consumer live) | #28, #29, #30, #31, #33 (and #16, #23 designed-for) |
|
||||
| handles already on the record → server-side resolution | #4, #9, #10, #19, #20, #42, #43, #44 |
|
||||
| server's own backend / caps snapshot (no new carrier) | #32, #36, #37, #53, #54 |
|
||||
| new/extended control record (reset, death, EGL control plane) | #41, #51, #52 |
|
||||
| applier descriptor / server-derived — no carrier | #6, #7, #24, #45 |
|
||||
| client-local role fact — no carrier | #50 |
|
||||
| P3b/P4b twin-table re-keying (not a wire question) | #8, #20, #21, #43 |
|
||||
|
||||
Top 10 by frequency (per-draw first):
|
||||
|
||||
| rank | row | site | frequency |
|
||||
|---|---|---|---|
|
||||
| 1 | #40 | `gPipeInputs` BARRIER-PULLED reads (`GetBoundVertexArray` `DirectGLES.cpp:4486`, `GetProgramForDraw` `:4497` unconditional per draw) | per draw |
|
||||
| 2 | #24 | XFB six pulls in `StartPendingTransformFeedback` (`DirectGLES.cpp:1224-1343`) | per draw |
|
||||
| 3 | #18 | `HasDefinedContent()` (`Managers.cpp:3148`) | per draw that ensures a buffer |
|
||||
| 4 | #29 | `OnGpuWritten` direct callback (`Managers.cpp:2752`) | per draw with SSBO/atomic/writable image |
|
||||
| 5 | #50 | `RunsAsTheServerRole()` (`WireTables.cpp:71`) | per routed record |
|
||||
| 6 | #1 | client `MipmapStorage` texel reads (`Managers.cpp:7315` etc.) | per uploaded level, per validate |
|
||||
| 7 | #7/#8 | texture-unit sync walk + sync-list replay (`DirectGLES.cpp:2204-2215`, `:2119-2279`) | per draw on memo miss / per draw |
|
||||
| 8 | #19 | `HandleOfBuffer` → `GetLifetimeId()` (`Managers.cpp:2705-2716`) | per ensure / memo rebuild |
|
||||
| 9 | #37 | Magma `SupportsFloat64VertexAttributes` (`VertexInputStateFactory.cpp:249`,`:502`) | per pipeline build |
|
||||
| 10 | #6 | FBO attachment walk (`DirectGLES.cpp:8177-8256`) | per blit/mip/copy |
|
||||
|
||||
---
|
||||
|
||||
## 3. Already wire-clean (verified on this head)
|
||||
|
||||
- **Buffers, whole family**: all ten `Ops_H_*` handlers take handle + record + SEG_STAGE bytes only; `StagedShadowStore::Adopt` copies on apply (`Managers.cpp:2165`, `:2225`); `Fatal{StageSnapshotTooNarrow}` six named sites (`StagedShadow.h:106`); `hostBytes` is server-owned under split (rule C's one named violation is fixed). `resource_subdata` declares a real size, cross-checked (`PipeApply.cpp:715`). `resource_flush_range` carries no bytes, transport-gated (`PipeApply.cpp:1885-1888`). `buffer_subdata_resident` copies, never retains (`Managers.cpp:2199-2207`).
|
||||
- **resource_respecify**: `initialBytes == nullptr` under split; `Fatal{UncarriedInitialBytes}` (`WireTables.cpp:367-374`) / `Fatal{InitialBytesNotCarried}` (`PipeFill.cpp:768-775`) guard both directions.
|
||||
- **Persistent maps**: tier-2 emulated push goes block-wise through SEG_STAGE (`PersistentMapTracker.cpp:76-127` → `BufferObject.cpp:404-434` → `WireTables.cpp:314-330`); `Fatal{RoleViolation}` bars the apply thread from the producer; tiers 0/1 are named Fatals; `liveHostBase()` cannot fall back to `MappedData()` under a transport (`Managers.cpp:2986-2988`, ID-50/52).
|
||||
- **CreateShaderState**: archive crosses as one SEG_STAGE blob; server decodes into apply-locals; six `Spirv[]` refs zeroed and Fatal if declared (#39).
|
||||
- **Caps**: `FormatCapabilities` + `RendererInfo` cross as serialized blobs in the `CapsSnapshot` control frame (`ServerSession.cpp:366-408` → `CapsMirror.cpp:55-87`); DirectGLES format-cap lookups are routed to the server's backend (`Utils.cpp:40-51` main arm, `BackendObject_DirectGLES.cpp:866-874`).
|
||||
- **ReadPixels**: tight wire form, neutral pack server-side, scatter client-side; oversized reads refused at the client before emission (`ReplySlot.h:191-207`); PACK-PBO destination named-refused (ID-57).
|
||||
- **DrawVbo user indices**: staged into SEG_STAGE, `Ptr=nullptr`, four honesty arms, sink resolves via `MGPipeHostBytes` (`PipeApplier.cpp:559`, `PipeWireCodec.cpp:521-536`).
|
||||
- **Fence/sync family**: client mints `{slot,gen}`, only the handle crosses; native fences live on the apply thread (wave-3, CONTRACT-P5B §9).
|
||||
- **Persistent-map / XFB counters**: `MGPDrawInfo::XfbCpuCapturedVertices` has no reader, so its deadness leaks nothing.
|
||||
- **Roles**: `gMGPipeSegmentResolver` server-only with double-install Fatal; `gBackendFunctionsTable` split correctly; the three `MGPipeGetResourceOps()` liveness reads in `PipeFill.cpp:642/655/1069` short-circuit to `CapsMirror::ServerConsumes` under a transport; no `MG_Remote/Server` or `MG_Pipe` TU reads any `MG_Impl/Pipe` singleton except the `SlotTables.h` backend arm (#42).
|
||||
|
||||
---
|
||||
|
||||
## 4. Surprises / disagreements with the contracts and ARCHITECTURE.md §17
|
||||
|
||||
1. **The texture texel path is the real rule-C violation, and no table names it.** CONTRACT-P5 §0 calls `hostBytes` "the tree's exactly one violation" — fixed on this head. But texture uploads stage the level into SEG_STAGE and `ApplyTextureUpload` then **drops the pointer** ("DISPATCHES TO NOBODY", `PipeApply.cpp:989-1008`); Espryt re-reads the texels from the client `MipmapStorage` (`Managers.cpp:7315`). Every texture-object method the server calls on a client object has **no row in `FieldOwnership.def`**, so the whole family is invisible to `rsp` and to `MOBILEGL_IPC_STRICT_ERRORS`, and `MOBILEGL_IPC_AUDIT=1`'s `0xDD` fill cannot observe it (textures never adopt staged bytes). `rsp` is a lower bound by a wide margin — exactly as `r2-v1.md:79` warned, but the unnamed set is larger than "sticky/non-verb forwards": it is the texture hot path.
|
||||
2. **SEG_EVENT is fully plumbed and silent.** Segments created, mapped, announced in Welcome, consumer drained after every reply verb (`ClientSession.cpp:836`) — and zero producers repo-wide. Worse: the one live writeback producer bypasses the ring with a raw host pointer (`Managers.cpp:2339-2343`), and the installed consumer would **reject** the ring's own blobref convention (`ResourceTracker.h:560-564` rejects any real `Seg`). A producer added tomorrow would be dropped, not delivered.
|
||||
3. **8 of 10 `MGPipeCallbacks` are never installed** — only `OnBufferWriteback`/`OnGpuWritten` have assignment sites (`ResourceTracker.h:606-613`), and both are invoked **in-line on the apply thread** straight into client `MG_State`. `OnGlError`, `OnSurfaceChanged`, `OnCapsInvalidated`, `OnMipLevelsGenerated`, `OnXfbScatterReady`, `OnTexturePullRequest`, `OnTextureWriteback`, `OnLog` are declaration-only.
|
||||
4. **`MGPDrawInfo::XfbCpuCapturedVertices` / `kDrawHasXfbCount` ride nothing.** CONTRACT-P5B:163-164 says the field "rides when the client's XFB accounting has a value"; on this head it is written 0 (`EmitTables.cpp:402`, `:1873`) and read by nobody.
|
||||
5. **The barrier's client-half assertion is half-implemented.** CONTRACT-P5 §4 says "the client checks [`InBarrierWait`] when it touches `gPipeInputs` outside a barrier" — the function has zero call sites (`ClientSession.cpp:880`). Only `ApplyThreadIsInsideApplier` is enforced, and only at emit (`ClientSession.cpp:748`). The two client writes that run outside the barrier (`PipeFill.cpp:2798` into `gPipeInputs`, `:2656` into `g_applier`) are covered by the barrier's post-condition, not by the advertised check.
|
||||
6. **`GetCaps`'s two blobrefs are answered by the snapshot, not the record.** The `GetCaps` wire record is dead (decoder declines, no emitter); ARCHITECTURE §17's "GetCaps 两个 blobref 的载体" open item is in practice the `CapsSnapshot` frame, which is wire-clean. The open item is record hygiene, not a missing carrier.
|
||||
7. **Magma was left out of three fixes Espryt got.** `pActiveBackendObject` routing (#37 vs `Utils.cpp`), mip-level re-derivation (#14 vs `DirectGLES.cpp:8080-8111`), and the `MarkGpuWritten` callback (#30) all have a DirectGLES arm and an untouched DirectVulkan twin. CURRENT_STAGE_PROGRESS §5's "Magma split compute/image: 82 of 89 wrong answers" is consistent with this.
|
||||
8. **Windows inproc does not exercise the POSIX attach path.** `AttachInProcess` aliases the server's `ShmSegment` objects on `_WIN32` (`ShmSegment.cpp:352-359`); the dup+`Adopt`+`Map` arm that P6 generalises is POSIX-only. Windows-lane green says nothing about segment lifetime discipline.
|
||||
9. **Stale doc/code citations found while auditing** (all content still true, only the numbers drifted): `StagedShadow.h:11-14` and `PipeApplier.h:33-37` repeat CONTRACT-P5's `Managers.cpp:1980-1983/:2035/:2000/...` (now `:2165`,`:2225`,`:2183`,`:2271`,`:2279`,`:2315`,`:3179`,`:5393-5396`); `PipeWireCodec.cpp:1872` cites `PipeApply.cpp:702` for the subdata length check (now `:715`); CONTRACT-P5 table 3: `PipeInputs.h:706`→`:806`, `PipeApply.cpp:396/402`→`:409/:415`, `Managers.cpp:5490-5496`→`:5806-5812`, `Init.cpp:44`→`:63`, `Managers.cpp:2594`→`:2769`; `EmitTables.cpp:21-22` header comment says B=11/C=58 while its own `static_assert`s pin B=54/C=15 (`:1643-1667`).
|
||||
10. **`EmitBlitNamedFramebuffer` already carries the two FBO handles** (`EmitTables.cpp:776-777`) — the "scoped client binding" inproc dependency #1 is therefore removable inproc (P5c), not only at P6: the sink can resolve `ReadFbo`/`DrawFbo` server-side today. Same for the mip registry lookup (#4, `MGPMipPlan::Res` already crosses).
|
||||
|
||||
---
|
||||
|
||||
## 5. Existing numbers (no runs performed; cited from notes)
|
||||
|
||||
- `rsp=35` for Triangle and PersistentCoherentMap entries (pinned table, `~/w7/notes/p5/p5-results/joint-v1.md:271`, log lines `:1482-1493`; reproduced `x2-v1.md:137`). **`rsp=2690` for OpenRA over a 5-frame window** (`x2-v1.md:138`).
|
||||
- `rsp=35` is repeatedly stated to be a **lower bound**, not a census: `~/w7/notes/p5b/p5b-results/r2-v1.md:64`, `:79`; `p5-close-codex-review.md:220`; `docs-codex-v1.md:11`. This audit confirms the bound is low by at least the whole texture family (§4.1).
|
||||
- **`rsp` per Minecraft frame is unmeasured** — stated at `~/w7/notes/p5b/p5b-results/c0b-v1.md:263`; no P5b-close `rsp` sum exists in the notes. The only numeric `rsp=` in the whole p5b notes tree is the forwarded 35.
|
||||
- P5b final census lane logs (`~/w7/p5b-final-census-348d22a4/lane-stage32/`, 17 logs, 51 stats lines): `rsp` histogram — `0`×29, `260`×4, `271`×3, `80`/`133`×2, `50/110/131/138/139/143/150/167/171/185/2472`×1 (e.g. `…StorageBufferRegrowScenario…log:580` `rsp=2472`; `…TextureUploadShape…log:580` `rsp=150` with `maxrec=1360`).
|
||||
- `maxrec=784` (`SetVertexAttribDefaults`) dominates 979 of 1206 lane logs; cap 4 MiB of an 8 MiB SEG_CMD (`x2-v1.md:118-125` table; SmallRing ledger `x2m-v1.md:55`). Largest observed `maxrec=4632`.
|
||||
- Class-C first-blocker census (`~/w7/notes/p6/census-classC.md`): `BindImageTexture` 138, `BeginTransformFeedback` 95, `DrawElements` 56, `DispatchCompute` 49, `PatchParameteri` 43, `CopyImageSubData` 30, `MemoryBarrier` 18, `MultiDrawElementsBaseVertex` 18, `ClearBufferiv` 12, `ClearBufferuiv` 8 — all now migrated; 505 `UnmigratedVerb` + 6 `StageSnapshotTooNarrow` aborts in the baseline.
|
||||
- Device A/B lanes (`p5-results/ab-v1.md`, 193 `rsp=` lines): all `rsp=0`/`rsp=None` — the stats line is not published on Android device runs, so no device-side `rsp` exists.
|
||||
|
||||
## 6. What this sizes for P5c (suggested, one line each)
|
||||
|
||||
1. **Adopt staged texture bytes server-side** (#1–#3): the bytes already cross; add the texture half of `StagedShadowStore` and route `SyncMipmapsToBackend` to it. Retires the largest un-instrumented family and makes `MOBILEGL_IPC_AUDIT` meaningful for textures.
|
||||
2. **Wire three SEG_EVENT producers** (#28, #29, #33) and fix the writeback consumer's segment arm: the ring, consumer and counters already exist.
|
||||
3. **Resolve records by their carried handles** (#4, #9, #10): named blit, mip descriptor, CopyTex — all three already carry the handle the lookup re-derives.
|
||||
4. **Re-point Magma's four mirror reads + Espryt's fallback** (#36, #37) at the server's own backend.
|
||||
5. **Kill the unguarded per-draw read** (#18) with a descriptor live-content bit.
|
||||
6. **Transport-refuse the legacy buffer arm** (#26); implement or delete `InBarrierWait` (#56).
|
||||
7. Leave #41/#51/#52/#55 to P6 (they are its stated job), but #41 and #52 can get their control records in P5c since the mailbox already serialises the call shape.
|
||||
Reference in New Issue
Block a user