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,222 @@
|
||||
# CONTRACT-P6 (DRAFT) — the backend runs in a second process
|
||||
|
||||
> **P5f prerequisites completed** (2026-09-20): field ownership has zero
|
||||
> `BARRIER_PULLED` rows; the dual-block and strict gates, context/lifetime work,
|
||||
> registry and reverse-channel guards, closing review fixes, and final Redmi
|
||||
> paired runs have passed. See [`P5F-WIRE-COMPLETENESS.md`](../p5f/P5F-WIRE-COMPLETENESS.md),
|
||||
> the [closing review](../p5f/close-review.md) and [device report](../p5f/device-report.md).
|
||||
>
|
||||
> **P6 has not started:** `a6`, `c6`, and spawn implementation remain unstarted.
|
||||
> This remains a draft written before its own audit. Package `a6` ([`P6-SPAWN-PLAN.md`](P6-SPAWN-PLAN.md) §5)
|
||||
> is a read-only audit whose output is this file's input. Rows that depend on it are marked
|
||||
> **`PENDING a6`**. `c6` moves this file to `MobileGL/MG_Remote/CONTRACT-P6.md`, where it becomes
|
||||
> normative.
|
||||
|
||||
Authority once landed: this file, beside `CONTRACT-P5.md` (table 0, byte carriers, R-1…R-17),
|
||||
`CONTRACT-P5B.md` (class-C slots), `CONTRACT-P5C.md` (rule E, SEG_EVENT, the guards) and
|
||||
`CONTRACT-P5E.md` (rule F, the barriered predicate, the wait rule). Disagreements: this file is
|
||||
newer and wins; §9 lists them. Historical planning base `feat/disaggregated @ f23fbc1b`; every `file:line` re-resolves
|
||||
at `c6`'s head. Paths under `MobileGL/` unless they start with `docs/`.
|
||||
|
||||
Changes go through the integrator, in `c6`'s copy. Packages compile against these rows from day one.
|
||||
|
||||
---
|
||||
|
||||
## §0 Rule G
|
||||
|
||||
Rules A–F bind unchanged. P6 adds:
|
||||
|
||||
**Rule G — a role may not name a process-local handle.** Rule E forbade naming the other role's
|
||||
*memory*; rule G extends it to *identity*. A value whose meaning comes from the owning process's
|
||||
kernel or loader state — `EGLDisplay`, `EGLSurface`, `EGLContext`, `ANativeWindow*`, any `void*`
|
||||
window handle, an fd number, a pid, a mapped address — either crosses as a **token** defined below,
|
||||
or does not cross. Descriptors cross only by `SCM_RIGHTS` (`Transport/FdPassing.h`), where the
|
||||
kernel renumbers them.
|
||||
|
||||
Rule G's teeth are §8's arm-proof gate: a spawn lane that silently ran monolith satisfies every
|
||||
other gate here.
|
||||
|
||||
## §1 Table 0 additions
|
||||
|
||||
| row | encoding | invalid | consumer |
|
||||
|---|---|---|---|
|
||||
| `DisplayToken` / `SurfaceToken` / `ContextToken` | `Uint64`, minted by the client, dense from 1, never reused in a session. Server keeps token → native handle; it never sees the client's EGL values. `protocol.fbs:186-196`'s `display` / `surface` are already `ulong` and are these. | `0` on any op but `ReleaseCurrent` → `Fatal{ProtocolCorruption}` | the server's surface map |
|
||||
| `SurfaceOpKind` additions | **LANDED by P5f `fc`** (append-only, `protocol.fbs:166-179`): `SetSwapInterval=8`, `ReleaseResources=9`, `SetWindowHandle=10`, plus `WindowKind::MetalLayer=6` and `SurfaceOp.readSurface/context` (f0-egl's schema gap list, confirmed to the letter). | unknown tag → `Fatal{ProtocolCorruption}`, never ignored | `ServerMain`'s control pump |
|
||||
| `WindowKind::AndroidNativeWindow` at the server | Refusal: `Fatal{UnmigratedSurface, "AndroidNativeWindow@P12"}`. | — | §4.3 |
|
||||
| `FatalCode::ServerCrashed` / `DeviceLost` | Already allocated (`protocol.fbs:234-242`); P6 is the first phase that can produce either. | — | §5 |
|
||||
| ABI fingerprint | Unchanged. `CapsCodec.h:23-29`: spawn is same-machine, same-binary, so the existing `sizeof(DynamicBackendParameters)` / `sizeof(MGPCaps)` / build-fingerprint handshake is inherited. Fixed-width rewrite stays P7's. | mismatch → `Fatal{AbiMismatch}` | `SessionHandshakeTest.cpp:115` |
|
||||
|
||||
## §2 The transport (`so`)
|
||||
|
||||
1. `SocketTransport` implements `ITransport` and adds nothing to it. The two doorbell accessors
|
||||
stay on the session (`Transport/SessionRings.h:279-285`, `Server/ServerSession.cpp:670-690`).
|
||||
2. `ReceiveFrame`'s `BUFFER_TOO_SMALL` keeps the message queued. `ITransport.h` records that the
|
||||
earlier branch dropped it, wedging the stream at the first oversized message.
|
||||
3. **`SocketTransport` must be green before a second process exists**: one `socketpair()`, two
|
||||
threads, the whole `InProcessTransportTest` suite. Same discipline as `Transport/SessionRings.h:22-28`.
|
||||
4. The server creates the four segments (`SessionRings.h:120-130`); the client adopts them by
|
||||
`SCM_RIGHTS`. `ShmSegment::Adopt` (`Transport/ShmSegment.h:57`, `ShmSegmentPosix.cpp:120`) and
|
||||
the aux socket (`Transport/FdPassing.cpp:92`) exist and are tested (`MG_Test/Wire/FdPassingTest.cpp:114`,
|
||||
`:187`). `AttachInProcess` (`SessionRings.h:147-159`) is replaced by an adopt on the received fds.
|
||||
5. Doorbells are `SocketDoorbell`. `Doorbell.h:385-420` chose a socket byte over a futex so peer
|
||||
death arrives as `POLLIN|POLLHUP` with `recv()==0` rather than as a hang. One syscall per wake
|
||||
is the price; §8.8 measures it.
|
||||
6. Windows: `Adopt` is POSIX-only. `UnixSocket` and `NamedPipe` stay named refusals
|
||||
(`ConfigLoader.cpp:310-348`). P6 lands POSIX only.
|
||||
|
||||
## §3 The process (`sm`)
|
||||
|
||||
1. **The child must not be able to become a client.** Both required: (a) `MOBILEGL_TRANSPORT` and
|
||||
every role-selecting `MOBILEGL_IPC_*` removed from the child's envp; (b) the child's config
|
||||
cannot recursively select a client transport. The original plan expressed (b) as forcing
|
||||
`Monolith`. **`PENDING a6`**: separate that anti-recursion decision from backend server-role
|
||||
selection. P5f's record consumers currently select their server arm with an active transport;
|
||||
blindly forcing `Monolith` would select frontend glue. Preserve both anti-recursion controls
|
||||
while retaining the server-owned record path; `c6` must settle the concrete selector.
|
||||
2. Image lookup: `MOBILEGL_IPC_SERVER_PATH` (already parsed, `Config.h` `IpcTable::ServerPath`),
|
||||
then `dladdr` to find `libMobileGLServer.so` beside the loaded library. **An unresolvable path
|
||||
is a named refusal, never a monolith fallback** — `ConfigLoader.cpp:315-317` names that accident.
|
||||
3. `ServerMain`. Today's `MobileGLServer` (`CMakeLists.txt:923`) is the P0 spike stub
|
||||
(`tools/spikes/server_stub/main.cpp`). **`PENDING a6`**: whether the server image can link
|
||||
without `MG_Impl` (`MG_Backend/MGPipe/PipeInputs.h` claims it). If not, this file says so and the
|
||||
debt is recorded against P13 rather than left as a comment.
|
||||
4. Handshake: `Hello` → `Welcome` → segment descriptors → first `CapsSnapshot`
|
||||
(`protocol.fbs:59-153`). Bounded retry; an exhausted budget is a named refusal.
|
||||
5. Child exits on EOF; parent reaps. §8.4 makes this mechanical.
|
||||
|
||||
## §4 The control plane (`cp`)
|
||||
|
||||
1. **The framing itself LANDED in P5f, package `fc`** (`docs/Disaggregated/notes/p5f/fc-report.md`).
|
||||
The twelve `Server*` forwarders no longer post a function pointer plus a stack-local `void*` to a
|
||||
one-slot mailbox (that was P5c audit row G4, recorded as P6's by `CONTRACT-P5C.md:537`): each
|
||||
packs a value-only `Server::SurfaceControlFrame`
|
||||
(`MG_Remote/Server/SurfaceControlFrame.h`) and the one blocking slot carries it by value. P6's
|
||||
remainder is TRANSPORT ONLY: the client encodes the frame with
|
||||
`MG_Remote::EncodeSurfaceOpFrame` (`MG_Remote/Protocol/SurfaceOpCodec.h`) onto the control
|
||||
socket, the server's pump decodes and enters through
|
||||
`MG_Remote::ServerApplyWireSurfaceOp`, and the reply crosses as `SurfaceReply`.
|
||||
2. Reconciliation against the enumerators (f0-egl §4.2, landed): `ServerSwapEGLBuffers` stays a
|
||||
record with its own present credit (P5e ruling, `Client/BackendObject_Remote.cpp`);
|
||||
`ServerInitCapabilities` is answered by `CapsSnapshot`; `ServerInitWindowSurface` is a
|
||||
client-side no-op. The three ride the inproc frame channel as inproc-only kinds that the codec
|
||||
refuses to encode (`SurfaceWireError::InprocOnlyOpOnTheWire`). The remaining nine map onto the
|
||||
seven plus §1's additions - ten wire ops with `ReleaseCurrent`.
|
||||
3. **Real windows are refused, by name.** `WindowHandle::Handle` (`MG_Backend/BackendObject.h:561-566`)
|
||||
is an `ANativeWindow*` on Android. fc landed the refusal at the wire entry: a decoded
|
||||
`WindowKind::AndroidNativeWindow` dies `Fatal{UnmigratedSurface, "AndroidNativeWindow@P12"}`
|
||||
(`SurfaceOpCodec.cpp` `ServerApplyWireSurfaceOp`). P6 lands pbuffer / surfaceless / offscreen —
|
||||
what `HeadlessGL`, the split-equivalent lane and trace replay need, and what P6's exit gate
|
||||
measures. **Real window arrival is P12.**
|
||||
4. `ForgetCurrentTuple`'s N-3 rule holds identically on the frame path: the forgetting calls moved
|
||||
INTO the dispatch (`ServerLoop.cpp` `ApplySurfaceControlFrame`), and ServerLoopTest's C7/N-3
|
||||
controls drive them through framed posts unchanged.
|
||||
|
||||
## §5 Death, and what P5e changed
|
||||
|
||||
1. The latch is already designed and is implemented unchanged: `docs/Disaggregated/ARCHITECTURE.md:504`
|
||||
— server dies → client reads EOF/EPIPE → device-lost latch (GL calls no-op, `eglSwapBuffers`
|
||||
returns `EGL_FALSE` + `EGL_CONTEXT_LOST`, `glGetGraphicsResetStatus` returns
|
||||
`GL_UNKNOWN_CONTEXT_RESET`); `MOBILEGL_IPC_RESPAWN=1` restarts and re-pushes (default off).
|
||||
Client dies → server reads EOF and exits; `MOBILEGL_IPC_IDLE_EXIT_S` (default 30) is a last resort.
|
||||
2. What P5e added, and no existing document covers. Under lockstep a dead apply thread took the
|
||||
process with it, so "the client kept drawing" was unreachable. Under run-ahead the client is
|
||||
several records ahead by construction. Therefore:
|
||||
- A published, never-applied record is **discarded at the latch, not waited on**.
|
||||
- **Slow and dead are distinguished without a timeout threshold.** A server one frame behind is
|
||||
P5e's intended steady state; a server that is gone is `Fatal{ServerCrashed}`. `SocketDoorbell`
|
||||
already latches `m_dead` on EOF (`Doorbell.cpp`'s `Drain`) — take the fact from there.
|
||||
- **A frozen peer produces no hangup.** Android's cached-app freezer suspends the child without
|
||||
closing anything. P6 gives a named, bounded diagnostic; full handling is P12's.
|
||||
3. This is P6's only new design; everything else is carriage. It shares a predicate with E1's
|
||||
outstanding re-specification (ID-122) — design the two together, and settle neither by choosing a
|
||||
threshold.
|
||||
|
||||
## §6 Process-lifetime statics (`st`)
|
||||
|
||||
**Implemented by P5f `fs`; P6 inherits and verifies it.** The statics recorded as P6 debt in
|
||||
`CONTRACT-P5C.md:538-539` no longer carry unqualified synced state between contexts. The
|
||||
[fs report](../p5f/fs-report.md) records the full census, lifecycle rules and red-once evidence.
|
||||
|
||||
- `ContextEpoch` combines native ES context generation, served-context serial and backend
|
||||
execution arm (monolith / transport server). `ScopedDefaultUnpackState` republishes defaults
|
||||
when that key changes; render-state invalidates its shadow before the version fast path.
|
||||
Identical parameter bytes or versions cannot make a new epoch inherit an old sync result.
|
||||
The transport raw-depth sampler owns a native sampler and rebuilds it on native generation change.
|
||||
- XFB state is role-local; the server map is keyed by the record's non-reused
|
||||
`BoundStreamOutputLifetimeId`, including virtual name 0, with capture-local scatter scratch.
|
||||
**A served-context serial change / `applier_reset` is not object destruction.** Current binding
|
||||
state is reset, but still-live paused/pending spans survive and `set_context_values` selects
|
||||
their lifetime identity again; returning to a context does not emit another Begin. Native
|
||||
context generation change discards the old native ids/spans, and context destruction clears them.
|
||||
- Server liveness follows successful make-current and the control lifecycle. Release-current,
|
||||
release-resources, context/backend destruction and loop stop clear it. Surface creation alone
|
||||
is not a current context, and a verb stamp cannot revive a released server context.
|
||||
|
||||
`a6` checks these established ownership/lifetime rules against the new process/session boundary;
|
||||
`st` verifies their socket/spawn lifecycle wiring and G5 controls. It does not introduce a new
|
||||
“clear every object at every reset” policy or reopen the P5f implementation work. Additional
|
||||
process/session lifetime findings, if any, remain **`PENDING a6`**; P6 still does not add multi-context
|
||||
support (§9.2).
|
||||
|
||||
## §7 Unchanged by P6
|
||||
|
||||
Rings, codec, record layout, applier, both verb sinks, both backends, the barriered predicate and
|
||||
the wait rule (`CONTRACT-P5E.md` §2). P6's lane runs the same reduced path as `integration-split`
|
||||
and must produce the same name set and the same numbers, not more (§8.2). The 511 `UnmigratedVerb`
|
||||
class-C entries are not P6's.
|
||||
|
||||
## §8 The gate
|
||||
|
||||
Beyond the five-part gate (`docs/Disaggregated/ARCHITECTURE.md` §13.2):
|
||||
|
||||
1. G1 — pull build 0/0/0/0, `.text` unchanged.
|
||||
2. G2/G14 — `integration-spawn`'s name set identical to `integration-split`'s.
|
||||
3. `integration-spawn` green at the same count as `integration-split` (179/179 on the historical
|
||||
draft baseline; `c6` refreshes the actual discovery and result sets).
|
||||
4. Process tree, mechanical — child count before and after every entry: exactly one while
|
||||
running, zero after. `HeadlessGL`'s fork pre-check leaves no orphan.
|
||||
5. **Arm proof (ID-124)** — every spawn entry records the child pid and `transport=spawn` in its own
|
||||
private log. A spawn lane that fell back to monolith passes items 1-4.
|
||||
6. Red-once per package (R-16), one named pair each.
|
||||
7. Device — Redmi `2f7cbe2e`, reboot-clean, paired A/B in one thermal window; OpenRA on Adreno 830
|
||||
at split SSIM ≥ 0.99.
|
||||
8. Performance recorded, not gated, but one number is mandatory: **the socket doorbell's cost against
|
||||
`inproc`'s condvar.** P5d took the client thread 15.0 → 9.2 ms/frame and part of that was the
|
||||
doorbell path. P6's only expected regression.
|
||||
|
||||
Negative controls, each run red once:
|
||||
|
||||
| # | knob | what it must falsify |
|
||||
|---|---|---|
|
||||
| S1 | `MOBILEGL_IPC_SERVER_PATH=/nonexistent` | named refusal, not a silent monolith fallback (§3.2) |
|
||||
| S2 | `kill -9` the server mid-frame | §5.1's latch; the client never hangs and never keeps submitting |
|
||||
| S3 | child envp not scrubbed | §3.1's second safety catches it, by name |
|
||||
| S4 | inherited P5f epoch invalidation disabled in spawn lifecycle wiring | a replaced context inherits stale synced state; returning to a still-live XFB lifetime must retain its paused span (§6) |
|
||||
| S5 | `WindowKind::AndroidNativeWindow` reaches the server | named `Fatal`, not a black screen (§4.3) |
|
||||
|
||||
S2's shape is settled before it is written. E1 demanded a `Fatal` that occurs zero times in the
|
||||
entire run (ID-122); S2 must falsify *"the client can tell slow from dead"*.
|
||||
|
||||
## §9 Amendments to the earlier contracts
|
||||
|
||||
1. `CONTRACT-P5C.md:537-539` — EGL value framing was discharged by P5f `fc`, and the unpack /
|
||||
render-state epoch work by P5f `fs`. P6 carries the existing frames over the socket (§4) and
|
||||
verifies the inherited lifecycle rules in the second process (§6).
|
||||
2. `CONTRACT-P5C.md:56` says P6's multi-context shape reads `MGPApplierReset::ContextSerial` for
|
||||
real. **Declined**: P6 stays single-context, multi-context moves to P12 where the Service
|
||||
lifecycle makes it concrete, and the assertion stands unchanged.
|
||||
3. `Transport/ReplySlot.h` marks the 2 MiB reply cap and chunked readback "P6 debt". **Declined**:
|
||||
they are P9's. Taking them here would make "a transport swap and nothing else" false a second time.
|
||||
4. `CapsCodec.h:23-29` — inherited unchanged; recorded in §1 so it is not re-litigated.
|
||||
|
||||
## §10 Not P6
|
||||
|
||||
Real window arrival and the `android:process=":mgl"` Service (P12); multi-context (P12, §9.2);
|
||||
chunked readback and the reply-slot pool (P9, §9.3); `DynamicBackendParameters` fixed-width rewrite
|
||||
(P7); `MOBILEGL_IPC_POLL_ESCALATE` (P10); remaining monolith-only frontend-object / twin-registry
|
||||
glue cleanup (P3b/P4b) and named P7 functionality debts; Windows `pipe:` / `unix:` (§2.6); the 511
|
||||
class-C entries (§7). P5f already eliminated `BARRIER_PULLED` ownership and transport frontend-keyed
|
||||
registry access; those are completed prerequisites, not debts to carry forward.
|
||||
|
||||
E1's re-specification (ID-122) is **not** discharged by P6 and does not become P6's because P6
|
||||
starts. It appears here only because §5.3 argues it shares a predicate.
|
||||
@@ -0,0 +1,406 @@
|
||||
# P6 重审:面向 gfxstream 形状的终局
|
||||
|
||||
> 审查头 `b3b9c2ee`(`feat/disaggregated`,与 `origin` 同步)。本文是对 [`P6-SPAWN-PLAN.md`](P6-SPAWN-PLAN.md)
|
||||
> 与 [`P6-CONTRACT-DRAFT.md`](P6-CONTRACT-DRAFT.md) 的逐行重审,判据是一个尚未写进路线图的终局:
|
||||
> **client 在别处(AVF pVM / 容器类虚拟机)产生 GL 命令流,server 在一个 Android app 里解析、执行、渲染并显示。**
|
||||
>
|
||||
> 本文不推翻 P6,**也不改变 P6 的形状**。它给出:P6 哪些行在终局下是错的(四行,其中两行在树上已实测为假)、
|
||||
> P6 必须现在付但很便宜的几项、以及终局在路线图上的落点。所有 `file:line` 在本头解析。
|
||||
> 标 **[实测]** 的是在树上核对过的;标 **[外部未验证]** 的必须先做探针再当成前提。
|
||||
>
|
||||
> **2026-09-21 更正(a6 收官后)**:a6 逐条复核了本文,推翻四处——`MG_State` 八站点的形状(§2.5)、
|
||||
> abort 计数 93→92、`m_windowHandle` 的注入点形状、以及 `MGPipeSplitActive()` 的命名冲突。
|
||||
> 正文已就地更正。a6 另发现四处本文未及的阻塞项(apply 线程在第一条记录前 abort、控制面两端都没接、
|
||||
> 控制回复等待无期限、`SurfaceReply` 装不下 result)。**以 [`notes/p6/a6-audit-v1.md`](a6-audit-v1.md) 为准。**
|
||||
>
|
||||
> **2026-09-22 更正(终局改判)**:本文假设的终局——client 在 AVF pVM、链路 `AF_VSOCK`——**撤回**。现定终局:
|
||||
> client 与 server 可在**不同机器、不同 OS / 架构**上,经 **TCP** 连接;传输栈拆成控制面(`ITransport`)× 数据面(`ILink`)
|
||||
> 两根独立可选、握手协商、可混搭的轴(同机可控制面 TCP + 数据面共享段)。后果:§3 加一行 **D TCP**(约束集与 C 相同——
|
||||
> 无 fd 传递、无共享页——但 RTT 毫秒级、带宽 30–100 MB/s);§3.1、§7.3、§8.1、§8.2 的 vsock 条目撤回;§6 第 3 行
|
||||
> "P7 不变、定宽只是协商值"改为**定宽 + 布局摘要是 P6.5 的第一个包**;"形态 B 不需要 P6.5"不再是有效场景,**P6.5 上关键路径**;
|
||||
> §5.2 的 `LinkTerms` / `Refuse` / 指纹拆分经树上核实**未由 hs 落地**,归 P6.5。以 `ROADMAP.md` 的 P6.5 / Ph 行与
|
||||
> `ARCHITECTURE.md` §11.9 为准;本文其余部分作为审查记录不再改。
|
||||
|
||||
---
|
||||
|
||||
## 0 一句话结论
|
||||
|
||||
P6 的**进程那一半**(fork/exec、envp 剔除、EOF 死亡、`ServerMain`、控制帧传输、静态量核验、整个出口门)
|
||||
在终局下**几乎逐字成立**——它讲的是"两个角色在两个地址空间",对"哪个内核"一个字都没说。
|
||||
P6 的**传输那一半**(`SCM_RIGHTS` + `ShmSegment::Adopt` + 共享 `RingControl` 页)**过不了 pVM 边界**,
|
||||
这没关系——**前提是 P6 在它下面留一道缝**,而当前计划一道都没有:`ITransport.h:16-20` 自己写明热路径绕开它,
|
||||
`Ring.h:259` / `ReplySlot.h:117` / `EventRing.h:125-128` 直接收 `void* base + capacity`。
|
||||
|
||||
所以重审的结论不是"重排 P6",而是:**P6 的形状不动,范围加五件,其中三件机械、一件是纠错。**
|
||||
|
||||
---
|
||||
|
||||
## 1 P5e 已经替终局把最贵的账付了
|
||||
|
||||
这一点值得单独写一段,因为它决定了终局到底可不可行。
|
||||
|
||||
跨 VM 边界唯一致命的不是带宽,是**每帧会合次数**。侧写记录在案(`MEASUREMENTS.md` §11):
|
||||
lockstep 下客户端每帧进入 doorbell 等待约 **916 次**(对 ~849 draw),VD32 下约 **3600 次**,
|
||||
`WaitForAppliedOrEventBacklog` 占客户端 GL 线程 **31.58%** 自身时间。
|
||||
**任何一个 916×/帧 的会合结构,放到一条 RTT 以 µs 计的链路上都是死的。**
|
||||
|
||||
P5e 的 run-ahead 把它降到**每帧一次结构性会合**(present credit),`ARCHITECTURE.md` §13.1 的零 roundtrip
|
||||
清单是它的正式表述。于是链路延迟的乘数从 ~900 变成 ~1:**1 ms 的 RTT 是 16.7 ms 帧的 6%,不是 900 ms。**
|
||||
|
||||
> gfxstream 花了很多年才走到"生成式编码器 + 可用/已消费计数器 + 门铃抑制 + 一帧一次同步"。
|
||||
> 这套形状 MobileGL 已经有了,而且是为别的理由做的。终局要抄的是 gfxstream 的**协议**,不是它的**传输**(§4)。
|
||||
|
||||
带宽侧的账相形之下是小事:实测持久映射线流量 364.7 KB/帧,`ARCHITECTURE.md` §14 预算 ~1 MB/帧,
|
||||
60 fps 即 22–64 MB/s。**但这里有一个必须先量的缺口,见 §7。**
|
||||
|
||||
---
|
||||
|
||||
## 2 在树上实测出的四个硬洞(本次审查的最高价值产出)
|
||||
|
||||
这四条不是设计意见,是在 `b3b9c2ee` 上核对出来的事实,其中两条与两份 P6 文档的**明文陈述相反**。
|
||||
|
||||
### 2.1 [实测] X11 / Win32 窗口种类今天是**被接受**的,而终局的首要 guest 正好走这条路
|
||||
|
||||
`P6-CONTRACT-DRAFT` §4.3 与 §8 的 S5 认为"真窗口在 server 端具名拒绝"。实际上只拒两种:
|
||||
|
||||
- `WindowBackendForWireWindowKind`(`Protocol/SurfaceOpCodec.cpp:104-113`)**接受** `WindowKind::X11 → WindowBackend::X11`
|
||||
和 `Win32Hwnd → Win32`;`DecodeWireSurfaceOp`(`:141-179`)只拒 `AndroidNativeWindow` 和 `MetalLayer`。
|
||||
- 解码后 `op.nativeToken()` 原样抄过,`UnpackWindowHandle`(`Server/ServerLoop.cpp:875-882`)无条件
|
||||
`HandleFromToken<void*>`,交给 backend 当 `NativeWindowType` 用。
|
||||
- `DetectWindowBackend()` 是编译期 `#if` 链(`MG_Impl/EGLImpl/EGLImpl.cpp:59-70`)。
|
||||
|
||||
**后果**:终局的首要 guest 是一个 Linux pVM,它编译 `__linux__`、宣告 X11、送一个 XID——
|
||||
一个**完全正确、毫无恶意**的 guest,做 EGL 里最普通的一次调用,就穿过了计划认为已经关上的那道拒绝,
|
||||
在 server 进程里变成一次野指针解引用。今天它是潜伏的(P6 只跑离屏),终局里它在用户的 app 里。
|
||||
|
||||
**改法**:拒绝改成**白名单**——只接受 `Pbuffer` / `Surfaceless` / `None`,凡是命名了 client 进程窗口对象的
|
||||
种类一律具名拒绝。理由也要改:不是"P12 之前不支持",而是 **Rule G 的重述——一个含义来自对端窗口系统的值永远不过线**。
|
||||
S5 随之加宽:`WindowKind::X11` 带一个像样的 XID 到达 server 必须具名变红,且门要能证伪"token 到达了 `UnpackWindowHandle`"。
|
||||
今天的 S5 只测 `AndroidNativeWindow`,**洞开着它照样绿**。
|
||||
|
||||
### 2.2 [实测] device-lost 闩锁**不存在**
|
||||
|
||||
`P6-CONTRACT-DRAFT` §5.1 写的是 "The latch is already designed and **is implemented unchanged**",
|
||||
`P6-SPAWN-PLAN` §4 写的是"照抄"。两句都是假的:
|
||||
|
||||
- `EGL_CONTEXT_LOST` / `GL_UNKNOWN_CONTEXT_RESET` 在 `MG_Test` 之外只出现在两个枚举转字符串函数里。
|
||||
- `FatalCode::DeviceLost` / `ServerCrashed` 只是生成的 schema 枚举值,**零 producer、零 consumer**。
|
||||
- `glGetGraphicsResetStatus` 无条件返回 `GL_NO_ERROR`(`MG_Impl/GLImpl/Getter/GL_Getter.cpp:2855-2861`)。
|
||||
- `MOBILEGL_IPC_RESPAWN` 与 `MOBILEGL_IPC_IDLE_EXIT_S` **在任何地方都没有被解析**。
|
||||
|
||||
**今天 server 死掉,client 会永远静默地 DECLINE 每一条 verb,`glGetError` 干净。**
|
||||
|
||||
这是当前计划**最大的一处尺寸错误**:它被记成了"搬运",实际是一个完整的包。P6 必须写它,并按包计价。
|
||||
它也是唯一能把 S2(`kill -9` 之后客户端能否区分"慢"与"死")做成一个能因错误实现变红、而不只是因缺失变红的门的前提。
|
||||
|
||||
### 2.3 [实测] `Fatal{}` 是 `std::abort()`,`MG_Remote` 下有 92 个非测试站点
|
||||
|
||||
`Transport/WireLog.cpp:50`:记日志 → echo 到 stderr → `std::abort()`。
|
||||
|
||||
今天这完全正确:server 是 client fork 出来的子进程,一条坏记录意味着"我们自己有 bug",崩掉是对的。
|
||||
**终局里 server 是一个长期存活的普通 Android app,替用户自己装的 VM 渲染。**
|
||||
此时每一个从对端字节可达的 abort 站点都是一个远程 kill——而且很多不需要恶意字节:
|
||||
一个仅仅**不排空 `SEG_EVENT`** 的 guest 就能在 60 秒内用 `Fatal{EventRingOverflow}` 杀掉宿主渲染 app。
|
||||
|
||||
P6 该做的**不是**把它改成闩锁(那需要在每个 `[[noreturn]]` 站点发明一条真实返回路径,不是"一个函数翻一下"),
|
||||
而是**收口**:一个 `Session::Fail(FatalCode, detail)`,P6 里仍然 `[[noreturn]]`、仍然 abort、日志逐字不变,
|
||||
但换来三件当下就值的东西——(a) 一个地方在死之前向对端发一帧 `SessionFault{family, detail, seq, op}`,
|
||||
让 guest 的日志知道是哪条记录杀了会话,而不是读到一个裸 EOF;(b) 一个遥测点;
|
||||
(c) 一道 CI 普查门,禁止在收口之外新增 abort 站点。**策略翻转留给 Ph(§6)。**
|
||||
|
||||
### 2.4 [实测] 段尺寸由 **client 的环境变量**决定
|
||||
|
||||
`ConfigLoader.cpp:363-364`:`MOBILEGL_IPC_RING_MB` / `STAGE_MB` 从 **client 进程**的 env 读,量程到 1024 / 4096 MiB。
|
||||
终局里这意味着**一个 guest 里的环境变量决定渲染 app 内部一次几百 MB 的分配**。
|
||||
|
||||
配套的另一半:`ShmSegment::Adopt` 的 `fstat`"不信对端宣告的尺寸"检查(`ShmSegmentPosix.cpp:127-133`)
|
||||
是目前**唯一**的边界,而它在没有 fd 的链路上没有对应物。
|
||||
|
||||
**改法(P6,便宜)**:四个尺寸变成 **server 陈述**的协商字段,client 的请求可被 server 钳制并在 `Welcome` 里报告钳制后的值。
|
||||
|
||||
### 2.5 另外三条尺寸性事实
|
||||
|
||||
| 事实 | 出处 | 影响 |
|
||||
|---|---|---|
|
||||
| `mobilegl_server_main` **在树上不存在**,只存在于 `ARCHITECTURE.md:488-496`;唯一的 `MobileGLServer` target 是 P0 spike 桩 | 实测 | `a6` 第 5 项(server 能否不链 `MG_Impl`)必须**真去链一次**,而不是再读一遍断言。三个阶段的文档都在断言它,没人试过 |
|
||||
| `MG_Config::Transport != Monolith` 有 **238 个**非测试站点:155 `MG_Backend` / 35 `MG_Impl` / 21 `MG_Remote` / 12 `MG_Pipe` / **8 `MG_State`** / 7 Config | 实测 | 此前每一次普查都漏了 `MG_State` 那 8 个。**~~它们是唯一不按目录成形的一批、同一个函数里同时问两个问题~~ a6 已推翻这个判断**:8 个里 2 个是注释,其余 6 个里 5 个是单问题测试,只有 `MipmapStorage.cpp:55-56` 一个真的同时问两个;而"同时问两个"的形状散在 `SlotAllocator` / `PipeFill` / `PipeApply` / `Managers` / `MG_Remote/Client` 的 **18 个站点**上。`a6` 仍应先分类这一族,但取样对象是那 18 个,不是 `MG_State` 的 8 个 |
|
||||
| `m_windowHandle` **不止一个注入点**。a6 给出精确形状:全树 store 只有 4 处(`BackendObject.cpp:475`、`:365`、`:206`、`:207`),read 只有 5 处;`:283` 是一次**调用**不是 store;`.Width`/`.Height` **没有任何读者** | 实测 | "server 拥有显示"确实不是一处改动,但最小 latch 点比原先写的更清楚:`surfaceState->Window` 只在 `RegisterEGLWindowSurface`(`:232-238`)写一处。连同 `sameHandle` 去重键共四处,见 [`a6-audit-v1.md`](a6-audit-v1.md) §6 |
|
||||
|
||||
---
|
||||
|
||||
## 3 三种部署形态,以及每种真正可用的东西
|
||||
|
||||
终局不是一个场景,是三个,约束差别很大。
|
||||
|
||||
| 形态 | 边界 | 可用传输 | 可用 bulk | P6 机制是否够用 |
|
||||
|---|---|---|---|---|
|
||||
| **A 同内核两进程**(P6 的 spawn) | 进程 | `AF_UNIX` | `SCM_RIGHTS` + memfd/ASharedMemory + mmap | ✅ 今天就成立 |
|
||||
| **B 容器类 guest**(DroidSpace / Winlator / Termux,共享内核) | 命名空间 / 沙箱 | `AF_UNIX` | 同上(含 `AHardwareBuffer_sendHandleToUnixSocket`,API 26) | ✅ **整套 P6 机制逐字可用** |
|
||||
| **C AVF pVM** | 内核 | `AF_VSOCK`,**仅此** | 无。无 SCM_RIGHTS、无共享页、无 dma-buf | ❌ 需要 P6.5 |
|
||||
| **D 跨机 TCP**(2026-09-22 定的终局) | 机器 / OS / 架构 | `TCP`,仅此 | 无 | ❌ 需要 P6.5;且两端是**不同二进制**,wire 定宽 + 布局摘要成硬前提 |
|
||||
|
||||
**这是本次审查最令人愉快的一条结论:形态 B 的终局,从"P6 + 修订后的 P12"就能到达,不需要 P6.5。**(2026-09-22:形态 B 不再是操作性场景;终局是 D,P6.5 在关键路径上。)
|
||||
同内核意味着 `AF_UNIX` + memfd + `SCM_RIGHTS` 全部照旧。
|
||||
Winlator 在自己 app 内跑 VirGL / Vortek 渲染服务,是"终局减去 VM"的一个**已出货存在性证明**。
|
||||
|
||||
### 3.1 [外部未验证] AVF 形态有一个可能致命的外部约束
|
||||
|
||||
> **撤回(2026-09-22)**:终局不再是 AVF,本节只作历史记录,探针不做。
|
||||
|
||||
审查给出的判断是:**一个普通(untrusted)Android app 根本无法参与 AVF。**
|
||||
两道独立的闸,任一成立即致命:
|
||||
|
||||
1. `android.system.virtualmachine` 是 `@SystemApi`,`MANAGE_VIRTUAL_MACHINE` 限预装 / 平台签名(开发期可 `adb shell pm grant`)。
|
||||
2. AOSP sepolicy 带 `neverallow all_untrusted_apps *:vsock_socket ~{ getattr getopt read write };`
|
||||
——即 `socket(AF_VSOCK)` 被 MAC 拒绝,不是权限门。app 只能读写**别人递给它的** vsock fd,而那只有 VM 拥有者拿得到。
|
||||
|
||||
若这条成立,"在一个普通 Android app 里跑 server"对形态 A / B **为真**,对 AVF **为假**——
|
||||
AVF 下 server 必须**链进 VM 启动器 app 本身**,或者由第三方桥接后走 IP 到达。
|
||||
|
||||
另外一条方向性事实:`VirtualMachine.connectVsock(port)` 是 **host → guest** 拨号。
|
||||
所以在 AVF 形态里 **MobileGL 的 server 是 socket 的拨号方,client 是监听方**——
|
||||
这正是 §5.2 要把 Role 与 Dial 拆成两根轴的直接理由。
|
||||
|
||||
> **这条必须先做探针再当前提。** 一小时的设备实验:从一个普通 app 调 `socket(AF_VSOCK)`,抓 avc denial。
|
||||
> 它不改变任何结构,但改变终局能承诺什么。**没有人应该靠口碑给一条链路定尺寸。**
|
||||
|
||||
---
|
||||
|
||||
## 4 抄 gfxstream 的协议,不抄它的传输
|
||||
|
||||
gfxstream 的传输——virtio-gpu MMIO 设备、256 M–8 G 的 host memory window、`RESOURCE_MAP_BLOB`、ASG 共享环——
|
||||
**每一样都要 VMM 级权限加 hypervisor memslot 配合**,一个拿不到内核的 app 永远得不到。
|
||||
virgl 同理:它们 present 的方式是把一个 guest 资源变成 virtio-gpu 的 scanout。
|
||||
|
||||
**纯用户态、可以抄、而且 MobileGL 已经有的**:生成式 1:1 编码器 / 解码器、available/consumed 计数器、
|
||||
门铃抑制、blob-vs-inline 的载体选择、fence 时间线、每上下文的 capset 协商。
|
||||
|
||||
这条应当写进契约作为一条禁令:**任何需要 guest 可见的 host 内存窗口、virtio-gpu context/blob、
|
||||
MMIO 门铃或 DRM 设备的设计,都不在本项目的可达集内。**
|
||||
同理,presentation 侧不要再用 gfxstream 类比推理——它的 present 路径我们结构上就够不着。
|
||||
|
||||
---
|
||||
|
||||
## 5 P6 的重新定范围
|
||||
|
||||
**判决:P6 的形状不变**——fork/execve、socketpair、`SCM_RIGHTS`、只落 pbuffer / surfaceless / 离屏。
|
||||
理由:P6 昂贵且不可逆的那一半是**进程/角色**那一半,它不在乎对端是 fork 出来的孩子还是 vsock 那头的 pVM,
|
||||
而且**只有一个真的第二进程能逼它诚实**。传输那一半是死路,但那可以接受——只要下面有缝。
|
||||
|
||||
净新增两个包(`lk`、`hs`),一个是计划本来就欠、记错了科目的(`dl`),三个已有包各加一条。
|
||||
|
||||
### 5.1 `lk`(新)——数据面的缝
|
||||
|
||||
`Transport/ILink.h` + `ShmLink`(今天的 `SessionSegments` / `Ring` / `ReplySlotPool` / `EventRing` 逐行搬到接口后面,
|
||||
行为零变化)。`SessionProducer` / `SessionConsumer` / `ServerLoop` / `PipeWireEncoder` 收 `ILink*`,其余不动。
|
||||
|
||||
**`ITransport` 不扩、不改**——它自己的头(`ITransport.h:16-20`)把自己限定在控制面,而那个范围对 vsock 本来就是对的。
|
||||
|
||||
一条实测出来的反例值得记下:**不要把一个 progress 块别名到 `RingControl` 上面**。
|
||||
`Ring.h:134-147` 的 watermark 那条 cache line 是 `{appliedSeq, submittedSeq, retiredSeq, completedFrameSerial, presentAckSerial}`,
|
||||
`eventRingFull` / `eventDropped` 在整整一条线之后的另一个 `alignas(64)` 组里,
|
||||
而且 `submittedSeq` 是 **producer 写**、其余四个是 consumer 写。
|
||||
任何声称"单写者 64 字节块别名它"的设计在三个独立的点上不成立。
|
||||
|
||||
**改法是在 P6 里重组 `RingControl`**:把 `submittedSeq` 挪到 producer 自己那条线(`Ring.h:45-50` 写明它是诊断量、无人等待),
|
||||
把 `eventRingFull` / `eventDropped` 提进 watermark 组,整组包成具名 `LinkProgress` 成员并加逐字段 `offsetof` 静态断言。
|
||||
`ShmLink::Progress()` 于是直接返回共享页里的指针——自旋循环里零额外 store、零虚调用,
|
||||
而 `SessionRings.h` 的每一条规则(`Watermark::Reached` 的 acquire + `>=`、`AdvanceMonotonic` 的 backwards-is-Fatal,`Ring.cpp:364-386`)
|
||||
在**源码层面保持唯一实现**。
|
||||
|
||||
今天重组是免费的(两端同一二进制,由指纹强制);**有了第二份构建的那天它就是一次 wire break。**
|
||||
|
||||
缝必须覆盖两个方向:client 把 `kSegEvent` 装到自己的映射上(`ClientSession.cpp:661`),
|
||||
而 `MG_Impl/Pipe/ResourceTracker.h:606` 通过它解析 writeback payload——
|
||||
那个站点也要走缝访问器,否则缝的纯度门是假的。
|
||||
|
||||
**门**:G1 `.text` 差异具名认领;inproc 车道结果数与逐线程 CPU 与改缝前逐字相同
|
||||
(`RingProducer::Reserve` 在 ~850–3550 记录/帧上失去内联的风险在这里**实测**,不靠论证);
|
||||
外加一道机械 grep 纯度门——`RingControl` / `RingProducer` / `ReplySlotPool` / `EventRingConsumer` / `m_shm.`
|
||||
只允许出现在 `Transport/ShmLink.*` 与传输自己的测试里。
|
||||
red-once:任一站点绕过缝则 grep 变红;回退 `RingControl` 重组则 `offsetof` 静态断言变红。
|
||||
|
||||
**代价**:约一周加半天。**不做的代价**:五个包加两个阶段的重写——
|
||||
P9 要在 `SEG_REPLY` 里建 slot 池、P11 要建 `SEG_ADOPT`(一块 client 写 server 读、绑 `completedFrameSerial` 的映射),
|
||||
"以后再说"意味着移植三个映射形状的机制而不是一个。
|
||||
|
||||
### 5.2 `hs`(新)——握手身份,以及一次不是 abort 的拒绝
|
||||
|
||||
把 `abiFingerprint` 拆成 `wireFingerprint`(永远比较)与 `buildFingerprint`(仅在 `Dial == Fork` 时比较)。
|
||||
|
||||
**有一个广为流传的改法是错的**:`AbiFingerprintInputs`(`SessionRings.h:544-566`)自己的注释写明
|
||||
`GIT_COMMIT_HASH_SHORT` 在里面是因为"两份 sizeof 相同的构建仍然可能对**字段顺序**有分歧,而那是任何 sizeof 看不见的"。
|
||||
所以"去掉 git stamp、加一个目录 hash"**如其所述是错的**——
|
||||
一个覆盖 `(opcode, payload 结构名, flags, WaitClass)` 的目录摘要,既看不见 `MGPResourceDesc` 内部的成员重排,
|
||||
也看不见一次宽度变化;去掉 stamp 而不补上那道守卫,就是开了一个静默读错状态的洞。
|
||||
|
||||
`wireFingerprint` 因此要混入:**有序目录摘要** + **payload 布局摘要**(由 `PipeFields.def` 派生,逐成员的
|
||||
name / `offsetof` / `sizeof`——`gen_pipe.py` 已经在 CI 里强制字段表点名每个成员,所以这是生成器加法,不是工具链)
|
||||
+ 记录头布局 + 两个 blob codec 版本 + `kOpCount` + `MOBILEGL_ABI_VERSION` + 字节序 + 指针宽度,
|
||||
**并且保留** `sizeof(MGPCaps)` 与 `sizeof(DynamicBackendParameters)`——
|
||||
因为 `MGPWireRec_GetCaps` 就是由 `sizeof(MGPCaps)` 复合出来的(`PipeWire.inc:529-535`),它们是 **wire 事实**,不是构建事实。
|
||||
**删掉** `sizeof(GLFunctionsTable)`:它从不过线,今天加一个 backend 槽就作废所有对端,毫无 wire 理由。
|
||||
|
||||
独立的另一半:握手分歧变成一条 `Refuse{code, detail, 对端的值}` 控制消息 + 两端
|
||||
`MOBILEGL_ERR_PROTOCOL_MISMATCH`——server 发 Refuse 并 exit 0,client 回收子进程并**具名拒绝,不回落 monolith**。
|
||||
**握手路径上不留任何 abort。** 现成的写法就在同一个函数八行之外:`ServerSession.cpp:456-466` 已经为畸形帧
|
||||
返回 `MOBILEGL_ERR_PROTOCOL_MISMATCH` 并带正确的 `msg_as_Hello() != nullptr` 守卫。
|
||||
顺带修一个实测出的不对称:**client 只检查 `abiFingerprint`(`ClientSession.cpp:566-568`),从不检查 `abiMajor` / `abiMinor`。**
|
||||
|
||||
附 `LinkTerms{dataPlane, wireForm, maxReplyBytes, cmdWindowBytes, stageWindowBytes}` 追加进 Hello / Welcome,
|
||||
`dataPlane` 在 P6 里**只有一个合法值** `SharedSegments`,其余具名拒绝;四个尺寸由 **server 陈述**(§2.4)。
|
||||
|
||||
**注意 P6 的策略反而更严**:`buildFingerprint` 在 `Dial == Fork` 下照样比较——
|
||||
fork 下子进程本来就是同一二进制,比较它能抓住一个指向旧 `libMobileGLServer.so` 的陈旧 `MOBILEGL_IPC_SERVER_PATH`,
|
||||
那是 P6 真实的失败模式。**终局是一次策略翻转,不是一次重新设计。**
|
||||
|
||||
**门(三条 red-once,各证伪一件不同的事)**:
|
||||
(1) 在临时树里交换某个 payload 结构里两个同宽成员 → 布局摘要变化而 git stamp **不变**(这是今天的指纹想红都红不了的门);
|
||||
(2) `wireMajor = 99` → 两端具名拒绝,server exit 0 不留 core,client 不回落 monolith;
|
||||
(3) 两份**仅 git stamp 不同**的对端在 `Dial != Fork` 下连接成功——**正控制**,没有它,拆分可以被报成"已落地"而 stamp 比较悄悄活着。
|
||||
|
||||
### 5.3 `dl`(计划已欠、记错科目)——device-lost 闩锁 + fail 收口
|
||||
|
||||
写 §2.2 那个闩锁:会话作用域,**从 `Doorbell::Dead()` 置位,永不从超时置位**;
|
||||
此后 GL 入口 no-op、`eglSwapBuffers` 返回 `EGL_FALSE` + `EGL_CONTEXT_LOST`、
|
||||
`glGetGraphicsResetStatus` 返回 `GL_UNKNOWN_CONTEXT_RESET`。首次产出 `FatalCode::ServerCrashed` / `DeviceLost`。
|
||||
解析 `MOBILEGL_IPC_RESPAWN` 与 `IDLE_EXIT_S`,`RESPAWN=1` 在有阶段实现重推之前是具名拒绝。
|
||||
加上 §2.3 的 `Session::Fail` 收口与 CI 普查门。
|
||||
|
||||
**门**:S2 重新瞄准——`kill -9` server → client 必须闩锁(不挂起、不继续提交、不 abort)。
|
||||
red-once:**改成从超时置位闩锁,则配对的正控制"server 落后一帧是正常态"必须变红**。
|
||||
这一对正是 §5.2 要求的"慢 vs 死"判别,也是这里**唯一能证伪错误实现、而不只是证伪缺失**的门。
|
||||
|
||||
### 5.4 三个已有包各加一条
|
||||
|
||||
| 包 | 加什么 |
|
||||
|---|---|
|
||||
| `a6` | 第 5 项从"读"改成**真链一次**(加 CMake target,试着不链 `MG_Impl`,失败就记下真实的未定义符号表)。新增:(6) 按 Role / Dial / SplitActive 分类 238 个站点,**先做 `MG_State` 那 8 个**;(7) 普查从对端字节可达的 abort 站点(`MG_Remote` 下 92 个),它决定 `dl` 的收口是改名还是重设计;(8) 枚举 `m_windowHandle` 的**每一处**写入(§2.5)与每一个**没有分片走查**的记录类型 |
|
||||
| `cp` | 窗口种类改**白名单**(§2.1);`SurfaceReply.defaultFb` 标 `(deprecated)`——编码器硬写 0、解码器从不读,P5f/fc 已裁定 `kEventSurfaceChanged` 是唯一载体,现在烧掉这个槽以免它被复活成第二真相源 |
|
||||
| `sm` | `MG_Config::Role{Monolith, Client, Server}` × `Dial{No, Fork, Connect}` 两根正交轴 + 三个具名谓词(`MGPipeSplitActive()` / `MGPipeServerArm()` / `MGPipeShouldDial()`;**注意 `MGPipeSplitActive` 与既有的 `MGPipeRoleSplitActive()` 命名冲突,后者先改名**,且三者都必须 `inline constexpr` 可折叠否则 G1 红)。反递归变成**结构性的 `Dial = No`**,而不是强置 Monolith——后者会选中 frontend glue,正是 `CONTRACT` §3.1 点名的陷阱;envp 剔除留作第二道独立保险,S3 照样证伪它。`ClientSession::Start` 拆出 `Connect(ITransport&)`:client 不再在自己线程上调 `ServerSessionInstance().Accept()`(`ClientSession.cpp:534-539`)、不再按引用 attach(`:599-600`)、不再在失败路径上关 server 单例(`:758`)、不再拿 `Welcome` 去跟本地 server 对象对账(`:577`,对任何真对端都是空检查——四个 `SegmentRef` 本来就在线上,改成**每条车道都只对线上值校验**)。`MGPipeServerArm()` 写成 `Role == Server \|\| (Role == Client && ServerLoop::OnApplyThread())`:第二个析取项是迁移路径,独立 server 出现的那天第一项点亮、线程判据处处答否,于是它是**可证的死代码**而不仅仅是没人用 |
|
||||
|
||||
> `MGPipeRunAheadCapBitsFor(...)` 与 `ConsumedSubsystemsFor(ActiveBackendType)` 要挪到 server 侧。
|
||||
> 注意一个被多处写错的细节:**CallMask 的能力位那一半已经读 server 自己的 backend 了**
|
||||
> (`MG_Backend/Init.cpp:184-211` 读 `loop.Backend()->GetBackendFunctions()`,代码里带了理由)。只有那两个函数需要搬。
|
||||
|
||||
### 5.5 `t6` 的出口门加三条负控制、两个必测数字
|
||||
|
||||
- **S6**:对端宣告 `LinkTerms.dataPlane = StreamOnly` → 具名拒绝,且 **server 活下来继续服务下一个连接**。
|
||||
- **S7**:在 `Session::Fail` 之外新增一个裸 abort → 普查门变红。
|
||||
- **S8**:`integration-spawn` 全程断言 `SessionFaultCount() == 0`——**好路径**上的断言,
|
||||
正是 E1 / ID-122 想要而表达不出来的那种,而且 S5 / S6 能证伪它。
|
||||
- **两个数字**(都可在现有 inproc 车道上取,不需要第二个进程):
|
||||
`SEG_STAGE` 字节/帧与**分片后**的记录数/帧;以及 server 自己的 `PipeStats` 经控制通道回传——
|
||||
`PipeStats.h:255-263` 自己写明 spawn 下 client 打印 `srv=0 srvpark=0`,
|
||||
**一个意思是"在另一个进程里"的零,长得和一个意思是"从没等过"的零一模一样**,正是本项目到处禁止的那种假绿。
|
||||
- 第 8 项(socket 门铃相对 condvar 的代价)的措辞要能**接受一个负向回归而不显得可疑**:
|
||||
今天是 ~1600 次自旋/帧打在一条共享 cache line 上(99.8% 靠自旋解决),
|
||||
socket 链路没有那条 line,但把它换成 ~4 次阻塞读/帧**可能更便宜**。
|
||||
|
||||
---
|
||||
|
||||
## 6 终局在路线图上的落点
|
||||
|
||||
终局不是一个阶段,是四件能力,家不一样。
|
||||
|
||||
| | 阶段 | 内容 | 顺序约束 |
|
||||
|---|---|---|---|
|
||||
| 1 | **P6(修订)** | 十个包,仍然可交付,仍然只落离屏 | — |
|
||||
| 2 | **P6.5(新)stream 数据面** | `StreamLink` 作为 `ILink` 的第二实现:分块封帧、watermark 变消息(**规则逐字保留**——late-never-early、`>=` 不是 `==`、倒退是 Fatal,只有机制变)、reply 变成自带 seq 的真消息(于是 **删掉** slot 池、`seq & mask` 取模、stamp 自检与 `ReplySlot.h:56-62` 的 P9 漂移风险)、`SEG_STAGE` 的编码器局部分配器变成发送窗口、**每方向一条专用读线程**(否则 event-ring 的流控死锁以 write/write 互阻的形式原样复活) | **必须在 P11 之前**,且**约束 P9 的机制选择** |
|
||||
| 3 | **P7 不变** | 定宽 payload 重写是**跨架构**前提,不是跨进程前提;`hs` 让它变成一个协商出来的 `wireForm` 值而不是新机器。**2026-09-22 改判:跨架构现在就是终局,定宽 + 布局摘要归 P6.5 wf,P7 不再持有它** | — |
|
||||
| 4 | **P9 重定范围** | 从"`SEG_REPLY` 异步 slot 池"改成"**异步 reply 语义**",机制推到 P6.5 之后 | 否则 P9 造一个阶段的工作量给 stream 删掉 |
|
||||
| 5 | **P11 加一条具名拒绝** | `SEG_ADOPT` 的档位是**只对共享映射成立**的;在非 shm 链路上点名 T0/T1 是具名拒绝并强制 T2 | 在 P6.5 之后 |
|
||||
| 6 | **P12 修订,而且更小** | **删掉 Surface 传递那一半**(Java `Surface` → Messenger/AIDL → `MobileGLServerService` → `ANativeWindow_fromSurface`,以及那 ~15–25 MB 的额外 ART)。server app 拥有自己的 SurfaceView,client 根本没有窗口,**于是 minSdk 26 没有扁平化 `ANativeWindow` 的 NDK API——那条逼得 P5–P11 必须无窗口的约束——彻底不再成立,因为什么都不需要被扁平化。** 新增:一个追加的 `WindowKind::ServerOwned`、两个后端各一条 `CreateEGLWindowSurface` 臂、**第二个 `m_windowHandle` 注入点**(§2.5;a6 精确化为:`ActivateEGLSurface` 每次 make-current 用 `surfaceState->Window` 覆写 server 的窗口,最小 latch 点在 `RegisterEGLWindowSurface` `BackendObject.cpp:232-238`,另需改 `sameHandle` 去重键 `BackendObject_DirectGLES.cpp:962-967`)、DirectGLES 进程全局 `g_Display`/`g_Surface`/`g_Context` 的去全局化、以及 DirectGLES 的 `kEventSurfaceChanged` Width/Height 缺口(Espryt 只发布格式,`DirectGLES.cpp:15793-15805`,server 拥有显示时 client 的默认 FBO 会永远停在 `MG_Impl/Init.cpp` 的 512×512 占位值)。**Magma 近得多**:它的旋转 / preTransform 补偿本来就整个在 server 侧、按 server 自己的 surface 取键 | 形态 C 需要 P6.5 + Ph;**形态 B 两个都不需要** |
|
||||
| 7 | **Ph(新)不可信 guest 加固** | 当前路线图里**没有家**。内容:把 `Session::Fail` 的**策略**翻成每会话闩锁(P6 收口站点,Ph 改它们做什么——注意这需要在每个站点发明真实返回路径,不是一个函数翻一下);handle slot 预算(guest 能跨 13 个 kind 各逼一次 `1<<20` 条目的 vector resize,而 `BackendSlotTable` 的两条拒绝是 `MOBILEGL_ASSERT`,release 下展开为空,留下一个**静默的 null twin**);readback 尺寸门挪到 server 侧、且在 resize **之前**加绝对上限;`StagedTextureStore` 的 resize 按该 level 宣告的范围设界;`ArchiveVector` 按 `count * sizeof(element)` 设上限;`SEG_EVENT` 溢出策略不能再是"一个仅仅在自己门铃上 park 的 guest 60 秒内杀掉宿主渲染器" | **必须在任何出货的 server app 接受一个不是它自己产生的 guest 的连接之前** |
|
||||
|
||||
**顺序小结**:`P6 → {P7 ∥ P6.5 ∥ Ph}`;P6.5 在 P11 与 P9 机制选择之前;Ph 在任何出货 server 之前。**2026-09-22**:IPC 跑道改为 `P6 → P6.5 → Ph → P12 → P9 → P10 → P11(同机臂)`,P7 与 P3b/P4b 在 monolith 跑道上并行。
|
||||
|
||||
---
|
||||
|
||||
## 7 本周就能做、而且最省钱的三件事
|
||||
|
||||
### 7.1 发布 `SEG_STAGE` 字节/帧与**分片后**记录数/帧(数小时,零新代码)
|
||||
|
||||
计数器已经接好了(`stage-buffer`、`stage-texture`、`stage-ubo-global`、`stage-ubo-named`、
|
||||
`stage-vertex-client`、`stage-index-client`、`stage-indirect-cmd`、`pmap`、`csob-blob`)。
|
||||
跑一个 MC VD12 窗口和一个 VD32 窗口,`MOBILEGL_PIPE_STATS_PERIOD=1`,发布按字节类分的那一行。
|
||||
|
||||
**为什么是最值钱的一小时**:`MEASUREMENTS.md:342` 明文写着分片后的逐 blob 分布**不存在**,
|
||||
而 `SEG_STAGE` 大约是链路预算里其余部分的 **10 倍**——它是决定 stream 链路到底可不可行的**那一个**数字。
|
||||
今天这一类唯一实测到的量是 364.7 KB/帧的持久映射流量,而 `ARCHITECTURE.md:477` **预算**是 ~1 MB/帧,
|
||||
整个"26 还是 64 MB/s 可行性"的论证就卡在这两个数中间。
|
||||
记录数/帧同样从没直接量过(只量过 draw/帧与头字节/帧),而它是"stream 链路的反向通道每帧要 ~1 条消息还是 ~900 条"的分母——
|
||||
也就是 **P6.5 到底是一次传输练习还是一次协议重设计**。
|
||||
|
||||
它还可以**在 `c6` 写下第一行之前**取到,而它的答案会改变 `c6` 对 `LinkTerms` 默认窗口尺寸的写法。
|
||||
|
||||
### 7.2 `a6` 的链接实验(同一周)
|
||||
|
||||
加上 `MobileGLServer` target,试着不链 `MG_Impl` 链一次。这是 P6 本来就欠的一个硬是非题,
|
||||
三个阶段的断言都没有解决它,而它的答案同时决定 **guest 侧产物能做到多小**。
|
||||
|
||||
### 7.3 `AF_VSOCK` 探针(一小时,设备上)
|
||||
|
||||
> **撤回(2026-09-22)**:终局改为 TCP 跨机;对应的测量变成 TCP loopback 与跨机臂上的 RTT / 吞吐(`ROADMAP.md` 开放问题 19)。
|
||||
|
||||
从一个普通 app 调 `socket(AF_VSOCK)`,抓 avc denial;量一次 guest↔host 的 1 MiB 吞吐与单向延迟。
|
||||
§3.1 那条外部约束不做这个探针就不能当前提。
|
||||
|
||||
> **明确不要先做**的一件事:几份草案提议在门铃 notify 路径上加一个合成延迟做链路扫描。
|
||||
> `SessionConsumer::ApplyOne` **每应用一条记录**就调一次 `NotifyClient()`(`SessionRings.h:465`),
|
||||
> 所以 1 ms 的延迟在 VD12 上是 ~850 ms/帧,臂根本跑不完;而且 `CondVarDoorbell::Notify` 取的是
|
||||
> `Park` 持有的同一把 mutex,那个 sleep 是在**串行化等待者**而不是在延迟它。
|
||||
> 要扫延迟,只放在 present-credit 返回路径上(一个站点,结构上每帧一次),或者在双进程 socketpair 彩排上正经做。
|
||||
|
||||
---
|
||||
|
||||
## 8 仍然未决(不要当成已答)
|
||||
|
||||
1. ~~**[外部未验证]** 普通 Android app 能否成为 pVM 的 vsock 对端(§3.1)。它不改结构,改的是终局能承诺什么。~~ 撤回(2026-09-22,终局改为 TCP)。
|
||||
2. ~~**[外部未验证]** pKVM 下手机上的 `AF_VSOCK` 吞吐与单向延迟。~~ 撤回(2026-09-22;换成 TCP 跨机的 RTT 与吞吐,`ROADMAP.md` 开放问题 19)。树里、文档里、脚本里对 vsock / AVF / virtio / gfxstream / virgl
|
||||
**零引用**(已 grep);公开数字都是服务器级 x86 的 iperf3,这个配置下的延迟数字**根本不存在**。
|
||||
3. server image 能否不链 `MG_Impl`。`PipeInputs.h:281/:744/:957` 与 `P5F-WIRE-COMPLETENESS` §1.4 断言它,
|
||||
`SPAWN-PLAN:77` 与 `CONTRACT` §3.3 挂着它。读不出来,只能试链(§7.2)。
|
||||
4. **`appliedSeq` 能否懒传输。** 这**不是**一个开放问题,是一条 P6.5 必须**修正案**处理的已关闭契约行:
|
||||
`Ring.h:71-77` 写的是"批处理只能让 watermark 变**晚**。除 `appliedSeq` 外的五个都可以懒发布",
|
||||
`Ring.h:52-58` 称它是"P5 **禁止**批处理的那一个 watermark"。
|
||||
几份设计拿 late-never-early 去论证懒传输合法;那条规则**明文把 `appliedSeq` 排除在外**。
|
||||
真正未决的是修正它的**代价**:修正案需要一条 flush-on-idle 规则(apply 线程将要 park 时、以及 post 一次 reply 时 flush),
|
||||
否则一帧里最后一条 `kWaitReply` 记录会把两端一起挂住;而且它把合并间隔压到全部 14 条 `kWaitReply` 加 10 条 `kWaitApplied` 行的延迟上。
|
||||
在 P6.5 的契约里用一条**专门挑起"帧内最后一条记录"情形**的 red-once 定它,不要靠推理。
|
||||
5. 缝的热路径代价。`ILink::ReserveRecord` 在 VD32 下是 ~850–3550 次/帧的虚调用,
|
||||
而客户端线程已经是 ~94% 占用(16.7 ms 帧里 15.72 ms)。预期在噪声里,**但 `lk` 的门要量,不要论证**。
|
||||
具体风险是 `RingProducer::Reserve` 失去向编码器的内联。若不在噪声里,答案是把 reserve/commit 对做成
|
||||
link 自有 arena 上的非虚函数,而不是加一个开关。
|
||||
6. **并发多 guest**:一 guest 一进程,还是会话索引式解析器?`ServerSession` 在四个独立的点上是单会话
|
||||
(泄漏的函数静态单例;`g_sessionOwner` 的 CAS,第二个取用者是 `Fatal{RoleViolation}`;四个 `gMGPipeCallbacks`
|
||||
进程全局;`gMGPipeSegmentResolver` 一个每进程非原子 inline 变量,拒绝第二次安装);
|
||||
DirectGLES 额外是**每进程单 surface**。`Close()` 写得可重入,顺序重连接近可达,并发不可达。
|
||||
**显式决定它,而不是等第二个 guest 连上来的时候发现它**——注意 Android 上第二个进程很便宜、
|
||||
而且免费换来崩溃隔离,这在这里比省内存重要得多;但数量被 manifest 卡死,因为 `android:process` 名是静态的。
|
||||
7. `MOBILEGL_IPC_PRESENT_CREDIT > 1` 似乎**从没量过**。`ARCHITECTURE.md:475` 给了 1..8 的量程和一段反对调高的论证,
|
||||
同时说只有实测吞吐收益能抵掉延迟代价——这暗示那个测量没做。**在一条带延迟的链路上它是首要杠杆**,
|
||||
而它的代价因此未知;叠加 Magma 的 `Present` 本来就在 `vkWaitForFences` 上等 2–3 帧,credit 2 就是端到端 4–5 帧。
|
||||
在现有 inproc 臂上取它很便宜。
|
||||
8. 哪些记录类型仍然没有分片走查。在 stream 链路上,一条超出发送窗口的未分片记录是 `Fatal{RingOverrun}` 而不是一次拆分,
|
||||
所以那份枚举是选 P6.5 默认窗口尺寸的**前提**,不是后续。`a6` 第 8 项产出它。
|
||||
|
||||
---
|
||||
|
||||
## 9 `c6` 要改的契约措辞
|
||||
|
||||
1. §1 的 ABI 指纹行 → `hs`(§5.2)。
|
||||
2. §5.1 停止声称 device-lost 闩锁已实现(§2.2)。
|
||||
3. §7 停止声称 "a transport swap and nothing else"——**这句话在本次重审之后不再为真**,
|
||||
§7 要把四项新增列出来,而不是把它们夹带过去。
|
||||
4. Rule G 第二句改成传输中立:
|
||||
*"Descriptors cross only by a mechanism the transport declares it supports, and where the transport declares none
|
||||
they do not cross at all and the bytes are transferred instead; a transport may not invent a third answer."*
|
||||
(当前措辞把 `SCM_RIGHTS` 硬编进了一条通用规则。)
|
||||
5. 新增两条规则:**Rule H——一个 client 命名的窗口永不过线,永久**(不是"直到 P12");
|
||||
以及一条对 `Ring.h:71-77` 的显式**修正案登记**:`appliedSeq` 按名被排除在懒发布之外,
|
||||
任何未来的 stream 链路**修正**这条规则而不是绕着它推理。P6 不改行为,它只是让这个问题不必三个阶段之后再凭记忆重吵一遍。
|
||||
6. 声明 `ILink`、`StreamLink`(未实现,每个方法是具名拒绝 `Fatal{UnmigratedDataPlane, "StreamLink@P6.5"}`)与 `LinkTerms`。
|
||||
**门**:声明而未实现的 `StreamLink` 必须能对着 `ILink` **编译通过**——
|
||||
这是"缝能不能说出一条流需要的东西(progress 传输、窗口字节、flush)"的廉价充分性证明,一行实现都不用写。
|
||||
red-once:删掉 `StreamLink` 声明需要的任意一个 `ILink` 方法,构建变红。
|
||||
@@ -0,0 +1,126 @@
|
||||
# P6 spawn transport — 包计划
|
||||
|
||||
> 历史规划基线 `feat/disaggregated @ f23fbc1b`。路径在 `MobileGL/` 下,旧行号在 `c6` 落地时重核。
|
||||
> 契约草稿 [`P6-CONTRACT-DRAFT.md`](P6-CONTRACT-DRAFT.md),`c6` 落地时移为 `MobileGL/MG_Remote/CONTRACT-P6.md`。
|
||||
> **P5f 前提全部完成**(2026-09-20):零 `BARRIER_PULLED` 分类、双块 / strict 门、静态状态世代与生命周期、registry / 反向通道边界均已收口;阶段审查修复及最终 Redmi 六个 clean-boot 臂也已通过。见 [`P5F-WIRE-COMPLETENESS.md`](../p5f/P5F-WIRE-COMPLETENESS.md)、[收口审查](../p5f/close-review.md)和[设备报告](../p5f/device-report.md)。
|
||||
>
|
||||
> **P6 尚未开工:`a6`、`c6` 与 spawn 实现均未启动。** 下文保留历史包规划;标 `待 a6` 的 P6 进程边界事项仍需审计确认,P5f 完成不等于 P6 已实现。
|
||||
|
||||
---
|
||||
|
||||
## 1 树上已有的(不要重写)
|
||||
|
||||
| 件 | 位置 | 测试 |
|
||||
|---|---|---|
|
||||
| `ITransport`(含 `ShareFd`/`ReceiveFd`) | `MG_Remote/Transport/ITransport.h` | `InProcessTransportTest` |
|
||||
| `SocketDoorbell` | `Transport/Doorbell.h:385-420`;`Doorbell.cpp:211-360` | `MG_Test/Wire/FdPassingTest.cpp:197`/`:227`/`:260`/`:289` |
|
||||
| SCM_RIGHTS fd 传递(专用 `SOCK_DGRAM` socketpair) | `Transport/FdPassing.cpp:92` | `FdPassingTest.cpp:267`/`:291` |
|
||||
| `ShmSegment::Adopt`(POSIX) | `Transport/ShmSegment.h:57`;`ShmSegmentPosix.cpp:120` | `FdPassingTest.cpp:114`/`:187` |
|
||||
| inproc attach 是 dup+Adopt+Map 的真实第二份映射 | `Transport/SessionRings.h:22-28`、`:147-159` | 现有 split 车道 |
|
||||
| 控制面 schema:`SurfaceOp`/`SurfaceReply`/`WindowKind`/`CtrlEnvelope` | `Protocol/protocol.fbs:166-290` | `ProtocolSmokeTest`、`flatc-check` |
|
||||
| ABI 指纹握手(同机同二进制,原样继承) | `CapsCodec.h:23-29` | `SessionHandshakeTest.cpp:115` |
|
||||
| `spawn`/`unix:`/`pipe:` 具名拒绝 | `ConfigLoader.cpp:310-348` | — |
|
||||
| `MOBILEGL_IPC_SERVER_PATH` 已解析未消费 | `Config.h` `IpcTable::ServerPath` | — |
|
||||
|
||||
传输原语已付过账。P6 是装配 + 控制面 + 进程。
|
||||
|
||||
## 2 缺什么
|
||||
|
||||
1. `SocketTransport`。`ClientSession.cpp:468` 目前硬拒非 `InProcess`。
|
||||
2. `ServerMain`。今天的 `MobileGLServer`(`CMakeLists.txt:923`)是 P0 spike 桩(`tools/spikes/server_stub/main.cpp`),Android-only、默认 OFF。
|
||||
3. 进程机制:fork/execve;envp 剔除 + 子进程禁止递归选择 client transport(双保险);`dladdr` 兜底;有界重试握手;EOF 即退;不留孤儿。原“子进程强制 monolith”的具体实现**待 a6**:P5f 的 server record 臂依赖 active transport 选路,必须区分反递归与 backend server 角色选择,不能因此回到 frontend glue。
|
||||
4. 控制面帧。**P5f 包 fc 已把帧化本身落地**:forwarder 改发 `SurfaceControlFrame` 值帧(`MG_Remote/Server/SurfaceControlFrame.h`),schema 缺口(3 枚枚举 + `readSurface`/`context` 字段 + `WindowKind::MetalLayer`)已按 append-only 补齐,wire 编解码与具名拒绝在 `MG_Remote/Protocol/SurfaceOpCodec.cpp`(`ServerApplyWireSurfaceOp`)。P6 的 `cp` 只剩传输:client 侧 `EncodeSurfaceOpFrame` 上 socket、server 泵进 `ServerApplyWireSurfaceOp`、`SurfaceReply` 回程与 §4 的死亡接线。P5c 审计 G4 行,原记 P6。
|
||||
5. 静态状态 / 生命周期的 spawn 验证,**不是重做 P5f fs**。unpack / render shadow 已按 native generation、served-context serial、执行臂组成的 `ContextEpoch` 失效;raw-depth sampler 按 native generation 重建。XFB 按 server lifetime id 隔离,served-context reset 保留仍活着的 paused/pending span,native context 销毁才清对象;server liveness 由控制生命周期持有。`st` / `a6` 核这些语义在第二进程与 socket 接线下仍成立,见草稿 §6 与 [fs 报告](../p5f/fs-report.md)。
|
||||
6. 死亡语义,见 §4。
|
||||
|
||||
## 3 边界:P6 不做真窗口
|
||||
|
||||
`WindowHandle::Handle`(`MG_Backend/BackendObject.h:561-566`)在 Android 上是 `ANativeWindow*`,子进程用不了。`protocol.fbs:186-196` 的 `nativeToken` 注释已写明 Android 的窗口 out of band 传递——那是 P12。
|
||||
|
||||
- P6 落 pbuffer / surfaceless / 离屏:够 `HeadlessGL`、等价 split 车道、trace replay,也正是 P6 出口门量的东西。
|
||||
- 真窗口的管道(令牌、`SurfaceOp`、`SurfaceReply`)落,但到达 server 时具名拒绝。
|
||||
- **P6 新增的手机 spawn 臂只承诺 trace 和离屏;真窗口游戏接入归 P12。** 现有 monolith / inproc 运行能力不因此改变。
|
||||
|
||||
## 4 P5e 留下的:不等待的客户端 + 会死的服务端
|
||||
|
||||
闩锁语义已定(`docs/Disaggregated/ARCHITECTURE.md:504`):EOF → device-lost latch、`EGL_CONTEXT_LOST`、`GL_UNKNOWN_CONTEXT_RESET`;`MOBILEGL_IPC_RESPAWN` 默认关;`IDLE_EXIT_S` 默认 30。照抄。
|
||||
|
||||
新的是 run-ahead 之后的三个状态:
|
||||
|
||||
| 情形 | 要求 |
|
||||
|---|---|
|
||||
| server 被 kill,客户端已跑在前面 | 走上述闩锁;已发布未 apply 的记录明确丢弃,不等待 |
|
||||
| server 被 SIGSTOP / Android freezer 冻住(**不产生挂断事件**) | 有界等待 + 具名诊断 |
|
||||
| server 活着但落后一帧以上 | 这是 P5e 的正常态,必须与上两者可区分 |
|
||||
|
||||
死亡判定取 `SocketDoorbell` 在 EOF 上 latch 的 `m_dead`(`Doorbell.cpp` 的 `Drain`),**不用超时阈值**。这是 P6 唯一的新设计,其余是搬运。它与 E1 对照的重新定义(ID-122)共用同一个谓词,建议一起做。
|
||||
|
||||
## 5 包与依赖序
|
||||
|
||||
```
|
||||
a6 (只读审计,不写代码)
|
||||
└─ c6 (契约 + 惰性线上行,行为零变化)
|
||||
├─ so (SocketTransport)
|
||||
├─ sm (ServerMain + fork/exec + 进程纪律)
|
||||
├─ cp (已有控制帧的 socket 传输 + 回程)
|
||||
├─ st (验证 P5f epoch / lifetime 的 spawn 接线 + G5)
|
||||
└─ t6 (spawn 车道 + 阴性对照 + CI)
|
||||
└─ 集成 commit:ConfigLoader 不再拒绝 spawn
|
||||
```
|
||||
|
||||
**a6**(先跑,尚未启动)。以 P5f 已完成的双块、身份守卫、生命周期、反向通道及设备证据为输入,核验从同进程双角色变为真实进程后的新增边界,不重复领取已完成的迁移。产出:逐行清单,形状照 `notes/p5c/p5c-audit-v1.md`。点名查:
|
||||
|
||||
1. 仍过线的裸指针 / 进程局部句柄。
|
||||
2. **进程级静态中语义属于 context 或 session 的**——以 `notes/p5f/f0-statics.md` 与 fs 全清单处置为基线,验证 §2.5 的 epoch / lifetime 规则与新 process/session 退出边界;不可把每次 `applier_reset` 解释为清空所有对象。
|
||||
3. `gPipeInputs` 在 spawn 下的角色归属,以及禁止子进程递归当 client 时仍选中 server record 臂的机制。
|
||||
4. 复用 fc 已补齐的 `SetSwapInterval` / `ReleaseResources` / `SetWindowHandle` 等 schema 与 wire codec,核 socket 对接与 inproc-only op 的边界(`SwapEGLBuffers` 走记录、`InitCapabilities` 走 `CapsSnapshot`、`InitWindowSurface` 是客户端 no-op),不重复追加已落地枚举。
|
||||
5. server 能否不链 `MG_Impl`(`MG_Backend/MGPipe/PipeInputs.h` 如此声称)。做不到就记账。
|
||||
|
||||
**c6**:契约;复用 fc schema,只有 a6 确认的新缺口才 append-only 扩展;令牌类型;新旋钮(`ARCHITECTURE.md:639` 已登记的 P6+ 项,`POLL_ESCALATE` 归 P10);跨包接缝的声明 + 未落地断言体;`MobileGLServer` 真目标。
|
||||
|
||||
**so**:`SocketTransport`。**必须在第二个进程出现之前就绿**——一次 `socketpair()` + 两个线程跑 `InProcessTransportTest` 全套,含 `BUFFER_TOO_SMALL` 留帧语义。理由同 `SessionRings.h:22-28`。
|
||||
|
||||
**sm / cp / st / t6**:见 §2 与 §3。`cp` 在 fc 之后只剩传输;`ForgetCurrentTuple` 的 N-3 语义已在帧路径的分发里原样成立(`ApplySurfaceControlFrame`,ServerLoopTest 的 C7/N-3 对照驱动)。
|
||||
|
||||
## 6 出口门
|
||||
|
||||
五部分门(`ARCHITECTURE.md` §13.2)之外:
|
||||
|
||||
1. G1 pull 构建 0/0/0/0,`.text` 不变。
|
||||
2. **G2/G14**:`integration-spawn` 用例名集合与 `integration-split` 逐名相同。
|
||||
3. `integration-spawn` 全绿,数字与 `integration-split` 一致(历史草稿基线 179/179;`c6` 重核实际发现 / 执行集合)。
|
||||
4. **进程树门(机检)**:每条用例前后数子进程,运行中恰好多一个,运行后为零;`HeadlessGL` fork 预检无孤儿。
|
||||
5. **臂证明门**:每条用例在自己的私有日志里留下子进程 pid 与 `transport=spawn`。ID-124 已证明假绿会发生,而一条实际跑了 monolith 的 spawn 车道能通过 1–4。
|
||||
6. 逐包 red-once(R-16),各一条具名对。
|
||||
7. 设备:Redmi `2f7cbe2e`,reboot-clean + 同热窗口配对 A/B;OpenRA 在 Adreno 830 上 split SSIM ≥ 0.99。
|
||||
8. 性能只记录不阻塞,但必须采到一个数:**socket 门铃相对 inproc condvar 的代价**。P5d 把 client 线程从 15.0 压到 9.2 ms/帧,其中有门铃路径的钱。P6 唯一预期的回归。
|
||||
|
||||
## 7 阴性对照
|
||||
|
||||
| # | 旋钮 | 证伪什么 |
|
||||
|---|---|---|
|
||||
| S1 | `MOBILEGL_IPC_SERVER_PATH=/nonexistent` | 具名拒绝,非静默回落 monolith |
|
||||
| S2 | 运行中 `kill -9` server | 客户端能区分慢与死;不挂起、不继续提交 |
|
||||
| S3 | 子进程 envp 未剔除 | 第二道保险挡住递归 spawn 并具名 |
|
||||
| S4 | 临时关闭 spawn 接线中继承的 P5f epoch 失效 | 替换 context 错用旧同步状态;返回仍活着的 XFB lifetime 必须保留 paused span |
|
||||
| S5 | `WindowKind::AndroidNativeWindow` 到达 server | 具名 Fatal |
|
||||
|
||||
S2 的形状先想清楚再写:E1 索要的 Fatal 在整次运行里出现 0 次(ID-122)。
|
||||
|
||||
## 8 风险与未决
|
||||
|
||||
1. 慢 / 死的区分(§4)。P6 唯一新设计,与 E1 重定义合并考虑。
|
||||
2. Android cached-app freezer 冻结不产生挂断事件。完整处理归 P12,诊断归 P6。
|
||||
3. server 能否不链 `MG_Impl` — 待 a6;做不到即记账,不留空头承诺。
|
||||
4. Windows:`Adopt` 是 POSIX-only,`unix:` / `pipe:` 继续具名拒绝,P6 只落 POSIX。
|
||||
5. `SEG_REPLY` 2 MiB 单槽 cap 与 chunking(`Transport/ReplySlot.h` 记作 P6 debt,ID-47)→ **推给 P9**。
|
||||
6. class-C 的 511 条 `UnmigratedVerb`(`notes/p6/census-classC.md`)不是 P6 的账。
|
||||
7. E1 对照(ID-122)不因 P6 开工而解决。
|
||||
|
||||
## 9 不属于 P6
|
||||
|
||||
真窗口与 `android:process=":mgl"` Service(P12);多 context(P12,`CONTRACT-P5C.md:56` 原写 P6,本计划改判);chunked readback 与 reply-slot 池(P9);`DynamicBackendParameters` 定宽重写及已具名拒绝的功能债(P7);`POLL_ESCALATE`(P10);剩余 monolith-only frontend-object / twin-registry glue 清理(P3b/P4b)。`BARRIER_PULLED` 分类与 transport 前端身份访问已由 P5f 归零,不能继续列成未偿的 P6 前提债。
|
||||
|
||||
## 10 开工顺序
|
||||
|
||||
先跑 `a6`,只读。清单出来之前 `c6` 写不实,后面五包的大小是猜的。
|
||||
@@ -0,0 +1,378 @@
|
||||
# P6 — spawn transport(2026-09-22 收官)
|
||||
|
||||
> 本页是该阶段的**阶段汇总**:阶段表行、实测与落地形状的完整文本(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)。
|
||||
|
||||
## 摘要
|
||||
|
||||
- 十包全落地:a6 审计 → c6 契约(`MobileGL/MG_Remote/CONTRACT-P6.md`)→ lk `RingControl` 按写者重组 → so `SocketTransport`(AF_UNIX + SCM_RIGHTS)→ sm 两个独立启动的进程 → cp EGL 控制帧跨进程 → hs build stamp / abi 补检 / 真实 pid → dl device-lost 闩 + `Session::Fail` 漏斗 → st fb-slot memo 具名 Fatal → t6 `integration-spawn` 车道(102/102)+ per-role 日志。
|
||||
- 出口门 1–8 全达成:G1 0/0/0/0(`.text` `0xa52203`);spawn 与 split 名集合一致且同数绿;进程树恰多一个子进程;逐条 arm 证明;每包 red-once;**门 7** 真机配对 A/B 判读 **tie**(inproc vs spawn client CPU −0.15% / +0.16%,monolith 约贵 30%);**门 8** 三个强制性能数齐(门铃 tie、`SEG_STAGE` 字节/帧、分块后记录/帧)。
|
||||
- 真机:`OpenRA.DirectGLES` spawn ssim 1.0 连跑三次;DirectVulkan 分离路径的不确定分歧归 P7(后由 B3 证明是 wire 臂 frame-serial floor 不健全)。杀 server 从 123 s 的错误 `BarrierTimeout` 变为 5.7 s 的正确 `DEVICE LOST`。
|
||||
- 包计划、契约草稿与终局重审(2026-09-24 从上层移入):[`P6-SPAWN-PLAN.md`](P6-SPAWN-PLAN.md)、[`P6-CONTRACT-DRAFT.md`](P6-CONTRACT-DRAFT.md)(已被 `CONTRACT-P6.md` 取代)、[`P6-ENDSTATE-REVIEW.md`](P6-ENDSTATE-REVIEW.md)(其 AVF pVM / `AF_VSOCK` 终局已撤回,见页首更正)。
|
||||
|
||||
## 阶段表行(原 `ROADMAP.md`)
|
||||
|
||||
- **阶段**:**P6** spawn transport
|
||||
- **状态**:✅ **已收官(2026-09-22)**;全部包已落地于 `feat/disaggregated`(头 `77cbd176`,2026-09-21),出口门第 1–6 项此前已达成,第 7/8 项于 2026-09-22 采齐。收官前核出的三项:server 进程侧 `PipeStats` 从未初始化(`srv=0 srvpark=0` 是结构性零,门 8 无 server 半边)**已在收尾中修好**;184 符号棘轮 CI 门(契约 §12.1)与契约 §2 分给 hs 的 `LinkTerms` / `Refuse` / 指纹拆分**未落地**,移交 P6.5(负控 S6 随之)
|
||||
- **落地什么 / 范围**:十包全落地:**a6** 进程装配/链接边界审计 → **c6** 规范契约 + 数据面缝惰声明 → **lk** `RingControl` 按写者重组 → **so** `SocketTransport`(AF_UNIX SOCK_STREAM + SCM_RIGHTS,12 条契约用例)→ **sm** 两个独立启动的进程(非 fork,name 汇合、共享匿名段,四守卫接线)→ **cp** EGL 控制帧跨进程并应答(`InitCapabilities` wire kind 11)→ **hs** build stamp 显式 present 入指纹 + `abiMajor/Minor` 补检 + 真实 pid → **dl** device-lost 闩(取自描述符挂断绝不取自超时)+ `Session::Fail` 漏斗(`FatalFamilies.def` 词表 + 90 站点归一 + `SessionFault` 帧命名家族)+ Fatal 普查门 → **st** fb-slot memo 具名 Fatal → **t6** `integration-spawn` 车道(102/102)+ 名集合结构性一致门 + per-role 日志(`<base>.client.log` / `<base>.server.log`)。Android CI 新增 `spawn-acceptance` 臂,App 从 `nativeLibraryDir` 解析 server 路径。真机 Redmi `2f7cbe2e` 上 `OpenRA.DirectGLES` spawn ssim=1.0 连跑三次 + 6 case 绿;`DirectVulkan` 真机分离路径不确定分歧(inproc 与 spawn 同表现→ Magma × 真实 GPU,非 P6,桌面 lavapipe 为 1.0)。边界仍为 pbuffer / surfaceless / 离屏;真窗口归 P12。契约 [`MG_Remote/CONTRACT-P6.md`](../../contracts/CONTRACT-P6.md);a6 产出 [`a6-audit-v1.md`](a6-audit-v1.md)、[`a6-link-experiment.md`](a6-link-experiment.md)(**server 不能不链 `MG_Impl`**:184 符号,P7 101 / P3b-P4b 14 / 共有 60 / P6 自己 6);终局重审 [`P6-ENDSTATE-REVIEW.md`](P6-ENDSTATE-REVIEW.md)。**收尾四项(2026-09-22,工作树未提交)**:wire 计数器——`PipeStats` 新增 `ByteClass::StageSegmentBytes`(`PipeWireCodec.cpp:878` `StageAllocate` 唯一收口)与 `CallClass::WireRecords`(`:1188` `EncodeRecord` 提交路径)+ staged-blob 直方图,汇总行新增 `seg=` / `wrec=`;`ServerMain.cpp` 补 `PipeStats::Init()` / `Shutdown()`(spawn server 此前从不武装计数器——修前 0 条汇总行、修后 29 条,SSIM 1.0 不变);`MOBILEGL_PIPE_STATS_FILE` 按角色派生 `<base>.client.json` / `<base>.server.json`(走 `RoleLogPath` 同一导出规则,基名不指向文件);工具入库 `tools/device_bench/p6/{ab_session.py,render_ab.py,README.md}` 与 `tools/trace_replay/run_android_retrace_local.py`(+19 行 `MOBILEGL_TRACE_PACKAGE`),`pin_device.sh` 新增 `2f7cbe2e` 条目(本板 GPU 钳 1050 MHz:`thermal_pwrlevel` 写 0 读回 1、`max_gpuclk` 只读 1 050 000 000;绝对值与 1100 MHz 时代的 `35d0befa` 行不可比)。
|
||||
- **验收门 / 证据**:出口门(契约 §9)1–6 ✅:G1 pull 0/0/0/0、`.text` 恒 `0xa52203`;`integration-spawn` 与 split 名集合一致(可比 102==102)且同数绿;进程树运行时恰多一子进程、结束为零;每条 spawn 条目记子进程 pid 与 `transport=spawn`(`--require-spawn` 门);每包 red-once。**7/8 已采(2026-09-22)**:**门 7** 真机 reboot-clean 同热窗口配对 A/B(Redmi `2f7cbe2e` / M332BF / SM8750 / Adreno 830v2,CPU 定频 little 1555200 / big 1958400,GPU 钳 1050 MHz(本板 `thermal_pwrlevel` 写 0 读回 1、`max_gpuclk` 只读 1 050 000 000;绝对值与 1100 MHz 时代的 `35d0befa` 行不可比,只有同会话配对可比),`minecraft-1.21.4-rd12-odinlite-in-world` + DirectGLES,~1471 draws/帧;六臂交错 × best-of-3:18/18 runner 退出 0、36/36 pin check `PINNED`、0 `Fatal`;client CPU p50 ms/帧 inproc 7.880/7.889 vs spawn 7.876/7.869,均值 **−0.15%**,符号随臂序翻转,臂内散布 0.2–4.2%;第二会话 inproc/spawn 交错 × best-of-2:4/4 OK、8/8 `PINNED`、0 `Fatal`,7.987/7.989 vs 7.992/8.009 = **+0.16%**)——判读 **tie**(差值在臂内噪声内),如实记录、不设门;monolith 基线约贵 30%(−29.8% / −29.9%)。**门 8①** socket 门铃 vs inproc condvar:client 121.1 waits/帧、5.6–6.1 parks/帧,两传输逐字相同(run total 30 401–30 407);server inproc 10 866–11 963 waits/帧、5.0–6.2 parks/帧,spawn 10 415–10 416 waits/帧、4.66–4.90 parks/帧——socket 阻塞读**既不更便宜也不更贵**(契约 §9「阻塞读可能更便宜」未兑现),spawn server waits 少 8.9–12.9% 归因于 handoff 纪律而非门铃本身,唯一 socket 略差的列是 `clipark/f`(6.07 vs 5.60/5.75)。**门 8②③**(inproc,真实 trace retrace):`SEG_STAGE` 字节/帧 OpenRA 130.8 KB median / 8.01 MB steady mean(含启动负载 8.07 MB),rd12 816.2 KB median / 1.53 MB steady mean(含负载 10.79 MB,rd12 首帧 981 654 draws vs 稳态 ~1471,run-wide mean 约 7× 稳态,两个读法都报);分块后记录/帧 OpenRA 211 median / 206 mean,rd12 7 497 median / 7 504 mean;`maxrec=1808` 与分块前相同(默认 8 MiB chunk 预算在这些负载上从未被打到)。证据 [`notes/p6/gate7-device-ab.md`](gate7-device-ab.md) / [`notes/p6/gate8-doorbell-device.md`](gate8-doorbell-device.md) / [`notes/p6/gate8-wire-counters.md`](gate8-wire-counters.md)
|
||||
|
||||
## 收官快照(原 `CURRENT_STAGE_PROGRESS.md`,2026-09-22)
|
||||
|
||||
|
||||
|
||||
**状态(2026-09-22):P6 已收官。** 全部包(a6…t6)落地,出口门第 1–8 项全部达成:门 7(真机
|
||||
`2f7cbe2e` reboot-clean、同热窗口配对 A/B)判读为 **tie**——`inproc` 与 `spawn` 的 client CPU/帧
|
||||
差 −0.15%(会话 1)/ +0.16%(会话 2),都落在臂内散布之内,如实记录、不设门;门 8 的三个强制
|
||||
性能数(socket 门铃 vs condvar、`SEG_STAGE` 字节/帧、chunking 后记录/帧)已采齐,逐数见 §2;
|
||||
G1 pull 构建 **0/0/0/0** 且 `.text` 逐字节相同。测量期的源头:门 7 报告记 `75dd0cb1`、门 8 的
|
||||
wire 计数器与真机第二轮记 `94c130d6`。分支 `feat/disaggregated` 其后又落地两个 P6.5 设计提交
|
||||
(`872370ba`、`4e7bf0fe`),**现头 `4e7bf0fe`,与 `origin` 同步**;**工作树另有未提交的 P6 收尾
|
||||
改动**(wire 计数器、`ServerMain` 的 `PipeStats` 武装、`MOBILEGL_PIPE_STATS_FILE` 角色派生、设备行
|
||||
与工具入库、测试),见 §1.1。三种传输形态(`monolith` / `inproc` / `spawn`)在桌面(WSL lavapipe)
|
||||
与真机(Redmi `2f7cbe2e`)上都跑通了真实 trace 的两进程 retrace,逐像素对上 golden。性能**只记录、
|
||||
不设门**。
|
||||
|
||||
---
|
||||
|
||||
### 1. 包状态
|
||||
|
||||
契约把 P6 切成 a6(审计)→ c6(契约)→ lk / so / sm / cp / hs / dl / st / t6。全部已落地:
|
||||
|
||||
| 包 | 落地什么 | 状态 / 证据 |
|
||||
|---|---|---|
|
||||
| **a6** | 进程装配与链接边界的核验;198 行审计;184 符号的链接实验(server 不能不链 `MG_Impl`) | ✅ `c25a7760`;[`notes/p6/a6-audit-v1.md`](a6-audit-v1.md)、[`a6-link-experiment.md`](a6-link-experiment.md) |
|
||||
| **c6** | 规范契约(21 条裁定)+ 数据面缝 `Transport/ILink.h` / `StreamLink.h`(声明不接线) | ✅ `b6293957`;`CONTRACT-P6.md` |
|
||||
| **lk** | `RingControl` 按写者重组 + 可证伪的 per-field 断言;数据面缝的 pre-flight | ✅ `99649a90`、`db62d674` |
|
||||
| **so** | `SocketTransport`(AF_UNIX SOCK_STREAM + SCM_RIGHTS),12 条 ITransport 契约用例 | ✅ `5f846d96` |
|
||||
| **sm** | 两个**独立启动**的进程(非 fork),靠 name 汇合、共享匿名段;D1c 的六谓词里 D10 需要的三个,四个「编进来却永不武装」的守卫接线 | ✅ `70c45ab9`、`11807ac7`、`e3bb6d8b` |
|
||||
| **cp** | EGL 控制帧跨进程并应答;`InitCapabilities` 上线(wire kind 11);真实 trace 两进程 retrace 逐像素通过 | ✅ `5239ae0c`、`7e244b37` |
|
||||
| **hs** | build stamp 从「静默空串」变成显式 present 标志入指纹;客户端补检 `abiMajor/Minor`;`Hello::pid` / `Welcome::serverPid` 携带真实 pid | ✅ `90f9a790` |
|
||||
| **dl** | device-lost 闩(取自描述符的挂断,绝不取自超时);D5b「alive-but-silent」具名诊断;`MOBILEGL_IPC_RESPAWN` 具名拒绝;`Session::Fail` 漏斗(`FatalFamilies.def` 词表 + 90 站点归一 + `SessionFault` 帧向对端命名家族);Fatal 普查门 | ✅ `557dc2c1`、`8b13d8a8`、`3399b879`、`3a12a48a`、`4bb4d4fa`、`b46da700`、`77cbd176` |
|
||||
| **st** | fb-slot memo 的具名 Fatal(`nullptr==nullptr` 读成缓存命中、返回未填槽的潜在崩溃,sm 关掉可达性、st 出声) | ✅ `e3bb6d8b` |
|
||||
| **t6** | `integration-spawn` 车道(102/102);集合一致做成结构性(一个宏两条臂)+ 校验门;per-role 日志 | ✅ `15f5b54b`、`5fb54f03` |
|
||||
|
||||
配套:CI 的 `retrace-split` 从「1 case × 1 后端 × inproc」扩成「全 CI 矩阵 × 两后端 × inproc/spawn」,
|
||||
`split` 键改成 opt-out;Android CI 新增 `spawn-acceptance` 臂,真机 App 从 `nativeLibraryDir` 解析
|
||||
server 路径(`dc5bd935`、`d83fc664`、`53406749`、`7c8120cc`)。
|
||||
|
||||
#### 1.1 收尾(2026-09-22)
|
||||
|
||||
下列改动**在两轮测量(门 7 的 `75dd0cb1` 头、门 8 的 `94c130d6` 头)之后落地、目前仍在工作树里未
|
||||
提交**(其后两个提交 `872370ba`、`4e7bf0fe` 只改文档与 `Transport/StreamLink.h` 的注释,不含这些代码):
|
||||
|
||||
- **wire 计数器**:`PipeStats` 新增 `ByteClass::StageSegmentBytes`(唯一收口点
|
||||
`PipeWireCodec.cpp:878` `StageAllocate`)与 `CallClass::WireRecords`(`:1188` `EncodeRecord` 提交
|
||||
路径),外加一个 staged-blob 直方图(复用 `PayloadBucketOf` 的桶边界,只经 JSON dump 出口);
|
||||
汇总行新增 `seg=` / `wrec=` / `wrec/f=`(后者与 `draws/f=` 同形,无 Present 时按既有规则退回窗口总量)。
|
||||
两个计数器都在 `#if MOBILEGL_PIPE_PUSH` 内,落点选在唯一收口点而不是调用方,否则等于维护一张
|
||||
"今天存在哪些 producer" 的名单。
|
||||
- **`ServerMain` 的 `PipeStats` 武装**:spawn server 此前从不武装计数器(红一次的证据:
|
||||
**修复前 spawn server 0 条汇总行、修复后 29 条**,同一条 spawn trace、两侧 SSIM 均 1.000000)。
|
||||
`Init()` 放在 `MG_ConfigLoader::Init()` 与 `MGPipeSetServerProcessRole(true)` **之后**、
|
||||
`Shutdown()` 放在 `loop.Stop()` 之后 `_exit(0)` 之前——两处顺序都是承重的(前者让 latch 读到真
|
||||
配置值,后者让 apply 线程不再发布时取运行总量与 JSON dump)。见 §2.1。
|
||||
- **`MOBILEGL_PIPE_STATS_FILE` 角色派生**:与日志 sink 同一套命名规则(库 `RoleLogPath` 导出、
|
||||
PipeStats 调用而非复制),dump 与 banner 都印/写 `<base>.client.json` / `<base>.server.json`,
|
||||
**基名不再指向任何文件**——没跟上改名的读取方会当场 `ENOENT`,这是刻意的。这一条在 G1 上红了
|
||||
三次才做对(无条件派生 → `.text +24`;加 `#if` 但两臂共用局部 → 1 symbol resized;两臂分离但
|
||||
重写 `MGLOG_W` 格式串 → `.rodata +64`),最终形态是 pull 臂的代码逐语句原样、所有新增都在 `#if` 内。
|
||||
- **`pin_device.sh` 新增 `2f7cbe2e` 条目**:本板 GPU 钳 **1050 MHz**(`thermal_pwrlevel` 写 0 读回 1、
|
||||
`max_gpuclk` 只读 1 050 000 000、devfreq `max_freq` 同值),因此**绝对值与 1100 MHz 时代的
|
||||
`35d0befa` 行不可比**,只有同会话的配对可比。三种动作(`check` / `pin` / `unpin`)均已实测。
|
||||
- **工具进树**:`tools/device_bench/p6/{ab_session.py,render_ab.py,README.md}`(真机配对 A/B 会话
|
||||
运行器 + 只读渲染器,门 7 快照里的 `gate7_ab.py` / `render_gate7.py` 是它们的前身)与
|
||||
`tools/trace_replay/run_android_retrace_local.py`(+19 行):`MOBILEGL_TRACE_PACKAGE` 覆盖,
|
||||
让开发包能**装在既有 trace 包旁边**而不是替换它(两个不同密钥签的 APK 不能共用一个 id;
|
||||
缺省即原行为)。四个文件目前都在工作树里**未提交**。
|
||||
- **测试**:`PipeStats` **25/25**、全 unit **2367/2367**、`integration-spawn` **102/102**;
|
||||
G1 复验 **0/0/0/0** 且 `.text` **逐字节相同**(pull 配置下两侧各 10 158 850 字节,`cmp` 无差异)。
|
||||
逐条 red-once 与 G1 三次泄漏见
|
||||
[`notes/p6/gate8-wire-counters.md`](gate8-wire-counters.md) §9.7.3。
|
||||
|
||||
---
|
||||
|
||||
### 2. 出口门(契约 §9)
|
||||
|
||||
| # | 门 | 状态 |
|
||||
|---|---|---|
|
||||
| 1 | **G1** pull 构建 0/0/0/0、`.text` 不变 | ✅ 符号 0 差异、`.text` 恒为 `0xa52203`(每次改动后复测) |
|
||||
| 2 | **G2/G14** `integration-spawn` 名集合 == `integration-split` | ✅ `scripts/ci/spawn_lane_parity.py`:可比 102 == 102;名只增不删 |
|
||||
| 3 | `integration-spawn` 与 split 同数绿 | ✅ 102/102 |
|
||||
| 4 | 进程树:运行时恰多一个子进程、结束后为零 | ✅ `ServerSpawnTest.StartsAServerProcessAndHandshakesAcrossIt`(`CountOwnChildren`) |
|
||||
| 5 | Arm 证明(ID-124):每条 spawn 条目记子进程 pid 与 `transport=spawn` | ✅ `--require-spawn` 门要求 ConfigLoader marker **且** `spawn ARMED - pid N` |
|
||||
| 6 | 每包 red-once(R-16) | ✅ dl 的 S2/S7、hs 的 serverPid、sm/st 的守卫塌缩、t6 的名集合漂移均已跑红一次 |
|
||||
| 7 | **设备**:Redmi reboot-clean、同热窗口配对 A/B | ✅ **配对 A/B 判读 tie**:会话 1(boot id `e69d0329…`→`107f24d3…`)六臂交错 `monolith,inproc,spawn,inproc,monolith,spawn` × best-of-3 —— 18/18 runner 退出 0、36/36 pin check `PINNED`、0 `Fatal{`;client CPU p50 ms/帧 **inproc 7.880/7.889、spawn 7.876/7.869**(均值 −0.15%,符号随顺序翻转,臂内散布 0.2–4.2%),`monolith` 约贵 30%。会话 2(boot id `107f24d3…`→`7e6c6e9f…`)inproc/spawn 交错 × best-of-2:4/4 OK、8/8 `PINNED`、0 `Fatal`;client CPU **7.987/7.989 vs 7.992/8.009**(+0.16%,亦在 0.14–0.69% 臂内散布内)。差值在臂内噪声内,**如实记录、不设门**。见 §3、[`notes/p6/gate7-device-ab.md`](gate7-device-ab.md)、[`notes/p6/gate8-doorbell-device.md`](gate8-doorbell-device.md) |
|
||||
| 8 | **性能只记录**,但三个数强制:socket 门铃 vs condvar、`SEG_STAGE` 字节/帧、chunking 后记录/帧 | ✅ 三个数齐(见 §3.2 / §3.3 与 [`notes/p6/gate8-doorbell-device.md`](gate8-doorbell-device.md)、[`notes/p6/gate8-wire-counters.md`](gate8-wire-counters.md)):① socket 门铃 vs inproc condvar —— client **121.1 waits/帧**、5.6–6.1 parks/帧,两传输逐字相同(run total 30 401–30 407);server inproc **10 866–11 963** waits/帧、5.0–6.2 parks/帧(park 率 0.042–0.06%),spawn **10 415–10 416** waits/帧、4.66–4.90 parks/帧。判读(诚实):socket 阻塞读**既不更便宜也不更贵**,契约 §9「阻塞读可能更便宜」**未兑现**;spawn server waits 少 8.9–12.9% 归因于 handoff 纪律而非门铃本身;唯一 socket 略差的列是 clipark/f(6.07 vs 5.60/5.75,每帧多约 0.4 次 park)。② `SEG_STAGE` 字节/帧(inproc,真实 trace retrace):OpenRA **130.8 KB median / 8.01 MB steady mean**(含启动负载 8.07 MB),rd12 **816.2 KB median / 1.53 MB steady mean**(含负载 10.79 MB)。③ 分块后记录/帧:OpenRA **211 median / 206 mean**,rd12 **7 497 median / 7 504 mean**;`maxrec=1808` 与分块前相同,默认 8 MiB chunk 预算在这两条负载上**从未被打到** |
|
||||
|
||||
`MEASUREMENTS.md:342` 的「分块后的逐 blob 字节分布尚无新测量」据此可关闭:门 8 第二轮给了
|
||||
默认预算下的分布(`maxrec=1808`,稳态 `seg/wrec ≈ 109 B/条`),结论是**默认配置下该分布就是未分块的
|
||||
原始分布**(分块在这两条负载上没有机会生效,由 `MOBILEGL_IPC_STAGE_MB=1` 的负控独立证明:seg 运行
|
||||
总量两臂逐字节相同 2 698 026 763,`wrec` 仅 +0.11%)。
|
||||
|
||||
负控(各跑红一次):S1 不可解析镜像(sm)、S2 kill server(dl)、S3 未洗环境(sm)、S5 窗口 token
|
||||
到达(cp)、S6 **未跑——`LinkTerms.dataPlane` 不存在于树上**(`protocol.fbs` 无 `LinkTerms` / `Refuse`,hs 只落了 build stamp、`abiMajor/Minor` 补检与真实 pid;此处此前写"已跑红一次"是错的,随契约 §2 三行移交 P6.5,契约 §10.3)、S7 裸 abort(dl 普查门)、S8 `SessionFaultCount()==0`
|
||||
整轮(t6)。
|
||||
|
||||
#### 2.1 出口门之外仍欠(2026-09-22 核出;出口门 1–8 本身已全部达成)
|
||||
|
||||
- server 进程侧的 `PipeStats` 半边是**结构性零**:`ServerMain` 不跑 `MobileGL::Initialize`,`PipeStats::Init()` 从未在 server 进程执行,~80 处 `if (Enabled())` 永远为假,`srv=0 srvpark=0` 长得和"从没等过"一模一样(`PipeStats.h:256` 自己写明了这一点)——门 8 的"socket 门铃 vs condvar"因此没有 server 半边。**已修(工作树未提交,见 §1.1)**:在 server 角色初始化的唯一收口点于 config 加载与角色声明之后加 `Init()`,`loop.Stop()` 之后加 `Shutdown()`,汇总行落 `<base>.server.log`;spawn server 汇总行 0 → 29 条,SSIM 1.0 不变。
|
||||
- 184 符号棘轮 CI 门(契约 §12.1):`test.yml` / `scripts/` 里**没有**。
|
||||
- 契约 §2 表 0 分给 hs 的 `LinkTerms` / `Refuse` / `wireFingerprint` 拆分:**未落地**,移交 P6.5(`ROADMAP.md` P6.5 行,契约 §10.3)。
|
||||
- `MOBILEGL_IPC_IDLE_EXIT_S`(`ARCHITECTURE.md` §15.3 默认 30):未被解析。
|
||||
- `TextureParamsWithoutASamplerView` 的"P6 inspection forwarder"债(`MEASUREMENTS.md` §7.2):场景代码已无 P6 引用,是否已由 fc / cp 关闭**待核**。
|
||||
|
||||
---
|
||||
|
||||
### 3. 真机验收(Redmi `2f7cbe2e`)
|
||||
|
||||
trace APK 以 `-Pmobilegl.buildDisaggregated=ON` 构建,调试签名安装。功能全绿:
|
||||
|
||||
- **`OpenRA.DirectGLES` spawn**:ssim=1.000000、mismatchPixels=0、`Fatal{` 零条,连跑三次;
|
||||
`--require-spawn` 确认 `server role in pid N`。
|
||||
- 另有 6 个 case(含 in-world、BSL 光影)spawn 下通过。
|
||||
- **monolith** 控制组 ssim=1.0;证明门确认 monolith 只写 `mobilegl.client.log`、无 server 日志。
|
||||
|
||||
**如实记录、非 P6 引入**:`DirectVulkan` 在真机分离路径下画面分歧且**不确定**(inproc 与 spawn
|
||||
抽自同一组结果:0.988998/0.976494…,而同 pbuffer 的 monolith 是 1.0)。两种 transport 表现一致,
|
||||
故是 Magma 分离路径在真实 GPU 上的问题,P6 既未引入也修不了;桌面 lavapipe 上 DirectVulkan spawn 为 1.0。
|
||||
|
||||
那个会杀死 server 的 llvmpipe case(`iterationrp`,`LLVM ERROR: Cannot select vcvtps2ph`):dl 落地后
|
||||
从 123 秒的错误 `BarrierTimeout` 变成 **5.7 秒**的正确 `DEVICE LOST`(`revents=0x2010` = POLLRDHUP|POLLHUP)——
|
||||
仍红(驱动 bug),但红得诚实。
|
||||
|
||||
配对 A/B、门铃与 wire 计数器三张表的完整版在下文「实测」节 §12.2–§12.5(原快照里的 §3.1–§3.3 是它们的摘录,已去重)。
|
||||
|
||||
### 4. 日志按角色分文件(本阶段的一处基础设施改动)
|
||||
|
||||
spawn 的两个进程原先 O_APPEND 追加同一个 `MOBILEGL_LOG_FILE_PATH`(正确但两个会话混在一处)。现在
|
||||
库按**调用线程角色**写 `<base>.client.log` / `<base>.server.log`(inproc 下 apply 线程即 server 角色,
|
||||
同样分开)。基名不再指向任何文件——这是刻意的:没跟上改名的读取方会「文件不存在」当场报错,而不是
|
||||
半读通过。34 个消费方全部改到派生路径;拒绝普查读两份;派生规则由库 `RoleLogPath` 导出,不复制。
|
||||
G1 守卫下 pull 构建不变。
|
||||
|
||||
---
|
||||
|
||||
### 5. 已知未决 / 明确不属于 P6
|
||||
|
||||
- **`DirectVulkan` 真机分离路径分歧**——Magma × 真实 GPU,非 P6。见 §3 与 `ROADMAP.md` P7 行。
|
||||
- **P6.5**:传输栈两轴化(控制面 `ITransport` × 数据面 `ILink`,握手协商、可混搭)+ TCP 跨机 + wire 定宽与布局摘要;`StreamLink` 已声明未接线;`SEG_STAGE` 送窗口复活。终局已改为 TCP 跨机跨平台(2026-09-22),AF_VSOCK 撤回;见 `ROADMAP.md` P6.5 行、`ARCHITECTURE.md` §11.9。
|
||||
- **Ph**:让 `Session::Fail` 可返回的策略翻转(需在每个依赖 `[[noreturn]]` 的站点造真实返回路径)+ 配对 / 认证;前置于 P12 的非 loopback 监听。
|
||||
- **P12**:真窗口跨进程(`ANativeWindow*` 是客户端进程内指针,`SetWindowHandle` 至今具名拒绝)。
|
||||
- **seq/op 未穿 SessionFault 帧**:90 个站点不逐一穿线,消息本身已带 op,帧只带 code/family/message。
|
||||
|
||||
两条**结构性限制**,随收尾一起生效、如实记录(不是缺陷但会绊住读者):
|
||||
|
||||
- **spawn client 无 `OnPresent`** → 它的窗口字段 `frames=0 window=0`,于是
|
||||
`draws=` / `wrec=` / `bytes[...]` / `gates[...]` 与**所有 per-frame 字段**在 spawn client 上都印 0 或
|
||||
`n/a`,**无效**;但 `PublishGauge` 是 **store 不是 add**,所以 `cli` / `clipark`、`maxrec` /
|
||||
`maxcap` / `ringwraps` / `ringpads` / `ringwaits`,以及发射侧直接 `Add` 的
|
||||
`resid` / `csob-blob` / `seg` / `wrec` 的 **run total 有效**(窗口归属只有最后一段)。要取 spawn 的
|
||||
窗口化 client 数必须让 client 进程到达一次帧边界——那会与 backend 的帧边界重复计数,需单独判断,
|
||||
不在本阶段。**逐 role 的取数规则**因此是:`srv` 对读 server.log、`cli` 对读 client.log,
|
||||
spawn client 只有 `Shutdown` 终行(benchmark 模式)或 0 行(snapshot 模式)。
|
||||
- **`MOBILEGL_PIPE_STATS_FILE` 已改角色派生**:dump 与 banner 都写/印
|
||||
`<base>.client.json` / `<base>.server.json`,**基名不再指向任何文件**(与日志 sink 同一套
|
||||
`RoleLogPath` 规则,刻意让没跟上的读取方当场 `ENOENT` 而不是半读通过)。inproc 只产出
|
||||
`.client.json` 是**正确**的(服务端角色是线程不是进程,`Shutdown()` 只跑一次)。仓库内目前没有
|
||||
这样的读者(`grep` 确认),但任何新写的车道/脚本都要读派生名。语义未变:仍是「在这里写 dump」,
|
||||
只是「这里」由库按角色展开成两个名字。
|
||||
|
||||
## 实测:P6 出口测量(2026-09-22,Redmi `2f7cbe2e` + WSL 桌面)(原 `MEASUREMENTS.md` §12)
|
||||
|
||||
P6(spawn transport)的实现包(a6 / c6 / lk / so / sm / cp / hs / dl / st / t6)已全部落地,出口门 1–6 的逐项证据见 `CURRENT_STAGE_PROGRESS.md`;本节记录门 7(真机配对 A/B 热窗口)与门 8(三个强制性能数)在 2026-09-22 采齐的实测,以及支撑它们的收尾代码与工具。按本文件既有口径,下面所有性能数**只记录、不设门**:门 7 的判读是 tie,门 8 的三个数不带阈值。
|
||||
|
||||
### 12.1 协议(本节两个设备会话共同遵守)
|
||||
|
||||
| 项 | 值 |
|
||||
|---|---|
|
||||
| 设备 | Redmi `M332BF`,serial `2f7cbe2e`,SM8750 / Adreno 830v2 |
|
||||
| reboot-clean | `adb reboot` + `sys.boot_completed=1`,**boot id 前后比对**(id 变了才算数,见 §12.2) |
|
||||
| CPU 定频 | little `policy0` → 1555200,big `policy6` → 1958400(`pin_device.sh 2f7cbe2e pin`;每臂前 `pin`、后 `check`,非 `PINNED` 即作废该臂,不是降级) |
|
||||
| GPU 钉频 | kgsl `min/max_pwrlevel = 0` → **1050000000 Hz**(可比性警告见 §12.7) |
|
||||
| 风扇 | `/sys/class/xm_power/hw_monitor/pwm_fan` `target_level=2` |
|
||||
| 同热窗口臂交错 | 每个会话都在**一次 boot 内的唯一热窗口**里按给定顺序交错跑完,臂间有冷却 |
|
||||
| 负载 | `minecraft-1.21.4-rd12-odinlite-in-world`,DirectGLES,251 帧,**1471.36 draws/帧** |
|
||||
| 跑法 | `--benchmark-repeats 3`(门 7)/ `2`(门 8),`--benchmark-tail-frames 200`,`--benchmark-no-finish`,best-of-3 / best-of-2 |
|
||||
| split 开关 | `MOBILEGL_IPC_ROLE_SPLIT_STATE=1`、`MOBILEGL_IPC_STRICT_ERRORS=1`、`MOBILEGL_IPC_RUN_AHEAD=1` |
|
||||
| stats | `MOBILEGL_PIPE_STATS=1`、`MOBILEGL_PIPE_STATS_PERIOD=120` |
|
||||
| 源码头 | 门 7 会话 `75dd0cb1`;门 8 两会话 `94c130d6` + §12.6 的收尾改动(工作树) |
|
||||
| 臂的证明 | 每个 spawn 臂必须在**自己的**私有日志里出现 `Config: MOBILEGL_TRANSPORT=spawn` 与 `spawn ARMED - the server role runs in pid N`;`--transport` 在 `--benchmark` 模式下被 runner 忽略(会静默跑成 monolith),所以传输一律用显式 `--env MOBILEGL_TRANSPORT=…`,跑完按库自己的日志核对 |
|
||||
|
||||
**主指标 = client GL 线程自身的逐线程 CPU ms/帧**(§9 的规则:内核对本 app 的 `sched_setaffinity` 请求不生效,进程总量会把两个时钟域混在一起),由设备在**尾 200 帧**上汇总;`fps` 与 wall p50/p95 并列记录,不作主指标。
|
||||
|
||||
**帧分母取自哪条日志。** `frames=` 由 `PipeStats::OnPresent` 递增,而它是 backend 的帧边界:`spawn` 下 present 在 **server 进程**被应用,所以 spawn **client 的 `frames=0 window=0`**——它一个窗口都不推进。因此费率一律除以**真正数到帧的那条日志**的 `frames=`(inproc 取 client log,spawn 取 server log,两者都是 251),**不得**除以同一行的 `window=`,那会把费率抬高 run/window(本负载约 21×),得到一个看似合理而错的数。同理:
|
||||
|
||||
- spawn client 行里的 `srv=0 srvpark=0` 与 spawn server 行里的 `cli=0 clipark=0` 都是**「另一个进程」的零,不是「从未等待」**;`srv`/`srvpark` 由 apply 线程发布进**它自己进程**的 PipeStats,`cli`/`clipark` 由 client 的发射器发布进 client 进程。
|
||||
- spawn client 的 `cli`/`clipark` 仍然可信,因为 `EmitPresent` 走 `PublishGauge`(**store 不是 add**),run total 与窗口无关;而它的窗口化字段(`draws=`、`wrec=`、`bytes[...]`、`gates[...]` 及所有 `*/f`)在同一次运行里**无效**。
|
||||
- spawn client 整轮只有 `Shutdown` 的**一条终行**(benchmark 模式)或**一条都没有**(snapshot 模式:该模式在快照完成后抛出退出,跳过 `retrace::cleanUp()` → `MobileGL::Destroy()` → `PipeStats::Shutdown()`)。
|
||||
- `* total ms` 那类**每角色运行总量**包含第 1 帧的 shader 编译(本 fixture 的帧 1 花 **7332 ms** client CPU,其余 250 帧各 7.7–8.5 ms),**不是**每帧率,不得除以 251;它跨臂差 4.5–6.7% 与传输无关,这正是主指标取「尾 200 帧的逐帧值」的原因。
|
||||
|
||||
### 12.2 门 7:配对 A/B(两会话)
|
||||
|
||||
**会话 1**(boot id `e69d0329-2264-4a2d-9b00-e1a4ffb6154d` → `107f24d3-b1f1-4a97-ab8c-9706d1901f32`):六臂交错 `monolith, inproc, spawn, inproc, monolith, spawn` × best-of-3,**18/18 runner 退出 0、36/36 pin check `PINNED`、0 `Fatal{`**,12 次 pin check 的 `cpuss-0-0` 温度 37.6–46.5 °C。
|
||||
|
||||
| 臂 | 顺序 | wall p50 ms | **client CPU p50 ms/帧** | fps | 臂内散布 |
|
||||
|---|---|---:|---:|---:|---:|
|
||||
| monolith (a) | 1 | 11.320 | **11.231** | 86.32 | 1.0% |
|
||||
| inproc (a) | 2 | 7.971 | **7.880** | 106.04 | 0.3% |
|
||||
| spawn (a) | 3 | 7.989 | **7.876** | 106.12 | 2.2% |
|
||||
| inproc (b) | 4 | 8.001 | **7.889** | 105.78 | 0.2% |
|
||||
| monolith (b) | 5 | 11.287 | **11.240** | 86.26 | 1.3% |
|
||||
| spawn (b) | 6 | 7.979 | **7.869** | 105.95 | 4.2% |
|
||||
|
||||
**会话 2**(boot id `107f24d3-b1f1-4a97-ab8c-9706d1901f32` → `7e6c6e9f-1894-4916-bf39-cce48c9abd37`):只跑 inproc / spawn 交错 `inproc, spawn, spawn, inproc` × best-of-2(聚焦门 8 ①,见 §12.3),**4/4 runner 退出 0、8/8 pin check `PINNED`、0 `Fatal{`**,温度 37.2–44.9 °C。
|
||||
|
||||
| 臂 | 顺序 | wall p50 ms | **client CPU p50 ms/帧** | fps | 臂内散布 |
|
||||
|---|---|---:|---:|---:|---:|
|
||||
| inproc | 1 | 8.105 | **7.987** | 105.72 | 0.14% |
|
||||
| spawn | 2 | 8.116 | **7.992** | 104.43 | 0.34% |
|
||||
| spawn | 3 | 8.113 | **8.009** | 104.19 | 0.26% |
|
||||
| inproc | 4 | 8.089 | **7.989** | 103.72 | 0.69% |
|
||||
|
||||
**配对差(spawn − inproc)**,两个顺序都列,不挑好看的那个:
|
||||
|
||||
| 会话 | 指标 | inproc (a / b) | spawn (a / b) | Δ(均值) | Δ% |
|
||||
|---|---|:---|:---|---:|---:|
|
||||
| 1(best-of-3) | **client CPU p50 ms/帧** | 7.880 / 7.889 | 7.876 / 7.869 | **−0.012** | **−0.15%** |
|
||||
| 1 | wall p50 ms | 7.971 / 8.001 | 7.989 / 7.979 | −0.002 | −0.03% |
|
||||
| 1 | fps | 106.04 / 105.78 | 106.12 / 105.95 | +0.125 | +0.12% |
|
||||
| 2(best-of-2) | **client CPU p50 ms/帧** | 7.987 / 7.989 | 7.992 / 8.009 | **+0.0125** | **+0.16%** |
|
||||
|
||||
**monolith 基线行**(不属配对,按协议记录):
|
||||
|
||||
| 比较 | client CPU p50 ms/帧 | Δ | fps | Δ |
|
||||
|---|---|---:|---|---:|
|
||||
| monolith → inproc | 11.236 → 7.885 | **−29.8%** | 86.29 → 105.91 | +22.7% |
|
||||
| monolith → spawn | 11.236 → 7.873 | **−29.9%** | 86.29 → 106.04 | +22.9% |
|
||||
|
||||
**判读:tie。** 会话 1 的差值(−0.15%)落在臂内散布 0.2–4.2% 之内,且 wall 列的**符号随顺序翻转**(顺序 (a) inproc 领先 0.03%、顺序 (b) spawn 领先 0.03%),这是噪声的特征而不是效应的特征;四个 inproc / spawn 臂的 client CPU p50 都落在 7.87–7.95。会话 2 在同一负载、不同构建与不同 boot 上复现了这个 tie(+0.16%,臂内散布 0.14–0.69%,差值比它取自的臂内散布低一个数量级)。两会话之间移动的是绝对水平(约 0.1 ms),那是运行间漂移,不是传输效应。**两条 transport 在 client 每帧 CPU 上不可区分,两者都比 monolith 约便宜 30%**——spawn 是通过 socket 拿到这个数的,**这条负载的分辨率看不见 socket 门铃的代价**。性能只记录,**不设门**。
|
||||
|
||||
### 12.3 门 8① socket 门铃 vs inproc condvar
|
||||
|
||||
四个计数器:`srv` / `srvpark` = apply 线程进入 `Doorbell::Wait` 的次数 / 其中停止自旋转为阻塞的次数;`cli` / `clipark` = client 生产者的同一对。**两对都是运行总量**,所以费率除以该轮运行的 `frames=251`,**不是**同一行的 `window=`(见 §12.1)。
|
||||
|
||||
**会话 2 的完整账**(这次 spawn 的 server 半边也在——见 §12.6 的修复):
|
||||
|
||||
| 臂 | 传输 | counters 取自 | frames 取自 | `cli frames=` | `srv frames=` | srv | srvpark | cli | clipark | **srv/f** | **srvpark/f** | **cli/f** | **clipark/f** |
|
||||
|---|---|---|---|---:|---:|---:|---:|---:|---:|---:|---:|---:|---:|
|
||||
| 01 | inproc | client log(同进程两角色一行) | client log | 251 | 240 | 2 869 874 | 1 341 | 30 407 | 1 444 | **11433.8** | **5.343** | **121.1** | **5.753** |
|
||||
| 02 | spawn | client(cli) + server(srv) | server log | 0 | 251 | 2 614 177 | 1 229 | 30 401 | 1 524 | **10415.0** | **4.896** | **121.1** | **6.072** |
|
||||
| 03 | spawn | client(cli) + server(srv) | server log | 0 | 251 | 2 614 456 | 1 170 | 30 401 | 1 525 | **10416.2** | **4.661** | **121.1** | **6.076** |
|
||||
| 04 | inproc | client log | client log | 251 | 240 | 3 002 771 | 1 265 | 30 407 | 1 406 | **11963.2** | **5.040** | **121.1** | **5.602** |
|
||||
|
||||
**会话 1 的账**(同一个窗口里的另一轮,spawn 的 server 半边当时**采不到**):
|
||||
|
||||
| 臂 | 传输 | srv | srvpark | cli | clipark | **srv/f** | **srvpark/f** | **cli/f** | **clipark/f** |
|
||||
|---|---|---:|---:|---:|---:|---:|---:|---:|---:|
|
||||
| inproc (a) | inproc | 2 738 247 | 1 543 | 30 407 | 1 548 | **10909.4** | **6.148** | **121.1** | **6.169** |
|
||||
| spawn (a) | spawn | **不可得** | **不可得** | 30 401 | 1 538 | — | — | **121.1** | **6.127** |
|
||||
| spawn (b) | spawn | **不可得** | **不可得** | 30 401 | 1 530 | — | — | **121.1** | **6.096** |
|
||||
| inproc (b) | inproc | 2 727 377 | 1 281 | 30 407 | 1 399 | **10866.0** | **5.103** | **121.1** | **5.574** |
|
||||
|
||||
会话 1 的 spawn 半边不可得是**结构性**的、不是漏采:spawn server 进程当时从不跑 `PipeStats::Init()`(它只从 `MobileGL::Initialize()` 调用,而 spawn server 走的是 `MG_ConfigLoader::Init()` + `MG_Backend::InitServerRoleForSpawn()`),于是该进程里所有 `PipeStats::Enabled()` 门恒为 false,**一条汇总行都没有**——不是携带 0,是整行不存在。client 日志里的 `srv=0 srvpark=0` 因此是「另一个进程」的零。**该缺陷已在工作树修好**(§12.6),会话 2 就是修后的复采。
|
||||
|
||||
**逐列读法:**
|
||||
|
||||
- **`srv/f`(server 会合率)**:inproc `10 866–11 963`,spawn `10 415–10 416`;折算成每 draw,spawn 两臂各 **7.1**,inproc 两臂 **7.8 / 8.1**(1471.36 draws/帧;会话 1 的 inproc 两臂相应是 **7.4**)。spawn 比 inproc **低 8.9–12.9%**,但这不是传输的胜利:两个计数器数的**不是同一个事件**——inproc 下 apply 线程的 `Doorbell::Wait` 同时是同地址空间内发布 client 队列排空的机制、client 在 verb barrier 后面大段同步,spawn 下同一个循环是被描述符就绪唤醒;每帧两个角色必须达成一致的次数是**handoff 纪律**的性质,不是门铃的代价。可比的是 park 比例,而它两边几乎相同。
|
||||
- **`srvpark/f`(会合真的阻塞了多少)**:会话 2 inproc 5.343 / 5.040、spawn 4.896 / 4.661;会话 1 inproc 6.148 / 5.103(spawn 不可得)。两个会话合起来即**服务端 5.0–6.2 parks/帧、其中只有 0.042–0.06% 的等待进入阻塞**(会话 2 四臂逐臂 1 341/2 869 874 = 0.047%、1 229/2 614 177 = 0.047%、1 170/2 614 456 = 0.045%、1 265/3 002 771 = 0.042%;并入会话 1 的 inproc 两臂后上界到 0.056%)。自旋预算在两条传输上几乎覆盖全部会合——P5d/P5e 的结论在这里再次成立:代价是**会合本身**,不是唤醒。
|
||||
- **`cli/f`(client 自己的等待)**:**四个臂上都是 121.1**(会话 1 的四个臂也一样,运行总量 30 401–30 407 次),逐字到十分位。client 两种传输做同样的工作,传输不改变它**多久**等一次。
|
||||
- **`clipark/f`(client 的 park)**:**唯一 socket 略差的列**——会话 2 spawn 6.07(6.072 / 6.076)对 inproc 5.75 / 5.60,每帧多约 **0.4 次 park**(~121 次等待里的 0.4 次)。client 等待的 **4.6–5.1%** 会 park,比服务端高两个数量级,因为 client 的自旋预算花在一个经常还没到的生产者上。
|
||||
- **tie 判读**:client CPU 差 **+0.16%**(会话 2)落在 0.14–0.69% 的臂内散布内,会话 1 是 −0.15%;契约 §9 那条注记(「把 ~1600 spins/帧 转成 ~4 次阻塞读,**可能更便宜**」)的观测对象正是 client CPU ms/帧,而它**两个方向都没动**。**结论是诚实的:socket 阻塞读既不更便宜、也不更贵**——该注记的「更便宜」未兑现。注记里的 1600 spins/帧 是更重场景的数,本机 rd12 的参照是服务端 ~10 400–12 000 次会合/帧、client 121 次/帧;park 比例 0.042–0.06%(服务端)与 4.6–5.1%(client)也说明本场景的自旋几乎全都奏效。
|
||||
- 两条传输**都比 monolith 约便宜 30%**(§12.2),spawn 走的是一条 socket 而不是共享地址空间。
|
||||
|
||||
### 12.4 门 8②③:`SEG_STAGE` 字节/帧、分块后记录/帧、`maxrec` 与逐 blob 分布
|
||||
|
||||
口径:`MOBILEGL_PIPE_STATS=1` + `MOBILEGL_PIPE_STATS_PERIOD=1`(每个 `eglSwapBuffers` 一行,`window=1` 恰一帧),车道 = inproc + `MOBILEGL_IPC_ROLE_SPLIT_STATE=1` + `MOBILEGL_IPC_STRICT_ERRORS=1` + `MOBILEGL_IPC_RUN_AHEAD=1`,后端 DirectGLES,真实 trace retrace。两个负载:**OpenRA**(`MobileGLTraceReplay.OpenRA.DirectGLES.SPLIT`,SSIM **1.000000**)与 **rd12-odinlite-in-world**(无 SPLIT ctest 条目,按同一命令行手工驱动,SSIM **0.999998**)。新增的两个计数器都落在**唯一的收口点**上:`SEG_STAGE` 字节记在 stage 分配器(`MobileGL/MG_Remote/Wire/PipeWireCodec.cpp:878`,`StageAllocate`),记录数记在记录提交路径(`MobileGL/MG_Remote/Wire/PipeWireCodec.cpp:1188`,`EncodeRecord` 成功路径)——所以覆盖是构造性的,不是一张「今天有哪些 producer」的名单。(两处行号取 §12.6 收尾改动后的工作树内容。)这两个数在 **inproc 车道**采集;spawn 下 client 的字节 / 记录类同样在采(它们由 client 的发射器 Add,run total 可信),但 spawn 的**服务端**字节 / 记录类要等 §12.6 的 `ServerMain.cpp` 修复之后才存在。
|
||||
|
||||
**framing 警告(两个读数都报)**:`PERIOD=1` 下**第一行覆盖整个启动 / 加载窗**——rd12 的帧 1 有 **981 654 draws**、5 053 895 条记录、`seg=2 317 939 359`,而其余每帧只有约 1 471 draws。所以「窗口求和 / 帧数」是**含加载的均值**;报这个数时必须说清是哪个口径。rd12 的加载窗把 run-wide 均值抬到稳态均值的**约 7 倍**(10.79 vs 1.53 MB/帧);OpenRA 两个值接近(8.07 vs 8.01 MB/帧)是因为它的加载窗与稳态窗同量级。
|
||||
|
||||
| 口径 | OpenRA | rd12 in-world |
|
||||
|---|---:|---:|
|
||||
| **`SEG_STAGE` 字节/帧——稳态中位数** | **130.8 KB/帧**(130 848 B) | **816.2 KB/帧**(816 248 B) |
|
||||
| **`SEG_STAGE` 字节/帧——稳态均值**(丢弃前 10% 窗) | **8.01 MB/帧**(8 012 890 B) | **1.53 MB/帧**(1 534 555 B) |
|
||||
| `SEG_STAGE` 字节/帧——含启动负载的均值 | 8.07 MB/帧(8 068 255 B) | 10.79 MB/帧(10 792 107 B) |
|
||||
| **记录/帧(分块后)——稳态中位数** | **211** | **7 497** |
|
||||
| **记录/帧(分块后)——稳态均值** | **206** | **7 504** |
|
||||
| 记录/帧——含启动负载的均值 | 196.8 | 27 689.5 |
|
||||
| 参考:`draws` 稳态中位数 | 30 | 1 471 |
|
||||
| `maxrec` / `maxcap`(运行总量) | 1808 B / 4 194 304 B(0.043%) | 1808 B / 4 194 304 B(0.043%) |
|
||||
| 运行总量 `seg` / `wrec`(帧数) | 233 979 394 / 5 706(29 帧) | 2 698 026 763 / 6 922 378(250 帧) |
|
||||
| `ringwraps` / `ringpads` / `ringwaits` | 0 / 0 / 0 | 61 / 53 / 0 |
|
||||
|
||||
读法:
|
||||
|
||||
- **两个负载的稳态形状完全不同,这正是必须分开报的理由**:OpenRA 稳态的 `tex` 中位数是 32 768 B 而均值 5.6 MB(少数窗有巨大的纹理上传尖峰),`seg` 的中位数 / 均值因此差 **61×**;rd12 稳态的 `tex` 中位数为 0(多数帧不上传纹理),差 **1.9×**。只报一个数就会掩盖另一个负载的形状。按本文件同类数字的惯例,稳态中位数与稳态均值这对都列出来。
|
||||
- **`maxrec=1808` 与分块前完全相同,原因不是「分块没生效」而是「分块没有机会生效」**:默认 8 MiB chunk 预算(`MGPipeStageChunkBytes()` = `clamp(segment/4, 4096, segment)`,默认 32 MiB → 8 MiB)在这两条负载上从未被打到,所有 blob 都是原始尺寸。稳态 `seg/wrec ≈ 816 248/7 497 ≈ 109 B/条`,与全局的 390 B/条都在字节级别。§6.3 记的分块前 `maxrec=1808` / `SetVertexAttribDefaults` 因此原样成立;`ringwaits=0`(250 帧一次都没等过 retiredSeq)与 rd12 稳态 `seg` 中位数对 32 MiB 的 `SEG_STAGE` 约 40 帧余量一致。
|
||||
- **`wrec` 是窗口计数**(`PERIOD=1` 下每窗恰一帧,所以 `wrec` 与 `wrec/f` 同值),且 `PERIOD=1` 每帧印一行 INFO 本身有可观开销——**这些帧数不能当性能数**,只用于按帧摊平字节与记录。
|
||||
- **交叉核对(能排除什么、不能排除什么)**:`seg` 记 wire 写进 `SEG_STAGE` 的字节,后端的 `buf`/`tex`/`csob-blob` 记往驱动搬的字节,两个总体不同、不要求相等,但应在同一量级且同步起伏。逐窗(250 窗)比对:`seg` 中位数 818 030 / 均值 10 792 107,`parts`(= buf+tex+csob-blob)中位数 291 840 / 均值 3 978 204,均值比值 2.713,每条记录 389.8 B;两者在同一些窗一起抬升、同一些窗一起落底,没有出现「一个动另一个不动」的窗。比值 > 1 有解释(`seg` 稳态恒有 `csob-blob ≈ 281 KB/帧` 的 program archive 只走 wire 不经后端字节类,加上 persistent-map 推送与 tail 字节)。这**不能证明覆盖完整**(没有第三方真值),能排除的是「`seg` 明显偏离同一批字节」这一整类错误。
|
||||
- **逐 blob 字节分布的首次测量**:答案是「默认配置下该分布就是未分块的原始分布」。取数车道是 **integration**(`ctest -R "^DirectGLES\.(Arena|Ssbo|Buffer|Atomic|Readback)"`,19/19 通过),经 `MOBILEGL_PIPE_STATS_FILE` 的 JSON dump——**retrace 车道拿不到 dump**,因为 snapshot 模式在快照完成后抛出退出、跳过了 `retrace::cleanUp()` → `MobileGL::Destroy()` → `PipeStats::Shutdown()`(§12.1),所以 dump 只能在 benchmark 模式或 integration 车道取。该 dump:**70 records**、`seg=5768 B`,直方图复用了 draw payload 的桶边界(bucket 0 = 0 字节,bucket n>0 = [2^(n-1), 2^n))。**这里有两个不同的计数,必须写清,否则会被读成同一个数**:**非空 bucket 数 = 8**(落在 bucket 3–12),**blob 条数 = 12**;也就是说「**8 blobs / bucket 3–12**」这句简写里的 8 指的是**有内容的桶数**,而逐桶计数合计是 12 条 blob。逐桶:bucket 3 [4,8) 4 条、4 [8,16) 1 条、5 [16,32) 2 条、7 [64,128) 1 条、9 [256,512) 1 条、10 [512,1024) 1 条、11 [1024,2048) 1 条、12 [2048,4096) 1 条(4+1+2+1+1+1+1+1 = 12)。这批 integration 用例的 `frames=0`(跑 swap 但不走 Present 计数),所以窗口字段无意义,分布本身是**运行总量**(分布没有「窗口」可言)。
|
||||
|
||||
### 12.5 负控:`MOBILEGL_IPC_STAGE_MB=1`(256 KiB chunk 预算)
|
||||
|
||||
要让分块真正发生,唯一的办法是把 stage 预算人为压小;同一条 rd12 trace、同一个库、只改这一个环境变量的 A/B:
|
||||
|
||||
| rd12 in-world,inproc split | `STAGE_MB=32`(chunk 8 MiB) | `STAGE_MB=1`(chunk 256 KiB) | 变化 |
|
||||
|---|---:|---:|---|
|
||||
| SSIM | 0.999998213 | 0.999998213 | 不变 |
|
||||
| **`seg` 运行总量** | **2 698 026 763** | **2 698 026 763** | **逐字节完全一致** |
|
||||
| `seg` 稳态中位数 | 816 248 | 554 104 | −32% |
|
||||
| **`wrec` 运行总量** | 6 922 378 | 6 929 736 | +7 358(**+0.11%**) |
|
||||
| `wrec` 稳态中位数 / 均值 | 7 497 / 7 504 | 7 497 / 7 508 | +0.05% |
|
||||
| `tex` 运行总量 | 641 567 296 | 1 886 392 128 | **+194%** |
|
||||
| `buf` / `csob-blob` / `draws` | 见 §12.4 | 与 `STAGE_MB=32` 逐项相同 | 不变 |
|
||||
| `maxrec` / `maxcap` / `ringwraps` / `ringpads` | 1808 / 4 194 304 / 61 / 53 | 同左 | 不变 |
|
||||
|
||||
这是**它自己那个问题的负结果,如实记录**:
|
||||
|
||||
- **`seg` 运行总量两侧逐字节相同**说明该计数器测的是**生产者交出来的内容**,与发射侧怎么切、arena 开多大**完全无关**——这正是把落点放在唯一收口点的直接证据:若记在 emitter 侧或记成 arena 占用,这一行就会跟着预算动。
|
||||
- **稳态中位数 −32% 与运行总量不变同时成立**:同样的总字节被**重新分到不同的窗口**(预算变小后,原本一次完成的上传被切成多次、跨帧重传),所以**逐窗归属会动、总量不会**。读数应以运行总量或明确声明的窗口口径比较,**不要**拿两套配置的单窗中位数直接对比。
|
||||
- **`wrec` 只涨 0.11%**(+7 358 条 / 250 帧 ≈ +29 条/帧,稳态中位数两侧相同)说明这条 trace 的内容本来就没有超过 256 KiB 的 blob,即使预算压到 256 KiB 也几乎无可切;`maxrec` 仍是 1808,第三次确认(`maxrec` 是单条**记录**的字节上界,blob 被切不改变它)。
|
||||
- **`tex` +194% 是这次 A/B 真正的发现,但不作结论**:`MOBILEGL_IPC_STAGE_MB` 同时是 **arena 大小**与 chunk 预算的来源,压小它改变了纹理 slab 的切分与重传行为(整宽 slab 被预算切碎后每片各自重传)。这一项**不在门 8 的定义里**,且**没有隔离到单变量**(arena 大小与 chunk 预算被同一个环境变量绑在一起),因此只作为 A/B 的可解释性证据记录,**不作结论**;要分开这两个效应需要把二者拆成可独立配置的量,那是另一个包的事。
|
||||
- 因此门 8 的「chunking 后记录/帧」取**默认配置**的 §12.4 值。
|
||||
|
||||
### 12.6 支撑本节的收尾代码与工具(工作树,未提交)
|
||||
|
||||
| 改动 | 位置 | 内容与证据 |
|
||||
|---|---|---|
|
||||
| 新计数器 `ByteClass::StageSegmentBytes` | `MobileGL/MG_Remote/Wire/PipeWireCodec.cpp:878`(`StageAllocate`) | stage 分配器的**唯一收口**;摘要行 `bytes/f[...]` 里印 `seg=` |
|
||||
| 新计数器 `CallClass::WireRecords` | `MobileGL/MG_Remote/Wire/PipeWireCodec.cpp:1188`(`EncodeRecord` 提交路径) | 记录提交路径的**唯一收口**(`Reserve` 成功、正文写完、blob 槽诚实性检查之后、`++m_emitSeq` 之前);摘要行印 `wrec=` 与 `wrec/f=`,与 `draws/f=` 同形、按 `perFrame` 规则联动 |
|
||||
| staged-blob 直方图 | `MobileGL/MG_Util/Metrics/PipeStats.{h,cpp}` | 复用 `PayloadBucketOf` 的桶边界,**运行总量**,经 JSON dump 出口(Tracy 画不了分布,与既有 `cmd-bytes-per-draw-histogram` 的选择一致) |
|
||||
| spawn server 进程从未武装计数器 | `MobileGL/MG_Remote/Server/ServerMain.cpp`,`PipeStats::Init()` 加在 `MG_ConfigLoader::Init()` 与 `MGPipeSetServerProcessRole(true)` **之后**,配一行 `Shutdown()` 在 `loop.Stop()` 之后、`_exit(0)` 之前 | **红一次**:修复前 spawn server 在 `mobilegl.server.log` 里 **0 条**汇总行,修复后 **29 条**;SSIM 1.0 不变。三处顺序都是承重的:`Init()` 从 config latch 该开关(必须晚于配置解析)、晚于定角色(让汇总行进 server 角色日志)、`Shutdown()` 晚于 `loop.Stop()`(apply 线程正是发布 `srv`/`srvpark` 的线程) |
|
||||
| `MOBILEGL_PIPE_STATS_FILE` 的角色分路 | `MobileGL/MG_Util/{Metrics/PipeStats.cpp,Debug/Log.{h,cpp}}` | 走 `RoleLogPath` **同一套导出规则**派生成 `<base>.client.json` / `<base>.server.json`;**基名不再指向任何文件**(没改的读取方会当场 `ENOENT`,这是刻意的)。G1 上这里红过三次(无条件派生 → `.text +24 B`;两臂共用一个局部 → 1 symbol resized;重写 `MGLOG_W` 格式串 → `.rodata +64 B`),最终形态是 pull 臂的代码**逐语句原样**、所有新增都在 `#if` 之内 |
|
||||
| 测试 | `MobileGL/MG_Test/Util/PipeStatsTest.cpp` 等 | PipeStats **25/25**;全量 unit **2367/2367**;spawn integration **102/102**;**G1 符号 0/0/0/0 且 `.text` 逐字节相同**(强于门要求的 `+0`),pull 构建零 `MG_Remote` 符号、零新计数器符号 |
|
||||
| 设备 A/B 工具入库 | `tools/device_bench/p6/{ab_session.py,render_ab.py,README.md}` | 采集(reboot / pin / 按序跑臂 / 逐线程 CPU 采样 / 按角色拉日志 / 臂的证明)与渲染(`session-summary.json` → 表格)分离,渲染器只读采集结果,不能影响采集;`spawn` 的两个结构性零(`srv` 与 `frames` 在 server 日志)由渲染器处理并**在表里标明取自哪条日志** |
|
||||
| runner 的包名覆盖 | `tools/trace_replay/run_android_retrace_local.py`(+19 行) | `MOBILEGL_TRACE_PACKAGE`;一台机器上已有另一个 key 签的 trace 安装(两个不同 key 签的 APK 不能共用一个 id),所以门 7 / 门 8 的 APK 装成 `top.mobilegl.plugin.p6gate7.trace` / `.p6gate8.trace` 并与既有安装并存,runner 的包名常量由此覆盖;既有安装原样保留 |
|
||||
| `pin_device.sh` 的 `2f7cbe2e` 行 | `tools/device_bench/pin_device.sh`(+28 行) | 定频路径 + kgsl 节点 + GPU 钳 1050 MHz 的实测值(§12.7);三个动作(`check` / `pin` / `unpin`)都实跑过,pin 在负载下保持、在 idle 下 90 s 稳定,stock 值是硬编码而非现场采样(否则会把已钉的状态读成 stock 并永久钉住) |
|
||||
|
||||
### 12.7 不可比项与未跑项
|
||||
|
||||
- **本板 GPU 钳 1050 MHz。** `pin_device.sh` 的 `2f7cbe2e` 行把 kgsl `min/max_pwrlevel` 钉 0,但本板实际拿到的是 **1050000000 Hz(1050 MHz)**:`thermal_pwrlevel` 恒为 1(写 0 返回成功、读回仍是 1),`max_gpuclk` 只读且为 1050000000,devfreq 的 `max_freq` 也把 1100000000 的写夹下来。所以这一行记的是「**本板真正能跑到的最高频**」,不是顶端 OPP,`check` 对着真相比对。**后果**:本节的绝对时间与 **1100 MHz 时代**的 `35d0befa` 行(§3.2 / §4.4)**不可比**,与 §7.4 那一轮 Redmi 的 1100 MHz 口径也不可比——钟频不同,**只有同场配对可比**,本节的配对结论也只在这个意义下成立。
|
||||
- **OpenRA 真机辅负载未跑。** 门 7 / 门 8 的真机会话只跑 `minecraft-1.21.4-rd12-odinlite-in-world`,OpenRA 只在 WSL 桌面 llvmpipe 的 retrace 车道跑过(§12.4 的两个数之一)。**真机 OpenRA 未跑**,如实记录。
|
||||
- **门 8① 的两种门铃只在一条负载、一台设备上比过**,且参照注记里的 1600 spins/帧 属于更重的场景;若存在差异,应在每帧会合次数更多的负载上才看得见。
|
||||
- **spawn client 的窗口化字段仍不可信**,而且这一项是**结构**不是缺陷:要让 spawn client 推进窗口,得让 client 进程到达一次 `PipeStats::OnPresent`,而 client 的帧边界在 spawn 下是 `EmitPresent`(每条 present 记录一次)——接上去会与 backend 的帧边界重复计数。**不要顺手接**。
|
||||
- **`MOBILEGL_IPC_STAGE_MB` 同时是 arena 大小与 chunk 预算的来源**,所以分块的净效果没有被单变量隔离(§12.5 的 `tex` +194%)。
|
||||
|
||||
## 里程碑记录(原 `ROADMAP.md`)
|
||||
|
||||
- **P6 收官(2026-09-22)**:a6/c6/lk/so/sm/cp/hs/dl/st/t6 十包于 2026-09-21 合入 `feat/disaggregated`(头 `77cbd176`);三种传输(monolith/inproc/spawn)桌面与真机两进程 retrace 逐像素对上 golden;device-lost 闩把杀 server 从 123 s 错误 `BarrierTimeout` 变 5.7 s 正确 `DEVICE LOST`;`Session::Fail` 漏斗把裸 abort 93→4。出口门 1–6 ✅;**门 7 / 8 于 2026-09-22 采齐**:真机 reboot-clean 同热窗口配对 A/B 六臂 18/18 runner 退出 0、36/36 `PINNED`、0 `Fatal`,inproc vs spawn 的 client CPU p50 差 −0.15%(第二会话 +0.16%)——**判读 tie**(臂内散布 0.2–4.2%),monolith 基线约贵 30%;门 8 三数齐(门铃 A/B tie、`SEG_STAGE` 字节/帧、分块后记录/帧);G1 符号 0/0/0/0 且 `.text` 逐字节相同。**P6 就此收官,未设性能门**(只记录)。逐项见 `CURRENT_STAGE_PROGRESS.md`。
|
||||
|
||||
## 本目录
|
||||
|
||||
| 文件 | 内容 |
|
||||
|---|---|
|
||||
| [`a6-audit-rows.md`](a6-audit-rows.md) | a6 审计 — 全部行 |
|
||||
| [`a6-audit-v1.md`](a6-audit-v1.md) | a6-audit-v1 — spawn 之前,进程/角色边界还差什么 |
|
||||
| [`a6-link-experiment-data.md`](a6-link-experiment-data.md) | a6 item 5 - link experiment raw data |
|
||||
| [`a6-link-experiment.md`](a6-link-experiment.md) | a6 第 5 项:server 能否不链 `MG_Impl`——实验结果 |
|
||||
| [`census-classC.md`](census-classC.md) | P6 class-C dynamic census |
|
||||
| [`docs-closeout-measurements.md`](docs-closeout-measurements.md) | docs-closeout-measurements — P6 收官事实写入 `MEASUREMENTS.md` |
|
||||
| [`docs-closeout-progress.md`](docs-closeout-progress.md) | docs-closeout-progress — `CURRENT_STAGE_PROGRESS.md` 的 P6 收官写入报告 |
|
||||
| [`docs-closeout-roadmap.md`](docs-closeout-roadmap.md) | P6 收官事实写入 `ROADMAP.md` —— 改动报告 |
|
||||
| [`gate7-device-ab.md`](gate7-device-ab.md) | Gate 7 — Redmi `2f7cbe2e` paired A/B, and gate 8 item 1 (the doorbell) |
|
||||
| [`gate8-doorbell-device.md`](gate8-doorbell-device.md) | Gate 8 item ① — the doorbell, measured on the device (server half included) |
|
||||
| [`gate8-wire-counters.md`](gate8-wire-counters.md) | gate8-wire-counters — 门 8 的两个 wire 计数器、首采,与 spawn server 侧的 wait 账 |
|
||||
| [`git-worktree-fix.md`](git-worktree-fix.md) | MobileGL-disagg worktree:git 修好报告 |
|
||||
| [`lk-itemisation.md`](lk-itemisation.md) | lk — 开工前的逐文件清单 |
|
||||
| [`P6-CONTRACT-DRAFT.md`](P6-CONTRACT-DRAFT.md) | CONTRACT-P6 (DRAFT) — the backend runs in a second process |
|
||||
| [`P6-ENDSTATE-REVIEW.md`](P6-ENDSTATE-REVIEW.md) | P6 重审:面向 gfxstream 形状的终局 |
|
||||
| [`P6-SPAWN-PLAN.md`](P6-SPAWN-PLAN.md) | P6 spawn transport — 包计划 |
|
||||
@@ -0,0 +1,336 @@
|
||||
# a6 审计 — 全部行
|
||||
> 头 `b3b9c2ee`。七项各由一个审计 agent 产出、一个对抗复审 agent 逐条重新解析 `file:line`。
|
||||
> `复审` 列:空 = 复审确认;其余 = 复审的异议与更正,**以复审为准**。
|
||||
> 汇总与结论见 [`a6-audit-v1.md`](a6-audit-v1.md);第 5 项链接实验见 [`a6-link-experiment.md`](a6-link-experiment.md)。
|
||||
|
||||
---
|
||||
|
||||
## a6.1 裸指针 / 进程局部句柄
|
||||
**小结**:I opened every site below at b3b9c2ee. The honest headline is that the *byte-carrying* families are closed: `MGHostSpan::Ptr` is written non-null nowhere in the tree (the single producer, WireTables.cpp:603-607, writes nullptr explicitly), every `MGPBlobRef` that could hold a host address is caught at the ENCODER by CheckBlobIsHonest whose BlobSlotsFor table covers all eleven blobref members in MGPipeTypes.h, the only blobref resolve outside the codec (ResourceTracker.h:598-618) is a bounds-checked read of the client's own SEG_EVENT mapping, the reverse producers copy payload into SEG_EVENT rather than shipping pointers, MapPersistent declines by ruling, and the sixteen FATAL PipeInputs rows make every server read of a frontend pointer a named abort. What is NOT closed is *identity*: EGL display/surface/context still cross as bit-cast host pointers (ServerLoop.cpp:838-846 `TokenFromHandle`/`HandleFromToken`, consumed at :908-946), `nativeToken` is an `ANativeWindow*`/HWND as an integer, and the wire path that would refuse them (`ServerApplyWireSurfaceOp`) has **no production caller at all** - the live inproc path never reaches it. The single thing c6 most needs from this item is the answer to its own PENDING question: forcing `MG_Config::Transport = Monolith` in the child is **not** safe, because 151 sites in MG_Backend alone (208 tree-wide) select their server-role arm on `Transport != Monolith`, and flipping them selects frontend glue that does not exist in a second process. The anti-recursion control must be a separate flag from the role selector. Second-most important: `MGPipeServerBlockNoteIdentity()` is gated on the `MOBILEGL_IPC_ROLE_SPLIT_STATE` knob (default false), so under spawn with the knob off the server block's `ContextIdentity()` stays nullptr and DirectGLES' fb-slot memo reads that as a cache HIT against its own nullptr initialiser - an unnamed null-slot crash where the comment at PipeInputs.h:878-884 says a named one was intended. Third: the server cannot link without MG_Impl today - `PipeInputs::IsLive()` and the seven F-class forwarders live in MG_Impl/Pipe/PipeFill.cpp:2135-2230, and both role-refusal helpers live in MG_Impl/Pipe/SlotAllocator.cpp:29-57, so dropping MG_Impl from the server image drops the guards with it.
|
||||
|
||||
复审结论:**sound-with-fixes**(重新解析 25 条,异议 13 条,另指出 6 处遗漏)
|
||||
|
||||
| # | 判定 | 事实 | 站点 | spawn 下如何坏 | 守卫 | 归属 | 复审 |
|
||||
|---|---|---|---|---|---|---|---|
|
||||
| A1-1 | already-handled | MGHostSpan::Ptr - the one pointer field on the wire. Verified: NO site in the tree ever assigns it a non-null value. | MobileGL/MG_Pipe/MGPipeHostSpan.h:32 (struct MGHostSpan); MobileGL/MG_Remote/Client/WireTables.cpp:603-607 (Wire_Escape_SetProgramBindings - the only producer, writes `entry.Name.Ptr = nullptr` explicitly); MobileGL/MG_Impl/Pipe/ProgramEmit.h:336 (`MGPProgramStorageOverride entry{};` - the monolith producer value-initialises it) | Nothing. There is no non-null Ptr to break. I grepped every `.Ptr =` and `Ptr = ` in the tree outside MG_Test: the only assignment is the nullptr one. | CheckHostSpanIsHonest arm 1, PipeWireCodec.cpp:527-533, Fatal{ProtocolCorruption,"host-span"} on Ptr != nullptr - run at | a6 | |
|
||||
| A1-2 | already-handled | Host spans ARE emitted today - exactly one family. The audit asked; the answer is yes, not zero. MGPProgramStorageOverride::Name is an MGHostSpan and set_program_bindings (opcode 80) emits one per storage-block override. | MobileGL/MG_Pipe/MGPipeTypes.h:1062-1067 (`MGHostSpan Name; // the block name, NUL included, staged whole`); MobileGL/MG_Pipe/PipeCalls.def:340 (`SetProgramBindings ... kVarTail/kHostSpan`); MobileGL/MG_Remote/Client/WireTables.cpp:589-607 (stages each name, fills the span); MobileGL/MG_Remote/Wire/PipeWireCodec.cpp:1946-1975 (decoder resolves each) | Nothing in this row by itself - the span is already fully wire-shaped. It matters because it falsifies the standing claim that P5 emits zero host spans, so every host-span guard is LIVE code with real traffic rather than latent P8 code. | CheckHostSpanIsHonest(span, segments) at the decoder, PipeWireCodec.cpp:1954; plus the NUL-termination check at :1955-19 | a6 | |
|
||||
| A1-3 | p6-must-handle | The ENCODER's blanket host-span honesty pass does not cover set_program_bindings' spans. It requires `layout.TailCount == 2 && layout.SecondTailIsHostSpans`; set_program_bindings has THREE tails and SecondTailIsHostSpans is deliberately false, so the only check on those spans runs at the decoder. | MobileGL/MG_Remote/Wire/PipeWireCodec.cpp:1144-1155 (the encoder pass and its two conditions); :717-722 (`// NOT SecondTailIsHostSpans: the spans are MEMBERS of the third tail's elements`); :1946-1954 (the decoder-side per-element check that does fire) | A malformed override span is refused in the SERVER process. The client sees the peer die and takes the device-lost latch; the operator gets a server-side Fatal naming a record the client produced, and the producing call stack is in the other process. It is a diagnosis loss, not a correctness loss. | partial - decoder-only (PipeWireCodec.cpp:1954). No encoder-side arm. | c6 | |
|
||||
| A1-4 | no-action | kDrawHasUserIndices is set by NO emitter in the tree, so MGPipeHostBytes - the only consumer of gMGPipeSegmentResolver - is unreachable today. | MobileGL/MG_Pipe/MGPipeHostSpan.h:50-56 (MGPipeHostBytes); MobileGL/MG_Remote/Server/PipeApplier.cpp:743 (the ONE caller); MobileGL/MG_Remote/Client/EmitTables.cpp:1916-1918 and :411 ("NO kDrawHasUserIndices: the reduced path draws from a VBO"); MobileGL/MG_Impl/Pipe/OwnedDrawInputs.h:51 (clears the bit) | Nothing, and it would still be correct if it did fire: gMGPipeSegmentResolver is installed in the SERVER process by ServerSession::Accept, so a span resolved there names the server's own mapping of SEG_STAGE. This is the family that is genuinely finished. | CheckHostSpanIsHonest arm 4 (segment-range, PipeWireCodec.cpp:543-563) plus PipeApplier.cpp:745-750's null-resolve Fatal | P8 | |
|
||||
| A1-5 | already-handled | MGPBlobRef carrying a raw host address: the monolith emitters still write one into Blob.Offset, and the split emitters overwrite it. The encoder catches any that is not overwritten. | MobileGL/MG_Impl/Pipe/ProgramEmit.h:227 (`Blob.Offset = reinterpret_cast<Uint64>(program->GetUBOData())`), :434, :438; MobileGL/MG_Impl/Pipe/TextureEmit.h:1458-1459, :1511, :1529; MobileGL/MG_Impl/Pipe/VertexInputEmit.h:409-411 (Seg=None with a NON-ZERO Size); guard at MobileGL/MG_Remote/Wire/PipeWireCodec.cpp:488-500 and the encoder pass at :1122-1127 | Nothing new. The failure mode is identical to inproc and already aborts on the producing side, which is the process that can name the call site. | CheckBlobIsHonest, PipeWireCodec.cpp:459-512, called for every blob slot of every emitted record at :1123-1127 | a6 | **line-does-not-resolve** — Re-cite (a) as VertexInputEmit.h:410-412 and (b) as PipeWireCodec.cpp:456-475 for the two named arms (and note :495-505 as a THIRD arm - 'a content blob that names any segment but SEG_STAGE' - which t |
|
||||
| A1-6 | later-stage | BlobSlotsFor is the coverage of the encoder's blob guard. I enumerated every MGPBlobRef member in MGPipeTypes.h (11: MGPCaps x2, MGPRenderStateDesc, MGPDynamicState, MGPVertexElements, MGPSamplerDesc, MGPProgramDesc Spirv[6]+Reflection, MGPGlobalConstants, MGPResidualValueState, MGPSubData, MGPStorageBlockBinding) against the table. Coverage is complete. | MobileGL/MG_Remote/Wire/PipeWireCodec.cpp:303-330 (BlobSlotsFor); MobileGL/MG_Pipe/MGPipeTypes.h:174,175,476,501,531,541,636,1096,1195,1292,1797 (every blobref member) | Nothing today. The standing hazard is append-only growth: a new record type with a blobref that nobody adds to this switch gets no encoder check, and under spawn the resulting Fatal lands in the peer process. | none for the table itself - there is no static_assert or generator tie between MGPipeTypes.h's blob members and this swi | P7 | |
|
||||
| A1-7 | already-handled | MGPBlobRef resolved to an address OUTSIDE the codec: exactly one site in the tree - the client's writeback consumer resolving kSegEvent through ClientSession::Segments(). | MobileGL/MG_Impl/Pipe/ResourceTracker.h:598-618 (the kSegEvent arm, `session->Segments().Resolve(kSegEvent, bytes.Offset, bytes.Size)`); producer side MobileGL/MG_Remote/Client/ClientSession.cpp:285-300 (`blob.Offset = events.OffsetInSegment(bytes)`); the Seg==None arm's transport refusal at ResourceTracker.h:583-592 | Nothing, PROVIDED the spawn client maps SEG_EVENT and installs it at ClientSession.cpp:663-665 exactly as AttachInProcess does today. If the adopt path maps only three of the four segments, Resolve answers nullptr and the site aborts by name - which is the correct failure, not a silent one. | ResourceTracker.h:583-592 (Seg==None under transport) and :607-616 (out-of-segment run); both Fatal{ProtocolCorruption} | so | **line-does-not-resolve** — Re-cite as ClientSession.cpp:654-662 (all four Installs; SEG_EVENT at :660-662). Verdict already-handled / phase so unchanged and correct - the precondition 'spawn's adopt must map all four slots' is |
|
||||
| A1-8 | already-handled | gMGPipeSegmentResolver - one plain non-atomic inline variable per process, installed by the SERVER role only, via a file-static table pointer. | MobileGL/MG_Pipe/MGPipeHostSpan.h:47; MobileGL/MG_Remote/Wire/PipeWireCodec.cpp:348-355 (g_processResolverTable + ProcessResolverThunk), :428-449 (Install/Uninstall); installed at MobileGL/MG_Remote/Server/ServerSession.cpp:566, uninstalled at :665; the client explicitly does NOT install (ClientSession.cpp:645-665) | Nothing - it becomes trivially correct. In the server process the server installs it; in the client process it stays nullptr and nothing calls MGPipeHostBytes. The double-install Fatal loses its reason to exist but stays harmless. Note for c6: PipeCatalogueTest.cpp:1122 asserts it is nullptr, which stays true in a client process and stays false in a server one - the test's home moves. | WireProtocolFatal at PipeWireCodec.cpp:434-438 | a6 | |
|
||||
| A1-9 | already-handled | gMGPipeCallbacks - ten function pointers at namespace scope. Four are installed by ServerSession::Accept as PRODUCERS; the client's installer is monolith-gated; six entries have no caller at all. | MobileGL/MG_Pipe/MGPipeCallbacks.h:61 (the global); MobileGL/MG_Remote/Server/ServerSession.cpp:575-580 (installs OnGlError/OnBufferWriteback/OnGpuWritten/OnSurfaceChanged), :666-678 (releases only its own); MobileGL/MG_Impl/Pipe/ResourceTracker.h:679-695 (client installer) gated at MobileGL/MG_Impl/Pipe/PipeFill.cpp:866-869 | Nothing. Each process gets its own copy of the inline variable: the server's holds its four producers, the client's stays all-null and its consumers are called BY NAME from DrainEventRing (ClientSession.cpp:266-300), never through the table. What the producers hand the wire is a COPY: ServerOnBufferWriteback memcpys the backend's mapped bytes into SEG_EVENT (ServerSession.cpp:299-303) and ServerOnSurfaceChanged copies MGPSurfaceInfo field by field (:332-341). No host pointer reaches the ring. | ServerSession.cpp:356-366 and ResourceTracker.h:680-690, both Fatal{RoleViolation}; plus MGPipeAnnounceBufferGpuWritten' | a6 | |
|
||||
| A1-10 | blocks-p6 | EGLDisplay / EGLSurface / EGLContext cross as bit-cast host pointers. TokenFromHandle is `reinterpret_cast<uintptr_t>` and HandleFromToken is its inverse; the frame's display/surface/readSurface/context are those bits. | MobileGL/MG_Remote/Server/ServerLoop.cpp:838-846 (TokenFromHandle / HandleFromToken); posted at :1063-1066, :1078-1082, :1107-1119, :1123-1128, :1139-1143; consumed at :908-909, :915, :923, :928, :943-946; field declarations at MobileGL/MG_Remote/Server/SurfaceControlFrame.h:72-76 | HandleFromToken<EGLDisplay>(frame.display) hands the server's eglInitialize a pointer from the CLIENT process's EGL. There is no check: it is a reinterpret_cast into a driver call. Best case EGL_BAD_DISPLAY, worst case an address that happens to be mapped in the server. Every one of the five ops above is affected. | none. The only range check on the frame is WindowBackendFromFrameValue (ServerLoop.cpp:872-882), which validates the bac | cp | **line-does-not-resolve** — Re-cite as ServerLoop.cpp:839-848 (the pair), SurfaceControlFrame.h:75-78 (the four token fields), ServerLoop.cpp:864-873 (WindowBackendFromFrameValue). Verdict blocks-p6 / phase cp unchanged and corr |
|
||||
| A1-11 | blocks-p6 | SurfaceControlFrame::nativeToken is `ANativeWindow*` / HWND / XID as an integer. | MobileGL/MG_Remote/Server/SurfaceControlFrame.h:78 (`Uint64 nativeToken = 0; // HWND / XID / ANativeWindow* as an integer`); packed at MobileGL/MG_Remote/Server/ServerLoop.cpp:864-869 (PackWindowHandle -> TokenFromHandle(handle.Handle)); unpacked at :876-881 into a WindowHandle handed to CreateEGLWindowSurface (:915) and SetWindowHandle; source type MobileGL/MG_Backend/BackendObject.h:579-584 (`void* Handle`) | A window surface created from a client-process ANativeWindow* in the server process. The named refusal for exactly this exists - SurfaceWireError::AndroidNativeWindowArrived -> Fatal{UnmigratedSurface,"AndroidNativeWindow@P12"} - but it lives on the wire decode path, which nothing calls (see A1-12). On the live frame path there is no refusal at all. | exists but unreachable: MobileGL/MG_Remote/Protocol/SurfaceOpCodec.cpp:157-166 (decode) and :197-215 (the Fatal) | cp | **line-does-not-resolve** — Re-cite as: SurfaceControlFrame.h:83 (the field); ServerLoop.cpp:853-858 (PackWindowHandle, the pack at :855); :875-882 (UnpackWindowHandle, the unpack at :878); :915 (handed to CreateEGLWindowSurface |
|
||||
| A1-12 | p6-must-handle | The wire surface-op codec - the half that carries every named process-local refusal - has NO production caller. `ServerApplyWireSurfaceOp` and `EncodeSurfaceOpFrame` are referenced only by their own header and by MG_Test. | MobileGL/MG_Remote/Protocol/SurfaceOpCodec.cpp:116 (EncodeSurfaceOpFrame), :197 (ServerApplyWireSurfaceOp); the live path is MobileGL/MG_Remote/Server/ServerLoop.cpp:658-670 (RunSurfaceControlFrame) -> :886-960 (ApplySurfaceControlFrame), which never touches the codec | Not a break - an unarmed gate. Every rule-G refusal in this family (AndroidNativeWindow@P12, MetalLayer@P12, InprocOnlyOpOnTheWire, UnknownWindowKind) can only go red once cp routes the frame through the socket. A spawn lane that kept the by-value path would satisfy the exit gate while never once running the code that refuses a process-local window. | n/a - the guards ARE the unreached code | cp | |
|
||||
| A1-13 | blocks-p6 | The client attaches to the server's shared memory by holding a C++ reference to the server's SessionSegments object, not by receiving descriptors. | MobileGL/MG_Remote/Client/ClientSession.cpp:533 (`Server::ServerSession& server = Server::ServerSessionInstance();`), :575-586 (Welcome cross-check reads `server.Shm().AnnouncedSize(slot)` directly), :599-601 (`m_shm.AttachInProcess(server.Shm(), MemoryRole::Client)`), :704 (`Server::ServerLoopInstance().Start(server)`); MobileGL/MG_Remote/Transport/SessionRings.h:160 (AttachInProcess signature); MobileGL/MG_Remote/Transport/ShmSegment.cpp:311-352 (dup + Adopt + Map off `owner.m_segments[index]->Fd()`) | There is no `server` object in the client process. Three separate things break: the Welcome geometry cross-check has nothing to compare against, AttachInProcess has no owner, and ServerLoopInstance().Start(server) is starting the other process's apply thread. SessionSegments has no constructor that takes received descriptors - only Create and AttachInProcess. | none - it is a compile-time coupling, so it fails to build rather than failing silently. That is the safe direction. | so | **line-does-not-resolve** — Fix :533 -> :534 and add the teardown sites to the row's `site` column: ClientSession.cpp:758, :802, :814 and MG_Backend/Init.cpp:255. ARCHITECTURE.md:504 already rules that under spawn the client's d |
|
||||
| A1-14 | blocks-p6 | Segment descriptors never cross: ShareFd / ReceiveFd have no production caller, SegmentRef carries no fd, and on Android the segment name is not openable. | MobileGL/MG_Remote/Transport/ITransport.h:98,107 (the two virtuals); MobileGL/MG_Remote/Transport/InProcessTransport.cpp:187-226 (a real dup-based implementation, unused); MobileGL/MG_Remote/Protocol/protocol.fbs:48-53 (SegmentRef = id/kind/sizeBytes/name - no fd field); MobileGL/MG_Remote/Transport/ShmSegmentPosix.cpp:62-65 (ASharedMemory_create - the label is not a resolvable name); MobileGL/MG_Remote/Transport/ShmSegment.h:22-24 says so | On Android the four segments cannot reach the child at all. ASharedMemory gives an anonymous fd; SegmentRef::name is a debug label; there is no shm_open path to it. SCM_RIGHTS is the only route and nothing calls it outside MG_Test. | none - the primitives are built and unit-tested (FdPassing.cpp:173, MG_Test/Wire/FdPassingTest.cpp) but unwired | so | |
|
||||
| A1-15 | p6-must-handle | No pid crosses. Hello::pid is hardcoded 0 and Welcome::serverPid is filled from the CLIENT's Hello, so it is always 0. | MobileGL/MG_Remote/Client/ClientSession.cpp:519-521 (`/*pid=*/0u`); MobileGL/MG_Remote/Server/ServerSession.cpp:532-534 (`CreateWelcome(builder, abiMajor, abiMinor, static_cast<Uint32>(hello->pid()), ...)` - the fourth argument is serverPid); MobileGL/MG_Remote/Protocol/protocol.fbs:64 (Hello.pid), :80 (Welcome.serverPid) | Two things. (a) P6-SPAWN-PLAN §6.5's arm-proof gate wants each test's private log to carry the child pid plus `transport=spawn`; serverPid is the natural carrier and it currently echoes the peer's value, so a spawn lane could log `serverPid=0` and still look armed. (b) The process-tree gate (§6.4) counts children externally; a serverPid the client can assert against is the in-band version of the same check. This is a pid crossing that SHOULD exist and does not, rather than one that must be removed. | none - no consumer, so a wrong value is unobservable | sm | |
|
||||
| A1-16 | blocks-p6 | ClientSession owns BOTH transport ends as concrete `unique_ptr<InProcessTransport>` and reads the doorbell pair off the concrete type. The server's mirror of the same access is guarded; the client's is not. | MobileGL/MG_Remote/Client/ClientSession.h:357-358 (both members typed InProcessTransport); MobileGL/MG_Remote/Client/ClientSession.cpp:622-623 and :632 (`m_clientTransport->PeerDoorbell()` / `SelfDoorbell()`); the guarded server equivalent at MobileGL/MG_Remote/Server/ServerSession.cpp:709-740 (role check then Fatal{UnmigratedVerb,"ServerSession::ConsumerDoorbell"} for any non-InProcess role) | A SocketTransport cannot be stored in either member, and StartOverTransportPair's signature takes two InProcessTransport unique_ptrs. The client also cannot legitimately own the server end at all. It is a compile-time break, which is the honest direction - but note the asymmetry: ServerSession already has the named-Fatal shape for an unmigrated transport role and ClientSession has no equivalent. | partial - ClientSession.cpp:482-490 refuses non-inproc modes by name at Start, which is what keeps this from being reach | so | **line-does-not-resolve** — Re-cite the members as ClientSession.h:355-356. Verdict blocks-p6 / phase so unchanged and correct. |
|
||||
| A1-17 | blocks-p6 | InitSplitRoles builds BOTH roles in the one process: the server's private BackendObject, its CallMask, its CapsSnapshot source, then the client session, then the client's BackendObject_Remote. | MobileGL/MG_Backend/Init.cpp:148-224 (the whole function); specifically :155-158 (`loop.CreateBackend(...)` - the server's backend, on the app thread), :162 (`ServerSessionInstance()`), :209-210 (`ClientSessionInstance().Start(...)`), :221 (`pActiveBackendObject = MakeUnique<BackendObject_Remote>()`) | Steps 1 and 2 - backend creation, the consumer-mask honesty cross-check (AssertConsumerMaskIsHonest, :117-138) and the capability-bit derivation off `loop.Backend()->GetBackendFunctions()` (:183-205) - all have to run in the CHILD, after exec, before the Welcome. `g_resourceOpsAtStep2` (:145) is a pointer compared against MGPipeGetResourceOps() later, which only means anything inside one process. | the caller refuses to continue on false rather than falling back to monolith (the named refusal at :210-216) - so a fail | sm | **line-does-not-resolve** — Re-cite as: Init.cpp:151-230 (InitSplitRoles); :157-158 (loop.CreateBackend on the app thread); :119-139 (AssertConsumerMaskIsHonest); :146 (g_resourceOpsAtStep2); :163 (ServerSessionInstance); :184-2 |
|
||||
| A1-18 | already-handled | gPipeInputs' O-class members are raw frontend pointers and SharedPtrs. All nine reachable getters are classified FATAL, and a server read under a stamped verb aborts by name. | MobileGL/MG_Backend/MGPipe/PipeInputs.h:808-818 (SharedPtr<VertexArrayObject>, BindingSlot<BufferObject>*[15], BindingSlotRange1D<BufferObject>*[15], BindingSlot<FramebufferObject>*[2], ImageTextureBinding*, three SharedPtr<ProgramObject>, TextureUnit*); classification at MobileGL/MG_Pipe/FieldOwnership.def:28-43; enforcement at MobileGL/MG_Backend/MGPipe/PipeInputs.h:96-105 (MGP_INPUT_CHECK) and MobileGL/MG_Backend/MGPipe/PipeInputs.cpp:382-414 (MGPipeInputUnfreshRead) | Nothing, and the failure direction is right: in a server process gPipeInputs is filled by nobody, every field is withdrawn, and any MGB_CTX read of any class aborts with the field and verb named. This is the family P5f genuinely closed. The exception is A1-20. | MGP_INPUT_CHECK / MGPipeInputUnfreshRead, Fatal{UnmigratedPipeInput} and Fatal{RoleViolation}; plus MGPipeStickyForwardP | a6 | |
|
||||
| A1-19 | blocks-p6 | The dual-block selection and the server block's identity are gated on a KNOB (MOBILEGL_IPC_ROLE_SPLIT_STATE, default false), not on the transport. Under spawn the rehearsal is not optional - it is the reality - and the knob-off path has no server block identity. | MobileGL/MG_Backend/MGPipe/PipeInputs.cpp:292-295 (`MGPipeRoleSplitActive() = Ipc.RoleSplitState && Transport != Monolith`), :297-299 (MGPipeClientInputs), :314-315 (`MGPipeServerBlockNoteIdentity` returns early when the knob is off); default at MobileGL/Config.h:550 (`Bool RoleSplitState = false`); the hazard is written out at MobileGL/MG_Backend/MGPipe/PipeInputs.h:876-884 | With the knob off in a server process, nothing ever calls SetIdentity on gPipeInputs, so ContextIdentity() stays nullptr for the life of the process. DirectGLES' fb-slot memo compares identity FIRST against a nullptr-initialised static, reads a HIT, and returns `*g_fbSlotCache[target]` - a null FbBindingSlot* - WITHOUT running MGP_INPUT_CHECK, because the cache-hit path bypasses the accessor entirely. That is an unnamed null dereference in exactly the place PipeInputs.h:880-884 says a named abort was intended. It is reachable whenever MOBILEGL_PIPE_LEGACY_MEMOS is on (CMakeLists.txt:43 - ON by default) and kMGPipeSubsystemEsprytSlots (bit 5) is clear. | none on this path - the memo hit is the bypass. The Fatal it should produce lives behind a knob that spawn cannot assume | c6 | |
|
||||
| A1-20 | p6-must-handle | The fb-slot memo caches raw FbBindingSlot* pointers into the frontend GLContext and is keyed on MGB_CTX_IDENTITY - a raw pointer compare with no generation. | MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp:199-213 (GetFramebufferBindingSlotChecked: `const void* ctx = MGB_CTX_IDENTITY; if (ctx != g_fbSlotCacheContext) { ... }`), statics at :177-178; the push-arm bypass at :195-198 (`if (EsprytSlotTablesEnabled()) return MGB_CTX->GetFramebufferBindingSlot(target);`) | Two ways, both only on the legacy arm. (a) A1-19's null identity makes the very first call a false hit. (b) Even with a correct identity token, the cached pointers address the CLIENT's GLContext, which does not exist here. The comment at :180-186 already records that this path bypasses the per-verb poison stamp at all five call sites. | structural only: EsprytSlotTablesEnabled() (SlotTables.h:150-153) routes past it, and ResolveEsprytSlotTablesArm Fatals | c6 | |
|
||||
| A1-21 | p6-must-handle | The frontend-keyed twin registry and slot allocator are guarded, but the predicate is `ServerLoop::OnApplyThread()` rather than "this is the server process". | MobileGL/MG_Impl/Pipe/SlotAllocator.cpp:29-43 (MGPipeRefuseAllocatorFromApplyThread) and :45-57 (MGPipeRefuseFrontendKeyedRegistryFromApplyThread), both `if (!ServerLoop::OnApplyThread()) return;`; call sites at MobileGL/MG_Backend/DirectGLES/SlotTables.h:281, :398, :410, :476, :505 and MobileGL/MG_Backend/DirectGLES/Managers.h:341, :406, :430, :436; the allocator's own three at SlotAllocator.cpp:217, :230, :239 plus the singleton accessor at :329 | They stop coinciding. Server-process code that is NOT on the apply thread - backend bring-up before Start, and any RunSurfaceControlFrame dispatch that takes the non-apply-thread branch (ServerLoop.cpp:669-670) - passes the guard. MGPipeSlots() in the server process is then a freshly constructed, EMPTY allocator (SlotAllocator.cpp:338-339): FindByLifetimeId answers the null handle and Acquire mints a slot the client knows nothing about. Both are silent wrong answers where the inproc build gives a named abort. | Fatal{RoleViolation,"MGPipeSlots"} - correct message, predicate too narrow for two processes | c6 | |
|
||||
| A1-22 | blocks-p6 | The server cannot link without MG_Impl today. PipeInputs' out-of-line definitions and BOTH role-refusal helpers live in MG_Impl translation units. This is the direct answer to P6-SPAWN-PLAN §5 item 5 and P6-CONTRACT-DRAFT §3.3. | MobileGL/MG_Impl/Pipe/PipeFill.cpp:2135-2141 (PipeInputs::IsLive - what MGB_CTX_LIVE expands to, read at 20+ MG_Backend sites), :2160-2230 (the seven F-class forwarders: GetBufferBindingPointCount, GetProgramObject, GetTextureObject, HasOpenTransformFeedbackSpan, InvalidateCompileEnv, ValidateProgramName, RecordError); MobileGL/MG_Impl/Pipe/SlotAllocator.cpp:29-57 (both refusal helpers) and :324-340 (MGPipeSlots); the claim it contradicts is at MobileGL/MG_Backend/MGPipe/PipeInputs.h:281-284 and docs/Disaggregated/ARCHITECTURE.md:516 (§16 lists PipeInputs.{h,cpp} under MG_Backend/MGPipe/) | A server image that drops MG_Impl loses PipeInputs::IsLive (an undefined symbol at 20+ MGB_CTX_LIVE sites) and, worse, loses MGPipeRefuseAllocatorFromApplyThread and MGPipeRefuseFrontendKeyedRegistryFromApplyThread - so the guards of A1-21 vanish along with the code they guard. The realistic P6 answer is that the server links the whole library and the separation is enforced at run time, not at link time; a6 should say so rather than leave the claim standing. | none; check_include_closure.py does not probe MG_Backend headers (SlotTables.h:80-82 says so) | sm | |
|
||||
| A1-23 | blocks-p6 | MG_Config::Transport is a process global that 208 sites switch on to pick the server-role arm, 151 of them in MG_Backend. Forcing it to Monolith in the child - which ARCHITECTURE.md §15.1 instructs - selects frontend glue. | MobileGL/Config.h:564 (the idiom named); representative server-arm selectors: MobileGL/MG_Impl/Pipe/SlotAllocator.cpp:30 and :49 (the two role refusals), MobileGL/MG_Pipe/PipeApply.cpp:2286-2291 (R-6's MapPersistent decline), MobileGL/MG_Impl/Pipe/PipeFill.cpp:2136-2138 (PipeInputs::IsLive -> MGPipeServerContextIsLive), MobileGL/MG_Backend/MGPipe/PipeInputs.cpp:293 (MGPipeRoleSplitActive), MobileGL/MG_Backend/DirectGLES/ContextEpoch.h:19 (`const Bool server = Transport != Monolith`), MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp:2212 and :2257 (the XFB key selector), MobileGL/MG_Impl/Pipe/ResourceTracker.h:585 and :704 | If the child sets Transport = Monolith to stop recursive spawning, all 151 MG_Backend selectors flip to the monolith arm: the applier stops declining MapPersistent, IsLive stops being server-owned and calls LiveContext() (a client GLContext that is not there), ContextEpoch stops treating itself as the server, and both role refusals in SlotAllocator.cpp return early - the guards go quiet in exactly the process that needs them. If instead the child leaves Transport = Spawn, ConfigLoader/Init could try to become a client again. The two controls are one variable today and must become two. | none - the recursion fuse and the role selector are the same field | c6 | **overstated** — Replace the count with: 179 `Transport != ...Monolith` comparisons tree-wide (MG_Backend 138, MG_Impl 25, MG_Pipe 6, MG_State 4, MG_Remote 4), plus 45 further `TransportMode::Monolith` mentions of whi |
|
||||
| A1-24 | no-action | Server-side addresses used as map keys that never cross - verified clean, recorded so c6 does not re-open them. | MobileGL/MG_Remote/Server/StagedTextureStore.h:214-217 (KeyForTwinAddress: a server-side twin address, tagged so it cannot alias the handle key space minted at :207-210); MobileGL/MG_Remote/Server/ServerLoop.h:161-163 (CurrentThreadKey via __builtin_thread_pointer, apply-thread identity only); MobileGL/MG_Pipe/PipeApply.cpp:1677 (`BoundStreamOutputLifetimeId = values.BoundTransformFeedbackLifetimeId` - a CLIENT-minted opaque integer that arrives in the set_context_values record, used as a server map key at DirectGLES.cpp:2007, :2213, :2258) | Nothing. None of these leaves the server process, and the XFB identity is the shape P5f fs chose precisely because a lifetime id is an opaque integer rather than an address. This is a family where the honest answer is "nothing left". | KeyForTwinAddress's top-bit tag (`Uint64{1} << 63` on the handle key) makes the two key spaces non-aliasing by construct | a6 | |
|
||||
| A1-25 | already-handled | MGPipeApplyMapPersistent's host-pointer return is declined by ruling under any transport, on both the monolith applier path and the codec path. | MobileGL/MG_Pipe/PipeApply.cpp:2256-2302, specifically :2285-2292 (`if (Transport != Monolith && AdoptTierIsEmulate()) return nullptr;`); MobileGL/MG_Remote/Wire/PipeWireCodec.cpp:1616-1638 (the codec arm never calls the applier and posts kStatusDeclined) | Nothing. The pointer that would be meaningless across a process boundary is never produced. Note for c6: the record payload is a bare MGPHandleOnly and carries neither size nor seedBytes, so the phase that lands a real map_persistent needs an append-only payload change before it can even call the applier (:1618-1622). | the two decline arms above; AdoptTierIsEmulate aborts by name at T0/T1 rather than returning | P11 | |
|
||||
|
||||
**复审另行指出的遗漏**:
|
||||
- MobileGL/MG_Remote/Client/WireTables.cpp:87 - `Bool RunsAsTheServerRole() { return Server::ServerLoop::OnApplyThread(); }`. This is A1-21's exact defect (an apply-thread predicate standing in for 'this process is the server') on a far larger and more consequential surface: it is the selector between the WIRE EMITTER and the MONOLITH ADAPTER for every routed row. Consulted at WireTables.cpp:156 (MGP_WIRE_SIMPLE), :166 (MGP_WIRE_BLOB), :180 (MGP_WIRE_TAIL), :256, :276, :295, :315, :328 and :576 (the five hand-written escapes including Wire_Escape_SetProgramBindings). In a spawn SERVER process any routed call that is not on mgl-srv-apply takes the CLIENT arm and reaches RequireSession (WireTables.cpp:106-119), i.e. Fatal{NoClientSession} - loud, but for the wrong reason and in the wrong process. The audit's c6_ask #4 names only the two SlotAllocator helpers; this site must be in the same ruling.
|
||||
- MobileGL/MG_Impl/Pipe/PipeFill.cpp:358, :976, :1115, :1206, :1256, :3598 and MobileGL/MG_Remote/Client/GpuWritePending.cpp:227 - six MG_Impl call sites and one MG_Remote one that select their role arm through RunsAsTheServerRole(), i.e. through ServerLoop::OnApplyThread(). Same ask as above, and they are additionally a second MG_Impl -> MG_Remote::Server link that A1-22's build-layout row does not count.
|
||||
- MobileGL/MG_Remote/Client/PersistentMapTracker.cpp:535 (`PersistentMapTracker::OnServerRole()`), MobileGL/MG_Remote/Client/ClientSession.cpp:1357 and :1376, MobileGL/MG_Pipe/PipeApply.cpp:1355, MobileGL/MG_Backend/DirectGLES/Managers.cpp:230 and :2868, MobileGL/MG_State/GLState/TextureState/MipmapStorage.cpp:56 and :116 - eight further production sites where ServerLoop::OnApplyThread() IS the role predicate. The MG_State pair is notable on its own: the frontend state layer calls into MG_Remote::Server to ask which role it is in.
|
||||
- MobileGL/MG_Remote/Client/ClientSession.cpp:758, :802, :814 and MobileGL/MG_Backend/Init.cpp:255 - the TEARDOWN half of A1-13. The client calls ServerSessionInstance().Close() twice and ServerLoopInstance().Stop() once, and MG_Backend::Init's shutdown calls ServerLoopInstance().Stop() unconditionally. Under spawn none of these can reach the other process; ARCHITECTURE.md:504 already rules that the server exits on EOF instead. A1-13 covers only bring-up and its natural_carrier column says nothing about shutdown.
|
||||
- MobileGL/MG_Impl/Pipe/PipeFill.cpp:348 - `GLContext* LiveContext() { return MG_State::pGLContext.get(); }`. A1-22's link-closure argument is right (I confirmed there are exactly 8 out-of-line `PipeInputs::` member definitions in PipeFill.cpp: IsLive at :2135 and the seven forwarders at :2160, :2178, :2184, :2190, :2202, :2217, :2223), but it names only MG_Impl. Those eight bodies all resolve through LiveContext(), so the transitive dependency is MG_Impl AND MG_State::pGLContext, and MG_State itself calls back into MG_Remote::Server (MipmapStorage.cpp:56, :116). The c6 ruling on 'does the server image link MG_Impl' is really 'does it link MG_Impl + MG_State'.
|
||||
- MobileGL/MG_Backend/MGPipe/PipeInputs.h:743-745 and :956-958 - two more statements of the 'MG_Impl is not in the server' premise that A1-22 and doc_drift bullet 3 do not name (they cite only :281-284). :744 says 'MGPipeFillAccess lives in MG_Impl, which is the role the server does not have'; :957 says 'NOT enough for a spawned server, where MG_Impl is not in the process'. All three have to move together with whatever c6 rules.
|
||||
|
||||
---
|
||||
|
||||
## a6.2 进程级静态
|
||||
**小结**:I re-read the fs-era mechanisms in the tree rather than in the reports, and they hold: `ContextEpoch` (native generation + served serial + execution arm) really does gate both the unpack shadow and the render-state shadow; the raw-depth sampler really is a pure native object rebuilt on native generation; XFB really is role-split and keyed on `BoundStreamOutputLifetimeId`; server liveness really is held by `g_serverContextLive` and driven only from make-current / release / destroy / stop. None of those needs redoing. The delta is elsewhere, and it has one shape: **almost every one of these keys, guards and lifecycles is selected by `MG_Config::Transport != Monolith` (155 sites under `MG_Backend` alone) or by the presence of a `ClientSession` in this process — two facts that stop meaning what they mean today the moment the roles are in two processes.** Concretely: `MGPipeApplierReset`'s layer-2 role guard (PipeApply.cpp:1353-1355) is disarmed in a server-only process because it requires `ClientSession::Active() != nullptr`; `MGPipeServerBlockNoteIdentity` (PipeInputs.cpp:314-315) is a no-op unless `MOBILEGL_IPC_ROLE_SPLIT_STATE=1`, which is OFF by default, so under spawn the server block's `ContextIdentity()` is nullptr with nothing left to fill it; `CountBarrierPull`'s unconditional Fatal arm (PipeInputs.cpp:174) is likewise knob-gated; and `PipeInputs::IsLive()` — the very answer fs re-owned — is **defined in `MG_Impl/Pipe/PipeFill.cpp:2135`**, which answers §3.3's `PENDING a6` question "can the server link without MG_Impl" with a flat no. The new exit boundary adds two owners that do not exist: nothing in a server-only process starts or stops `ServerLoop` (`ClientSession.cpp:704`/`:802` own that today, and the comment at :702 says so), and nothing owns the resolver/callback uninstall order that `ClientSession::Stop` currently sequences. The one thing c6 most needs from this: **write down, as a contract row, which single process-wide fact each of these arms actually keys on under spawn, because `Transport != Monolith` is true in BOTH processes and `ClientSession::Active()` is true in neither of the two the server lives in.**
|
||||
|
||||
复审结论:**sound-with-fixes**(重新解析 25 条,异议 9 条,另指出 7 处遗漏)
|
||||
|
||||
| # | 判定 | 事实 | 站点 | spawn 下如何坏 | 守卫 | 归属 | 复审 |
|
||||
|---|---|---|---|---|---|---|---|
|
||||
| A2-1 | blocks-p6 | `ContextEpoch::Server` — the execution-arm third of the epoch key — is `MG_Config::Transport != Monolith`, a process-global config value, not a role fact | MobileGL/MG_Backend/DirectGLES/ContextEpoch.h:18-21 (CurrentContextEpoch); consumers MobileGL/MG_Backend/DirectGLES/Managers.cpp:6497 (ScopedDefaultUnpackState::EnsureShadowSynced) and MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp:5044-5049 (RenderStateImpl::SyncRenderState) | Nothing, IF the server child keeps `Transport != Monolith`. If ARCHITECTURE.md:488's rule is implemented literally (`mobilegl_server_main` hard-sets `MG_Config::Transport = Monolith` before `Init()`), the epoch's arm bit flips to `false` in the server process and, with it, 155 other `MG_Config::Transport` reads under MG_Backend select the frontend/monolith arm inside the server. | none at the epoch itself; the epoch merely notices the flip and re-publishes once. The damage is in the other 155 sites, | c6 | **overstated** — Say '155 `MG_Config::Transport` reads under MG_Backend, 151 of them the Monolith comparison'. In c6_ask #1, add one sentence: MG_Impl (35) and MG_Remote (23) are deliberately NOT in the re-key set bec |
|
||||
| A2-2 | already-handled | `ScopedDefaultUnpackState::s_synced` + the six `s_*` pixel-store shadows + `s_epoch`, class-level `static inline` in a header-less .cpp scope | MobileGL/MG_Backend/DirectGLES/Managers.cpp:6472-6549 (class), :6495-6519 (EnsureShadowSynced), :6539 (s_synced), :6541 (s_epoch) | nothing. Under spawn only the server process ever constructs this scope; the native generation and served serial are both server-owned numbers. The only way to break it is A2-1's arm flip. | `s_epoch != epoch` (Managers.cpp:6498) | st | |
|
||||
| A2-3 | already-handled | render-state shadow family (`g_forceFullRenderStateResync`, `g_hasSyncedRenderState`, `g_syncedRenderStateVersion`, `g_syncedBackendViewport/ScissorBox`, `g_syncedColorMaskAlphaWidenMask`, `g_dualSourceDeclinedBlendStates`) plus the function-local `static ContextEpoch syncedEpoch` | MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp:5021-5049 (statics + the epoch gate), :5036-5041 (InvalidateSyncedRenderState), :16209 (the MakeCurrent invalidation that predates fs) | nothing. Both keys are server-owned. `MGB_CTX->GetRenderStateParametersVersion()` at :5054 reads the SERVER block of gPipeInputs, which the applier writes. | `syncedEpoch != epoch` (DirectGLES.cpp:5046) | st | **line-does-not-resolve** — Widen the cite to DirectGLES.cpp:5002-5049. Verdict already-handled is correct. |
|
||||
| A2-4 | already-handled | raw-depth-fetch sampler: the transport arm's function-local `static UniquePtr<BackendSamplerObject> native` + `static Uint generation`, and the LEGACY arm's two file statics that still hold `SharedPtr<MG_State::GLState::SamplerObject>` | MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp:313-344 (GetRawDepthFetchSampler), :316-321 (the transport statics and the generation rebuild), :82-83 (the legacy MG_State SharedPtr pair); destructor gate at MobileGL/MG_Backend/DirectGLES/Managers.cpp:14690-14708 | nothing on the transport arm. But it is one of the concrete things A2-1 costs: a server child forced to `Monolith` takes the :333-343 branch and constructs an `MG_State::GLState::SamplerObject` — a frontend object — inside the server process, and calls `SyncToBackend` on it, which is the client-registry identity lookup fs deliberately removed. | `generation != g_backendContextGeneration` (DirectGLES.cpp:318) and the destructor's generation compare (Managers.cpp:14 | st | |
|
||||
| A2-5 | p6-must-handle | `g_Display` / `g_Context` / `g_Surface` / `g_Config` — ONE EGL tuple per process, file-static, and `InitDisplayAndContext` unconditionally destroys the previous one before creating a new one | MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp:15668-15671 (the four statics), :16012-16013 (`InitDisplayAndContext` opens with `DestroyEGLContext()`), :16079-16095 (InitWindowSurface), :16097-16112 (InitPbufferSurface) | This is the hard answer to "can a server process hold more than one surface or session": **no, and the refusal is not named** — a second `InitWindowSurface`/`InitPbufferSurface` silently destroys the first surface, its context, and (see A2-6) the display. A spawn server that accepted a second session, or a client that created a pbuffer beside its window, loses the first without a log line. | none. There is no `Fatal{...}` and no `if (g_Surface != EGL_NO_SURFACE) refuse` — `DestroyEGLContext()` is simply called | c6 | |
|
||||
| A2-6 | p6-must-handle | `DestroyEGLContext()` ends with `eglTerminate(g_Display)` — a PROCESS-wide EGL teardown, not a context teardown | MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp:16730-16774, specifically :16761-16773 (`eglMakeCurrent(NO_SURFACE)`, `eglDestroyContext`, `eglDestroySurface`, `eglTerminate`, `g_Display = EGL_NO_DISPLAY`) | A spawn server that serves a second session after a `ReleaseResources` has had its `EGLDisplay` terminated; any EGL object another part of the server process still held (a Magma swapchain, a probe context) is invalidated with it. It also means the server process cannot be 'reset between clients' — `eglTerminate` + `eglInitialize` on the default display is the only path back, and nothing sequences it. | the `MGPipeServerSetContextLive(false)` at :16732-16733 and the generation bumps at :16750/:16754 make every STALE HANDL | sm | |
|
||||
| A2-7 | blocks-p6 | the served-context serial's two halves: the client's `g_applierResetContextSerial` (a namespace static that is NEVER reset anywhere) and the server's `PipeApplier::m_applierResetSerial`, a member of the LEAKED `ServerSessionInstance()` singleton that `Close()` does not reset either | MobileGL/MG_Remote/Client/WireTables.cpp:642 (declaration, comment says 'the client's own count'), :656 (`record.ContextSerial = g_applierResetContextSerial++`); MobileGL/MG_Remote/Server/PipeApplier.cpp:1149-1157 (the Fatal assertion), MobileGL/MG_Remote/Server/PipeApplier.h:322 (`m_applierResetSerial = 0`), MobileGL/MG_Remote/Server/ServerSession.h:188 (`PipeApplier m_applier`), MobileGL/MG_Remote/Server/ServerSession.cpp:376-382 (the leaked singleton), :656-689 (`Close()`, which resets neither) | A RECONNECTING CLIENT (new client process, same long-lived server process) sends ContextSerial 0 while the server expects N -> `Fatal{ProtocolCorruption, "ApplierReset.ContextSerial"}` and `std::abort()` IN THE SERVER. The mirror case (same client process, respawned server after `MOBILEGL_IPC_RESPAWN=1`) sends N while the new server expects 0 -> same abort. So `MOBILEGL_IPC_RESPAWN` as specified (ARCHITECTURE.md:504, 'restart and re-push everything') cannot work without deciding what this serial means across a reconnect. | the Fatal at PipeApplier.cpp:1150 — it fires, loudly and by name. The problem is that it fires on a LEGITIMATE reconnect | c6 | |
|
||||
| A2-8 | p6-must-handle | `g_sessionOwner` / `g_active` single-session enforcement: a SECOND OBJECT is a named Fatal, but a second `Accept()` on the SAME object — which is what `ServerSessionInstance()` makes the only reachable shape — returns an UNLOGGED error code | MobileGL/MG_Remote/Server/ServerSession.cpp:368 (`g_active`), :372 (`g_sessionOwner`), :421-439 (`Accept`'s CAS; `:425` is the silent `return MOBILEGL_ERR_INVALID_ARGUMENT`, `:426-428` the Fatal), :376-382 (`ServerSessionInstance()`); the one production caller is MobileGL/MG_Backend/Init.cpp:163 | P6 is the first phase in which a second client can physically arrive at a running server. It is refused — but through the `expectedOwner == this` branch, which returns `MOBILEGL_ERR_INVALID_ARGUMENT` with **no MGLOG line at all**. A ServerMain that logs only the rc gets a bare number; the project's 'always a NAMED refusal' rule is not met at exactly the point P6 makes reachable. (The other branch, a genuinely different `ServerSession*`, is correctly `Fatal{RoleViolation, "callback-double-install"}`.) | the CAS itself; but the same-object arm has no name and no log | c6 | **claim-false** — Replace with: 'the only production caller of Accept() is ClientSession.cpp:535; ServerSessionInstance() itself has four production callers (Init.cpp:163, ClientSession.cpp:534, :758, :814)'. Verdict p |
|
||||
| A2-9 | p6-must-handle | `ServerSession::Close()` re-enterability, and the asymmetry between how it releases the four reverse callbacks (owner-checked) and the process segment resolver (NOT owner-checked) | MobileGL/MG_Remote/Server/ServerSession.cpp:656-689; :663 `Wire::SegmentTable::UninstallProcessResolver()` unconditional, :666-677 the four `== &ServerOnX` identity checks; MobileGL/MG_Remote/Wire/PipeWireCodec.cpp:444-449 (Uninstall nulls whoever owns it), :430-442 (Install DOES check, and Fatals) | Nothing about re-entry. What breaks is the ORDER: the resolver's own comment (:661-662 and PipeWireCodec.cpp:445-446) says 'uninstall AFTER the apply thread has joined, never before', and the only thing that sequences that today is `ClientSession::Stop()` — which calls `ServerLoopInstance().Stop()` (join) at ClientSession.cpp:802 and only then `ServerSessionInstance().Close()` at :814. In a server-only process there is no ClientSession to impose that order. See A2-17. | the ordering is a comment, not a check. `Close()` does not assert that the apply thread has joined. | sm | |
|
||||
| A2-10 | already-handled | `gMGPipeSegmentResolver` + `g_processResolverTable`: one function pointer and one table pointer per process, and `MGPipeHostBytes` returns a SILENT nullptr when the resolver is unset | MobileGL/MG_Pipe/MGPipeHostSpan.h:47 (`inline MGPipeSegmentResolver gMGPipeSegmentResolver = nullptr`), :54-55 (the silent-null arm); MobileGL/MG_Remote/Wire/PipeWireCodec.cpp:348 (`g_processResolverTable`), :350-355 (thunk), :430-449 (install/uninstall); installed at MobileGL/MG_Remote/Server/ServerSession.cpp:565, released at :663 | nothing about ownership — the split makes the ruling trivially true, since the client process has no resolver to race. The residual risk is purely the teardown window of A2-9: after `UninstallProcessResolver()` the thunk is null and any still-decoding record resolves to a silent nullptr whose escalation lives in the caller rather than here. | `InstallProcessResolver`'s Fatal (PipeWireCodec.cpp:436-438) on the install side; caller escalation on the resolve side | c6 | |
|
||||
| A2-11 | later-stage | `gMGPipeCallbacks` has TEN entries; `ServerSession::Accept` installs FOUR and `Close` releases those four. The other six stay null for the life of the server process, and 'null means send nothing' is the documented default | MobileGL/MG_Pipe/MGPipeCallbacks.h:27-52 (the ten), :56-58 (`kMGPipeCallbackCount = 10` + static_assert), :61 (`inline MGPipeCallbacks gMGPipeCallbacks{}` with the 'Null-initialized: a backend that installs nothing sends nothing' comment); installs at MobileGL/MG_Remote/Server/ServerSession.cpp:575-580, releases at :666-677 | nothing new — but note the asymmetry for c6: the install/release identity check is per-entry and owner-checked, so the table survives a session cycle correctly, while the six unfilled rows will silently no-op the first time a spawn lane reaches a P8/P9 path. That is a phase boundary, not a spawn defect. | fv's named refusal on OnGlError; `InstallReverseCallback`'s `Fatal{RoleViolation, "callback-double-install"}` (ServerSes | P9 | |
|
||||
| A2-12 | blocks-p6 | `MOBILEGL_IPC_ROLE_SPLIT_STATE` is OFF by default and is NOT implied by a real transport — yet spawn IS the dual-block arrangement, structurally and unavoidably | MobileGL/Config.h:540-550 (`Bool RoleSplitState = false`, and the comment calling 0 'the negative control'); MobileGL/ConfigLoader.cpp:400-406 (plain env flag, forced off under PipeVerify); MobileGL/MG_Backend/MGPipe/PipeInputs.cpp:292-295 (`MGPipeRoleSplitActive() = knob && Transport != Monolith`), :297-299 (`MGPipeClientInputs`), :861 in PipeInputs.h (`gPipeInputsClientBlock`) | In the server process there is no client to fill anything, so the arrangement the knob simulates is the ONLY arrangement — but `MGPipeRoleSplitActive()` still answers FALSE unless an operator sets the env var. Three named mechanisms are therefore disarmed in the very configuration they were written for: (a) `CountBarrierPull`'s unconditional Fatal arm (PipeInputs.cpp:174-176); (b) `MGPipeServerBlockNoteIdentity` (see A2-13); (c) `MGPipeClientClearVerbBoundary` selecting the client block. A spawn lane run with the default config is a spawn lane with the role-split detector switched off. | none — the knob is the guard, and it defaults to the disarmed position | c6 | |
|
||||
| A2-13 | blocks-p6 | `MGPipeServerBlockNoteIdentity()` early-returns unless the role-split knob is armed, so under spawn the server block's `m_contextIdentity` stays nullptr and `m_live` is never written by anyone | MobileGL/MG_Backend/MGPipe/PipeInputs.cpp:314-328 (`if (!MGPipeRoleSplitActive()) return;` at :315, the odd-encoded token at :324-327); the rationale is spelled out at MobileGL/MG_Backend/MGPipe/PipeInputs.h:876-885; the consumer is MobileGL/MG_Pipe/PipeInputsSwitch.h:21 (`MGB_CTX_IDENTITY`) read at MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp:201-209 | In the server process nothing writes it: the client's SetIdentity is in MG_Impl and never runs there, and this function returns early. `MGB_CTX_IDENTITY` is then nullptr forever, and at DirectGLES.cpp:202 `ctx != g_fbSlotCacheContext` is FALSE on the very first call (both nullptr) so :209 dereferences a null `FbBindingSlot*` — the unnamed crash the rehearsal exists to replace with a named one. Reachable whenever `EsprytSlotTablesEnabled()` is false, i.e. on the supported `MOBILEGL_PIPE_PUSH` A/B arm with bit 5 clear (ARCHITECTURE.md §9.6). Not reachable on the default mask 0x3fff, which sets bit 5 (MG_Pipe/MGPipe.h:164) — and `MOBILEGL_PIPE_LEGACY_MEMOS` defaults ON (CMakeLists.txt:43) so the legacy arm IS compiled. | none in the default spawn config. The knob is what arms it. | c6 | **wrong-verdict** — Downgrade to p6-must-handle. Keep the c6 ask (the identity should not be knob-gated; its token is derived from MGPipeApplierContextSerial(), a server-owned clock) but state honestly that the crash at |
|
||||
| A2-14 | blocks-p6 | `MGPipeApplierReset`'s layer-2 role guard is armed by `ClientSession::Active() != nullptr` — i.e. by a CLIENT existing IN THIS PROCESS | MobileGL/MG_Pipe/PipeApply.cpp:1353-1360 (`Transport != Monolith && ClientSession::Active() != nullptr && !ServerLoop::OnApplyThread()` -> `Fatal{RoleViolation, "g_applier"}`); the documented exception is at :1348-1351; the state it protects is `g_applier` at :436 | In a spawn SERVER process, `ClientSession::Active()` is permanently nullptr — so the fixture exception becomes the permanent state and the guard NEVER fires. Any direct off-apply-thread `MGPipeApplierReset()` in the server silently resets server state that the wire is supposed to own. This is a gate that can no longer go red for the reason it exists. | the Fatal itself, disarmed by its own first conjunct | c6 | |
|
||||
| A2-15 | blocks-p6 | `PipeInputs::IsLive()` — the server-liveness answer fs re-owned — and 17 other `PipeInputs::` member definitions are compiled in `MG_Impl/Pipe/PipeFill.cpp`, the CLIENT-role translation unit | MobileGL/MG_Impl/Pipe/PipeFill.cpp:2135-2141 (the definition; the transport arm at :2137-2138 forwards to `MGPipeServerContextIsLive()`), :2160-2175 and following (the seven sticky forwarders); the declaration is MobileGL/MG_Backend/MGPipe/PipeInputs.h:262; the claim it contradicts is at PipeInputs.h:281 and :957 ('MG_Impl is not in the server at all') | This is the concrete answer to P6-SPAWN-PLAN §5 / P6-CONTRACT-DRAFT §3.3's `PENDING a6` question: **the server image cannot link without MG_Impl today**, and not because of some far-off glue but because the backend's own `PipeInputs` member functions are defined there. The spawn plan's own §2.3 worry ('blindly forcing Monolith would select frontend glue') is the same fact seen from the other end. | none — it is a link-time fact, and today it always resolves | c6 | **overstated** — Replace '17 other' with 'seven further (the seven F-class sticky forwarders)' and cite PipeFill.cpp:2135, :2160, :2178, :2184, :2190, :2202, :2217, :2223. Keep the verdict blocks-p6 — eight backend-cl |
|
||||
| A2-16 | p6-must-handle | `PipeInputs::IsLive()` answers `MGPipeServerContextIsLive()` for ANY non-monolith transport, and `g_serverContextLive` is only ever written from server-role code | MobileGL/MG_Impl/Pipe/PipeFill.cpp:2137-2138; MobileGL/MG_Backend/MGPipe/PipeInputs.cpp:305 (`namespace { Bool g_serverContextLive = false; }`), :307-310 (setter), :312 (getter); the six writers are MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp:16733 and MobileGL/MG_Remote/Server/ServerLoop.cpp:290, :295, :314, :475, :761, :1006 | In the spawn CLIENT process `Transport != Monolith` is also true, so any `MGB_CTX_LIVE` evaluated there would consult a global no one in that process ever sets -> permanently FALSE. I verified that every `MGB_CTX_LIVE` site is under `MG_Backend` (DirectGLES/Managers.cpp and DirectVulkan), which the client process should not be running — so this is latent rather than live, and it becomes live the moment A2-18's `InitSplitRoles` builds a DirectGLES backend in the client process. Separately: `g_serverContextLive` is a plain non-atomic `Bool` written from the apply thread (ServerLoop.cpp:475) and from whatever thread calls `Stop()` (:761). | none; it is a plain Bool with no role or thread assertion | c6 | **overstated** — Say 'seven writers'. No other change; verdict p6-must-handle stands. |
|
||||
| A2-17 | blocks-p6 | `ServerLoop` — the apply thread, the server's private BackendObject, the current-tuple and the liveness clear — is STARTED AND STOPPED BY CLIENT-ROLE CODE | MobileGL/MG_Remote/Client/ClientSession.cpp:700-704 (Start; the comment at :702 reads 'Under `inproc` the client is what starts the server role, which is why this call is here rather than in some server-side main'), :802 (Stop, step 3 of table 3's order); MobileGL/MG_Backend/Init.cpp:244-255 (`ShutdownSplitRoles`); the singleton is MobileGL/MG_Remote/Server/ServerLoop.cpp:810-812; the teardown it owns is :463-478 (Detach, backend reset on the context-owning thread, `MGPipeServerSetContextLive(false)`, `ForgetCurrentTuple`) | A server-only process has no `ClientSession` and therefore no driver for any of this. Every process-level static that the teardown at ServerLoop.cpp:463-478 is responsible for clearing — the backend object, `g_serverContextLive`, the EGL tuple, and (through `~BackendObject_DirectGLES` -> `DestroyEGLContext`) `g_backendContextGeneration`, the frame-fence ring and `g_backendContextOwnerThread` — has no owner on the EOF exit path ARCHITECTURE.md:504 specifies ('client dies -> server reads EOF -> destroy the native context immediately and exit'). | `ServerLoop::Stop`'s bounded join and its `Fatal{ApplyThreadJoinTimeout}` (ServerLoop.cpp:790-799) are the right mechani | sm | |
|
||||
| A2-18 | blocks-p6 | `InitSplitRoles()` builds the SERVER's BackendObject (and registers the process-wide resource-ops table) in whatever process has `Transport != Monolith`, then starts a CLIENT session in the same breath | MobileGL/MG_Backend/Init.cpp:151-229; :157-159 (`ServerLoopInstance().CreateBackend`), :163 (`ServerSessionInstance()`), :216 (`ClientSessionInstance().Start`), :228 (`pActiveBackendObject = BackendObject_Remote`); the backend construction is MobileGL/MG_Remote/Server/ServerLoop.cpp:166-191, whose :185-189 comment says `Initialize()` 'registers the resource op table' | Run unchanged in the spawn CLIENT process, this constructs a full `BackendObject_DirectGLES` there and calls `Initialize()`, which loads the driver entry points and installs `g_resourceOps` process-wide — in the process that must not have a DirectGLES backend at all. It is also the function that decides which process holds `ServerSessionInstance()` and `ServerLoopInstance()`. This is the concrete place where 'the child must not become a client' (P6-CONTRACT-DRAFT §3.1) and 'the parent must not become a server' meet, and it is the site a6.3's question lands on too. | `CreateBackend`'s `m_backend != nullptr` guard (ServerLoop.cpp:167-169) only prevents a second one in the same process | sm | |
|
||||
| A2-19 | already-handled | `PipeInputs::m_serverStampedVerb` — the latch that arms the whole split read path — is cleared by the APPLIER, not only by the client, exactly as the P6 comment demands | MobileGL/MG_Backend/MGPipe/PipeInputs.h:278-288 (the comment that names the P6 hazard by name); MobileGL/MG_Backend/MGPipe/PipeInputs.cpp:330-375 (stamp), :377 (`MGPipeServerClearVerbBoundary`); the server-side caller is MobileGL/MG_Remote/Server/PipeApplier.cpp:1328 (stamp) and :1331 (`LeaveApplier` -> clear) | nothing. I checked this specifically because PipeInputs.h:281-287 predicts the failure; the fix is already in the tree. | `PipeApplier::LeaveApplier` (PipeApplier.cpp:1331) | st | |
|
||||
| A2-20 | already-handled | XFB `g_roleXfbState` — a two-element array indexed by `Transport != Monolith`, per-arm native generation, server keys = `MGPipeApplier().BoundStreamOutputLifetimeId` | MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp:1629-1656 (`RoleXfbState`, `ActiveXfbState()`; the role index at :1645, the generation reset at :1647-1650, the role-change `NeedsBind` at :1651-1653), :1659-1677 (`CurrentXfb`, the lifetime key at :1663), :2210-2245 (bind), :2280-2287 (the server's virtual-name-0 arm), :2295-2306 (`OnBackendContextDestroyed`, which clears both arms) | nothing, except through A2-1: the arm index at :1645 is the same `Transport != Monolith` expression, so a forced-monolith server child would silently switch to the GL-name-keyed map and to `scatterProgram`, i.e. to frontend objects that do not exist in that process. | `state.NativeGeneration != g_backendContextGeneration` (:1647); `g_activeXfbRole != role` (:1651) | st | |
|
||||
| A2-21 | p6-must-handle | `EsprytSlotTablesEnabled()` — a function-local `static const Bool` latched ONCE per process at the first twin lookup, read off `MG_Config::Features.PipePush`, NOT off the transport | MobileGL/MG_Backend/DirectGLES/SlotTables.h:150-153 (the latch), :140 (`ResolveEsprytSlotTablesArm`); the body is MobileGL/MG_Backend/DirectGLES/Managers.cpp:431-471 (the `Fatal{PipeLegacyMemosDisabled}` NoArm stop at :454-458); the default mask is MobileGL/MG_Pipe/MGPipe.h:164 (`0x3fff`, bit 5 set) applied at MobileGL/ConfigLoader.cpp:266 | The two processes parse their own environments. ARCHITECTURE.md:488 specifies scrubbing `MOBILEGL_TRANSPORT` and all `MOBILEGL_IPC_*` from the child's envp — `MOBILEGL_PIPE_PUSH` is NOT in that set, so it inherits through envp but NOT through any value the parent set programmatically after its own parse. If the two arms disagree the client mints `{slot, gen}` handles the server's legacy address-keyed registry cannot resolve, with no gate that compares them. Note also that the `Hello`/`Welcome` fingerprint is build-only (CapsCodec.h) and carries no config. | the build fingerprint does not cover the subsystem mask; `ConfigLoader` logs it but nothing cross-checks | c6 | **line-does-not-resolve** — Cite ARCHITECTURE.md:489. Verdict p6-must-handle is right. Worth adding that MOBILEGL_PIPE_VERIFY is in the same unscrubbed class and interacts with A2-12: ConfigLoader.cpp:401-406 forces RoleSplitSta |
|
||||
| A2-22 | p6-must-handle | `g_processTeardown` / `EnsureProcessTeardownSentinel()` — the at-exit sentinel every twin destructor consults before touching the driver, registered LAZILY at first registry use | MobileGL/MG_Backend/DirectGLES/Managers.cpp:188-197 (`Bool g_processTeardown`, `std::atexit` registration at :195-196); readers at Managers.cpp:217, :4783, :6068, :9895, :12173, :14691, :15031 and MobileGL/MG_Backend/DirectGLES/SlotTables.h:65; registration sites Managers.h:358, SlotTables.h:275, :355 | The server process's exit path is brand new and `sm` chooses it. If it is `_exit()` (which ARCHITECTURE.md:493's 'EOF detection exits immediately and unconditionally' points at), no atexit handler and no static destructor runs at all — which is safe but means nothing in the tree is responsible for the EGL teardown, so A2-17's owner is mandatory. If it is `exit()`/return-from-main, the lazy registration order relative to the function-local statics registered later (e.g. `GetRawDepthFetchSampler`'s `native`, DirectGLES.cpp:316) decides whether a destructor calls `glDeleteSamplers` after `eglTerminate`. I could not settle the ordering by reading alone. | `InProcessTeardown()` early-outs in seven destructors, plus the independent generation gate at Managers.cpp:14704 which | sm | **line-does-not-resolve** — Change the citation to ARCHITECTURE.md:498. Keep verdict p6-must-handle and confidence uncertain — the open question about atexit ordering is genuinely unsettled by reading, and :498 makes `_exit` the |
|
||||
| A2-23 | p6-must-handle | `ClientSession::Stop()` reaches into the SERVER role's two process singletons directly, on both its arms | MobileGL/MG_Remote/Client/ClientSession.cpp:758 (`Server::ServerSessionInstance().Close()` on the failed-Start arm), :802 (`Server::ServerLoopInstance().Stop()`), :814 (`Server::ServerSessionInstance().Close()` on the started arm); the ordering argument is at :746-755 and :768-805 | In the spawn client process these calls still compile and still run. `ServerSessionInstance()` would construct a never-accepted `ServerSession` there (Close is then a near no-op), and `ServerLoopInstance().Stop()` would construct a `ServerLoop` in the client process and take its `!m_thread.joinable()` arm (ServerLoop.cpp:755-766), which writes the client process's own `g_serverContextLive = false` and `ForgetCurrentTuple()`. Harmless today, but it is two server-role singletons instantiated in the wrong process, and it is the same function that must instead send a shutdown frame over the socket. | none — the calls are unconditional on the arm | cp | |
|
||||
| A2-24 | no-action | `g_backendContextGeneration` starts at 1, only ever increments, and `ContextEpoch{}`'s default is `{0, 0, false}` — so the first `CurrentContextEpoch()` in any process can never equal the default-constructed shadow key | MobileGL/MG_Backend/DirectGLES/Managers.cpp:69 (`Uint g_backendContextGeneration = 1`); the single bump is MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp:16750 inside `DestroyEGLContext`; the default key is MobileGL/MG_Backend/DirectGLES/ContextEpoch.h:11-16 | nothing. Worth recording because it is the reason `st` does not need a 'prime the shadows at server start' step: the epoch's own zero value does it. | the epoch compare itself | st | |
|
||||
| A2-25 | already-handled | `StagedShadowStore` — 'ONE PER PROCESS', and its copying arm is latched at first use from `MG_Config::Transport != Monolith` | MobileGL/MG_Backend/DirectGLES/Managers.cpp:1154-1165 (the comment and `ServerStaged()`; the constructor argument at :1164 is `MG_Config::Transport != MG_Config::TransportMode::Monolith`); the drop-all at MobileGL/MG_Pipe/PipeApply.cpp:1487-1490 | nothing — it is server-private and its key is server-owned. It is a third transport-latched arm (with A2-21 and A2-1) that a forced-monolith child would flip, and since it latches at FIRST USE rather than at config parse, flipping `MG_Config::Transport` after the first staged resource would strand everything already staged. | the latch itself | st | |
|
||||
|
||||
**复审另行指出的遗漏**:
|
||||
- MobileGL/MG_Remote/Client/ClientSession.cpp:1300, :1397, :1402 — the FOURTH and FIFTH production consumers of MGPipeRoleSplitActive(), which A2-12 does not list. A2-12 names three mechanisms gated on the knob ((a) PipeInputs.cpp:174, (b) :315, (c) :297). The complete production set is five sites: `grep -rn MGPipeRoleSplitActive MobileGL/ | grep -v MG_Test` returns PipeInputs.cpp:174, :298, :315 AND ClientSession.cpp:1300 (`ApplyThreadIsInsideApplier`: `if (MGPipeRoleSplitActive()) return g_roleInsideApplier;`), :1397 and :1402 (`NoteApplyThreadEnteredApplier` / `NoteApplyThreadLeftApplier`: `if (!MGPipeRoleSplitActive()) g_applyThreadInsideApplier.store(...)`). The state behind them is `std::atomic<Bool> g_applyThreadInsideApplier{false}` at ClientSession.cpp:119 — a process-shared atomic WRITTEN BY THE SERVER ROLE AND READ BY THE CLIENT ROLE, which is the purest instance of this item's own subject. With the knob at its default 0, a spawn client process reads an atomic nobody in that process ever writes, so it is permanently false and the R-1 mutual-exclusion Fatal it feeds (RefusePipeInputsTouchWhileApplierOwnsIt, ClientSession.cpp:1304-1394) can never go red there. Honest framing for c6: under spawn that gate SHOULD be vacuous (there is no shared gPipeInputs to race), but it is vacuous by accident of a default-off knob rather than by a role fact — which is A2-12's thesis exactly. This is not a new discovery either: docs/Disaggregated/notes/p5f/f0-statics.md §S13 already classed this scalar 【A】 and predicted it in words ('拆进程后 client 那份恒 false … 否则会漏掉「client 读自己那份永远 false」的假绿'). VERIFIED by reading.
|
||||
- MobileGL/MG_Remote/Client/CapsMirror.cpp:166-171 (the leaked singleton), CapsMirror.h:95-98 ('Per client context in principle; one per process in P5'), CapsMirror.cpp:91 (`Valid()` is `m_generation != 0`), CapsMirror.cpp:55-87 (Adopt), sole adoption site ClientSession.cpp:448 — a process-scoped singleton holding the SERVER's session-scoped answers (CallMask, FormatCapabilityCache, RendererInfo, apiVersion, BackendType) that ClientSession::Stop() never resets. I checked Stop() line by line: :819-826 resets m_runAheadArmed / m_runAheadLatched / m_presentsSent under the explicit P5e argument 'the LATCH GOES DOWN WITH THE SESSION … a session that starts again must take it again from that session's own first snapshot rather than inherit a verdict about a server that is gone' — and does NOT extend that argument to the mirror the latch was derived from. `grep CapsMirror MobileGL/MG_Remote/Client/ClientSession.cpp` returns only :392, :448, :677, :840; there is no reset anywhere. This is the same shape as A2-7 on the caps side: under MOBILEGL_IPC_RESPAWN=1 (ARCHITECTURE.md:504) the reconnecting client answers R-8's only legal client-side question — CapsMirror::ServerConsumes, whose own comment at CapsMirror.cpp:126-136 says a placeholder mirror consuming nothing is 'the safe direction' and emitting to a server with no consumer is 'the one that loses uploads' — from the DEAD server's CallMask, and Valid() stays true so WarnPlaceholder never fires. The asymmetry worth naming to c6: f0-statics §S13 classed BOTH `g_applierResetContextSerial` (WireTables.cpp:642) and `CapsMirror.cpp:169` as 【B】 'client-side, per-process is fine'; a6.2 correctly reopened the first (A2-7) and did not reopen the second, although the respawn boundary is new to P6 for both. VERIFIED by reading; the consequence is inferred and depends on what MOBILEGL_IPC_RESPAWN's 're-push everything' is specified to do.
|
||||
- MobileGL/MG_Impl/Pipe/SlotAllocator.cpp:312-322 (`MGPipeSlotAllocator::Reset()`) and :324-341 (`MGPipeSlots()`) — the client's {slot, gen} handle allocator is a process-lifetime singleton whose own comment at :331-338 says 'NEVER DESTROYED, deliberately (one allocation for the life of the process)', and `Reset()` has ZERO callers in the whole tree (`grep -rn 'Slots()\.Reset\|SlotAllocator.*Reset'` finds only the definition). Same family as A2-7: a process-scoped counter/space that no session boundary resets, and here the reset that exists is dead code. Under MOBILEGL_IPC_RESPAWN=1 the client keeps its entire slot and generation space across the reconnect while the fresh server's twin registries start empty, so whether the respawn works at all depends on 're-push everything' re-emitting every resource_create with the SAME client-minted handles. c6 should say which, and either wire Reset() into the respawn path or delete it so it is not mistaken for a mechanism. VERIFIED that the allocator is process-scoped and Reset() is uncalled; the respawn consequence is inferred.
|
||||
- MobileGL/MG_Backend/MGPipe/PipeInputs.h:496, :515, :526 — the three `m_serverStampedVerb`-gated dual-arm getters (GetSamplingResolutionGeneration at :496, GetTextureBindGeneration at :515, GetTextureContextId at :526) each read `if (m_serverStampedVerb) return MGPipeApplier*Serial();` and otherwise fall back to a CLIENT-FILLED member (m_textureBindGeneration :517, m_textureContextId :528). This is A2-13's shape one level down and A2-13 does not cover it: in a server-only process the fallback member is never written by anyone, and PipeApplier::LeaveApplier (PipeApplier.cpp:1331) clears the stamp on every applier exit, so ANY backend read outside a stamped verb — a control-request path, InitCapabilities, a surface op, the sticky-forward exemption family PipeInputs.h:955-958 names — takes the non-stamped arm and keys off a permanently-zero value. These three answers key the whole DirectGLES context-scoped memo family: g_observedUnitBindingsContextId (DirectGLES.cpp:3179), g_unitTextureSyncListByHandleContextSerial (:3415), g_unitTextureSyncListContextId (:3423), g_fboTextureSyncListContextId (:3461), g_fboAttachmentSyncListContextSerial (:3487). Those memos are each double-keyed on native generation as well (:3419, :3425, :3462, :3488), so a stale read is bounded rather than catastrophic — which is why I rate it p6-must-handle for the contract rather than blocks-p6. VERIFIED the code shape by reading; reachability outside a stamped verb is inferred, and settling it needs the ServerMain control path sm has not written.
|
||||
- MobileGL/MG_Impl/GLImpl/Query/GL_Query.cpp:55-70 and MobileGL/MG_Impl/GLImpl/Sync/GL_Sync.cpp:34-35 — the query and sync registries (g_queryObjectsMutex / g_liveQueryObjects / g_nextQueryId / the four active-query ids / g_activePipelineStatisticsQueryIds; g_syncObjectsMutex / g_liveSyncObjects) are per-context BY SPEC and stored per-process. This is the literal statement of the item's title and a6.2 has no row for it at all, although docs/Disaggregated/notes/p5f/f0-statics.md §S12 already recorded it as a multi-context debt. Under spawn they stay in the CLIENT process, which is the right process, and P6-CONTRACT-DRAFT §9.2 declines multi-context (it moves to P12), so the correct verdict is later-stage/P12 — but the item should CLASSIFY them rather than omit them, so a6's successor does not re-discover them. Note the audit also used file paths that no longer exist: f0-statics cites `GL_Query.cpp:55-66` and `GL_Sync.cpp:34-37` without the Query/ and Sync/ subdirectories they now live in. VERIFIED by reading.
|
||||
- MobileGL/MG_Backend/Init.cpp:82 — a tree comment the audit had every reason to catch while working in this exact function and did not: it asserts 'MGPipeSetResourceOps has exactly one caller in the whole tree and it is Managers.cpp:2594'. At b3b9c2ee there are TWO callers and neither is at that line: DirectGLES/Managers.cpp:3137 and DirectVulkan/Renderer/VkBufferManager.cpp:170 (with the matching owner-checked unsets at Managers.cpp:3149-3150 and VkBufferManager.cpp:429-430). Low severity — it does not change any verdict — but it sits in the middle of InitSplitRoles' rationale block, which is the text c6 will read when splitting the function per A2-18. Two smaller instances of the same rot, both in comments the audit quotes from: PipeApplier.cpp:1160 cites 'the g_applier this role owns (PipeApply.cpp:409)' and PipeFill.cpp:822 cites 'a PROCESS-WIDE global (PipeApply.cpp:402)', while `MGPipeApplierState& g_applier` is at PipeApply.cpp:436 and `const MGPipeResourceOps* g_resourceOps` at :442. VERIFIED by reading.
|
||||
- NEGATIVE RESULT worth recording so c6 does not chase it, and so the integrator knows this was checked rather than skipped: g_resourceOps (PipeApply.cpp:442) is NOT a gap. It is the most obvious candidate in this family — a process-wide table the server registers that client code reads — but c1's R-8 work already moved every client-side consumer to the caps mirror, and the code names the spawn case by name: PipeFill.cpp:819-828 ('under spawn the client process has no backend at all, so the read answers null and five record families stop emitting - silently'), with the moved arms at :834-835 (MGPipeResourceSubsystemEnabled), :843-848 (MGPipeResourceOpsHaveSubDataResident) and :1427-1431 (P4aFamilyHasItsConsumer), and the server-side honesty check at Init.cpp:119-131 (Fatal{ConsumerMaskLie}). Likewise g_clientTablesUninstalled (WireTables.cpp:104) IS session-cycle-safe: it is reset to false at WireTables.cpp:730 and :800, unlike the two serials in A2-7. Both were checked and found already-handled.
|
||||
|
||||
---
|
||||
|
||||
## a6.3 gPipeInputs 角色归属与反递归
|
||||
**小结**:Today a record consumer selects its server arm with ONE predicate spelled 238 non-test times: `MG_Config::Transport != MG_Config::TransportMode::Monolith`. It is process-global, latched at `ConfigLoader::Init`, never thread-dependent. Beside it live exactly two other real predicates - `ServerLoop::OnApplyThread()` (ServerLoop.h:265, one relaxed load of `g_applyThreadKey` plus a thread-pointer compare) and `ClientSession::Active() != nullptr` - plus nine aliases/wrappers of those three. The decisive finding is that ARCHITECTURE.md:488's instruction ("`mobilegl_server_main` 在到达 `Init()` 之前把 `MG_Config::Transport` 硬置为 `Monolith`") is not merely suboptimal, it is unsound at named sites I opened: it flips `ContextEpoch::Server` to false and `Served` to 0 (ContextEpoch.h:19), constructs BOTH server staged stores with `copies=false` (Managers.cpp:1164, StagedTextureStore.h:475 - latched function-statics, unrecoverable after first use), re-enables the frontend VAO walk in the server (DirectGLES.cpp:2483/2576), disarms three role Fatals (SlotAllocator.cpp:30/50, MipmapStorage.cpp:55, BufferObject.cpp:63), and - worst, because it is SILENT - makes `PipeInputs::IsLive()` (PipeFill.cpp:2137) answer from the child's null `pGLContext` instead of `MGPipeServerContextIsLive()`, turning all 58 `MGB_CTX_LIVE` guards into a quiet "no context" in a process that has one. `Dial = No` is the right structural catch, but it is NOT sufficient at one site: `Init.cpp:266` is a two-way `Transport != Monolith` whose else-arm is the monolith backend switch at `Init.cpp:305`, so a child with `Dial=No` and `Transport=Spawn` still needs a THIRD `Role == Server` arm there or it falls into exactly the trap. gPipeInputs itself is already clean: the P5f dual-block census (`Harness/dualblock-expected-fatals.txt`) is EMPTY, which is in-process proof that the server block is self-sufficient - so the one thing c6 most needs from this audit is the decision at Init.cpp:266, expressed as a three-valued Role and not as a boolean Dial.
|
||||
|
||||
复审结论:**sound-with-fixes**(重新解析 27 条,异议 11 条,另指出 8 处遗漏)
|
||||
|
||||
| # | 判定 | 事实 | 站点 | spawn 下如何坏 | 守卫 | 归属 | 复审 |
|
||||
|---|---|---|---|---|---|---|---|
|
||||
| A3-1 | blocks-p6 | `MG_Config::Transport != TransportMode::Monolith` - the dominant server-arm selector. 238 non-test occurrences (311 with tests); 67 in DirectGLES.cpp, 27 VulkanRenderer.cpp, 24 Managers.cpp, 19 PipeFill.cpp, 16 DirectVulkan.cpp, 11 PipeApply.cpp, 9 ClientSession.cpp, 8 in MG_State. | MobileGL/Config.h:455 (declaration); MobileGL/ConfigLoader.cpp:33 (definition, plain non-atomic, default Monolith); representative consumers MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp:2483, MobileGL/MG_Backend/DirectGLES/Managers.cpp:2867 | In the child the two facts part company. If the child forces Monolith (ARCHITECTURE.md:488), all 238 sites select FRONTEND GLUE in the one process that has no frontend. If the child keeps non-Monolith, the same 238 sites are right but the predicate now also says "dial out" at Init.cpp:266, which is the fork chain. | none - it is a plain enum load, and the pull build folds it to constexpr Monolith (Config.h:566), so no gate sees it | c6 | **overstated** — Replace 238/311 with 178 non-test predicate sites (179 incl. the integration harness; 177 excluding the Config.h:564 comment), and 208 total comparisons against Monolith counting the 30 `== Monolith` |
|
||||
| A3-2 | p6-must-handle | `ServerLoop::OnApplyThread()` - the thread-identity predicate. Body is `g_applyThreadKey.load(relaxed) != 0 && key == CurrentThreadKey()`; the key is the thread pointer (TPIDR_EL0) on aarch64. | MobileGL/MG_Remote/Server/ServerLoop.h:265-271; key published at MobileGL/MG_Remote/Server/ServerLoop.cpp:344 (ApplyThreadMain) and cleared at :528 | In the server process the ROLE is the whole process. If ServerMain drives the applier on its main thread rather than through ServerLoop::Start, g_applyThreadKey stays 0 and every OnApplyThread() guard answers FALSE in the server - the guards silently stop guarding. If ServerMain does start a ServerLoop, the guards are right on that thread but still answer FALSE on the server's control-pump / socket-reader threads, which are also the server role. | none. The header argues the key is never 0 for a LIVE thread, not that the role implies a thread. | sm | |
|
||||
| A3-3 | p6-must-handle | `MGPipeRoleSplitActive()` = `MG_Config::Ipc.RoleSplitState && Transport != Monolith`. Deliberately NOT latched (two global loads per verb). | MobileGL/MG_Backend/MGPipe/PipeInputs.cpp:292-295 | Nothing breaks - it becomes MOOT, which is its own problem. Under spawn the two blocks are in two address spaces whatever the knob says, so the knob can no longer change behaviour in either process, and scripts/ci/dualblock_negative_control.sh's red form (ROLE_SPLIT_STATE=0 must turn the lane red) cannot go red in a spawn lane. This is a FOURTH question - "do the two roles share one storage object" - that Role/Dial/SplitActive cannot express. | scripts/ci/dualblock_negative_control.sh - and that is exactly the gate that stops being able to fail | t6 | |
|
||||
| A3-4 | already-handled | gPipeInputs storage and the dual-block selection. `gPipeInputs` is the SERVER-role block; `gPipeInputsClientBlock` exists only in a disaggregated build; `MGPipeClientInputs()` returns the client block iff MGPipeRoleSplitActive(). Both are leak-at-exit `*new PipeInputs()` because their O-class members are SharedPtrs to MG_State frontend objects. | MobileGL/MG_Backend/MGPipe/PipeInputs.h:837 (gPipeInputs), :861 (gPipeInputsClientBlock), :895 (the non-disagg fold); MobileGL/MG_Backend/MGPipe/PipeInputs.cpp:297-299 (selection) | Nothing, and that is the useful answer. In the SERVER process gPipeInputs is the only block and is wholly server-written; in the CLIENT process gPipeInputs (or the client block) is fill-written and read by NOBODY, because no backend is linked into the reading path there. The `gPipeInputsClientBlock` allocation and the selection branch become dead weight in both processes. | MG_IntegrationTest/Scenarios/DualBlockScenario.cpp asserts blocksDistinct and that a client verb boundary does not move | c6 | |
|
||||
| A3-5 | already-handled | Who WRITES gPipeInputs in the server role: the applier through MGPipeApplyAccess, unconditionally on `gPipeInputs` (never through MGPipeClientInputs). | MobileGL/MG_Pipe/PipeApply.cpp:1619 (BindRenderState), :1647 (SetDynamicState), :1656 (SetPixelPackState), :1668 (SetContextValues), :1682 (SetPatchState), :1741, :1822 | nothing - these are already address-space-local server writes. They are the reason gPipeInputs is self-sufficient in a second process. | n/a | c6 | |
|
||||
| A3-6 | already-handled | Who STAMPS gPipeInputs: MGPipeStampAccess, from PipeApplier. The stamp fills FilledGen[i] with the new serial for RECORD_SUPPLIED/APPLIER_DERIVED fields inside the verb's class mask and ZERO for everything else; FilledGen==0 is "never filled" and is Fatal on read. | MobileGL/MG_Backend/MGPipe/PipeInputs.cpp:330-375 (stamp), :377 (clear), :325 (SetIdentity); called from MobileGL/MG_Remote/Server/PipeApplier.cpp:1328 (StampVerbBoundary) and :1331 (LeaveApplier); freshness rule MobileGL/MG_Pipe/generated/PipeFilled.inc:421-426 | nothing structurally, but it is the ONLY writer of the server block's stamps in the child. Every read before the first stamp has FilledGen==0 and therefore Fatals - which is correct and loud. PipeInputs.h:277-285 already states that latching ServerStampedVerb TRUE is wrong "for P6, where MG_Impl is not in the server at all", and the clear at PipeApplier.cpp:1331 is what makes that true. | MGPipeInputUnfreshRead (PipeInputs.cpp:381-413) - poison Fatal or Fatal{RoleViolation} | st | |
|
||||
| A3-7 | already-handled | Who READS gPipeInputs: 383 MGB_CTX* occurrences in MG_Backend - 310 `MGB_CTX->`, 58 `MGB_CTX_LIVE`, 3 `MGB_CTX_IDENTITY`. All resolve to `&gPipeInputs`. | MobileGL/MG_Pipe/PipeInputsSwitch.h:19-21; densest consumers MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp (112), MobileGL/MG_Backend/DirectVulkan/Renderer/VulkanRenderer.cpp (135) | nothing on the read side. The P5f dual-block census is EMPTY (MobileGL/MG_IntegrationTest/Harness/dualblock-expected-fatals.txt, "the expected set is empty after fc -> fe -> fm integration"), i.e. the whole integration-split + integration-magma-split lane already runs green with the two blocks separated and MOBILEGL_IPC_STRICT_ERRORS=1. That is in-process PROOF that no backend read reaches the client fill. | dualblock-expected-fatals.txt is two-sided (split_log_paths.py expect-fatal fails on a new pair AND on a listed pair tha | st | **overstated** — Keep the verdict (already-handled) and the 58. Recompute the other four numbers, or drop them - they are decoration on a conclusion the empty census already carries. Same recomputation invalidates doc |
|
||||
| A3-8 | blocks-p6 | `PipeInputs::IsLive()` - the liveness forwarder, whose BODY branches on Transport and whose definition lives in MG_Impl. Non-monolith -> `MGPipeServerContextIsLive()` (server-owned, P5f fs). Monolith -> `LiveContext() != nullptr`, i.e. `MG_State::pGLContext`. | MobileGL/MG_Impl/Pipe/PipeFill.cpp:2135-2141; consumed as MGB_CTX_LIVE at MobileGL/MG_Pipe/PipeInputsSwitch.h:20, 58 read sites in MG_Backend | THE SHARPEST force-Monolith failure. With the child forced Monolith, IsLive() reads `MG_State::pGLContext`, which is null in the server process, so all 58 MGB_CTX_LIVE guards answer FALSE and every context-guarded backend path silently early-returns. IsLive() carries NO MGP_INPUT_CHECK (PipeInputs.h:259-262, it is "not a field"), so this is a silent wrong picture, never a named Fatal. | none - IsLive is outside the poison, by design | sm | |
|
||||
| A3-9 | p6-must-handle | Eight out-of-line `PipeInputs::` member definitions live in MG_Impl, not MG_Backend: IsLive, GetBufferBindingPointCount, GetProgramObject, GetTextureObject, HasOpenTransformFeedbackSpan, InvalidateCompileEnv, ValidateProgramName, RecordError. Six of them re-ask `Transport != Monolith` in their own bodies. | MobileGL/MG_Impl/Pipe/PipeFill.cpp:2135, :2160, :2178, :2184, :2190, :2202, :2217, :2223 | A server image that does not link MG_Impl has eight undefined symbols reachable from the backend's own MGB_CTX reads. Under force-Monolith the ones that DO link take the client path and answer from a null GLContext: GetBufferBindingPointCount returns 0 instead of kMGPipeMaxBufferBindingPoints, GetProgramObject/GetTextureObject return an empty SharedPtr, RecordError MGLOG_E_ONCEs and DROPS the error instead of firing the reverse-channel Fatal at PipeFill.cpp:2231-2235. | none. MGPipeStickyForwardPull (PipeInputs.cpp:442-452) only counts these inside a server-stamped verb, and with 0 BARRIE | a6 | **overstated** — Say FIVE re-ask the predicate, and split the other three out as 'null-GLContext in any child, independent of the force-Monolith decision' - they argue for the link/ownership question (a6.5), not for t |
|
||||
| A3-10 | blocks-p6 | `Init.cpp`'s single hook: `if (Transport != Monolith) { InitSplitRoles(); ... return; }` and the ELSE-arm, which is the monolith backend switch. | MobileGL/MG_Backend/Init.cpp:266 (the hook), :151-230 (InitSplitRoles), :216 (ClientSession::Start - the dial), :305-317 (the monolith switch) | THE ANTI-RECURSION SITE, and a boolean `Dial` is not enough here. `Dial = No` + `Transport = Spawn` makes the condition at :266 still TRUE, so the child dials. Making the condition `ShouldDial()` instead makes it FALSE in the child, which drops it into the monolith switch at :305 and constructs `BackendObject_DirectGLES` on the app thread with no ServerLoop, no applier and no stamp - the exact frontend-glue trap. This site needs a THREE-VALUED Role, not a boolean. | none. InitSplitRoles' failure path sets pActiveBackendObject=nullptr (Init.cpp:270-273) and is loud, but the Role==Serve | c6 | |
|
||||
| A3-11 | blocks-p6 | `ContextEpoch::Server` - `Transport != Monolith` used as a CACHE KEY VALUE, not a branch. The epoch is {native generation, served-context serial, Server}; with Server false the Served half is forced to 0. | MobileGL/MG_Backend/DirectGLES/ContextEpoch.h:17-21 | Force-Monolith gives the SERVER `Server=false, Served=0`, so the served-context serial stops invalidating anything and a replaced context reuses the previous one's sync state - which is exactly what negative control S4 exists to falsify. Separately, if c6 rewrites this as `MGPipeServerArm()` carrying the `OnApplyThread()` disjunct, the value becomes THREAD-dependent and the same static memo is keyed two ways under inproc. | P6-SPAWN-PLAN §7 S4 ("临时关闭 spawn 接线中继承的 P5f epoch 失效") - but S4 tests the epoch, not the Server bit that keys it | c6 | |
|
||||
| A3-12 | blocks-p6 | `ServerStaged()` - the server's buffer staged-shadow store, a function-static constructed ONCE with `Transport != Monolith` as its `CopiesIntoServerStorage` constructor argument. | MobileGL/MG_Backend/DirectGLES/Managers.cpp:1161-1166 (argument at :1164); class at MobileGL/MG_Remote/Server/StagedShadow.h:34-35 | Force-Monolith constructs it with `false` in the server process, so the server keeps NO authoritative bytes and falls back to a frontend MappedData that does not exist there. It is LATCHED, so nothing later can correct it. | none at the construction site. StagedShadowStore takes the flag as a parameter precisely so a unit case can compare the | c6 | **line-does-not-resolve** — Change the why-it-works cite from Managers.cpp:2247-2252 to Managers.cpp:1155-1157. The verdict (blocks-p6, latched, unrecoverable) is correct and survives. |
|
||||
| A3-13 | blocks-p6 | `ServerStagedTexture()` - the same shape for textures: a function-static constructed once with `Transport != Monolith`, consumed by BOTH backends (Espryt's Managers.cpp and Magma's VulkanRenderer.cpp). | MobileGL/MG_Remote/Server/StagedTextureStore.h:473-477 (argument at :475) | same as A3-12, and it is worse because two backends share the one store - a wrong latch in the child silently disables the texture staging both of them read. | none in production wiring (StagedTextureStore.h:92-95 says so out loud) | c6 | **claim-false** — The guard is not 'none' - it is MG_Test/Wire/StagedTextureStoreTest.cpp:740-743 + :445-453, an in-process red-once that WOULD catch a force-Monolith latch. The spawn-specific problem is therefore shar |
|
||||
| A3-14 | p6-must-handle | `ActiveXfbState()` - `const Int role = Transport != Monolith` used as an ARRAY INDEX into a 2-element role-partitioned XFB state table, with `g_activeXfbRole` tracking transitions and forcing a rebind on change. | MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp:1641-1655; consumers at :1662 (CurrentXfb), :1807 (BindScatterCaptureBuffer), :1848 (ScatterCapturedRecords), :2212 (BindTransformFeedback), :2257 (DeleteTransformFeedback) | Force-Monolith puts the server on index 0, whose keys are GL NAMES it never receives (the server's identity is `MGPipeApplier().BoundStreamOutputLifetimeId`, DirectGLES.cpp:1664). Also a decomposition misfit: rewriting `role` as `MGPipeServerArm()` with the OnApplyThread disjunct would make the index thread-dependent under inproc and split one process's XFB objects across both slots. | none - `g_activeXfbRole != role` only forces a rebind, it does not refuse | c6 | |
|
||||
| A3-15 | p6-must-handle | The "MONOLITH ONLY" frontend-glue gates: `if (Transport != Monolith) return true;` guarding client-side-vertex-array staging, which reads `MGB_CTX->GetBoundVertexArray()` and the frontend binding slots. | MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp:2483 (SyncClientSideVertexArraysForFetch), :2544 (ForIndirectFetch), :2576 (ForIndexedFetch); same shape at :4297, :4416, :8964 | Force-Monolith re-enables the whole family in the server. Here the failure IS named: GetBoundVertexArray is a FATAL row (MG_Pipe/FieldOwnership.def:27), so the read aborts with Fatal{UnmigratedPipeInput,"GetBoundVertexArray@<verb>"} - but only once the applier has stamped a verb. Between stamps FilledGen==0 also Fatals, so this class is loud rather than silent. It is still 40-odd bodies of dead-and-dangerous code re-armed in the wrong process. | MGP_INPUT_CHECK -> MGPipeInputUnfreshRead (PipeInputs.cpp:381) -> Fatal | c6 | **wrong-verdict** — Move DirectGLES.cpp:8962-8970 out of A3-15 and into A3-16's disarmed-Fatal family (it is the fifth member there, alongside the one named in `missed`). Fix FieldOwnership.def:27 -> :28. The remaining f |
|
||||
| A3-16 | p6-must-handle | Role-violation Fatals of the shape `if (Transport == Monolith) return; if (!OnApplyThread()) return; Fatal;` - the tree's canonical "SplitActive AND ServerArm" conjunction. | MobileGL/MG_Impl/Pipe/SlotAllocator.cpp:29-43 (MGPipeRefuseAllocatorFromApplyThread) and :46-56 (MGPipeRefuseFrontendKeyedRegistryFromApplyThread); MobileGL/MG_State/GLState/TextureState/MipmapStorage.cpp:54-67 (RefuseLegacyTextureArmFromApplyThread); MobileGL/MG_State/GLState/BufferState/BufferObject.cpp:62-66 (RefuseLegacyBufferArmFromApplyThread, via PushIsArmed/OnServerRole) | Force-Monolith makes the FIRST conjunct false, disarming every one of these in the process where the client allocator genuinely does not exist. With Transport kept non-Monolith, the SECOND conjunct is only true on a ServerLoop apply thread - the server's control-pump and socket-reader threads slip through. The review's `MGPipeServerArm() = Role==Server // (Role==Client && OnApplyThread())` FIXES both halves: in the child Role==Server makes the guard fire on every thread. This is the decomposition's best fit. | these ARE the guards | sm | |
|
||||
| A3-17 | p6-must-handle | `MGPipeApplierReset`'s three-conjunct guard: `Transport != Monolith && ClientSession::Active() != nullptr && !OnApplyThread()`. The middle conjunct is a FOURTH axis - "is there a live wire" as distinct from "is a transport configured". | MobileGL/MG_Pipe/PipeApply.cpp:1354-1362; the axis is documented at PipeApply.cpp:41-45 and ClientSession.cpp:455-458 | `ClientSession::Active()` is null in the SERVER process for the whole of its life - there is no client session there - so this guard is unconditionally disarmed in the child. It is a concrete counterexample to the three-predicate decomposition: SplitActive/ServerArm/ShouldDial cannot express "a peer session is live", and the tree already needs that axis in two places. | this is the guard; it stops being able to go red in the server process | c6 | |
|
||||
| A3-18 | p6-must-handle | `ClientSession::RefusePipeInputsTouchWhileApplierOwnsIt` - the gPipeInputs role guard. Opens with `if (Transport == Monolith) return;` then consults `ApplyThreadIsInsideApplier()`, a process-global atomic raised by the applier. | MobileGL/MG_Remote/Client/ClientSession.cpp:1303-1392 (entry at :1303, SplitActive test at :1320, the two Fatals at :1358 and :1387); flag at :119 and :1396-1404 | In the CLIENT process `g_applyThreadInsideApplier` is never set by anyone, so `ApplyThreadIsInsideApplier()` is permanently false and both Fatals become unreachable - a gate that can no longer go red for the reason it exists. It must be retired BY ROLE ("this process has no applier") and named, not left silently satisfied by an always-false global. | itself - and that is the problem | c6 | **overstated** — Keep verdict p6-must-handle. Restate the mechanism as: the flag is thread_local under role-split (:123) and a never-written process atomic otherwise (:119) - both answer false in a spawn client. State |
|
||||
| A3-19 | p6-must-handle | `OnFrontendStateObjectDestroyed`'s emit fork: `Transport != Monolith && !OnApplyThread()` -> emit object_death as a RECORD; else fall through to the direct twin-release switch. | MobileGL/MG_Backend/DirectGLES/Managers.cpp:229-231 | In the SERVER process any non-apply thread satisfies both conjuncts and would try to EmitObjectDeathRecord from the server - publishing into the ring the server is consuming. Rewriting `!OnApplyThread()` as `!MGPipeServerArm()` with the Role disjunct fixes it; rewriting it as `!OnApplyThread()` alone does not. | none at this site | sm | |
|
||||
| A3-20 | p6-must-handle | `MGL_BACKEND_SLOT_CAP` / `_LOCAL` / `_PTR_CAP` / `_PTR_LOCAL` - `Transport != Monolith` selecting "ask the CapsMirror (the REMOTE server's published caps)" vs "read the local backend function table". | MobileGL/MG_Remote/Client/SlotCaps.h:110-136; users MobileGL/MG_Impl/GLImpl/{Drawing,Getter,Query,Sync,Texture}, MobileGL/MG_Backend/Init.cpp | This predicate is asking `Role == Client`, not SplitActive. In the child (Role==Server, Transport non-Monolith) it answers "ask the mirror", and the child's CapsMirror is a PLACEHOLDER - CapsMirror.cpp:44-52 warns once and answers placeholder at generation 0. Reachability in the child depends on whether any MG_Impl GL entry point runs there; I did not establish that it does. | CapsMirror::WarnPlaceholder (CapsMirror.cpp:44-52) - a warning, not a refusal | c6 | |
|
||||
| A3-21 | p6-must-handle | The raw `g_applyThreadKey != 0` read - a THIRD question neither SplitActive nor ServerArm can ask: "has an apply thread ever run in this process". | MobileGL/MG_Backend/DirectGLES/Managers.cpp:2865-2884 (the buffer-mutation-epoch pin); the reasoning is written out at :2843-2855 | In the server process EVERY bump is legitimate before the applier starts and none is after, but `g_applyThreadKey != 0` still only answers "is a ServerLoop apply thread up", not "has this process finished bring-up". If ServerMain does not use ServerLoop, the pin never arms. The decomposition needs a bring-up/steady-state axis or this pin silently stops covering the server. | g_bufferMutationEpochBumpsOffTheApplyThread counter + Fatal under MOBILEGL_IPC_STRICT_ERRORS | st | |
|
||||
| A3-22 | p6-must-handle | The aliases: three wrapper functions whose whole body is one of the two real predicates, so a c6 rewrite must find them by BODY, not by name. | MobileGL/MG_Remote/Client/PersistentMapTracker.cpp:526-528 (PushIsArmed == Transport != Monolith) and :535 (OnServerRole == OnApplyThread); MobileGL/MG_Remote/Client/WireTables.cpp:87 (RunsAsTheServerRole == OnApplyThread); MobileGL/MG_Remote/Client/GpuWritePending.cpp:125-127 (GpuWriteSetIsClientSide == Transport != Monolith) | Each inherits its underlying predicate's failure exactly. `PushIsArmed()` in particular gates BufferObject's legacy-arm refusal (BufferObject.cpp:63), so force-Monolith disarms that Fatal through an alias rather than through the obvious spelling. | none | c6 | |
|
||||
| A3-23 | p6-must-handle | The subsystem-bit wrappers: `Transport != Monolith && <PipePush bit>` - six helpers that conjoin the server-arm question with a feature bit so an operator can put a family back on the frontend walk. | MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp:272-274 (FramebufferRecordArmIsMandatory), :3385-3388 (UnitTexturesByHandle), :660-661 (ResolveBufferBindingSubsystemArm); MobileGL/MG_Backend/DirectGLES/Managers.h:740-742 (ProgramHandleArm), :1146-1150 (VertexInputReadsRecords) | Force-Monolith makes all six answer "frontend walk" in the server. Under the decomposition they become `MGPipeServerArm() && bit`, which is right - but note that these are the sites where the server arm is legitimately OPTIONAL, so `ServerArm()` must not be conflated with "the record path is mandatory". | ResolveBufferBindingSubsystemArm refuses bit 13 without bit 7 by name (DirectGLES.cpp:663-672) - a good model for the sh | c6 | |
|
||||
| A3-24 | blocks-p6 | `MG_Config::TransportMode` itself: 5 enumerators in one Uint8, plus `TransportEndpoint` beside it. It conflates four independent facts and stores two different lifetimes. | MobileGL/Config.h:443-449 (enum), :455-457 (Transport + TransportEndpoint); MobileGL/ConfigLoader.cpp:33-34 (definition, default Monolith "so an early read sees Monolith rather than a torn enum") | The four conflated facts are: (1) does a wire exist; (2) WHICH ROLE this process plays - not encoded at all, inferred from (1); (3) whether and HOW this process dials (Spawn=fork+exec, UnixSocket=connect, NamedPipe=connect, InProcess=construct the peer here) - and P6-ENDSTATE-REVIEW:144-146 says that under AVF the SERVER dials and the CLIENT listens, which no enumerator can express; (4) the MEDIUM, carried half in the enum and half in TransportEndpoint. Adding Spawn costs exactly ONE predicate (ClientSession.cpp:482); adding the ROLE axis costs the other 238 nothing ONLY IF the child keeps Transport != Monolith. | ConfigLoader.cpp:347-350 names an unknown value; there is no guard on the conflation | c6 | |
|
||||
| A3-25 | p6-must-handle | `MOBILEGL_TRANSPORT=spawn` parses and is then RESET to Monolith - so `MG_Config::Transport` can never hold TransportMode::Spawn at this head, and the sequencing of the integration commit matters. | MobileGL/ConfigLoader.cpp:339-346 (the named refusal inside InitTransport, which spans :319-351) | If ConfigLoader stops refusing spawn BEFORE `so`/`sm` land, all 238 sites flip to the server arm in a process that has no working session: Init.cpp:266 enters InitSplitRoles, which creates the server's private backend at :158, registers the resource op table, and only then hits the refusal at ClientSession.cpp:482 and returns false - leaving pActiveBackendObject null with a half-built server behind it. P6-SPAWN-PLAN §5 already sequences the ConfigLoader change last; this row is the concrete blast radius for why. | ClientSession.cpp:482-489 named refusal; Init.cpp:270-277 refuses to fall back | c6 | |
|
||||
| A3-26 | p6-must-handle | Config is a SNAPSHOT of `environ` taken at ConfigLoader::Init, filtered to LIBGL_/MOBILEGL_ prefixes, and the map is destroyed immediately after. So the envp scrub is total for the child - and totally ineffective for anything the child later execs. | MobileGL/ConfigLoader.cpp:42-59 (IsAcceptedPrefix + the environ walk), :430-445 (Init order: InitBackendType, InitFeatures, InitTransport, InitIpc, then map.reset()); called once from MobileGL/Init.cpp:118 | This is what sizes the Dial=No-vs-envp-scrub question. `Dial` is in-process state and is NOT inherited; `MOBILEGL_TRANSPORT` IS. So the scrub catches exactly the cases Dial=No cannot: a GRANDCHILD that loads libMobileGL fresh (ARCHITECTURE.md:498 already names one - HeadlessGL's fork pre-check forks a child that runs full EGL bring-up), a respawn by MOBILEGL_IPC_RESPAWN (registered for P6+ at ARCHITECTURE.md:639), and a platform restart of the child. Dial=No catches what the scrub cannot: a second exec path added later that forgets to scrub, and any configuration source that is not envp. Also: Dial must be established BEFORE Init.cpp:118, because after ConfigLoader::Init the map is gone and a later setenv is invisible. | P6-SPAWN-PLAN §7 S3 ("子进程 envp 未剔除" -> 第二道保险挡住递归 spawn 并具名) | sm | |
|
||||
| A3-27 | p6-must-handle | The DualBlock scenario asserts an IN-PROCESS fact about the server block - `serverIdentity != nullptr` - that is only ever set by the server's own stamp/attach. | MobileGL/MG_IntegrationTest/Scenarios/DualBlockScenario.cpp:69-73 (the assertion); MobileGL/MG_IntegrationTest/Harness/DualBlockPeek.cpp:34-41 (the peek); identity written at MobileGL/MG_Backend/MGPipe/PipeInputs.cpp:314-328 | Run from the CLIENT process under spawn, `gPipeInputs.ContextIdentity()` is nullptr - nothing in that process ever calls MGPipeServerBlockNoteIdentity - so the case fails for a reason that is not a defect. P6-SPAWN-PLAN §6 G2/G14 requires the integration-spawn case-name set to be name-for-name identical to integration-split, so this case cannot simply be dropped. | the assertion itself - it goes red for the wrong reason | t6 | |
|
||||
|
||||
**复审另行指出的遗漏**:
|
||||
- MobileGL/MG_Impl/Pipe/SlotAllocator.cpp:23-27 - `MGPipeApplierIsUnbarrieredApply()`, a FIFTH member of A3-16's `if (Transport == Monolith) return false; if (!OnApplyThread()) return false;` family, in the same file the auditor opened and 6 lines above the row's own first cite. It is the only member of that family CALLED FROM THE BACKEND: MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp:2608 guards the Fatal{RoleViolation,"MGPipeSlots"} at :2609-2614 for a draw carrying client-memory vertex arrays applied unbarriered - 'the bytes below are the application's and are moving'. Declared MobileGL/MG_Impl/Pipe/SlotAllocator.h:178. Force-Monolith in the child disarms it at its first conjunct; a ServerMain that does not publish g_applyThreadKey disarms it at its second. It is also a NINTH MG_Impl symbol the backend needs at link time, which falsifies A3-9's and doc_drift #2's 'eight'.
|
||||
- MobileGL/MG_Remote/Server/ServerLoop.cpp:667 (`if (OnApplyThread()) return ApplySurfaceControlFrame(frame);`) and :735 (same, with hook/user) - two `OnApplyThread()` sites that are not guards at all but the re-entrancy arms of RunSurfaceControlFrame. With the key unpublished (a ServerMain that drives the applier without ServerLoop::Start) these answer FALSE on the thread that IS the applier, the frame goes into the one-slot control channel and waits on m_controlDone 'for an answer only THIS thread could ever give' - the hang described in as many words at ServerLoop.cpp:517-527, which also says the integration lane 'would catch that as a hang, not as a failed assertion'. This is the strongest concrete case for c6_ask #6 and the item never names it: it is a deadlock, not a disarmed guard.
|
||||
- MobileGL/MG_State/GLState/TextureState/MipmapStorage.cpp:112-126 - `g_textureLegacyArmScopeDepth` is a NON-thread_local process global (:112, and the comment at :103-111 argues that is safe precisely because OnApplyThread() gates both ends), and MGPipeTextureLegacyArmScope's constructor counts only `if (m_counted)` where `m_counted = ServerLoop::OnApplyThread()` (:115-118). The Fatal at :60 and its named Magma exemption at :59 read the same predicate, so A3-16's recommendation to rewrite :56 as `MGPipeServerArm()` (Role==Server on EVERY server thread) WITHOUT also rewriting :116 silently kills the declared texture-sync exemption and converts it into a spurious Fatal on every non-apply server thread. A3-16 asserts the rewrite 'FIXES both halves' and never opens the scope.
|
||||
- MobileGL/MG_Remote/Client/ClientSession.cpp:123 (`thread_local Bool g_roleInsideApplier = false;`) and :1299-1302 (`ApplyThreadIsInsideApplier()` returning g_roleInsideApplier under MGPipeRoleSplitActive(), the atomic otherwise) - A3-18 describes only the process atomic at :119. The comment at :120-122 is P5f's half-landed answer to this row and should be quoted in it.
|
||||
- MobileGL/MG_Remote/Client/ClientSession.cpp:1357 and :1376 - two further `Server::ServerLoop::OnApplyThread()` guards inside the very function A3-18 opens, both omitted from c6_ask #6's 'nine guards' list. Full census at this head: 14 non-comment OnApplyThread() call sites outside the definition at ServerLoop.h:265-271 - Managers.cpp:230, Managers.cpp:2868, SlotAllocator.cpp:25/:31/:50, PipeApply.cpp:1355, ClientSession.cpp:1357/:1376, PersistentMapTracker.cpp:535, WireTables.cpp:87, ServerLoop.cpp:667/:735, MipmapStorage.cpp:56/:116. Not nine.
|
||||
- MobileGL/MG_Remote/Transport/ITransport.h:40-44 - `enum class TransportRole { Server = 1 /* accepts the client connection */, Client = 2 /* connects to the server endpoint */, InProcess = 3 }`, consumed via ITransport::Role() (:124, implemented InProcessTransport.h:62, tested ServerSession.cpp:715/:733) - and MobileGL/MG_Remote/Transport/RoleMemory.h:42-46 `enum class MemoryRole { Client, Server }` (used ClientSession.cpp:600/:1490, ServerSession.cpp:486/:806). The item's headline recommendation is 'a three-valued Role and not a boolean Dial', and the tree already carries two Client/Server role vocabularies, one of which ALREADY encodes the accept-vs-dial distinction the review wants split out. c6 will reuse, rename or collide with these and the audit gives it no warning.
|
||||
- MobileGL/MG_Backend/DirectGLES/Managers.h:341, :406, :430, :436 and MobileGL/MG_Backend/DirectGLES/SlotTables.h:281, :398, :410, :476 - eight backend call sites of `MG_Pipe::MGPipeRefuseFrontendKeyedRegistryFromApplyThread`, defined in MG_Impl at SlotAllocator.cpp:48; plus `MG_Pipe::MGPipeSlots()` at SlotTables.h:285 and :481, declared MG_Impl/Pipe/SlotAllocator.h:165. doc_drift #2 sizes the MG_Impl link debt as 'eight undefined symbols reachable from the backend's own MGB_CTX reads'; the real surface is larger and is not MGB_CTX-shaped at all. MG_Backend also includes MG_Impl headers at 12 places (MobileGL/MG_Backend/DirectGLES/SlotTables.h:15, Managers.h:25, DirectGLES.cpp:38, DirectVulkan/Renderer/VulkanRenderer.cpp:20/:26/:27/:30/:48, UniformManager.cpp:16, VkRenderPassManager.cpp:11, SwapchainObject.cpp:11, DirectVulkan.cpp:15) and MG_State headers on 55 lines across 20+ files.
|
||||
- MobileGL/MG_Backend/DirectGLES/Managers.h:708-723 and :1012-1019 - six process-lifetime function-static latches (FramebufferSubsystemEnabled / TextureResourceSubsystemEnabled / SamplerSubsystemEnabled / ProgramSubsystemEnabled / ResourceSubsystemEnabled / VertexInputSubsystemEnabled), resolved at Managers.cpp:2939 and :2966 off `MG_Config::Features.PipePush`. Same latch-at-first-use hazard A3-12/A3-13 name, on the OTHER config table: in the child these must equal the client's, the envp scrub A3-26 discusses touches only MOBILEGL_TRANSPORT and MOBILEGL_IPC_*, and the only thing carrying Features to the child is the handshake configBlob (ARCHITECTURE.md:489). The item examines only the Transport-keyed latches and so its `open` item on which env vars must be scrubbed/inherited/negotiated is missing the MOBILEGL_PIPE_* family entirely.
|
||||
|
||||
---
|
||||
|
||||
## a6.4 控制面
|
||||
**小结**:All twelve Server* forwarders are value frames today - I opened every one (ServerLoop.cpp:1063-1178) and each packs a SurfaceControlFrame and posts it through RunSurfaceControlFrame; nothing carries a pointer. The contract's three "not on the wire" claims are two-thirds right: ServerSwapEGLBuffers has zero production callers (only MG_Test) and ServerInitWindowSurface has zero callers of any kind, so neither needs a socket form - but ServerInitCapabilities has a LIVE production caller on the first make-current of every surface (BackendObject_Remote.cpp:126, reached from BackendObject.cpp:341-347), and SurfaceOpCodec refuses to encode its kind (SurfaceOpCodec.cpp:119-122). "Answered by CapsSnapshot" describes the answer, not the request; under spawn there is no wire op by which a client can ask, and the first eglMakeCurrent fails. That is the one thing that makes "cp is TRANSPORT ONLY" false, and it is what c6 most needs from this item. The review's SurfaceReply.defaultFb claim is CONFIRMED at both ends (encoder hardcodes 0 at SurfaceOpCodec.cpp:184, decoder never reads it at :190-195, no test touches it). The one-slot mailbox needs no protocol change at all - it needs a second poster, because the apply thread never reads the control transport (ServerLoop.cpp:404-454) and PumpControlPlane drops SurfaceOp/SurfaceReply by name (ClientSession.cpp:1425-1432). Two further surprises: the EGL handles crossing the frame are ALREADY client-minted dense tokens (MG_State/EGLState/Core.h:212-215, counters at :247-250), so the token work P6-CONTRACT-DRAFT table 0 plans is already done; and the window-kind accept set for a window op is exactly {None, X11, Win32Hwnd} - I followed nativeToken all the way to eglCreateWindowSurface (DirectGLES.cpp:16084), which confirms the review's 2.1 hole end to end and adds a third member to it, WindowKind::None.
|
||||
|
||||
复审结论:**sound-with-fixes**(重新解析 34 条,异议 4 条,另指出 8 处遗漏)
|
||||
|
||||
| # | 判定 | 事实 | 站点 | spawn 下如何坏 | 守卫 | 归属 | 复审 |
|
||||
|---|---|---|---|---|---|---|---|
|
||||
| A4-01 | p6-must-handle | ServerInitializeEGLDisplay(dpy, major*, minor*) - packs kind=InitializeDisplay + display token; the two out-pointers come back as frame.eglMajor/eglMinor. VALUE FRAME today. NOT inproc-only. Socket form: SurfaceOpKind::InitializeDisplay(1), reply carries eglMajor/eglMinor (already in SurfaceReply). | MobileGL/MG_Remote/Server/ServerLoop.cpp:1063 (ServerInitializeEGLDisplay); dispatch at :902-913 (ApplySurfaceControlFrame); client caller MobileGL/MG_Remote/Client/BackendObject_Remote.cpp:206 | Nothing in the payload. The forwarder itself calls ServerLoopInstance() with no role branch - see A4-13. | Detail::SurfaceControlFrameHasOnlyValues() static_assert (SurfaceControlFrame.h:118); wire-kind alignment static_assert | cp | |
|
||||
| A4-02 | p6-must-handle | ServerCreateEGLWindowSurface(surface, WindowHandle&) - packs kind=CreateWindowSurface, surface token, and PackWindowHandle (windowBackend/nativeToken/width/height). VALUE FRAME today. NOT inproc-only. Socket form: SurfaceOpKind::CreateWindowSurface(2) - but every production windowKind is refused at the server (A4-23/A4-24). | MobileGL/MG_Remote/Server/ServerLoop.cpp:1078 (ServerCreateEGLWindowSurface); pack at :853-858; dispatch :914-921 | handle.Handle is a client-process value. Android dies by name at the decoder; X11/Win32 do NOT (A4-24). P6 is offscreen only, so this op should never legitimately cross in P6. | SurfaceWireError::AndroidNativeWindowArrived / MetalLayerArrived -> Fatal at SurfaceOpCodec.cpp:201-217 | cp | |
|
||||
| A4-03 | already-handled | ServerResizeEGLWindowSurface(surface, w, h) - packs kind=ResizeWindowSurface + surface + width/height. VALUE FRAME today. NOT inproc-only. Socket form: SurfaceOpKind::ResizeWindowSurface(4), pure scalars. | MobileGL/MG_Remote/Server/ServerLoop.cpp:1087; dispatch :922-926; client caller BackendObject_Remote.cpp:230 | nothing - it is four scalars | none needed | cp | |
|
||||
| A4-04 | already-handled | ServerCreateEGLPbufferSurface(surface, w, h) - packs kind=CreatePbufferSurface + surface + width/height; the encoder stamps windowKind=Pbuffer from the op, and the decoder never reads windowKind for this kind. VALUE FRAME today. NOT inproc-only. Socket form: SurfaceOpKind::CreatePbufferSurface(3). THIS IS P6's ONLY WORKING SURFACE PATH. | MobileGL/MG_Remote/Server/ServerLoop.cpp:1097; encoder windowKind at SurfaceOpCodec.cpp:124-126; decoder skips it because OpNeedsAWindowBackend is false (SurfaceOpCodec.cpp:55-57, :156) | nothing. This is the op P6's exit gate rides on. | none needed | cp | |
|
||||
| A4-05 | p6-must-handle | ServerMakeEGLCurrent(dpy, draw, read, ctx) - ONE forwarder, TWO kinds: it self-classifies the three-NO_* release shape into SurfaceControlOp::ReleaseCurrent and everything else into MakeCurrent. VALUE FRAME today. NOT inproc-only. Socket form: SurfaceOpKind::MakeCurrent(6) / ReleaseCurrent(7); the four-tuple needs readSurface+context, which fc already appended. | MobileGL/MG_Remote/Server/ServerLoop.cpp:1107-1121 (classification at :1112-1114); dispatch :935-983; wire fields protocol.fbs:208-209 | nothing in the payload. But the MakeCurrent arm republishes CapsSnapshot from inside the dispatch (:959-969) - see A4-30 for the socket ordering that creates. | static_asserts pin MakeCurrent=6/ReleaseCurrent=7 (SurfaceOpCodec.cpp:39-42); ID-67 republish counter (ServerLoop.h:311) | cp | |
|
||||
| A4-06 | already-handled | ServerSwapEGLBuffers(dpy, draw) - packs kind=SwapBuffersInprocOnly. VALUE FRAME today. INPROC-ONLY. Socket form: NONE, and none is needed: it has ZERO production callers. The only callers in the tree are MG_Test/Wire/ServerLoopTest.cpp:1674 and :1693 (the N-3 recreate control, which needs a swap that is not a record). | MobileGL/MG_Remote/Server/ServerLoop.cpp:1123; dispatch :1032-1038; the reason at Client/BackendObject_Remote.cpp:279-288 | nothing. Verified: grep over MobileGL/ finds no non-test caller. | SurfaceControlOpHasWireKind returns false (SurfaceControlFrame.cpp:47-48) -> EncodeSurfaceOpFrame answers InprocOnlyOpOn | cp | |
|
||||
| A4-07 | p6-must-handle | ServerSetEGLSwapInterval(interval) - packs kind=SetSwapInterval + swapInterval; returns void, so the rc is discarded at the call site. VALUE FRAME today. NOT inproc-only. Socket form: SurfaceOpKind::SetSwapInterval(8), one int. | MobileGL/MG_Remote/Server/ServerLoop.cpp:1132 (note the `(void)` at :1136); dispatch :984-987; client caller BackendObject_Remote.cpp:297 | nothing in the payload, but the discarded rc means a client whose server died sees no error at all from eglSwapInterval - the void forwarders drop MOBILEGL_ERR_NOT_INITIALIZED on the floor. | none - `(void)ServerLoopInstance().RunSurfaceControlFrame(frame)` | cp | |
|
||||
| A4-08 | already-handled | ServerReleaseEGLSurface(surface) - packs kind=ReleaseSurface + surface token; void, rc discarded. VALUE FRAME today. NOT inproc-only. Socket form: SurfaceOpKind::ReleaseSurface(5). | MobileGL/MG_Remote/Server/ServerLoop.cpp:1139; dispatch :988-998 (which calls ForgetCurrentTupleIfItNames); client caller BackendObject_Remote.cpp:301 | nothing | ForgetCurrentTupleIfItNames (ServerLoop.cpp:333-336) | cp | |
|
||||
| A4-09 | p6-must-handle | ServerReleaseEGLResources() - packs kind=ReleaseResources, no arguments; void, rc discarded. BLOCKING BY CONTRACT. VALUE FRAME today. NOT inproc-only. Socket form: SurfaceOpKind::ReleaseResources(9). | MobileGL/MG_Remote/Server/ServerLoop.cpp:1146-1157 (the contract note at :1147-1153); dispatch :1000-1014; client caller BackendObject_Remote.cpp:309 | The two posters split across two PROCESSES. In the server process the inline arm still works. In the client process the call must become a socket round trip that BLOCKS until the server's DestroyEGLContext has run, because MobileGL::Destroy() walks on the moment it returns (Init.cpp:68, cited at ServerLoop.h:489-493). A fire-and-forget socket send would reinstate scout-install 5.3's hazard across a process boundary. | OnApplyThread() re-entrancy arm (ServerLoop.cpp:667); Fatal{ApplyThreadNotRunning} (:690-696) | cp | **claim-false** — Keep the row and keep verdict p6-must-handle - the BLOCKING requirement is real and correctly argued (MG_Impl/EGLImpl/EGLImpl.cpp:328 calls ReleaseEGLResources and :336 walks straight into MobileGL::D |
|
||||
| A4-10 | blocks-p6 | ServerInitCapabilities() - packs kind=InitCapabilitiesInprocOnly. VALUE FRAME today. Marked INPROC-ONLY. Socket form: THERE IS NONE, AND IT NEEDS ONE. This is the single claim in the contract that the code contradicts. | MobileGL/MG_Remote/Server/ServerLoop.cpp:1159-1164; dispatch :1019-1031; LIVE client caller MobileGL/MG_Remote/Client/BackendObject_Remote.cpp:126 (`if (!Server::ServerInitCapabilities())`), reached from MG_Backend/BackendObject.cpp:341-347 on the first make-current per surface | EncodeSurfaceOpFrame REFUSES this kind (SurfaceOpCodec.cpp:119-122 -> InprocOnlyOpOnTheWire), so the spawned client cannot ask. With no wire form the forwarder runs in the CLIENT process against an empty ServerLoop and returns MOBILEGL_ERR_NOT_INITIALIZED -> BackendObject_Remote::InitCapabilities returns false -> the base class's MakeEGLCurrent fails -> the FIRST eglMakeCurrent under spawn fails. Not an edge case: it is on the bring-up path of every surface. BackendObject_Remote.cpp:119-125 argues explicitly why the client may not assume ServerMakeEGLCurrent already asked (a surface can be replaced without a new make-current). | SurfaceControlOpHasWireKind=false (SurfaceControlFrame.cpp:47-48) - the guard is doing its job; the gap is that a live c | c6 | |
|
||||
| A4-11 | already-handled | ServerInitWindowSurface() - packs kind=InitWindowSurfaceInprocOnly. VALUE FRAME today. INPROC-ONLY. Socket form: NONE needed - it has ZERO callers anywhere in the tree, tests included. The client-side virtual is a bare `return true`. | MobileGL/MG_Remote/Server/ServerLoop.cpp:1166-1171; dispatch :1039-1044; the client-side no-op at Client/BackendObject_Remote.cpp:145-150 | nothing | SurfaceControlOpHasWireKind=false; SurfaceControlFrameTest.cpp:269-275 | cp | |
|
||||
| A4-12 | p6-must-handle | ServerSetWindowHandle(WindowHandle&) - packs kind=SetWindowHandle + windowBackend/nativeToken/width/height; void, rc discarded. VALUE FRAME today. NOT inproc-only. Socket form: SurfaceOpKind::SetWindowHandle(10) - same windowKind refusal surface as CreateWindowSurface. | MobileGL/MG_Remote/Server/ServerLoop.cpp:1173-1178; dispatch :1015-1018; client caller BackendObject_Remote.cpp:215 (posted BEFORE ServerCreateEGLWindowSurface) | It is a second full socket round trip for something BackendObject::ActivateEGLSurface already does for itself from the registered surface state (BackendObject.cpp:283, `SetWindowHandle(surfaceState->Window)`). Worse, the dispatch stores the decoded nativeToken as a raw pointer with no backend check when windowKind is None - see A4-25. | WindowBackendFromFrameValue range check (ServerLoop.cpp:864-873) - but it ACCEPTS Unknown(-1) | cp | |
|
||||
| A4-13 | blocks-p6 | THE TWELVE FORWARDERS HAVE NO ROLE BRANCH. Every one of them ends in `ServerLoopInstance().RunSurfaceControlFrame(frame)` unconditionally. There is no `if (MG_Config::Transport == Spawn)`, no ClientSession lookup, nothing. This is the whole of cp's client-side work and no line of it exists. | MobileGL/MG_Remote/Server/ServerLoop.cpp:1063-1178 (all twelve); the singleton at :810-814; the declarations and their 'the seam is twelve signatures' rationale at ServerLoop.h:495-522 | In the client process ServerLoopInstance() has never been Start()ed and m_backend is null, so PostSurfaceControlFrameWithCallerLock takes the `!m_running && !backendAlive` arm and returns MOBILEGL_ERR_NOT_INITIALIZED (ServerLoop.cpp:698-703) with NO LOG LINE. Every EGL call under spawn would fail as an unnamed false - the exact silent-fallback shape this project forbids. The Fatal{ApplyThreadNotRunning} next door (:690-696) does NOT fire, because it is gated on backendAlive. | none on the path that is actually taken; the named Fatal is on the other arm | cp | |
|
||||
| A4-14 | already-handled | THE ONE-SLOT BLOCKING MAILBOX, protocol in full. Poster: takes m_callerMutex (serialises every non-apply-thread poster), takes m_controlMutex, reads m_running under that same lock, copies the frame into m_controlFrame, sets m_controlPending=true / m_controlFinished=false, publishes the release-store shadow m_controlPosted LAST, rings the CONSUMER doorbell (publish-then-ring), then waits on m_controlDone. Taker: the apply thread's PumpControlRequest does a fast negative on the shadow, takes the lock, copies the frame OUT, clears the shadow (when TAKEN, not when finished), runs ApplySurfaceControlFrame OUTSIDE the lock, then republishes frame+result under the lock, sets m_controlFinished, notify_all. Poster copies the reply half out of m_controlFrame. | MobileGL/MG_Remote/Server/ServerLoop.cpp:658-671 (RunSurfaceControlFrame), :673-727 (PostSurfaceControlFrameWithCallerLock), :542-582 (PumpControlRequest); members at ServerLoop.h:394-423; the park predicate at ServerLoop.cpp:398-402 | NOTHING IN THE PROTOCOL. The slot already carries a pure-value frame; the handshake, the shadow, the doorbell order and the C2 exit block are all address-space-local to the server. What changes is only WHO POSTS: today the app/GL thread, under spawn a server-side reader. The minimal cp shape is an mgl-srv-io thread that ReceiveFrame -> DecodeWireSurfaceOp -> ServerApplyWireSurfaceOp -> EncodeSurfaceReplyFrame -> SendFrame, and that thread simply becomes the poster this code already supports. The alternative - a fourth arming term in `ready` so the apply thread polls the socket itself - would be the only change that touches this protocol. | C2 exit block answers a stranded request NOT_INITIALIZED rather than leaving it blocking (ServerLoop.cpp:490-502); m_con | cp | |
|
||||
| A4-15 | blocks-p6 | THE POSTER'S WAIT HAS NO DEADLINE. `m_controlDone.wait(lock, [this]{ return m_controlFinished; })` - an unbounded predicate wait. Compare the ring side, which uses kBarrierTimeoutMs and dies Fatal{BarrierTimeout} by name. | MobileGL/MG_Remote/Server/ServerLoop.cpp:724; the bounded counterpart at Client/ClientSession.cpp:1198-1214 (WaitForApplyToCatchUp, Fatal{BarrierTimeout}) | A SIGSTOP'd / Android-freezer'd server produces NO EOF and NO reply. The GL thread then blocks forever inside eglMakeCurrent with no diagnostic. P6-SPAWN-PLAN §4 names the frozen-server case but only for the record/death path; this is the wait that actually wedges a GL thread, and it is not in that table. | none | cp | **overstated** — Soften to: 'P6-SPAWN-PLAN §4's table already requires a bounded wait + named diagnostic for the freezer case, but its chosen mechanism - SocketDoorbell::m_dead latched on EOF (Transport/Doorbell.h:388 |
|
||||
| A4-16 | blocks-p6 | THE APPLY THREAD NEVER READS THE CONTROL TRANSPORT. Its loop is PumpControlRequest / DrainRing / park, and its `ready` predicate has exactly three terms (stop, ControlIsPending, cmdHead != LocalTail) plus the eventRingFull veto. No socket, no ITransport, no PeekFrameSize. The server's ONLY ITransport reads in the whole tree are the one handshake receive and the sends. | MobileGL/MG_Remote/Server/ServerLoop.cpp:398-454 (the loop and `ready`); the server's only transport reads/sends at Server/ServerSession.cpp:450 (handshake), :538 (Welcome), :653 (PublishCapsSnapshot) | A SurfaceOp arriving on the socket is read by nobody. There is no server-side control reader after the handshake. cp must add one (mgl-srv-io) or add the socket to the park predicate. This is the largest single piece of cp's actual work and the plan's 'cp 只剩传输' does not size it. | none - there is nothing to go red | cp | |
|
||||
| A4-17 | blocks-p6 | THE CLIENT'S CONTROL PUMP DROPS SurfaceOp AND SurfaceReply BY NAME. PumpControlPlane consumes only CtrlMsg::CapsSnapshot; anything else is logged at WARN and `continue`d. The comment names SurfaceOp/SurfaceReply as 'P6's and P7's' precisely so a later phase does not discover the loop swallowing them - and that is now. | MobileGL/MG_Remote/Client/ClientSession.cpp:1406-1444, the drop at :1425-1432 | A SurfaceReply that lands while some other code path is pumping caps is WARNed and discarded, and the forwarder waiting for it never wakes. The control socket carries two interleaved streams (server-pushed CapsSnapshot, and replies correlated to requests) and needs a demultiplexer with a per-seq rendezvous. Today it has a single-consumer drain loop that understands one message type. | the MGLOG_W at :1429 - it will fire, which is better than silence, but the request still hangs (A4-15) | cp | |
|
||||
| A4-18 | p6-must-handle | ClientSession holds BOTH ENDS of the transport and its start path is typed to the concrete InProcessTransport, not to ITransport. StartOverTransportPair takes two unique_ptr<InProcessTransport> and refuses if either is null. | MobileGL/MG_Remote/Client/ClientSession.cpp:474-496 (Start, the named non-InProcess refusal at :482-488) and :498-511 (StartOverTransportPair) | A spawn client owns ONE end. The signature must be generalised to ITransport (or a second entry point added), and the handshake stops being drivable by one thread - Hello and Welcome cross a real socket. ITransport already has the right shape (ITransport.h:46-128); nothing there needs to change. | the named refusal at :482-488 is exactly right and is what so/cp replace | so | |
|
||||
| A4-19 | p6-must-handle | SurfaceReply.defaultFb IS DEAD AT BOTH ENDS - the review's claim CONFIRMED. The encoder passes a literal 0 as the DefaultFramebufferInfo offset (flatbuffers AddOffset skips a null offset, so the field is ABSENT in the buffer, not zero-valued); the decoder writes only seq/ok/eglMajor/eglMinor and never touches it; no test in the tree reads it. | encoder MobileGL/MG_Remote/Protocol/SurfaceOpCodec.cpp:181-188 (the `/*defaultFb=*/0` at :184); decoder :190-195; schema MobileGL/MG_Remote/Protocol/protocol.fbs:212-218; generated accessor protocol_generated.h:1225-1226; the round-trip test that covers everything BUT it, MG_Test/Wire/SurfaceControlFrameTest.cpp:239-261 | Nothing breaks - but the slot is a second truth source waiting to be revived by someone who reads the schema and not the code. | none; nothing asserts it stays empty | c6 | |
|
||||
| A4-20 | p6-must-handle | SurfaceReply CARRIES NO MobileGLResult. The frame's reply half is {ok, eglMajor, eglMinor}; ServerApplyWireSurfaceOp RETURNS the rc but the wire has nowhere to put it. So 'the apply thread is gone' (NOT_INITIALIZED) and 'the driver said no' (ok=false) are the same byte on the wire. | schema MobileGL/MG_Remote/Protocol/protocol.fbs:212-218; encoder MobileGL/MG_Remote/Protocol/SurfaceOpCodec.cpp:183-184; the rc that is dropped, :219-221; the inproc collapse the forwarders do, ServerLoop.cpp:1075 (`return rc == MOBILEGL_OK && frame.ok`) | A client cannot tell a server that died mid-op from a legitimate refusal, so it cannot decide between arming the device-lost latch and returning EGL_FALSE. The test that exercises this collapse is MG_Test/Wire/ServerLoopTest.cpp:474-495: rc==NOT_INITIALIZED, wireReply->ok()==false, and the reply cannot say which. | none | c6 | |
|
||||
| A4-21 | p6-must-handle | A seq==0 SurfaceOp IS SILENTLY RENUMBERED, not refused. RunSurfaceControlFrame mints a local seq when frame.seq is 0, and its own comment says a wire request 'is already numbered by its client and MUST retain that number' - but nothing enforces that the wire request actually had one. The encoder copies frame.seq verbatim and mints nothing. | MobileGL/MG_Remote/Server/ServerLoop.cpp:659-662; the encoder's verbatim copy at Protocol/SurfaceOpCodec.cpp:133-135 | Under spawn the CLIENT must mint, because the reply is correlated by seq. A client that forgets gets a server-minted number it has never seen - an uncorrelatable reply, silently. This is the same shape as Fatal{ProtocolCorruption}: a value the peer could not have written. | none - the renumbering is unconditional | c6 | |
|
||||
| A4-22 | p6-must-handle | DecodeWireSurfaceReply DOES NOT CORRELATE. It overwrites seq/ok/eglMajor/eglMinor into whatever frame it is handed and returns void - no comparison against the request's seq, no error channel at all. | MobileGL/MG_Remote/Protocol/SurfaceOpCodec.cpp:190-195; header contract at SurfaceOpCodec.h:87 | The correlation has to live somewhere. If it lives in the pump rather than here, say so in the contract; if it lives here, this signature has to grow a SurfaceWireError like its SurfaceOp twin. | none | c6 | |
|
||||
| A4-23 | blocks-p6 | THE WINDOW-KIND ACCEPT SET, EXACTLY. windowKind is only consulted for the two ops OpNeedsAWindowBackend answers true for: CreateWindowSurface and SetWindowHandle. For those: ACCEPTED = {None(0) -> WindowBackend::Unknown, X11(2) -> X11, Win32Hwnd(3) -> Win32}. REFUSED = {AndroidNativeWindow(1) -> AndroidNativeWindowArrived, MetalLayer(6) -> MetalLayerArrived, Surfaceless(4) and Pbuffer(5) -> WindowKindNamesNoBackend, any value 7..255 -> UnknownWindowKind}. All four refusals reach std::abort at the wire entry, the first two with UnmigratedSurface@P12 messages and the rest with Fatal{ProtocolCorruption,"SurfaceOp"}. For every OTHER op windowKind is ignored entirely, including CreatePbufferSurface, whose encoder stamps Pbuffer that nobody reads. | MobileGL/MG_Remote/Protocol/SurfaceOpCodec.cpp:55-57 (OpNeedsAWindowBackend), :104-114 (WindowBackendForWireWindowKind), :156-176 (the decode arm), :197-222 (the Fatals); schema protocol.fbs:181-192 | X11 and Win32Hwnd are ACCEPTED, and that is the review's 2.1 hole - I confirm it and add a third member: WindowKind::None is accepted too (:110), and the decode still copies nativeToken through (:175) even though the backend tag says Unknown. | MG_Test/Wire/SurfaceControlFrameTest.cpp:295 (Surfaceless), :308 (Android), :327/:350/:364 (the aborts). NOTHING tests X | c6 | **claim-false** — Replace the guard sentence with: 'X11, Win32Hwnd and None are each pinned as ACCEPTED, both directions, at SurfaceControlFrameTest.cpp:162-174, and X11 + a nonzero nativeToken is pinned as a successfu |
|
||||
| A4-24 | blocks-p6 | nativeToken FOLLOWED ALL THE WAY INTO THE DRIVER, as asked. For an accepted windowKind: op.nativeToken() -> frame.nativeToken -> UnpackWindowHandle's HandleFromToken<void*> (an unconditional reinterpret_cast) -> WindowHandle::Handle -> RegisterEGLWindowSurface stores it in EGLSurfaceState::Window -> ActivateEGLSurface calls SetWindowHandle(surfaceState->Window) -> BackendObject_DirectGLES::InitWindowSurface does `reinterpret_cast<NativeWindowType>(m_windowHandle.Handle)` -> DirectGLES::InitWindowSurface calls `eglCreateWindowSurface(g_Display, g_Config, window, nullptr)`. There is no validation anywhere on that chain except the Backend-tag range check and the `!handle.Handle` null test. | MobileGL/MG_Remote/Protocol/SurfaceOpCodec.cpp:174-175 -> Server/ServerLoop.cpp:875-882 (UnpackWindowHandle) -> MG_Backend/BackendObject.cpp:227-238 (RegisterEGLWindowSurface) -> :282-283 (ActivateEGLSurface) -> DirectGLES/BackendObject_DirectGLES.cpp:899-907 -> DirectGLES/DirectGLES.cpp:16079-16095 (the eglCreateWindowSurface at :16084) | On a Linux/Windows build an X11 XID or an HWND reaches eglCreateWindowSurface in the SERVER process. An XID and an HWND happen to be system-scoped and might even work, which is worse than crashing: it makes the refusal look unnecessary while a guest with a private window system hands the server a wild value. This is the review's 2.1, confirmed end to end at this head. | BackendObject.cpp:227's `handle.Backend == Unknown // !handle.Handle` - a soft `return false` with an MGLOG_E, not a nam | c6 | |
|
||||
| A4-25 | p6-must-handle | WindowKind::None ON A WINDOW OP is accepted, maps to WindowBackend::Unknown(-1), and the raw nativeToken is copied through anyway. WindowBackendFromFrameValue's range check passes -1 (its lower bound IS Unknown), so UnpackWindowHandle builds {Unknown, <token-as-pointer>, w, h}. CreateWindowSurface then fails softly at BackendObject.cpp:227; SetWindowHandle does not fail at all - it just STORES the foreign pointer. | MobileGL/MG_Remote/Protocol/SurfaceOpCodec.cpp:110 (None -> Unknown), :174-175 (token copied regardless); MobileGL/MG_Remote/Server/ServerLoop.cpp:864-873 (the range check that admits -1), :875-882; MG_Backend/BackendObject.cpp:227-230 and :473-476 | A corrupt or hostile SurfaceOp with windowKind=None and a nonzero nativeToken gets a client-process pointer STORED in the server's m_windowHandle with no refusal of any kind. It is later overwritten by ActivateEGLSurface, so it is latent rather than immediately fatal - but 'latent' is exactly what the whitelist exists to remove. | none for SetWindowHandle; a soft false for CreateWindowSurface | c6 | |
|
||||
| A4-26 | already-handled | THE EGL HANDLES ARE ALREADY CLIENT-MINTED DENSE TOKENS. MG_State fabricates every EGLDisplay/EGLConfig/EGLSurface/EGLContext as `EncodeHandle<T>(m_next*Handle++)` over counters that all start at 1; they are never driver handles. The server's BackendObject uses them purely as std::map keys and identity comparisons; the REAL EGL objects are DirectGLES' process globals g_Display/g_Surface/g_Context, created from the native window and never named on the wire. | MobileGL/MG_State/EGLState/Core.h:212-215 (EncodeHandle), :247-250 (the four counters, each = 1); mint sites Core.cpp:143 (display), :163 (config), :687 (context), :830/:868/:905/:945/:977/:1010 (surfaces); server-side use as map keys MG_Backend/BackendObject.cpp:198, :232, :265-268, :324-335; the real objects at DirectGLES/DirectGLES.cpp:16031-16056, :16084 | NOTHING. This is the best news in the item: P6-CONTRACT-DRAFT table 0's DisplayToken/SurfaceToken/ContextToken ('minted by the client, dense from 1') is a description of what MG_State already does, not work to do. The server needs no token->native map, because it never had native handles to map to. | the static_asserts in TokenFromHandle/HandleFromToken that the type is a pointer | c6 | |
|
||||
| A4-27 | already-handled | ForgetCurrentTuple AND ITS N-3 RULE LIVE INSIDE THE DISPATCH, so the frame path preserves them by construction. Six call sites: ApplyThreadMain's exit (after ~backend), Stop()'s never-started arm, and four dispatch arms - CreateWindowSurface on success, CreatePbufferSurface on success, ReleaseSurface via ForgetCurrentTupleIfItNames, and ReleaseResources. The rule itself: forget after any event that may have destroyed the native context the held tuple names, because EGL handles are recycled (on this host they are literally 0x1). | MobileGL/MG_Remote/Server/ServerLoop.cpp:325-336 (the two functions); call sites :478, :764, :919, :933, :996, :1012; the rule stated at ServerLoop.h:325-337; the red-once control named at ServerLoop.cpp:1007-1011 | NOTHING. Because the calls are on the dispatch side of the seam, an io-thread poster changes nothing about them. P6-CONTRACT-DRAFT §4.4 and P6-SPAWN-PLAN:83 both claim this; I verified it at all six sites and the claim holds. | ServerLoopTest's C7/N-3 recreate control reads NativeBindCount()==1 where 2 is required if :1012 is deleted (stated at S | cp | |
|
||||
| A4-28 | already-handled | WHICH CONTROL OPS NEED A GL/EGL CONTEXT TO COMPUTE - all of them are on the SERVER side, on the apply thread, which already owns the context for life. NEED IT: CreateWindowSurface / CreatePbufferSurface (they CREATE the context via InitDisplayAndContext), MakeCurrent (native eglMakeCurrent + the base class's InitCapabilities GL queries), SetSwapInterval (eglSwapInterval needs a current context - DirectGLES defers when there is none), ReleaseSurface (may reach DestroyEGLContext), ReleaseResources (DestroyEGLContext), and the three inproc-only kinds. DO NOT: InitializeDisplay (two constants), ResizeWindowSurface (bookkeeping only, not overridden by DirectGLES), ReleaseCurrent (the ClientRelease arm records and does not forward), SetWindowHandle (a struct store). | MG_Backend/BackendObject.cpp:182-187 (InitializeDisplay constants), :196-210 (Resize, bookkeeping); ServerLoop.cpp:282-293 (ClientRelease, no native call); BackendObject.cpp:473-476 (SetWindowHandle); DirectGLES/DirectGLES.cpp:16031-16056 + :16079-16095 (context creation), :16065-16077 (swap interval), :16178-16185 (MakeCurrent); BackendObject_DirectGLES.h:31-50 (the override list, which is how I know Resize and SetSwapInterval are not overridden) | nothing - the split is already drawn in the right place. Under spawn the apply thread stays the context owner in its own process, which is, in ServerLoop.h's words, 'exactly the shape P6's spawned server inherits'. | the 32 existing context-owner guards | cp | |
|
||||
| A4-29 | already-handled | NOTHING IN THE CLIENT'S CONTROL PATH NEEDS A GL CONTEXT. The nine EGL virtuals on BackendObject_Remote do exactly three things besides forwarding: a run-ahead wait on a shm watermark, a caps-mirror refresh, and a SEG_EVENT drain that writes MG_State texture shadows. No GL call, no driver entry point. | MobileGL/MG_Remote/Client/BackendObject_Remote.cpp:190-194 (WaitForApplyBeforeEglForwarder), :83-92 (RefreshFormatCapabilities, reads CapsMirror), :224/:233/:242/:272 (DrainPublishedEvents); the event consumer at Client/ClientSession.cpp:225-257, which only calls MG_State AllocateStorage/SetInternalFormat | nothing. The answer to the item's last question is: no. | CONTRACT-P5C rule E / the RoleViolation guards | cp | |
|
||||
| A4-30 | blocks-p6 | CapsSnapshot IS PUSHED FROM INSIDE THE DISPATCH, on the apply thread, mid-op. The MakeCurrent arm and the InitCapabilities arm both call ServerSession::PublishCapsSnapshot(), which builds a FlatBuffer and calls SendEnvelope on the same ITransport the reply will use. | MobileGL/MG_Remote/Server/ServerLoop.cpp:959-969 (MakeCurrent arm) and :1025-1030 (InitCapabilities arm); Server/ServerSession.cpp:609-654 (the send at :653); ITransport's threading note at Transport/ITransport.h:27-29 ('callers serialize sends') | Two consequences. (1) ORDERING: the snapshot must reach the client BEFORE the reply that its adoption depends on, because the client pumps and adopts right after the RPC returns (BackendObject_Remote.cpp:268-273). Same-socket FIFO gives that for free ONLY if the same thread sends both - i.e. if the io thread does not send the reply while the apply thread is still sending the snapshot. (2) SERIALISATION: under spawn the server has two potential senders (the apply thread's PublishCapsSnapshot and the io thread's SurfaceReply) on an interface that is explicitly not internally synchronised for send. | none - ITransport documents the requirement but does not enforce it | cp | |
|
||||
| A4-31 | no-action | MGPipeServerSetContextLive, called from five sites in the control dispatch, writes a PROCESS-LOCAL static g_serverContextLive. Both the setter and the only reader are server-side: MGPipeServerContextIsLive is read from PipeInputs::IsLive, which is reached only through MGB_CTX_LIVE, and every MGB_CTX_LIVE use site is under MG_Backend/. | MobileGL/MG_Backend/MGPipe/PipeInputs.cpp:305-312; writers at Server/ServerLoop.cpp:290, :295, :314, :475, :761, :1006; reader chain MG_Impl/Pipe/PipeFill.cpp:2135-2141 -> MG_Pipe/PipeInputsSwitch.h:20 -> MG_Backend/DirectGLES/Managers.cpp:7304 etc. | NOTHING. I checked specifically because the control dispatch touches it: there is no client-side reader of MGB_CTX_LIVE anywhere under MG_Impl or MG_State, so the static stays inside the server process and keeps meaning what it means. (Flagging for the integrator in case a6.2's statics item counts it - it is server-local and needs no carrier.) | purity gate C's ban on pGLContext outside MG_State/MG_Impl keeps MGB_CTX_LIVE server-side | cp | |
|
||||
| A4-32 | p6-must-handle | ServerSetWindowHandle IS A REDUNDANT BLOCKING ROUND TRIP. The client posts it immediately before ServerCreateEGLWindowSurface, but the server's own ActivateEGLSurface sets the window handle from the surface it just registered. | client MobileGL/MG_Remote/Client/BackendObject_Remote.cpp:212-216; the server's own set at MG_Backend/BackendObject.cpp:282-283 (`SetWindowHandle(surfaceState->Window)`), fed from RegisterEGLWindowSurface's store at :232-238 | Two socket round trips instead of one, each with the reply wait of A4-15, at exactly the moment the plan's §6.8 wants to measure socket-doorbell cost against inproc condvar. Also doubles the surface at which A4-25's unvalidated SetWindowHandle store is reachable. | none | cp | |
|
||||
| A4-33 | already-handled | THE TEST PROBE'S RAW FUNCTION POINTER IS A MEMBER, NOT SLOT CONTENT, and ProbeForTesting has no wire kind - so the one remaining pointer in the control channel cannot cross. Worth recording because P5c row G4 was exactly 'a function pointer in the mailbox'. | MobileGL/MG_Remote/Server/ServerLoop.h:228-235 and :424-428 (m_controlProbeHook/m_controlProbeUser as atomics beside the slot); SurfaceControlFrame.cpp:47-48 (no wire kind); the probe dispatch at ServerLoop.cpp:892-895 | nothing. The pointer never leaves the process it was taken in, and the codec refuses the kind. | SurfaceControlOpHasWireKind=false; SurfaceControlFrameTest.cpp:269-275 covers all four inproc-only kinds | cp | |
|
||||
| A4-34 | p6-must-handle | THE CONTROL PUMP'S LOOP BOUND IS PeekFrameSize()==0, which means something different on a stream socket than on a message queue. On InProcessTransport a message is whole or absent; on a socketpair a partially reassembled frame also answers 0. | MobileGL/MG_Remote/Client/ClientSession.cpp:1415-1418; Transport/Framing.h:9-28 and :79-80 (FrameReader is a byte-stream reassembler, explicitly 'it never assumes a read() returned a whole frame'); ITransport.h:83-85 | A reply-wait loop that breaks on PeekFrameSize()==0 would spin out of a half-arrived frame and report no reply. The pump's bound and the reply wait need different shapes: the pump stays non-blocking, the reply wait must block with a deadline (A4-15). | Framing.h latches PROTOCOL_MISMATCH on a violated frame, so corruption is named - but a short read is not corruption | so | |
|
||||
|
||||
**复审另行指出的遗漏**:
|
||||
- MobileGL/MG_Remote/Client/ClientSession.cpp:704 - `const MobileGLResult running = Server::ServerLoopInstance().Start(server);`. The CLIENT's Start() is what starts the apply thread; the comment at :700-703 says so ('Under `inproc` the client is what starts the server role, which is why this call is here rather than in some server-side main'). Under spawn this line IS the server-side main that does not exist. It is the same no-role-branch shape as A4-13 and it is not in a6.4 at all; it is also absent from P6-ENDSTATE-REVIEW.md:264's sm list (which names :534-539, :577, :599-600, :758 but not this).
|
||||
- MobileGL/MG_Remote/Client/ClientSession.cpp:802 - `Server::ServerLoopInstance().Stop();` inside the client's teardown, between transport->Shutdown() (:797) and the emitter release (:808-813). The bounded join, the private-backend destruction and the ordering argument at :800-805 all live on the client's thread today. Same gap, same omission from both a6.4 and the review's list.
|
||||
- MobileGL/MG_Remote/Client/ClientSession.cpp:534-535, :577, :582, :599-600, :758, :814 - the remaining direct reaches from client code into the server singletons: `Server::ServerSessionInstance()` + `server.Accept(*m_serverTransport)` (:534-535), the Welcome cross-check that reads `server.Shm().AnnouncedSize(slot)` (:577, :582), `m_shm.AttachInProcess(server.Shm(), ...)` (:599-600), and two `ServerSessionInstance().Close()` (:758, :814). A4-18 covers only the InProcessTransport typing of StartOverTransportPair and does not enumerate these even to assign them to sm/so. The review has four of the six; the audit should have closed the set with file:line so c6 can see the whole seam at once.
|
||||
- MobileGL/MG_Remote/Protocol/SurfaceOpCodec.cpp:156-176 - `nativeToken` is SILENTLY DROPPED for the eight non-window ops. `decoded.nativeToken = op.nativeToken()` (:175) is inside the `if (OpNeedsAWindowBackend(kind))` block opened at :156, so a wire SurfaceOp with kind=ReleaseSurface (or MakeCurrent, or ReleaseResources) carrying nativeToken=0xDEADBEEF decodes to frame.nativeToken == 0 with no log, no SurfaceWireError and no Fatal. A4-23 caught the windowKind half of this ('for every OTHER op windowKind is ignored entirely') but not the token half - and nativeToken is the field that actually carries a foreign address. By the project's own rule (and by A4-21's framing of seq==0), a value the peer could not legitimately have written is Fatal{ProtocolCorruption}, not a silent zero. c6's Rule G should cover both fields, not just the kind.
|
||||
- MobileGL/Config.h:443-449 and :455 - c6_asks item 2 offers `MG_Config::Transport == Spawn` as one of three candidate role predicates. TransportMode::Spawn = 2 does exist (:446) and Transport is a runtime `extern TransportMode` under MOBILEGL_BUILD_DISAGGREGATED (:455, constexpr Monolith only in the non-disaggregated build at :566), so the predicate is mechanically viable - but P6-ENDSTATE-REVIEW.md:264 has ALREADY ruled against the Transport dial as the role predicate: it requires two orthogonal axes `Role{Monolith, Client, Server}` x `Dial{No, Fork, Connect}` and names forcing the child to Monolith as the trap ('后者会选中 frontend glue,正是 CONTRACT §3.1 点名的陷阱'). The review is listed as key reading and is what AMENDED a6, so the ask should have been framed as 'confirm the review's MGPipeServerArm() against these twelve sites', not as an open three-way choice.
|
||||
- MobileGL/MG_Backend/BackendObject.h:616-620 - `enum class SurfaceKind { None, Window, Pbuffer }`. There is no surfaceless surface kind anywhere in BackendObject, and `WindowKind::Surfaceless` (protocol.fbs:186) is refused by the decoder (SurfaceOpCodec.cpp:168-172 -> WindowKindNamesNoBackend, pinned at SurfaceControlFrameTest.cpp:181, :295). A4-04 states correctly that pbuffer is 'P6's ONLY WORKING SURFACE PATH' but never draws the doc consequence: P6-SPAWN-PLAN.md:40 and P6-CONTRACT-DRAFT.md:107 both promise 'pbuffer / surfaceless / 离屏', and surfaceless has no backend implementation and no wire op at this head. That belongs in doc_drift beside the other two P6-SPAWN-PLAN entries.
|
||||
- In-code citation drift in the exact comments a6.4 quotes, none of it flagged: (a) MobileGL/MG_Remote/Server/ServerLoop.h:491 and MobileGL/MG_Remote/Client/BackendObject_Remote.cpp:307 cite 'MobileGL/Init.cpp:68' for pActiveBackendObject.reset(); at this head that call is MobileGL/Init.cpp:77 and :68 is a comment about the live-sync registry. (b) MobileGL/MG_Remote/Client/BackendObject_Remote.cpp:257 cites 'ServerLoop.cpp:613-628' for the caps republish; the republish is ServerLoop.cpp:959-969. (c) MobileGL/MG_Remote/Server/ServerLoop.cpp:1148 and ServerLoop.h:489 cite 'EGLImpl.cpp:326' for the ReleaseEGLResources call; it is MG_Impl/EGLImpl/EGLImpl.cpp:328. A4-09 reproduces (a) and (c) verbatim as if they resolved.
|
||||
- P6-CONTRACT-DRAFT.md:46 cites `protocol.fbs:234-242` for 'FatalCode::ServerCrashed / DeviceLost ... Already allocated'. At this head `enum FatalCode` is protocol.fbs:248-256 (ServerCrashed = 5 at :254, DeviceLost = 4 at :253); lines 234-242 are `enum AuxRequestKind` plus the `table AuxRequest` header. Same table 0 the audit combed for drift (it caught :43's protocol.fbs:186-196 and :44's correct 166-179) - this row was skipped.
|
||||
|
||||
---
|
||||
|
||||
## a6.6 Transport 站点分类
|
||||
**小结**:The 238-site census is CONFIRMED exactly, but only with the integrator's own counting rule: 238 = grep-lines matching `MG_Config::Transport` (any suffix, so `TransportMode` and `TransportEndpoint` count) in non-test dirs, distributed 155 MG_Backend / 35 MG_Impl / 21 MG_Remote / 12 MG_Pipe / 8 MG_State / 7 Config. Twelve of the 238 are COMMENT lines, so there are 226 live code lines; counting occurrences of the bare symbol instead gives 228. The eight MG_State sites are NOT the sample the plan thinks they are: two of the eight (BufferObject.cpp:60, BufferObject.h:194) are comments, five of the remaining six are single-question `SplitActive` tests of the R-6 / third-state shape, and only ONE (MipmapStorage.cpp:55) literally asks both questions in one function. The "asks both questions" shape is not MG_State-local at all - it appears at 18 sites across MG_Impl/Pipe/SlotAllocator.cpp, MG_Impl/Pipe/PipeFill.cpp, MG_Pipe/PipeApply.cpp, MG_Backend/DirectGLES/Managers.cpp and MG_Remote/Client, and it already has two spellings in the tree (`Transport!=Monolith && !RunsAsTheServerRole()` for the client arm, `Transport!=Monolith && OnApplyThread()` for the server refusal). The three proposed predicates DO cover everything I opened, but a fourth axis exists and it is not a predicate: WHEN the question is asked. Most sites ask per-draw; VulkanRenderer.cpp:14593/:14616 and StagedTextureStore.h:475 ask ONCE, during device creation or at first use, which means the spawn server's Role must be established before MG_Backend::Init() rather than at session start. The one thing c6 most needs from this: decide whether the spawn SERVER process carries `Transport != Monolith` or `Transport == Monolith`, because 148 backend code lines and both Fatal role guards flip together on that single bit, and a server process left at Monolith selects the frontend glue arm everywhere - which P6-ENDSTATE-REVIEW.md:264 already names as the trap but which nothing in the tree currently prevents.
|
||||
|
||||
复审结论:**sound-with-fixes**(重新解析 26 条,异议 11 条,另指出 7 处遗漏)
|
||||
|
||||
| # | 判定 | 事实 | 站点 | spawn 下如何坏 | 守卫 | 归属 | 复审 |
|
||||
|---|---|---|---|---|---|---|---|
|
||||
| A6-S1 | no-action | Comment line documenting that PushIsArmed() is a read of MG_Config::Transport and OnServerRole() a relaxed load of the apply-thread key. NOT a code site. | MobileGL/MG_State/GLState/BufferState/BufferObject.cpp:60 (comment inside RefuseLegacyBufferArmFromApplyThread) | Nothing at this line. But the comment's cost argument ("one relaxed load each") is what a rename has to preserve: if MGPipeSplitActive() stops being one load of a process global it regresses a per-draw guard that simpleperf measured at 2.66% self on the client thread (ServerLoop.h:90-96). | none (comment) | c6 | |
|
||||
| A6-S2 | p6-must-handle | `if (MG_Config::Transport != MG_Config::TransportMode::Monolith) return;` - R-6's "second door": refuse the LEGACY backend persistent-map mint when a transport is live. | MobileGL/MG_State/GLState/BufferState/BufferObject.cpp:308 (BufferObject::TryAdoptLargeStorage) | Nothing, if the client process keeps Transport != Monolith. This is a pure SplitActive question and it never asks who is running. In the SERVER process the function is unreachable (no frontend BufferObject exists there), so the answer is irrelevant on that side. | the R-6 decline is doubled at PipeApply.cpp:2287 and at PipeWireCodec.cpp:1636; PipeStats' persistent-map-push counter i | sm | |
|
||||
| A6-S3 | p6-must-handle | `if (MG_Config::Transport != Monolith && atOffset == 0 && data.size >= m_size) { m_gpuWritePending = false; }` - the third state's only exit. | MobileGL/MG_State/GLState/BufferState/BufferObject.cpp:559 (BufferObject::WritebackFromBackend) | Nothing structural - it is SplitActive only. One latent sharpness: the condition `data.size >= m_size` is how a whole-buffer writeback is recognised, and the SLICED readback path at :605-618 has to clear m_gpuWritePending by hand for exactly that reason. Under spawn the slice size (BufferWritebackSliceBytes) is driven by ring capacity, so more buffers will take the sliced path and the by-hand clear at :614 becomes the common case rather than the exception. | AwaitBufferWriteback's third-state Fatal (BufferObject.cpp:619-628, MG_Remote/Client/GpuWritePending.cpp) | sm | **line-does-not-resolve** — Sliced path :594-612; by-hand clear :612; whole-buffer emit :614; AwaitBufferWriteback call :620; no-route clear :627-629. Drop 'BufferObject.cpp:619-628' from the guard field and keep only MG_Remote/ |
|
||||
| A6-S4 | p6-must-handle | `if (MG_Config::Transport != Monolith) { ... }` - the WHOLE split arm of SyncGpuWrites: emit readback (sliced or whole), then block in AwaitBufferWriteback. | MobileGL/MG_State/GLState/BufferState/BufferObject.cpp:590 (BufferObject::SyncGpuWrites) | This is the one MG_State site whose failure mode is a HANG rather than a Fatal. AwaitBufferWriteback blocks on a reply slot. If the spawn SERVER process is configured with Transport != Monolith and any thread there reaches SyncGpuWrites on a frontend BufferObject (there should be none, but the guard that would catch it is the accessor guard, not this function), it emits a readback with no ClientSession and waits. Today inproc is protected only because the apply thread aborts earlier in the accessor. | indirect: RefuseLegacyBufferArmFromApplyThread on the accessors; BufferWritebackIsReachable's no-route clear at :627 | sm | |
|
||||
| A6-S5 | p6-must-handle | `if (MG_Config::Transport != Monolith) return false;` - R-6's second door again, on the shader-storage residency path. | MobileGL/MG_State/GLState/BufferState/BufferObject.cpp:879 (BufferObject::EnsureGpuResidentStorage) | nothing - pure SplitActive, one direction, and the fallback (stay shadow-backed) is the spawn-correct answer | same as A6-S2 | sm | |
|
||||
| A6-S6 | p6-must-handle | `MG_Config::Transport == MG_Config::TransportMode::Monolith &&` as a CONJUNCT inside a multi-line map-persistent condition (not a statement of its own). | MobileGL/MG_State/GLState/BufferState/BufferObject.cpp:958 (BufferObject::AcquireMemoryRange, the legacy AcquirePersistentMap arm) | nothing semantically; it is the textual shape that resists a mechanical rewrite | same as A6-S2 | sm | |
|
||||
| A6-S7 | no-action | Comment line: "Everything here is behind the build option AND behind `MG_Config::Transport != Monolith` at the call site". NOT a code site. | MobileGL/MG_State/GLState/BufferState/BufferObject.h:194 (the "P5 b1" block declaring PushMappedSpanBlock / NotePersistentMapStateChanged / HasLiveHostWritesForWire / HasOutstandingGpuWrite) | nothing at this line, but the comment is the thing c6 will read to decide which members are client-only, and it understates where the gate actually sits | none (comment) | c6 | **line-does-not-resolve** — Call sites are BufferObject.cpp:227 (ResizeShadow), :378 (ReleaseMemory), :833 (glMapBuffer arm), :923 (AcquireMemoryRange), :947 (the MOBILEGL_PIPE_PUSH persistent arm). The callee's own gate is :489 |
|
||||
| A6-S8 | p6-must-handle | `if (MG_Config::Transport == Monolith) return;` immediately followed by `if (!MG_Remote::Server::ServerLoop::OnApplyThread()) return;` then a named-scope exemption, then Fatal{RoleViolation, "texture-legacy-arm"}. THE two-question sample. | MobileGL/MG_State/GLState/TextureState/MipmapStorage.cpp:55-70 (RefuseLegacyTextureArmFromApplyThread) | Both halves become structurally constant, in opposite directions, and that is the finding. In the spawn CLIENT process g_applyThreadKey is永 0 (ServerLoop.h:265-271: `key != 0 && key == CurrentThreadKey()`), so OnApplyThread() can never be true and the guard can never fire - a gate that cannot go red. In the spawn SERVER process there is no frontend TextureObjectMipmap to call it on, so it also cannot fire. The guard's whole value evaporates at exactly the moment spawn makes the violation impossible - which is fine as an outcome but must be a DECLARED retirement, not a silently dead abort. | itself; the pinned surface list in MG_Test/Wire/RemoteClientTest.cpp's RemoteGuards is what keeps the list honest | sm | **line-does-not-resolve** — RefuseLegacyTextureArmFromApplyThread :54-67; the Monolith test :55; the OnApplyThread test :56; the MGPipeTextureLegacyArmScope exemption :59; the Fatal :60-66. RefuseLegacyTextureShapeReadFromApplyT |
|
||||
| A6-P1 | blocks-p6 | PATTERN: the backend body's server-arm test. 148 code lines (150 total minus 2 comments) across MG_Backend/DirectGLES (98 lines) and MG_Backend/DirectVulkan (52 lines). Predominant form is the bare `if (MG_Config::Transport != Monolith) {` / `... == Monolith) return;`. | Representatives opened: MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp:315 (GetRawDepthFetchSampler), :442 (indirect command resolve), :876 (shader-storage GPU-write walk), :2483 (SyncClientSideVertexArraysForFetch), :8398-8417 (multi-draw indirect), :15600 (GetTexImage PBO); MobileGL/MG_Backend/DirectGLES/Managers.cpp:3289, :3482; MobileGL/MG_Backend/DirectGLES/Utils.cpp:55 (ActiveBackendFormatCaps), :2363; MobileGL/MG_Backend/DirectVulkan/DirectVulkan.cpp:1054; MobileGL/MG_Backend/DirectVulkan/Renderer/VulkanRenderer.cpp:685 (ApplyLineWidthState), :3162, :13148 | This is the headline. All 148 flip together on ONE bit in the server process. If c6 spells "the server does not dial" as `Transport = Monolith` (the trap P6-ENDSTATE-REVIEW.md:264 names), every one of these selects the frontend glue arm inside a process that has no frontend. The failure is NOT uniformly loud: DirectGLES.cpp:2483 would read a null GetBoundVertexArray() and `return true` silently; Managers.cpp:3482 would call `bufferObject->SyncPersistentMappedRange()` on a null pointer's guard and skip; VulkanRenderer.cpp:13148 would read MGB_CTX and hit MGP_INPUT_CHECK's poison Fatal by FIELD name, which names the field and not the wrong-arm decision. | partial and at the wrong altitude: MGPipeInputPoisonFatalForVerb names a field, not a role; no gate exists that says "th | c6 | |
|
||||
| A6-P1a | later-stage | SUB-PATTERN of P1: role-INDEXED statics. `Array<RoleXfbState, 2> g_roleXfbState; Int g_activeXfbRole = -1;` with `const Int role = MG_Config::Transport != Monolith;` used as the subscript, plus four `const Bool server = ...` selectors that pick between a per-role member and the shared one. | MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp:1641-1656 (ActiveXfbState), :1645 (the subscript), :1662 (CurrentXfb), :1807-1809 (BindScatterCaptureBuffer), :1848-1850 (ScatterCapturedRecords), :2212 (BindTransformFeedback), :2257 (DeleteTransformFeedback) | Nothing breaks - but the whole construct is a same-address-space artifact. Under spawn each process has exactly one role and `g_roleXfbState[0]` is dead in the server, `[1]` dead in the client. Leaving it is harmless; collapsing it is the kind of cleanup that silently changes which key a test observes, so it should be a named decision rather than a drive-by. | none; g_activeXfbRole's NeedsBind reset is the only thing that notices a role change | cp | |
|
||||
| A6-P1b | blocks-p6 | SUB-PATTERN of P1: bring-up-time, ONCE-per-process reads of Transport inside device/instance creation and inside a function-static initialiser. | MobileGL/MG_Backend/DirectVulkan/Renderer/VulkanRenderer.cpp:14593 (descriptorIndexingCore, inside CreateDevice's feature selection), :14616 (wireDepthResolveEnabled); MobileGL/MG_Remote/Server/StagedTextureStore.h:475 (ServerStagedTexture's `static StagedTextureStore& store = *new StagedTextureStore(Transport != Monolith);`); MobileGL/MG_Backend/DirectGLES/ContextEpoch.h:19 (CurrentContextEpoch) | These decide BEFORE any session exists, so the spawn server's Role must be established at process entry - before MG_Backend::Init(), before VulkanRenderer's vkCreateDevice - not at ClientSession/ServerSession handshake time. Any design that derives ServerArm from "a session is attached" or "the apply thread is running" gets the wrong answer here, because on Magma the descriptor-indexing and depth-resolve feature set is baked into the VkDevice at this point and cannot be changed later. | none - a wrong answer here is a device created without the extensions the wire path needs, surfacing much later as a mis | c6 | **claim-false** — Drop ContextEpoch.h:19 from P1b and file it under A6-P1 (ordinary per-draw server-arm test). The bring-up-once family is then VulkanRenderer.cpp:14593, :14616, StagedTextureStore.h:475 and the missed |
|
||||
| A6-P2 | p6-must-handle | PATTERN: the client-arm emit/decide test, single question. ~48 code lines: MG_Impl (35 lines, 1 of them comment) + MG_State (6 code lines, rows S2-S6) + MG_Remote/Client's own predicates. | MobileGL/MG_Impl/Pipe/PipeFill.cpp (19 lines); MobileGL/MG_Impl/GLImpl/Texture/GL_Texture.cpp:6079, :6543, :6572, :6832; MobileGL/MG_Impl/GLImpl/Drawing/GL_Drawing.cpp:1347, :1409; MobileGL/MG_Impl/GLImpl/Query/GL_Query.cpp:782; MobileGL/MG_Impl/GLImpl/Getter/GL_Getter.cpp:1186; MobileGL/MG_Impl/Pipe/VertexInputEmit.h:389, :396; MobileGL/MG_Impl/Pipe/ResourceTracker.h:585, :704 | Nothing, in the client process. In the server process these TUs are linked (same libMobileGL.so) but should be unreachable. The two Fatals at ResourceTracker.h:585/:704 are the ones worth keeping: they fire on `Transport != Monolith` alone with no role term, so they stay able to go red in either process. | the two named Fatals above; MGPipeInputPoison for the fill side | sm | |
|
||||
| A6-P2a | blocks-p6 | PATTERN: the TWO-QUESTION sites - `Transport != Monolith` conjoined with a role probe in the same function. 18 sites, in TWO spellings that mean opposite things: the CLIENT arm `Transport != Monolith && !RunsAsTheServerRole()` and the SERVER refusal `Transport != Monolith && OnApplyThread()`. | CLIENT arm: MobileGL/MG_Impl/Pipe/PipeFill.cpp:357 (ClientRunsAhead), :975 (respecify+subdata follow-up), :1114 (flush-range follow-up), :1255 (MGPipeClientFinish), :3597 (applier reset); MobileGL/MG_Remote/Client/GpuWritePending.cpp:226 (MGPipeStageChunkBytes). SERVER refusal: MobileGL/MG_Impl/Pipe/SlotAllocator.cpp:24 (MGPipeApplierIsUnbarrieredApply), :30 (MGPipeRefuseAllocatorFromApplyThread), :49 (MGPipeRefuseFrontendKeyedRegistryFromApplyThread); MobileGL/MG_Impl/Pipe/PipeFill.cpp:1205 (MGPipeDeferDestroyAndFreeIfOnApplyThread); MobileGL/MG_Pipe/PipeApply.cpp:1353 (MGPipeApplierReset's Fatal); MobileGL/MG_Backend/DirectGLES/Managers.cpp:229 (OnFrontendStateObjectDestroyed), :2867 (mutation-epoch bump pin); MobileGL/MG_Remote/Client/ClientSession.cpp:1320+:1357 (RefusePipeInputsTouchWhileApplierOwnsIt); MobileGL/MG_State/GLState/TextureState/MipmapStorage.cpp:55; MobileGL/MG_State/GLState/BufferState/BufferObject.cpp:62-67; MobileGL/MG_Remote/Client/PersistentMapTracker.cpp:526/535 | The role term becomes a constant in each process and the conjunction degenerates - but in two DIFFERENT directions, which is why these cannot be rewritten uniformly. In the client process `!RunsAsTheServerRole()` is always true (g_applyThreadKey==0), so the six CLIENT-arm sites reduce to plain SplitActive - mechanical. In the server process `OnApplyThread()` is true only on the apply thread, so the twelve SERVER refusals still have a live second term, and a non-apply thread in the server (the EGL/control thread, the main thread) that reaches PipeFill.cpp:975 or :1114 would take the CLIENT branch and emit client wire records with no ClientSession. That is a NEW reachability that inproc never had, because in inproc every thread except the apply thread genuinely was the client. | PipeFill.cpp:984-995's ClientWireRecordsEmitted() self-check would abort by name (Fatal{InitialBytesNotCarried}) on the | c6 | **claim-false** — Retire the two-spelling taxonomy. Reclassify by POLARITY, not by name, into three buckets: (a) server-arm gates that proceed when split AND on the apply thread - SlotAllocator.cpp:24-25, :30-31, :49-5 |
|
||||
| A6-P3 | blocks-p6 | PATTERN: the four SlotCaps macros - `MGL_BACKEND_SLOT_CAP`, `MGL_BACKEND_SLOT_LOCAL`, `MGL_BACKEND_SLOT_PTR_CAP`, `MGL_BACKEND_SLOT_PTR_LOCAL`. Four DEFINITION lines that govern 14 non-test expansion sites. | MobileGL/MG_Remote/Client/SlotCaps.h:111, :116, :127, :134. Expansions: MG_Impl/GLImpl/Query/GL_Query.cpp (7), MG_Impl/GLImpl/Texture/GL_Texture.cpp (2), MG_Impl/GLImpl/Getter/GL_Getter.cpp (2), MG_Impl/GLImpl/Sync/GL_Sync.cpp (1), MG_Impl/GLImpl/Drawing/GL_Drawing.cpp (1), MG_Backend/Init.cpp (1) | The LOCAL forms are the interesting ones. `MGL_BACKEND_SLOT_LOCAL` answers `Transport == Monolith && slot != nullptr`, i.e. "I may call the backend directly". In the spawn SERVER process that is exactly what the server SHOULD do, and it would answer false if the server carries Transport != Monolith. One expansion is in MG_Backend/Init.cpp - bring-up code that runs in BOTH processes under spawn. c6 must decide whether LOCAL means "monolith" or "the backend is in this process", because under spawn those stop being the same statement. | none; a wrong LOCAL answer is a silently skipped call, not a Fatal | c6 | **overstated** — Restate as '4 definition lines governing 12 live expansion sites, all of them in MG_Impl/GLImpl, none in MG_Backend'. Delete the MG_Backend/Init.cpp sentence - it is the row's main argument for urgenc |
|
||||
| A6-P4 | p6-must-handle | PATTERN: role-NEUTRAL split-active tests in the shared applier and codec. 9 code lines in MG_Pipe/PipeApply.cpp (11 minus 2 comments) plus MG_Remote/Wire/PipeWireCodec.cpp:1636 and MG_Backend/MGPipe/PipeInputs.cpp:292-294. | MobileGL/MG_Pipe/PipeApply.cpp:1022, :1043, :1311 (NoP4aConsumer), :1487 (MGPipeApplierReleaseObjectRecords), :2139 (the flush-range fault rule), :2245 (staged-texture drop), :2287 (MGPipeApplyMapPersistent's R-6 decline), :3462; MobileGL/MG_Remote/Wire/PipeWireCodec.cpp:1636 (AdoptTier consult) | Nothing I can find. These are the most purely mechanical group in the census: `Transport != Monolith` -> `MGPipeSplitActive()` with no second question and no behaviour change. The one to watch is PipeApply.cpp:1311 (NoP4aConsumer), which reaches `ServerSession::Active()` - a singleton whose liveness in the spawn server process is a bring-up ordering question, not a role question. | Fatal{ProtocolCorruption} / Fatal{StageSnapshotTooNarrow} downstream | sm | **overstated** — State it as '8 role-neutral code lines in MG_Pipe/PipeApply.cpp (11 census lines minus 2 comments minus PipeApply.cpp:1353, which is A6-P2a's)'. The verdict p6-must-handle and the 'most purely mechani |
|
||||
| A6-P5 | blocks-p6 | PATTERN: DIAL / bring-up. The sites that decide whether this process brings up a split at all. 3 code lines in MG_Backend/Init.cpp plus ClientSession::Start's signature and mode refusal. | MobileGL/MG_Backend/Init.cpp:266 (Init's THE SINGLE HOOK), :216 (ClientSessionInstance().Start(MG_Config::Transport, MG_Config::TransportEndpoint)), :236 (ShutdownSplitRoles' early-out); MobileGL/MG_Remote/Client/ClientSession.cpp:474 (Start's signature), :482 (the `mode != InProcess` named refusal); MobileGL/MG_Remote/Client/ClientSession.h:70 | This is where MGPipeShouldDial() has to be born, and the split of InitSplitRoles into a server half and a client half is the actual P6 work. Under spawn the CLIENT must run steps 3-4 without step 1 (no local ServerLoop, so g_applyThreadKey stays 0 - which is what makes every role probe in the client answer correctly for free), and the SERVER must run step 1-2 without step 3. Note Init.cpp:236's ShutdownSplitRoles calls ServerLoopInstance().Stop() UNCONDITIONALLY for M-6's reason; in a client that never created a ServerLoop that is a no-op, but it is a no-op by accident rather than by design. | Init.cpp:271-276 refuses to fall back to monolith when InitSplitRoles fails - the one gate that is already spawn-shaped | sm | |
|
||||
| A6-P6 | blocks-p6 | The parse itself: `spawn` / `unix:` / `pipe:` are RECOGNISED, logged as "names a transport P6 implements and P5 does not", and then forced back to `MG_Config::Transport = Monolith`. | MobileGL/ConfigLoader.cpp:339-346 (MG_ConfigLoader::InitTransport); the four writes are :328, :332, :344, :350 | This is the first line c6 changes, and the trap is what replaces it. The refusal currently ends in `Transport = Monolith`, i.e. the refusal and the server's own resting state have the SAME spelling. The moment spawn is accepted, "I refused to dial" and "I am the server and do not dial" must stop being the same value or the 148 P1 sites cannot tell them apart. | the build-level gate CONTRACT-P5.md table 3 names (`nm --defined-only libMobileGL.so / grep -i MG_Remote` non-empty in b | c6 | **line-does-not-resolve** — Change the guard cite from Config.h:530-540 to Config.h:435-442. (The row's sibling cite in A6-P8, 'Config.h:424-440 argues it at length', DOES resolve - the 'WHY Transport IS NOT A FeaturesTable MEMB |
|
||||
| A6-P7 | p6-must-handle | The sites that are ALREADY the natural carrier: named predicates whose entire body is one Transport test. Rewriting these is a one-line change each and it converts a large number of call sites for free. | MobileGL/MG_Remote/Client/PersistentMapTracker.cpp:526-528 (PushIsArmed); MobileGL/MG_Remote/Client/GpuWritePending.cpp:125-127 (GpuWriteSetIsClientSide); MobileGL/MG_Backend/DirectGLES/Managers.h:740-742 (ProgramHandleArm), :1146-1152 (VertexInputReadsRecords); MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp:272-274 (FramebufferRecordArmIsMandatory), :661 (ResolveBufferBindingSubsystemArm), :3386 (the sampler twin); MobileGL/MG_Backend/MGPipe/PipeInputs.cpp:292-295 (MGPipeRoleSplitActive) | Nothing - but MGPipeRoleSplitActive (PipeInputs.cpp:292) is a NAME COLLISION waiting to happen: it means `Ipc.RoleSplitState && Transport != Monolith` (the P5f dual-block rehearsal), which is strictly narrower than the proposed MGPipeSplitActive(). Two predicates one word apart, one of which is gated on an env knob, is the kind of pair that drifts. | none | sm | |
|
||||
| A6-P8 | blocks-p6 | The G1 constraint on the rewrite: in a build without MOBILEGL_BUILD_DISAGGREGATED, `inline constexpr TransportMode Transport = TransportMode::Monolith;` | MobileGL/Config.h:566 (the #else arm of the MOBILEGL_BUILD_DISAGGREGATED block); the comment stating why is at Config.h:563-565 | Not a spawn break - a REWRITE break. MGPipeSplitActive() / MGPipeServerArm() / MGPipeShouldDial() must each be `inline constexpr`-foldable to false in the pull build, or 226 sites become real branches and G1 goes red across the whole tree. The SlotCaps.h precedent (:139-147) shows the shape: the pull build gets a DIFFERENT macro expansion, not a runtime-false predicate. | G1 (the pull build's symbol set and codegen must not move) - a build-level gate that WILL go red for this reason | c6 | |
|
||||
| A6-P9 | p6-must-handle | The FOURTH predicate that already exists and is not one of the three: MGPipeInstalledArm() -> {kNone, kMonolith, kClientWire}, "what the table actually does" as opposed to "what was ASKED for". | MobileGL/MG_Pipe/PipeRoute.h:234-239 (the enum, MGPipeInstalledArm, MGPipeNoteInstalledArm) with the contrast spelled at :235 | It is the honest answer to "am I the client arm" and it has no server value: kClientWire and kMonolith, no kServerApply. If c6 adds Role, this enum either grows a third value or becomes redundant with MGPipeShouldDial(). Leaving BOTH is how the tree ends up with two selectors that can drift apart - exactly what Managers.h:1142-1145 warns about for VertexInputReadsRecords. | MGPipeTablesAreInstalled() (PipeRoute.h:232) | c6 | |
|
||||
| A6-P10 | later-stage | The backend reaching the ServerLoop singleton to find ITSELF: `if (Transport != Monolith) { if (BackendObject* server = ServerLoopInstance().Backend()) ... }` with the monolith arm reading MG_Backend::pActiveBackendObject. | MobileGL/MG_Backend/DirectGLES/Utils.cpp:50-62 (ActiveBackendFormatCaps); MobileGL/MG_Backend/DirectVulkan/Renderer/VulkanRenderer.cpp:685-699 (ApplyLineWidthState) | Not a break, an unnecessary indirection that becomes a constraint: it means the spawn server process MUST construct a ServerLoop singleton and register its backend there even though nothing in that process needs a loop to route through. If c6 lets the server process put its backend in pActiveBackendObject (there being no BackendObject_Remote to compete for the slot), these two sites stop needing the Transport test entirely - a behaviour-preserving simplification, but only if BOTH are changed together. | Utils.cpp:59-63's named refusal of the mirror fallback | cp | **overstated** — Widen the site list to Utils.cpp:55, VulkanRenderer.cpp:685, DirectVulkan.cpp:868, VertexInputStateFactory.cpp:256, :599, plus the ungated VertexInputStateFactory.cpp:464. Change the framing from 'an |
|
||||
| A6-P11 | already-handled | Census correction: 12 of the 238 lines are COMMENTS, not code. 226 code lines remain. Counting occurrences of the bare symbol `MG_Config::Transport` (excluding TransportMode/TransportEndpoint) gives 228 non-test occurrences on 226 lines. | Comment-only lines: MobileGL/Config.h:564; MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp:2431; MobileGL/MG_Backend/DirectGLES/Managers.cpp:10389; MobileGL/MG_Backend/Init.cpp:263; MobileGL/MG_Impl/Pipe/ResourceTracker.h:55; MobileGL/MG_Pipe/PipeApply.cpp:20, :2134; MobileGL/MG_Pipe/PipeRoute.h:235; MobileGL/MG_Remote/Server/StagedShadow.h:34; MobileGL/MG_Remote/Server/StagedTextureStore.h:93; MobileGL/MG_State/GLState/BufferState/BufferObject.cpp:60; MobileGL/MG_State/GLState/BufferState/BufferObject.h:194 | nothing - but a rewrite package sized at 238 will overshoot by 12, and two of the twelve are inside the MG_State sample c6 is told to treat as representative | none | a6 | |
|
||||
| A6-P12 | blocks-p6 | The MobileGLServer target that MOBILEGL_IPC_SERVER_PATH points at is the P0 spike STUB - an Android-only, OFF-by-default executable built from tools/spikes/server_stub/main.cpp that links no MobileGL code at all. | CMakeLists.txt:31 (the option), :926-949 (the target); MobileGL/MG_IntegrationTest/CMakeLists.txt:1931 (MGL_ITEST_SPLIT_SERVER_PATH = ${CMAKE_BINARY_DIR}/libMobileGLServer.so); tools/trace_replay/CMakeLists.txt:467 (IPC_SERVER_PATH = same); MobileGL/Config.h:452-457 (IpcTable::ServerPath, "P6 consumes it; P5 lands the parse") | a6 item 5's "link it once for real" experiment has no target to start from: the spawn server is not a variant of this executable, it is a NEW target that has to link MG_Backend + MG_Pipe + MG_Remote/Server and answer the question of whether MG_Impl and MG_State come along. Until that target exists, every claim in this audit about "what MG_Config::Transport is in the server process" is a design choice and not an observation. | none - a ctest ENVIRONMENT block naming a nonexistent .so is currently silent | c6 | **line-does-not-resolve** — Change the Config.h cite from :452-457 to :468-473 (struct IpcTable open at :468, comment :469-472, `String ServerPath;` at :473), and add MobileGL/ConfigLoader.cpp:358 as the sole parse site. Everyth |
|
||||
| A6-P13 | p6-must-handle | Sites where the Transport test is spelled as a ?: SELECTOR across a #if boundary, splitting one expression over preprocessor arms rather than guarding a statement. Mechanically the hardest group to rewrite without changing shape. | MobileGL/MG_Backend/DirectGLES/DirectGLES.cpp:8396-8407 and :8413-8421 (useNative / resource selection), :8496-8513 (the twin block), :9361, :9518, :9782, :9831, :13574, :14590, :14831, :15153, :15600; MobileGL/MG_Backend/DirectGLES/Utils.cpp:2363-2366; MobileGL/MG_Backend/DirectVulkan/Renderer/VulkanRenderer.cpp:3162-3167; MobileGL/MG_State/GLState/BufferState/BufferObject.cpp:958 | Not a semantic break, but a sed-and-commit rewrite will mangle these. I count ~20 of them in DirectGLES.cpp alone by form. They are the concrete reason the answer to "is the rewrite mechanical" is NO for MG_Backend even though every one of them is a pure ServerArm question. | G1 | sm | |
|
||||
| A6-P14 | p6-must-handle | SUSPECTED ALREADY-WRONG-FOR-INPROC: the client-arm respecify and flush-range follow-ups guard against the apply thread with `!RunsAsTheServerRole()`, but only ONE of the two has a counter that can notice if the guard is wrong. | MobileGL/MG_Impl/Pipe/PipeFill.cpp:975-1000 (respecify: has the ClientWireRecordsEmitted() before/after self-check and Fatal{InitialBytesNotCarried}) vs MobileGL/MG_Impl/Pipe/PipeFill.cpp:1114-1116 (flush-range: `if (Transport != Monolith && !RunsAsTheServerRole() && size != 0) MGPipeEmitResourceSubData(...)` with no check at all) | In the server process a NON-apply thread answers false to RunsAsTheServerRole() and would take the client arm here. The respecify site aborts by name. The flush site emits a resource_subdata into nothing and the picture is wrong until StageSnapshotTooNarrow fires on a later flush. I am flagging this as the asymmetry, not as a live bug: I did not find a path that reaches PipeFill from a non-apply thread in a server-role process today, because today there is no server-only process. | asymmetric: Fatal{InitialBytesNotCarried} at :987 for the respecify, only the downstream Fatal{StageSnapshotTooNarrow} f | sm | |
|
||||
| A6-P15 | blocks-p6 | ANSWER TO "do the three predicates cover everything": yes for role, no for one axis. Three sites ask a question that is neither SplitActive nor ServerArm nor ShouldDial - they ask "does the backend live in THIS process". | MobileGL/MG_Remote/Client/SlotCaps.h:116 (MGL_BACKEND_SLOT_LOCAL) and :133-136 (MGL_BACKEND_SLOT_PTR_LOCAL), expanded at MobileGL/MG_Impl/GLImpl/Texture/GL_Texture.cpp:6837 and 13 other call sites including MobileGL/MG_Backend/Init.cpp | Under spawn there are two processes, and in the SERVER process the backend IS local while a transport IS active. The macro's two terms stop being the same question. This is the fourth pattern the task asked me to name if the three did not cover it: LOCALITY, not role. It is small - 2 macro definitions, 14 expansions - but it is real, and folding it into ShouldDial ("if I do not dial, the backend is local") is a coincidence in the current topology rather than a definition. | none - a wrong answer is a silently skipped backend call | c6 | **overstated** — Restate as '2 macro definitions, 2 live expansion sites, both at MobileGL/MG_Impl/GLImpl/Texture/GL_Texture.cpp:6552 and :6837'. Keep the verdict - the locality/role conflation is real and c6 must rul |
|
||||
|
||||
**复审另行指出的遗漏**:
|
||||
- MobileGL/ConfigLoader.cpp:408 - `if (MG_Config::Transport == MG_Config::TransportMode::Monolith) return;`. This is the SEVENTH Config-dir census line and NO row in the item names it (A6-P6 accounts only for :326, :328, :332, :344, :350 and Config.h:564). It gates the one-line resolved-IPC-configuration log at :411-417 ('Config: IPC ring=%uMiB stage=%uMiB ... role-split-state=%d affinity=...'). It matters directly to this item's own open question #2, which asks for 'a first-boot log line in the server that prints the resolved Role so a wrong answer is visible in the first 20 lines of logcat': the site that would carry that line already exists and is gated on the exact bit under dispute, so a spawn server left at Transport==Monolith prints NOTHING and silences the very diagnostic the audit asks for.
|
||||
- MobileGL/MG_Backend/DirectGLES/Managers.cpp:1161-1166 - `MG_Remote::Server::StagedShadowStore& ServerStaged() { static ... store = *new StagedShadowStore(MG_Config::Transport != MG_Config::TransportMode::Monolith); return store; }` (the Transport read is census line :1164). This is the exact family twin of StagedTextureStore.h:475, which A6-P1b names as one of its three bring-up-once sites - and MobileGL/MG_Remote/Server/StagedTextureStore.h:466-467 literally says it follows 'ServerStaged() ruling verbatim'. Its own comment at :1155-1157 gives the same once-and-for-all argument ('an answer that changed mid-run would strand every resource already staged'). A6-P1b names the derivative and misses the original. It is also the wider of the two: ServerStaged() governs MGL_SERVER_STAGED_ADOPT/DROP/DROP_ALL/REQUIRE_COVERAGE at Managers.cpp:1191, :1201-1205, :3052, :3398, :3533.
|
||||
- MobileGL/MG_Impl/Pipe/PipeFill.cpp:2868-2869 and :2913-2914 - the g_fillPlan MEMO KEY: `&& g_fillPlan.CapsGeneration == (MG_Config::Transport != Monolith ? MG_Remote::Client::CapsMirrorInstance().Generation() : 0)` and the matching store. No row names either line. This is the ONLY shape in the whole 226-line census where the Transport answer feeds a CACHE KEY rather than a branch, which makes it the one site where a predicate rename can change WHEN the answer is computed and therefore change cache-invalidation semantics rather than just control flow. It is also a direct counterexample to A6-P7's organising quote from Managers.h:737-739 ('NOT LATCHED... Transport is configuration read once at bring-up'): here the Transport answer selects between a latched generation counter and a constant 0. And CapsMirrorInstance() is client-side structure, so if c6 gives the server process Transport != Monolith this code consults a mirror that has no meaning there.
|
||||
- MobileGL/MG_Impl/GLImpl/Texture/GL_Texture.cpp:6552 - `MGL_BACKEND_SLOT_LOCAL(GetTextureImage)` (in the `pActiveBackendObject->GetBackendType() == BackendType::DirectVulkan` arm). A6-P15 names only its twin at :6837 and then pads the list with 13 sites that belong to a different macro family. :6552 is the OTHER of the two real locality sites and it is the more interesting one, because it conjoins the locality question with a backend-type question against pActiveBackendObject - which A6-P10 establishes holds BackendObject_Remote on the client (Init.cpp:225-228), so in a spawn client this arm asks 'is the backend local' of an object that by construction is not.
|
||||
- MobileGL/MG_Backend/DirectVulkan/Renderer/VertexInputStateFactory.cpp:256-260, :599-603 and :464, plus MobileGL/MG_Backend/DirectVulkan/DirectVulkan.cpp:868-873 - four more sites in A6-P10's family (backend reaching ServerLoopInstance().Backend() for its own dynamic parameters). P10 asserts there are exactly two and that they must 'be changed together'. VertexInputStateFactory.cpp:464 is the sharpest of the four: it reads `ServerLoopInstance().Backend()` with NO Transport test at all (inside `#if MOBILEGL_BUILD_DISAGGREGATED` opened at :438) and silently treats a null answer as 'fp64 unsupported' at :465-467.
|
||||
- MobileGL/MG_Remote/Client/WireTables.cpp:87 - `Bool RunsAsTheServerRole() { return Server::ServerLoop::OnApplyThread(); }`. Not a census line, but the single fact that collapses A6-P2a's two-spelling taxonomy, and the item never opens it despite building a blocks-p6 row on the premise that the two names differ in meaning. c6 needs this on the record: there is exactly ONE role predicate in the tree under two names, so the Role axis has one implementation to redirect, not two.
|
||||
- MobileGL/MG_Impl/GLImpl/Sync/GL_Sync.cpp:66-67 - the comment `// This is the same pointer expression MGL_BACKEND_SLOT_PTR_LOCAL had in a pull build.` followed at :67 by the RAW `if (const auto backendFenceSync = MG_Backend::gBackendFunctionsTable.GL.FenceSync)`. A6-P3 counts this as an expansion; it is the opposite - a site where the macro was deliberately declined and the locality question left spelled with no Transport term at all. It is a third instance of A6-P15's locality question and the only one that would be invisible to a rewrite that greps for the macro names.
|
||||
|
||||
---
|
||||
|
||||
## a6.7 abort 普查
|
||||
**小结**:At b3b9c2ee there are 92 executable `std::abort()` statements under MobileGL/MG_Remote/ (94 grep hits minus two inside comments: EmitTables.h:25, WireLog.h:49); one of the 92, ClientSession.cpp:44's MGP5_C0_STUB, is defined at :39 and #undef'd at :1549 with zero expansions, so 91 can fire. Roughly 48 of them are reachable from bytes the PEER wrote, split ~27 server-side (records, SEG_STAGE, ctrl frames, the shared control page) and ~21 client-side (SEG_EVENT, reply slots, Welcome, the watermarks the server advances); the other ~44 are self-checks on our own invariants. Two shared funnels multiply that: Wire::WireProtocolFatal/At (PipeWireCodec.cpp:377/382) has 54 call sites, and the generated MGPipeWireProtocolFatal (PipeWire.inc:1177) has 84 MGP_WIRE_CHECK_BOUNDS arms plus the `<unknown opcode>` default at :1472 - every one of those 139 is peer-reachable by construction. ANSWER TO THE DECISION QUESTION: funnelling into one `Session::Fail(FatalCode, detail)` that is still `[[noreturn]]` and still aborts is a RENAME for all 92 sites plus the ~90 MG_Pipe ones - no site loses anything, because nothing after an abort is reachable today. The expense is entirely in the LATER latch flip, and it is 13 sites where a returning Fail is undefined behaviour with no honest value to return (8 of them reference-returning: EmitTables.cpp:216, WireTables.cpp:120, ServerSession.cpp:272/:698/:713/:724/:731/:739; 5 last-statement non-void: PipeWireCodec.cpp:927/:2312, ServerSession.cpp:262, ServerLoop.cpp:1056, StagedTextureStore.h:344, PersistentMapTracker.cpp:1059) plus ~9 where falling through IS the defect the Fatal exists to prevent (ServerSession.cpp:158's guessed CallMask is the named "marquee defect"; EmitTables.cpp:843's silent zero bpp; PipeWire.inc:1472's unknown-opcode dispatch). The remaining ~70 need one inserted `return`. THE ONE THING c6 MOST NEEDS: `ServerSession::ConsumerDoorbell()`/`ProducerDoorbell()` abort `Fatal{UnmigratedVerb}` for every TransportRole that is not InProcess (ServerSession.cpp:719-724, :735-739), and ServerLoop::ApplyThreadMain calls ConsumerDoorbell() unconditionally at ServerLoop.cpp:373 - so the first spawn session aborts on the apply thread before it pops a single record. That is a blocks-p6 row, not a hardening row. Separately, three guest-reachable unbounded allocations are real and verified: PipeApply.cpp:1566-1568 (CreateRenderState resizes RenderStateCsos to a peer-supplied Cso.Slot+1 with NO slot limit, unlike every sibling family which goes through RecordAt's bound), PipeApplier.cpp:439-440 (readback scratch from peer w*h*bpp), and ProgramArtifactsCodec.cpp:219-220 (count bounded by remaining BYTES then multiplied by sizeof(element)) - and there is not one try/catch anywhere under MG_Remote/, so each one ends in an uncaught std::bad_alloc and an unnamed std::terminate.
|
||||
|
||||
复审结论:**sound-with-fixes**(重新解析 30 条,异议 11 条,另指出 8 处遗漏)
|
||||
|
||||
| # | 判定 | 事实 | 站点 | spawn 下如何坏 | 守卫 | 归属 | 复审 |
|
||||
|---|---|---|---|---|---|---|---|
|
||||
| A7-1 | blocks-p6 | ServerSession::ConsumerDoorbell() / ProducerDoorbell() abort Fatal{UnmigratedVerb} for every TransportRole except InProcess; ApplyThreadMain calls ConsumerDoorbell() unconditionally | MobileGL/MG_Remote/Server/ServerSession.cpp:709-724 (ServerSession::ConsumerDoorbell), :727-739 (ServerSession::ProducerDoorbell), reached from MobileGL/MG_Remote/Server/ServerLoop.cpp:373 (ServerLoop::ApplyThreadMain) | The spawn transport's role is not InProcess, so mgl-srv-apply aborts at ServerLoop.cpp:373 before it pops its first record. The abort text says 'that is P6's SocketTransport' - it is the phase's own tripwire, correctly armed, and it fires first. | The Fatal itself is the guard; it goes red for exactly the reason it exists. | so | |
|
||||
| A7-2 | blocks-p6 | MGPipeApplyCreateRenderState resizes g_applier.RenderStateCsos to a peer-supplied Cso.Slot+1 with NO slot limit; every sibling create-family goes through RecordAt(records, slot, slotLimit) | MobileGL/MG_Pipe/PipeApply.cpp:1563-1569 (MGPipeApplyCreateRenderState) vs :471-476 (RecordAt) and its bounded callers at :1884, :2397, :2650, :2752, :2811, :1210/:1216; decode arm MobileGL/MG_Remote/Wire/PipeWireCodec.cpp:1713 | A record with Cso.Slot = 0xFFFFFFFE asks for ~4.29e9 entries of MGPipeRenderStateCsoRecord (8 + kMGPipePipelineChunkBytes = 396, so ~1.7 TB). std::length_error / std::bad_alloc, uncaught, std::terminate - no Fatal line, no family tag. | none - MOBILEGL_ASSERT at :1564 checks only slot != 0 and is inert at INFO | dl | |
|
||||
| A7-3 | already-handled | Wire::WireProtocolFatal / WireProtocolFatalAt: the [[noreturn]] funnel this layer already has, 54 call sites | MobileGL/MG_Remote/Wire/PipeWireCodec.cpp:377-380, :382-386 (definitions); declarations MobileGL/MG_Remote/Wire/PipeWireCodec.h:110-111 | nothing - this is the shape dl wants, one level down. It is the proof that the funnel is a rename: 54 sites already route through two functions. | n/a | dl | **claim-false** — State 93 call sites tree-wide, 54 of them in PipeWireCodec.cpp. Keep the verdict already-handled and the rename argument - it gets STRONGER, not weaker - but c6 must be told the rename touches six fil |
|
||||
| A7-4 | p6-must-handle | Generated MGPipeWireProtocolFatal: 84 MGP_WIRE_CHECK_BOUNDS arms plus the `<unknown opcode>` default, all peer-reachable, all [[noreturn]]-relying | MobileGL/MG_Pipe/generated/PipeWire.inc:1177-1181 (definition), :1183-1188 (MGP_WIRE_CHECK_BOUNDS), :1472 (the default arm, inside a Bool function that continues to gMGPipeWireRecordApply dispatch at :1474-1477) | Nothing breaks; it is exactly right. But it is GENERATED, so the funnel rename must be a generator edit, and if the latch ever flips, :1472 needs `return false` or an unknown opcode is handed to the real decoder. | the check itself | dl | **claim-false** — 83 arms plus the default = 84 peer-reachable sites behind MGPipeWireProtocolFatal. Total peer-reachable death sites behind the two named funnels is 177, not 139. |
|
||||
| A7-5 | later-stage | Eight reference-returning Fatal sites: a returning Fail is a null dereference or a missing return, and there is no value to invent | MobileGL/MG_Remote/Client/EmitTables.cpp:208-217 (RequireSession -> ClientSession&, `return *session;` at :217); MobileGL/MG_Remote/Client/WireTables.cpp:106-121 (RequireSession); MobileGL/MG_Remote/Server/ServerSession.cpp:267-273 (ReverseCallbackOwner -> ServerSession&), :695-701 (Control -> RingControl&, `return *control;` at :701), :713 and :724 (ConsumerDoorbell -> Doorbell&), :731 and :739 (ProducerDoorbell -> Doorbell&) | nothing today. These are the sites that make the LATER latch flip a redesign: a Doorbell& or a RingControl& has no null, so each caller must be restructured to ask a Bool question first. | none needed while Fail is [[noreturn]] | Ph | **line-does-not-resolve** — EmitTables.cpp:208-218, return at :218. ServerSession.cpp:693-701, abort at :698, return at :700. Verdict later-stage / phase Ph unchanged - the row's argument (a Doorbell& or RingControl& has no null |
|
||||
| A7-6 | later-stage | Five last-statement non-void Fatal sites: a returning Fail is UB (falls off the end of a value-returning function) | MobileGL/MG_Remote/Wire/PipeWireCodec.cpp:927 (PipeWireEncoder::StageAllocate -> Uint8*), :2312 (PipeWireDecoder::ApplyChecked -> Bool, the switch default); MobileGL/MG_Remote/Server/ServerSession.cpp:262 (ReserveEventOrBlock -> void*); MobileGL/MG_Remote/Server/ServerLoop.cpp:1056 (ServerLoop::ApplySurfaceControlFrame -> MobileGLResult); MobileGL/MG_Remote/Server/StagedTextureStore.h:344 (RequireLevelBytes -> const Uint8*); MobileGL/MG_Remote/Client/PersistentMapTracker.cpp:1059 (AdoptTierIsEmulate -> Bool) | nothing today. Each has a plausible-but-lying return (nullptr, false, an error code) that a caller would then have to check - StagedTextureStore.h:344's callers dereference the result, so nullptr is the crash one line later. | none | Ph | **claim-false** — Say six sites. Move PipeWireCodec.cpp:2312 into A7-3's funnel bucket where it belongs. Re-file StagedTextureStore.h:344 as its own finding: the function ALREADY has a nullptr return path its two produ |
|
||||
| A7-7 | later-stage | ServerSession::CallMask() falls through FatalUnsetCallMask to `m_capBits / MGCapsConsumerBits(...)` - the fall-through IS the defect the Fatal names | MobileGL/MG_Remote/Server/ServerSession.cpp:147-159 (FatalUnsetCallMask, [[noreturn]]), called from :415-420 (ServerSession::CallMask, returns Uint64) | nothing today; but it is the clearest example of a site where a returning Fail silently re-creates a named historical defect. Any latch flip must give this one a refusal path, not a return value. | none after the Fatal | Ph | **line-does-not-resolve** — ServerSession.cpp:412-417, call at :414, fall-through at :416, Bool twin at :410. Verdict later-stage / phase Ph unchanged. |
|
||||
| A7-8 | p6-must-handle | Ring watermark advance: Fatal{ProtocolCorruption,"watermark"} fires on a value read out of the SHARED control page | MobileGL/MG_Remote/Transport/Ring.cpp:364-377 (AdvanceMonotonic), call sites :390 submittedSeq, :394 appliedSeq, :403 retiredSeq, :407 completedFrameSerial, :411 presentAckSerial; page layout MobileGL/MG_Remote/Transport/Ring.h:135-139 | Both processes map the control page read-WRITE (ShmSegment.cpp:283 and :346 both call Map(false); the readOnly parameter at ShmSegment.h:64 has no true caller). A client that stores a huge appliedSeq into the shared page makes the SERVER abort here - a peer-written byte reaching a Fatal that was written as a self-check. | the Fatal itself, but it is aimed at our own bug, not at the peer | cp | **claim-false** — Both roles write cursors into the SAME page: RingControl is one 4096-byte object (static_assert at Ring.h:150), so the row's natural_carrier - 'map the control page read-only on the side that does not |
|
||||
| A7-9 | p6-must-handle | Four SEG_EVENT decode Fatals: the client aborts on a malformed reverse-channel record | MobileGL/MG_Remote/Client/ClientSession.cpp:268-370 (DrainEventRing): :277 corrupt record stream, :290 kEventBufferWriteback head->Size vs tail, :316 kEventGpuWritten RangeCount vs tail, :362 kEventGlError MessageBytes / missing NUL | Correct as written - these are real peer gates. What changes is the consequence: a server that dies mid-record now kills the app's GL thread with an abort instead of latching the context lost. | the four checks themselves, all named | dl | |
|
||||
| A7-10 | already-handled | Nine decoder honesty Fatals on peer blobrefs and spans - the densest peer-reachable cluster in the tree | MobileGL/MG_Remote/Wire/PipeWireCodec.cpp:455-514 (CheckBlobIsHonest, aborts at :466 :474 :504 :512), :516-523 (RequireDeclaredBlob, :521), :543-565 (CheckHostSpanIsHonest+segments, :562), :1498-1521 (ApplyChecked's tail cross-check, :1520), :1799 (CreateShaderState.Spirv declared), :2074 (ResourceSubData union box) | nothing breaks - this is the part of the census that is already right. It is the bulk evidence that the funnel is a rename: every one is `if (bad) { MGLOG_F(...); std::abort(); }` inside a void or continuing function. | the checks themselves | dl | |
|
||||
| A7-11 | p6-must-handle | PipeApplier peer-record Fatals: Present.FrameSerial, ApplierReset.ContextSerial, ObjectDeath.Handle/.Kind, the two sampler-window checks | MobileGL/MG_Remote/Server/PipeApplier.cpp:325-334 (OnPresent, FrameSerial 0 under run-ahead), :1144-1157 (OnApplierReset, ContextSerial), :1168-1183 (OnObjectDeath, null handle and Kind >= KindCount), :550-572 (CheckUnitWindows, both arms) | All six are exactly the shape a merely-unusual peer produces - a restarted client whose reset count disagrees, a present serial of 0 from a peer built before P5e. Each is a remote kill of the server. | the checks themselves, all named ProtocolCorruption | dl | |
|
||||
| A7-12 | already-handled | ServerLoop::DrainRing aborts on a corrupt SEG_CMD record header - the canonical peer gate | MobileGL/MG_Remote/Server/ServerLoop.cpp:617-626 (ServerLoop::DrainRing), detection at MobileGL/MG_Remote/Transport/Ring.cpp:246-262 (RingConsumer::Pop sets *outCorrupt and returns false, no abort) | nothing breaks. Note the good split already present: the TRANSPORT returns a flag, the SESSION decides to die. That is the shape the funnel wants everywhere. | Ring.cpp:251-253's bounds test | dl | |
|
||||
| A7-13 | p6-must-handle | Wire SurfaceOp validation aborts on the server: an ANativeWindow*, a CAMetalLayer*, an unknown wire kind, an out-of-range windowBackend tag, an undispatchable op | MobileGL/MG_Remote/Protocol/SurfaceOpCodec.cpp:197-218 (ServerApplyWireSurfaceOp); MobileGL/MG_Remote/Server/ServerLoop.cpp:864-871 (WindowBackendFromFrameValue), :1053-1057 (ApplySurfaceControlFrame's unknown-kind tail) | Under spawn the same frame arrives from the peer's flatbuffer, so ServerLoop.cpp:860-863's premise ('an out-of-range tag is a memory-corruption shape, not bad input') is false and the comment must be corrected in the same change. WindowBackendFromFrameValue also falls through to a cast of an out-of-range enum if the Fatal ever returns. | the three checks, all named | sm | |
|
||||
| A7-14 | p6-must-handle | Handshake aborts on both sides: FatalAbiMismatch on a peer's Hello / Welcome | MobileGL/MG_Remote/Server/ServerSession.cpp:92-108 (FatalAbiMismatch), called at :471-477 (protocol version) and :479-482 (struct fingerprint); MobileGL/MG_Remote/Client/ClientSession.cpp:83-92, called at :566-568 | A mismatched or hostile peer kills the other by sending a Hello/Welcome. Note the refusal the review points at is real and eight lines away: ServerSession.cpp:456-466 already answers MOBILEGL_ERR_PROTOCOL_MISMATCH for a malformed frame without aborting. Also: both FatalAbiMismatch calls fall through into Accept()/Start() continuing, so a returning Fail would mount shared memory for an ABI-mismatched peer. | the fingerprint comparison itself | so | |
|
||||
| A7-15 | p6-must-handle | Reply-path aborts on the client: the server's status byte and reply size can kill the app | MobileGL/MG_Remote/Client/ClientSession.cpp:1104-1110 (ReplyMissing), :1121-1127 (ReplyTooLarge); MobileGL/MG_Remote/Client/EmitTables.cpp:883-909 (RequireReadbackReplyComplete, four arms at :887 :894 :898 :907); MobileGL/MG_Remote/Client/WireTables.cpp:441-446 and :487-493 and :500-505 | A peer that posts status 2, a short OK payload, or a slot whose header stamps the wrong seq turns a glReadPixels into an abort. The client-side read already refuses an over-cap header.Size by returning false (ReplySlot.h:295-302), which is the non-abort shape to copy. | ReplySlot.h:295-302 bounds header.Size before the memcpy at :314 | dl | |
|
||||
| A7-16 | p6-must-handle | Four timeout/credit aborts on the client: a peer that simply stops is indistinguishable from a wedge, and the answer is abort | MobileGL/MG_Remote/Client/ClientSession.cpp:1071-1078 (BarrierTimeout), :1206-1214 (forced run-ahead wait), :1271-1279 (PresentCreditTimeout), :911-916 (RetirementWaitFailed, SEG_CMD); and the encoder's twin at MobileGL/MG_Remote/Wire/PipeWireCodec.cpp:921-928 (RetirementWaitFailed, SEG_STAGE) | A server process that is merely slow, swapped out or SIGSTOPped kills the client after kBarrierTimeoutMs. Under spawn 'the server is gone' becomes an ordinary event (SIGKILL, OOM-kill, a crash) and it must latch, not abort - this is precisely the S2 gate the review re-aims at P6.5. | the bounded wait itself | P6.5 | **line-does-not-resolve** — protocol.fbs:254. Trivial, but the item's own doc_drift section corrects a fourteen-line drift in P6-CONTRACT-DRAFT.md for this same enum, so the census should not introduce a one-line one of its own. |
|
||||
| A7-17 | later-stage | SEG_EVENT overflow policy: the server parks 30 s on a client's bell and then aborts | MobileGL/MG_Remote/Server/ServerSession.cpp:212-263 (ReserveEventOrBlock): :218 non-run-ahead immediate Fatal, :230 record too big for the ring, :244-251 the 30 s wait Fatal, :259-262 the emptied-ring Fatal; constant kEventBacklogWaitMs at :210 | A guest that simply never calls Drained() parks the host's renderer for 30 s and then kills it. The review names this; it is real and the 30 s constant is the whole of the policy. | kEventBacklogWaitMs = 30000 (ServerSession.cpp:210) - bounded, but bounded at a number that is already a hosting outage | Ph | **line-does-not-resolve** — Use :216. And add the cross-reference the row misses: ReserveEventOrBlock takes `Transport::Doorbell& bell = session.ConsumerDoorbell();` at ServerSession.cpp:234, so the whole SEG_EVENT backpressure |
|
||||
| A7-18 | p6-must-handle | Readback scratch is resized from a peer-supplied w*h*bpp with no absolute cap, and the resize happens BEFORE any size gate | MobileGL/MG_Remote/Server/PipeApplier.cpp:416-441 (ServerVerbSink::OnReadPixels): `tight` computed at :425-430 from info.Box.W/H and the format pair, `m_readbackScratch.resize(tight)` at :439-440 | A record with Box.W = Box.H = 65535 and RGBA8 asks for a 17 GB resize on the apply thread. bad_alloc, uncaught, terminate. The server also then calls PostReply with `tight`, which ReplySlot.h:235-246 would refuse - but only after the allocation. | none on the server side; the only bound is the client's own pre-emit check, which a peer does not have to run | dl | |
|
||||
| A7-19 | p6-must-handle | Program archive decode: a count bounded by remaining BYTES is then multiplied by sizeof(element) | MobileGL/MG_State/GLState/ProgramState/ProgramArtifactsCodec.cpp:166-175 (TakeCount), :216-223 (ArchiveVector arm: `value.resize(count)`); reached from MobileGL/MG_Remote/Wire/PipeWireCodec.cpp:1814-1818 (DecodeProgramArchive on peer-staged bytes) | With SEG_STAGE at its default 32 MiB, a forged archive can declare a count of ~32e6 for a vector whose element is tens of bytes, so the resize is one to two orders of magnitude larger than the archive. The outer-then-inner nesting lets a second such resize live at the same time. The top-level DecodeProgramArchive stage count IS bounded (:335-338, kProgramArchiveMaxStages); the recursive arm is not. | TakeCount's byte bound (real, but pre-multiplication) | dl | |
|
||||
| A7-20 | p6-must-handle | No try/catch anywhere under MG_Remote/, and exceptions are not disabled for MobileGL - every peer-driven allocation ends in an unnamed std::terminate | grep for try/catch over MobileGL/MG_Remote/**.{cpp,h} returns zero handlers (only struct names match); -fno-exceptions appears only under 3rdparty/apitrace. Allocation sites: MobileGL/MG_Pipe/PipeApply.cpp:1567, MobileGL/MG_Remote/Server/PipeApplier.cpp:440, MobileGL/MG_State/GLState/ProgramState/ProgramArtifactsCodec.cpp:220, MobileGL/MG_Remote/Server/StagedShadow.h:72, MobileGL/MG_Remote/Server/StagedTextureStore.h:441, MobileGL/MG_Remote/Server/ServerSession.cpp:68, MobileGL/MG_Remote/Client/ClientSession.cpp:67 | Every resource-exhaustion row above lands as std::terminate with no Fatal line, no family tag and nothing on stderr for a death control to match - the exact failure WireLog.h:35-52 was written to end. | none | dl | **claim-false** — Four verified unbounded peer-driven allocations, not three. Add StagedTextureStore.h:441 as its own blocks-p6 row with the StagedTextureRunImageOffset analysis, and note that StagedTextureStore::Adopt |
|
||||
| A7-21 | later-stage | MOBILEGL_ASSERT compiles out at INFO (the production default), so every assert-only diagnostic on a peer-supplied handle is silent in shipping builds | MobileGL/Defines.h:104-115 (MOBILEGL_ASSERT is live only when MOBILEGL_LOG_ACTIVE_LEVEL <= DEBUG, and expands to TRAP, not abort); peer-reachable users MobileGL/MG_Backend/DirectGLES/SlotTables.h:347-351 and :370-376, MobileGL/MG_Pipe/PipeApply.cpp:1564-1565 | A forged handle takes the silent refusal path. IMPORTANT NEGATIVE RESULT: in SlotTables.h the REFUSAL is a real statement (`return m_nullTwin;` at :351 and :376) outside the assert, and PipeApply.cpp:660-700's resolvers count every refusal into RefusedResourceCalls / RefusedObjectCalls - so the BOUND holds in release and the drop is observable. What is missing is the NAME, not the bound. | the real `return` statements beside the asserts, plus the Refused* counters (PipeApply.cpp:663-700) | Ph | |
|
||||
| A7-22 | p6-must-handle | Staged-shadow coverage Fatals: the server aborts because a record the peer should have sent did not arrive | MobileGL/MG_Remote/Server/StagedShadow.h:99-116 (RequireCoverage), MobileGL/MG_Remote/Server/StagedTextureStore.h:326-345 (RequireLevelBytes) | This is the purest 'merely unusual peer message' case in the census: a peer that draws from a buffer it never filled kills the host renderer with Fatal{StageSnapshotTooNarrow}. RequireLevelBytes returns const Uint8* and its callers dereference it, so it is also an A7-6 site. | the coverage set itself (StagedShadow.h CoverageHas) | dl | |
|
||||
| A7-23 | p6-must-handle | Two abort sites carry NO Fatal{...} family tag, so a verbatim funnel leaves them invisible to the family grep | MobileGL/MG_Remote/Client/PersistentMapTracker.cpp:1040-1060 (AdoptTierIsEmulate: two MGLOG_F lines, neither with a Fatal{} marker, then abort at :1059); MobileGL/MG_Remote/Transport/WireLog.cpp:34-51 (WireLogFatal formats whatever its caller passed - four ReplySlot.h callers do carry Fatal{}, Ring.cpp:370 does too) | nothing breaks, but the review's promise that the funnel keeps the log 'verbatim' means these two arrive at Session::Fail with no FatalCode to map to. AdoptTierIsEmulate is also a value-returning function whose abort is its last statement (A7-6). | none - a CI grep for Fatal{ would not see either | dl | |
|
||||
| A7-24 | already-handled | Control-frame receive resizes a vector from a peer-declared frame length - bounded, and the bound is a named refusal already | MobileGL/MG_Remote/Server/ServerSession.cpp:58-70 (ReceiveEnvelope, `out.resize(size)` at :68) and MobileGL/MG_Remote/Client/ClientSession.cpp:59-69 (:67); the bound is MobileGL/MG_Remote/Transport/Framing.h:48 (kMaxFramePayloadSize = 64 MiB) enforced at :173-179 with a WireLogError and MOBILEGL_ERR_PROTOCOL_MISMATCH, plus the send-side check at :58-63 | Only that 64 MiB per frame is still a large peer-driven allocation on a control plane whose real messages are kilobytes. Not a blocker. Recording it so c6 does not re-derive it: the framing layer is the ONE place in the tree that already does refusal-not-abort on a peer-supplied size, and it is the model for the rest. | Framing.h:173-179, a real named refusal that can go red | dl | |
|
||||
| A7-25 | no-action | MultiDraw arrays resized from a peer-supplied NumDraws - bounded transitively by the record-size cross-check | MobileGL/MG_Remote/Server/PipeApplier.cpp:676-710 (ServerVerbSink::OnDrawVbo's multi-draw arm), resizes at :687 :690 :699 :700 from info.NumDraws; the bound is MobileGL/MG_Remote/Wire/PipeWireCodec.cpp:1511-1521 (size == layout.TotalBytes) composed with MobileGL/MG_Remote/Transport/Ring.cpp:250-262 (size <= available && offset+size <= capacity) | nothing. NumDraws is capped at (SEG_CMD capacity)/sizeof(MGPDrawRange), ~350k at the 8 MiB default, so the four resizes are at most a few MB. A legitimate and useful negative result: the tail cross-check at :1520 is load-bearing as an ALLOCATION bound, not just a decode bound, and anything that weakens it re-arms this row. | PipeWireCodec.cpp:1511-1521, and it can go red for exactly this reason | dl | |
|
||||
| A7-26 | p6-must-handle | Encoder-side Fatals in PipeWireCodec are CLIENT self-checks, not peer-reachable - but two of them wait on a watermark the peer advances | MobileGL/MG_Remote/Wire/PipeWireCodec.cpp:834-928 (PipeWireEncoder::StageAllocate): :865 blob larger than SEG_STAGE at any occupancy (self), :912 and :927 the retirement wait (peer-paced); :973-1145 (EncodeRecord): :1030 record over MaxRecordBytes (self), :1140 a declared CreateShaderState.Spirv run (self) | :912 and :927 are the sites where a server that stops retiring kills the client after 5 s; the other two stay honest self-checks that never involve a peer byte. Worth keeping the distinction in the funnel's detail string so an operator can tell which half was wrong. | the 5000 ms bell wait at :917 | dl | |
|
||||
| A7-27 | no-action | Dead abort site: MGP5_C0_STUB is defined and #undef'd with zero expansions | MobileGL/MG_Remote/Client/ClientSession.cpp:39-44 (definition, abort at :44), :1549 (#undef); no expansion anywhere in the tree | nothing. Recording it so the census count is honest: 92 statements, 91 that can execute. | n/a | dl | |
|
||||
| A7-28 | p6-must-handle | PipeRoute's six reply-mailbox Fatals and PipeApply's three role/emulation Fatals are applier-reachable and must be in the funnel's scope, but are NOT peer-reachable | MobileGL/MG_Pipe/PipeRoute.cpp:85-97 (MGPipePostReply), :105-120 (TakeReply), :137-143 and :148-153 (TakeReplyBool/Pointer), :258-267 (Mono_SetResidualValueState); MobileGL/MG_Pipe/PipeApply.cpp:1353-1360 (MGPipeApplierReset off the apply thread), :3460-3467 (MGPipeUnmigratedEmulation), :63-70 (MGP_TRIP_WIRE_REPORT); MobileGL/MG_Pipe/generated/PipeFilled.inc:412-416 (MGPipeInputPoisonFatal) | Nothing peer-driven. Flagging two things c6 needs: (a) MGP_TRIP_WIRE_REPORT at PipeApply.cpp:63-70 only aborts under MOBILEGL_PIPE_POISON/VERIFY and is MGLOG_E otherwise, so it is a third policy alongside abort and assert and the funnel must not silently absorb it; (b) MGPipeInputPoisonFatal is a second [[noreturn]] funnel in generated code with its own family word. | n/a | c6 | |
|
||||
| A7-29 | p6-must-handle | Both processes will map every segment read-write; the readOnly parameter exists and has no true caller | MobileGL/MG_Remote/Transport/ShmSegment.h:64 (Map(bool readOnly)), :71 (MappedReadOnly); the only two callers are MobileGL/MG_Remote/Transport/ShmSegment.cpp:283 and :346, both Map(false); POSIX prot at ShmSegmentPosix.cpp:159, Win32 at ShmSegmentWin32.cpp:129 | Every shared cursor, watermark and parked flag (Ring.h:102-147) is writable by both sides, which is what makes A7-8 a peer-reachable abort and what turns SEG_REPLY and SEG_EVENT into surfaces the peer can scribble on. The plumbing to do better is already there and unused. | none today | cp | **claim-false** — Restate as: the RO path is built AND tested (FdPassingTest.cpp:116, :188); only the two production call sites pass false, deliberately and with a comment saying why. Then add the contradiction the row |
|
||||
| A7-30 | blocks-p6 | The schema's FatalCode has 7 values; the tree's Fatal{} vocabulary is 30 distinct family words plus 2 untagged sites | MobileGL/MG_Remote/Protocol/protocol.fbs:248-256 (FatalCode: None, ProtocolCorruption, RingOverrun, SegmentMismatch, DeviceLost, ServerCrashed, AbiMismatch) and :258-261 (table Fatal); the only reference to the enum in C++ is MobileGL/MG_Test/Wire/ProtocolSmokeTest.cpp:125 | The funnel's signature Session::Fail(FatalCode, detail) cannot carry today's 30 families in its first argument. Counts by family across the 92 sites: ProtocolCorruption 37, RoleViolation 8, RingOverrun 4, UnmigratedVerb 4, EventRingOverflow 4, NoClientSession 3, ReplyError 3, AbiMismatch 2, RetirementWaitFailed 2, BarrierTimeout 2, StageSnapshotTooNarrow 2, and 20 families with one site each, plus 2 untagged. Only 3 of the 30 map onto an existing FatalCode; SegmentMismatch has zero producers and PipeWireCodec.cpp:495-509 argues explicitly AGAINST minting a family for the case it names. | none - nothing today can notice the mismatch | c6 | **overstated** — Give c6 the family LIST (31 words, reproducible by `grep -rn 'Fatal{[A-Za-z]' MobileGL/MG_Remote/ / grep -v '^[^:]*:[0-9]*: *//' / grep -o 'Fatal{[A-Za-z]*' / sort -u`) and drop the invented per-famil |
|
||||
|
||||
**复审另行指出的遗漏**:
|
||||
- MobileGL/MG_Remote/Server/StagedTextureStore.h:441 - a FOURTH unbounded peer-driven allocation the item lists as an allocation site (in A7-20) but never flags. `shadow.Bytes.resize(needed, 0)` in CopyRunInto, needed = StagedTextureRunImageOffset(upload, regions) + byteSize. The offset function at MobileGL/MG_Remote/Server/StagedTextureStore.h:178-193 guards only `upload.Blob.Size != boxBytes` (:190); with box.D == box.H == 1 that reduces to Blob.Size == box.W * texelBytes and leaves box.Z, box.Y, regions[0].SrcSliceStride and SrcRowStride entirely free. Returned offset at :192-193. Reached from MobileGL/MG_Pipe/PipeApply.cpp:1037-1039 and MobileGL/MG_Backend/DirectGLES/Managers.cpp:2738-2740. Deserves its own blocks-p6 row beside A7-2 / A7-18 / A7-19.
|
||||
- MobileGL/MG_Remote/Server/StagedShadow.h:72 - a FIFTH candidate. `if (shadow.Bytes.size() < needed) shadow.Bytes.resize(needed, 0);` with `needed = std::max<SizeT>(width, offset + size)` at :71. Reached through the macro at MobileGL/MG_Backend/DirectGLES/Managers.cpp:1200-1201. MobileGL/MG_Pipe/PipeApply.cpp:707-711 (BufferRangeFault) bounds offset+size against `width`, but nothing I found bounds `width` itself - it is the resource's peer-declared storage. INFERRED, not verified: I did not trace create_resource's width validation to the end, so c6 should resolve this one before acting on it.
|
||||
- MobileGL/MG_Remote/Server/QueryServer.inc:5, :12, :16, :21, :34, :50, :80, :91, :111, :118, :130, :144 - twelve server-side Wire::WireProtocolFatal arms on peer-supplied query records (handle, Kind, lifecycle state, `request.Wait > 1`, `request.Reserved`). Peer-reachable by construction, in the funnel's rename scope, named by no row. A7-3 swallows them in a count that is itself wrong.
|
||||
- MobileGL/MG_Remote/Server/PipeApplier.cpp:104, :111, :116, :121, :132, :144, :155, :168, :209, :239, :255, :349, :354, :359, :618, :745, :1066 - seventeen more server-side funnel Fatals on peer fence / clear / readback / draw / stream-output records. A7-11 covers only six PipeApplier std::abort sites (:333, :1156, :1176, :1182, :562, :571) and none of these seventeen, because the census grepped `std::abort` and these route through Wire::WireProtocolFatal.
|
||||
- MobileGL/MG_Remote/Transport/ReplySlot.h:196, :227, :232, :239 and MobileGL/MG_Remote/Transport/Ring.cpp:370 - the five WireLogFatal call sites. Every one is a death site that carries a Fatal{ tag, and NONE is visible to the `std::abort` grep the whole census is built on. The item's c6 ask #4 asks the right question (count aborts, or Fatal{ tags, or both?) but the item's own answer - 92 statements / 91 reachable - only works for the abort grep. The two greps disagree by far more than the two sites the item names: ~98 extra Fatal{-tagged death sites (93 WireProtocolFatal/At + 5 WireLogFatal) are invisible to it.
|
||||
- NEGATIVE RESULT the item should have recorded, and the direct answer to A7-19's natural_carrier: MobileGL/MG_Remote/CapsCodec.cpp:318 (`count > r.RoomFor(sizeof(Int32))`) and :426 (`extensionCount > r.RoomFor(sizeof(Uint32))`) already do exactly what A7-19 asks ProgramArtifactsCodec to do - bound the count by remaining-bytes-divided-by-element-size BEFORE the resize at :324 and :430. RoomFor is defined at MobileGL/MG_Remote/CapsCodec.cpp:162-164 as `m_left / elementBytes`. This is the in-tree model for the fix and neither A7-19 nor any c6 ask cites it.
|
||||
- NEGATIVE RESULT worth recording so c6 does not re-derive it: MobileGL/MG_Remote/Wire/PipeWireCodec.cpp:1948 `overrideNames.reserve(static_cast<SizeT>(count))` is SAFE. count is `layout.TailBytes[2] / sizeof(MGPProgramStorageOverride)` at :1947 - a division, not a multiplication - and TailBytes is bound by the tail cross-check at :1511-1521. Same shape as A7-25's MultiDraw negative result, same load-bearing guard.
|
||||
- The design contradiction behind A7-29 and c6 ask #6: MobileGL/MG_Remote/Transport/ShmSegment.h:62-63 states the peer gets SEG_CMD read-only on the server side, but the RingControl page lives inside SEG_CMD (MobileGL/MG_Remote/Transport/SessionRings.h:165) and the server writes four of the five watermarks into it (SessionRings.h:439, Ring.cpp:593, :637, :645). The header's stated P6 design cannot be implemented as written. Neither A7-8 nor A7-29 notices, and c6 ask #6 asks the question in a form that presumes the design works.
|
||||
|
||||
---
|
||||
|
||||
## a6.8 窗口句柄与分片
|
||||
**小结**:PART A: there are exactly FOUR store statements to `m_windowHandle` in the whole tree (`BackendObject.cpp:475`, `:365`, `:206`, `:207`) and exactly FIVE reads (`BackendObject_DirectGLES.cpp:901`, `:963`, `:964`, `BackendObject_DirectVulkan.cpp:338`, `:343`). The corpus's "SetWindowHandle is the sole injection point" is false in the way the integrator said, but the fix is smaller than the review implies: the only full store, `SetWindowHandle` (`:473-475`), is reached from TWO callers - the wire op (`ServerLoop.cpp:1016`) and `ActivateEGLSurface` (`:283`) - and `ActivateEGLSurface` takes its value from `m_eglSurfaces[surface].Window`, written at exactly one place, `RegisterEGLWindowSurface` (`:232-238`). So a server-owned window needs ONE substitution at `:235`, ONE refusal at `ServerLoop.cpp:1015-1017`, ONE preserve in `ResetEGLRuntimeState` (`:365`), and - the non-obvious fourth - a new dedup key for `BackendObject_DirectGLES.cpp:962-964`, whose `sameHandle` compares the CLIENT's window pointer against the server's latched one and would therefore destroy and rebuild the native context on every `eglCreateWindowSurface`. The `Width`/`Height` writes at `:206-207` clobber nothing today because NOTHING READS THEM: `m_windowHandle.Width`/`.Height` have zero readers at this head. PART B: `resource_subdata`/`buffer_subdata_resident` (buffer ranges), texture levels (three-arm slab walk, not just whole-width), the persistent-map push and `GetTextureImage` all HAVE chunking walks; `create_shader_state`'s reflection+SPIR-V archive, `set_global_constants`' whole default UBO, `set_program_bindings`' three tails, `draw_vbo`'s `MGPDrawRange[NumDraws]` tail and `read_pixels`' single reply slot DO NOT. The corpus's "host index span" is wrong: `kDrawHasUserIndices` has NO producer at this head - the only occurrence in an emitter is the CLEAR at `OwnedDrawInputs.h:51` - so the largest unchunked client->server blob is the program archive and the largest unchunked TAIL is a multi-draw range array. The one thing c6 most needs: a stream link window must be sized against `create_shader_state`'s archive (the only unbounded blob) and `draw_vbo`'s range tail (the only unbounded tail), not against the index span the corpus names.
|
||||
|
||||
复审结论:**sound-with-fixes**(重新解析 31 条,异议 6 条,另指出 6 处遗漏)
|
||||
|
||||
| # | 判定 | 事实 | 站点 | spawn 下如何坏 | 守卫 | 归属 | 复审 |
|
||||
|---|---|---|---|---|---|---|---|
|
||||
| A8-1 | p6-must-handle | `m_windowHandle = handle;` - THE ONLY full store to the window handle in the tree | MobileGL/MG_Backend/BackendObject.cpp:473-475 (BackendObject::SetWindowHandle) | the `void*` is an ANativeWindow*/HWND/XID in the CLIENT process. The server's copy would name client memory. Nothing in the server can dereference it | SurfaceOpCodec.cpp:161 / :202 `Fatal{UnmigratedSurface, "AndroidNativeWindow@P12"}` and :165 / :208 `MetalLayer@P12` - b | cp | |
|
||||
| A8-2 | p6-must-handle | `backend->SetWindowHandle(UnpackWindowHandle(frame))` - the wire seam the corpus calls the SOLE injection point | MobileGL/MG_Remote/Server/ServerLoop.cpp:1015-1017 (ApplySurfaceControlFrame, case SurfaceControlOp::SetWindowHandle); unpacker at :875-882; only poster is ServerLoop.cpp:1173-1178 (ServerSetWindowHandle), whose only caller is MG_Remote/Client/BackendObject_Remote.cpp:215 | the token is a foreign address. It IS a seam a server-owned window must refuse - but deleting it is NOT sufficient, because A8-3 re-injects the same value | WindowBackendFromFrameValue's Fatal{ProtocolCorruption,"SurfaceOp.windowBackend"} (ServerLoop.cpp:864-873) covers a bad | cp | |
|
||||
| A8-3 | blocks-p6 | `SetWindowHandle(surfaceState->Window)` - THE SECOND SEAM the corpus missed | MobileGL/MG_Backend/BackendObject.cpp:282-283 (BackendObject::ActivateEGLSurface, Window arm) | with the server owning its own window, this overwrites the server's latched handle with the client-supplied copy held in m_eglSurfaces, on every activation - including both MakeEGLCurrent activation paths, which have no SetWindowHandle op in front of them at all | none | P12 | **wrong-verdict** — Demote A8-3 to `p6-must-handle` at phase P12, matching A8-4/A8-5/A8-6/A8-7/A8-9/A8-11/A8-15. Reserve `blocks-p6` for the rows that genuinely gate spawn bring-up: A8-13 (the refusal's side of the wire) |
|
||||
| A8-4 | p6-must-handle | `.Window = handle` - the ONLY write to the per-surface copy that A8-3 re-derives from; the smallest latch point | MobileGL/MG_Backend/BackendObject.cpp:232-238 (BackendObject::RegisterEGLWindowSurface); field declared at BackendObject.h:632 | holds the client's window pointer for the life of the surface, so every later activation re-clobbers | RegisterEGLWindowSurface refuses `handle.Backend == Unknown // !handle.Handle` (:227-229) - a null/untagged handle, not | P12 | |
|
||||
| A8-5 | p6-must-handle | MakeEGLCurrent path 1: first activation when no surface is initialised - reaches A8-3 with no SetWindowHandle op in front of it | MobileGL/MG_Backend/BackendObject.cpp:317-322 (`if (!m_eglSurfaceInitialized) { if (draw != read // !ActivateEGLSurface(draw)) ... }`) | a window handle reaches the driver through a path the wire's SetWindowHandle op never touched - so a P12 design that only guards the wire op has a hole here | none | P12 | |
|
||||
| A8-6 | p6-must-handle | MakeEGLCurrent path 2: switching the current surface - the second no-op-free route to A8-3 | MobileGL/MG_Backend/BackendObject.cpp:332 (`if (draw != m_eglSurface && !ActivateEGLSurface(draw))`) | same as A8-5; ActivateEGLSurface's early-out at :278-280 only covers the identical-surface repeat | none | P12 | |
|
||||
| A8-7 | p6-must-handle | `m_windowHandle = {};` - the ZEROING clobber | MobileGL/MG_Backend/BackendObject.cpp:359-367 (ResetEGLRuntimeState), reached from BackendObject.cpp:429 (DestroyPendingEGLSurfaceIfUnused), :461 (ReleaseEGLSurface), :467 (ReleaseEGLResources), BackendObject_DirectGLES.cpp:969-972 (destroy-recreate inside CreateEGLWindowSurface) and :1000-1004 (inside CreateEGLPbufferSurface) | a server-owned window is zeroed by a client-driven release or by a pbuffer create, and the next InitWindowSurface (A8-9/A8-11) then builds on a null window. DirectVulkan's InitWindowSurface names that refusal (`:338-341`); DirectGLES does not check at all | BackendObject_DirectVulkan.cpp:338-341 logs and returns false on a null handle. DirectGLES has no equivalent | P12 | |
|
||||
| A8-8 | later-stage | `m_windowHandle.Width/.Height = width/height` - the geometry writes, and the finding that NOTHING READS THEM | MobileGL/MG_Backend/BackendObject.cpp:205-208 (ResizeEGLWindowSurface, gated on `m_eglSurface == surface`); the surface-state twin at :203-204; reached from EGLImpl.cpp:734, ServerLoop.cpp:922-925, BackendObject_Remote.cpp:234, BackendObject_DirectVulkan.cpp:430 | nothing - these two stores are dead today. They become a clobber only on the day the server owns its own extent, which is exactly P12 | n/a | P12 | |
|
||||
| A8-9 | p6-must-handle | reader 1: `reinterpret_cast<NativeWindowType>(m_windowHandle.Handle)` -> DirectGLES::InitWindowSurface(nativeWindow) | MobileGL/MG_Backend/DirectGLES/BackendObject_DirectGLES.cpp:899-906 | dereferences a client-process ANativeWindow*. No null check and no tag check - a garbage pointer reaches eglCreateWindowSurface | none at this site; only the wire decoder's Fatal (A8-1) | P12 | |
|
||||
| A8-10 | p6-must-handle | reader 2: the `sameHandle` dedup key compares the INCOMING client handle against the latched one - the fourth edit point a server-owned window forces | MobileGL/MG_Backend/DirectGLES/BackendObject_DirectGLES.cpp:962-967, with the destroy-recreate it gates at :969-972 | with the server owning the window these NEVER match, so `sameHandle` is always false and every create runs DestroyEGLContext + ResetEGLRuntimeState - a full native context rebuild per surface create, plus the A8-7 zeroing. The dedup key must become the client's SURFACE token, not the window pointer | none - it degrades silently into a rebuild, which is a performance and lifetime fault, not a refusal | P12 | |
|
||||
| A8-11 | p6-must-handle | reader 3: DirectVulkan's InitWindowSurface null-checks then casts the handle | MobileGL/MG_Backend/DirectVulkan/BackendObject_DirectVulkan.cpp:337-352 | same as A8-9. Note the null check (`:338`) is the ONLY guard of its kind in either backend, and it catches A8-7's zeroing but not a foreign pointer | MGLOG_E + return false at :339-341 | P12 | |
|
||||
| A8-12 | no-action | the CLIENT's own m_windowHandle instance (BackendObject_Remote inherits the base) is WRITE-ONLY | MobileGL/MG_Remote/Client/BackendObject_Remote.cpp:210-226 (CreateEGLWindowSurface calls the base at :225, which reaches BackendObject.cpp:283 -> :475) and :145-150 (InitWindowSurface is a no-op that reads nothing) | nothing. The client's copy is harmless dead state and needs no P6 or P12 work | n/a | P6.5 | |
|
||||
| A8-13 | blocks-p6 | the AndroidNativeWindow@P12 refusal fires in the SERVER process, after the record has crossed; the client emits and the ENCODER does not refuse | encoder: MobileGL/MG_Remote/Protocol/SurfaceOpCodec.cpp:130-136 (EncodeSurfaceOpFrame) + :99-108 (WireWindowKindForWindowBackend maps Android -> AndroidNativeWindow and returns true). decoder refusal: :159-166, :199-213. client emitter with no pre-check: MobileGL/MG_Remote/Client/BackendObject_Remote.cpp:214-216 | on the rooted Redmi the first eglCreateWindowSurface from FCL/Minecraft will `std::abort()` the SERVER process. The CLIENT sees a dead peer / EOF, not a named refusal in its own log. The discipline says 'always a NAMED refusal'; here the name is in the corpse | the Fatal exists (SurfaceOpCodec.cpp:202-206) but is on the wrong side of the wire for diagnosis | c6 | **overstated** — Keep the verdict blocks-p6 - the decision is real and c6 must make it - but restate the mechanism: at b3b9c2ee the wire surface-op codec is reachable only from unit tests, so the Fatal has never run a |
|
||||
| A8-14 | already-handled | the two client-side WindowHandle construction sites and the compile-time backend tag | MobileGL/MG_Impl/EGLImpl/EGLImpl.cpp:135-140 (CreateWindowSurface) and :692-697 (CreatePlatformWindowSurface); DetectWindowBackend at :59-71 | DetectWindowBackend is `#if defined(__ANDROID__)` - it answers for the CLIENT's compile target and is carried as truth about a window the SERVER will try to use. Under spawn both processes are the same build so the tag is right; it is the POINTER beside it that is wrong | the decode-side refusal (A8-13) | P6.5 | |
|
||||
| A8-15 | p6-must-handle | the release paths that reach the zeroing store | MobileGL/MG_Impl/EGLImpl/EGLImpl.cpp:313-315 (DestroySurface -> ReleaseEGLSurface) and :326-329 (Terminate -> ReleaseEGLResources); forwarded at BackendObject_Remote.cpp:300-311; dispatched at ServerLoop.cpp:986-1010 | a client-driven eglTerminate zeroes the server's window handle (A8-7) and tears down the server's context. With a server-owned window whose lifetime is the Service's (P12), the client must not be able to zero it | the blocking-by-contract handshake preserves ORDER, not ownership | P12 | |
|
||||
| B8-1 | already-handled | resource_subdata / buffer_subdata_resident: CHUNKED. The walk cuts at MGPipeStageChunkBytes() = clamp(stage/4, 4096, stage) = 8 MiB by default | MobileGL/MG_Impl/Pipe/PipeFill.cpp:1011-1017 (MGPipeContentChunkCap), :1020-1052, :1054-1085; walk at MobileGL/MG_Impl/Pipe/ResourceTracker.h:250-267; budget at MobileGL/MG_Remote/Client/GpuWritePending.cpp:205-233 | nothing | PipeWireCodec.cpp:855-864 and :918-927 Fatal{RingOverrun, "SEG_STAGE"} as the backstop | P8 | |
|
||||
| B8-2 | already-handled | texture level upload: CHUNKED, and with THREE arms, not just whole-width slabs - depth-slices, then whole-row runs, then sub-row texel runs | MobileGL/MG_Impl/Pipe/TextureEmit.h:446-504 (MGPipeForEachTextureSlab; :472-479 slices, :480-491 rows, :492-503 texels), driven at :1499-1517 | nothing | same SEG_STAGE Fatal | P8 | |
|
||||
| B8-3 | p6-must-handle | the texture walk's SILENT FALLBACK to an uncut whole-level record when the pitch does not tile the level exactly | MobileGL/MG_Impl/Pipe/TextureEmit.h:457-459 (`if (sliceStride * depth != levelBytes) return false;`) and the caller's `if (!split)` arm at :1518-1531 | a level larger than the stage arena that also fails the tiling test falls back to one whole blob and dies at PipeWireCodec.cpp:858 Fatal{RingOverrun,"SEG_STAGE"} with a message that says 'report the record type with no cut' - which is wrong here: the type HAS a cut and declined to use it | the SEG_STAGE Fatal fires, but names the wrong cause. There is no log line at the `return false` itself | P8 | |
|
||||
| B8-4 | p6-must-handle | create_shader_state: NO CHUNKING WALK. The whole LinkArtifacts + SpirvArtifacts archive (up to 6 SPIR-V modules) is staged as ONE blob | MobileGL/MG_Remote/Client/WireTables.cpp:514-559, staged whole at :556 (`record.Reflection = session.Encoder().StageBytes(archive.data(), archive.size())`); catalogue row MobileGL/MG_Pipe/PipeCalls.def:201; payload MobileGL/MG_Pipe/MGPipeTypes.h:610-641 | unchanged mechanically, but it is the LARGEST unbounded client->server blob and therefore the number a stream link window must be sized against. Worst case = sizeof(all six generatedSpirv modules) + the reflection archive; there is no ceiling in the code and no measurement of the distribution (MEASUREMENTS.md:342 says the post-chunking per-blob byte distribution is unmeasured) | PipeWireCodec.cpp:855-864 Fatal{RingOverrun,"SEG_STAGE"} at stage capacity (32 MiB default); WireTables.cpp:552-555 Fata | P8 | **line-does-not-resolve** — Fatal{ArchiveEmpty} is at WireTables.cpp:549-552 (MGLOG_F at :550). The six per-stage blobrefs are MGPipeTypes.h:635 (`MGPBlobRef Spirv[6]; // per stage`), zeroed at WireTables.cpp:555. Note also that |
|
||||
| B8-5 | later-stage | set_global_constants: NO CHUNKING WALK. The whole default uniform block is one blob | MobileGL/MG_Impl/Pipe/ProgramEmit.h:202-241 (size from `program->GetUBOSize()` at :209, routed with that size at :233-234); staged via MobileGL/MG_Remote/Client/WireTables.cpp:221 (MGP_WIRE_BLOB); catalogue MobileGL/MG_Pipe/PipeCalls.def:215; payload MGPipeTypes.h:1092-1099 | unchanged mechanically. Realistic worst case is bounded by what the shader compiler produced for the default block - practically <= 64 KiB (GL_MAX_UNIFORM_BLOCK_SIZE's floor) - so it is far below the program archive and should NOT drive the link window size, contrary to the corpus which names it alongside the index span | the SEG_STAGE Fatal | P8 | |
|
||||
| B8-6 | no-action | set_program_bindings: NO CHUNKING WALK on its three tails; the NAMES are staged one at a time so each name is small, but the three tails are one reservation | MobileGL/MG_Remote/Client/WireTables.cpp:575-625 (per-name StageBytes at :597, the three tails at :611-621, emitted at :622-623); catalogue MobileGL/MG_Pipe/PipeCalls.def:340; header MGPipeTypes.h:1077-1085 | nothing mechanically; the tails are bounded by reflection, not by application data | the record bound, PipeWireCodec.cpp:1019-1031 Fatal{RingOverrun,"<op>"} at MaxRecordBytes (half the SEG_CMD ring, 4 MiB | P8 | |
|
||||
| B8-7 | p6-must-handle | draw_vbo's MGPDrawRange[NumDraws] tail: NO CHUNKING WALK. The largest unbounded TAIL in the catalogue | MobileGL/MG_Remote/Client/EmitTables.cpp:536-545 (`tails[0] = {ranges, numDraws * sizeof(MGPDrawRange)}`); MGPDrawRange is 12 bytes (MGPipeTypes.h:1620-1624); catalogue PipeCalls.def:261 | unchanged mechanically, but this is the ONE hot-path record whose size is application-controlled and unchunked. A glMultiDrawElements with ~350k sub-draws exceeds a default 4 MiB MaxRecordBytes. MEASUREMENTS.md:340 itself flags 'oversized DrawVbo tail' as a named unit refusal and :133 says the index/indirect tails 'still must be recorded' | PipeWireCodec.cpp:1019-1031 Fatal{RingOverrun,"DrawVbo"} - a named refusal, with no cut | P8 | **line-does-not-resolve** — Drop the MEASUREMENTS.md:133 cite - it names nothing. Keep MEASUREMENTS.md:340, which carries the whole load by itself. In the `open` block, the measurement instrument is at EmitTables.cpp:1067-1073 ( |
|
||||
| B8-8 | already-handled | CORRECTION: draw_vbo's host index span (kDrawHasUserIndices MGHostSpan) has NO PRODUCER at this head - the corpus names it as a remaining unchunked type and that is wrong | the only occurrence of kDrawHasUserIndices in any emitter is the CLEAR at MobileGL/MG_Impl/Pipe/OwnedDrawInputs.h:51; client index arrays become owned buffer resources at :46-56 and travel as ordinary chunked resource_subdata. EmitTables.cpp:536-543 only ever fills tails[1] with MGPDrawIndirect. The decode-side path (PipeWireCodec.cpp:2157-2178, :565-585) is live but unreachable | nothing - there are no host spans on the wire at all (kCapNeedsHostIndexBytes/kCapNeedsHostUboBytes are 0 for the whole of P5 by ruling, MG_Backend/Init.cpp:171-173) | CheckHostSpanIsHonest's four arms (PipeWireCodec.cpp:542-563) including the segment-range arm, plus CheckDrawUserIndices | P8 | |
|
||||
| B8-9 | already-handled | set_shader_buffers' OPTIONAL second host-span tail: no producer | MobileGL/MG_Remote/Client/WireTables.cpp:227-232 (the generic MGP_WIRE_TAIL carries the FIRST tail only, and says so); the bit that would ask for it is kCapNeedsHostUboBytes, never published (MG_Backend/Init.cpp:171-173, :184) | nothing | the cap-bit ruling | P7 | |
|
||||
| B8-10 | no-action | the six structurally bounded blobs with no chunking walk and no need for one | MobileGL/MG_Pipe/PipeCalls.def:187 CreateRenderState (RenderStateParameters chunk bytes, <= 1168 B - MGPipeTypes.h:471-478), :190 CreateVertexElements (MGPVertexAttribWire[<=32] + binding points - :522-532), :197 CreateSamplerState (SamplerParameters POD - :539), :205 SetDynamicState (dynamic chunks of the same 1168 B, staged OPTIONALLY - WireTables.cpp:255-268), :224 SetResidualValueState (MGL_RESIDUAL_BLOCK_SIZE == 8 - MGPipeTypes.h:1185-1197), :297 SetStorageBlockBinding (one NUL-terminated block name) | nothing | the SEG_STAGE Fatal as a backstop | P8 | **line-does-not-resolve** — Cite MG_Pipe/MGPipeValueTypes.h:660 for the 1168-byte bound (or MGPipeRenderStateSpans.h:36 for the span layout); MGPipeTypes.h:471-478 only establishes the 48-byte record. Downgrade the '<=32' attrib |
|
||||
| B8-11 | p6-must-handle | server->client bulk: read_pixels is UNCHUNKED (one SEG_REPLY slot); get_texture_image IS chunked; buffer writeback IS chunked | read_pixels: MobileGL/MG_Remote/Transport/ReplySlot.h:171-207 (RequireReadPixelsFits -> Fatal{ReplyTooLarge}), slot cap = ReplyBytes/SlotCount = 16 MiB/8 = 2 MiB (SessionRings.h:91-97, kDefaultReplySlotCount = ReplySlot.h:105), emitter check at EmitTables.cpp:955. get_texture_image: MobileGL/MG_Remote/Client/TextureReadbackEmit.inc:84-95 slices at session.MaxReplyBytes(). buffer writeback: MobileGL/MG_Remote/Client/GpuWritePending.cpp:189-203 slices at EventRingCapacity/4 (64 KiB by default) | a full-HD or 4K glReadPixels exceeds 2 MiB and Fatal{ReplyTooLarge} fires at the CLIENT before emission - a named refusal, correct, but a hard functional ceiling on the Redmi (1080p RGBA8 = 8.3 MB). The refusal text says this is 'a P6 debt (chunked readback), not a bigger pool' | Fatal{ReplyTooLarge} at ReplySlot.h:196 and the last-line-of-defence in ClientSession.cpp:1119-1126 | P9 | |
|
||||
| B8-12 | already-handled | the persistent-map push is chunked twice: at the block granularity, then at the content cap | MobileGL/MG_Remote/Client/PersistentMapTracker.cpp:523 (block bytes = MG_Config::Ipc.PersistentBlockKb * 1024, default 64 KiB) -> :735 PushMappedSpanBlock -> MobileGL/MG_State/GLState/BufferState/BufferObject.cpp:456-486 -> NotifySubData -> the chunked MGPipeEmitResourceSubData | nothing | both walks | P11 | |
|
||||
| B8-13 | already-handled | get_caps' two blobrefs do not ride a record at all; the caps snapshot crosses the control plane as a bounded RLE table | MobileGL/MG_Remote/CapsCodec.cpp:178-248 (EncodeFormatCapabilities, RLE over kFormatCapabilityTargetCount x kFormatCapabilityFormatCount cells declared at MG_Backend/BackendObject.h:102-103); PipeCalls.def:154 carries kHasBlob but the row is answered by CapsSnapshot, not by a record (ServerLoop.cpp:1017-1030, ROADMAP.md:126) | nothing about its SIZE. ROADMAP.md:126 notes it still owes a server->client carrier RULE - it may not be squeezed into SEG_STAGE - and under spawn it already crosses as a control frame, which is that rule | the ABI fingerprint assertion (ServerSession.cpp:91-108 FatalAbiMismatch) | cp | |
|
||||
| B8-14 | blocks-p6 | what bounds an ANNOUNCED segment size today: ShmSegment::Adopt's fstat check, which is skippable and has no upper bound | MobileGL/MG_Remote/Transport/ShmSegmentPosix.cpp:120-141 | the guard is `if (::fstat(fd,&st) == 0 && st.st_size > 0 && st.st_size < size) refuse`. If fstat FAILS, or st_size is 0, the announced size is TRUSTED and Map() mmaps that many bytes - a read past the real end is SIGBUS, not a named refusal. There is also NO UPPER bound: a peer announcing 4 GiB with a 4 GiB memfd is adopted and mapped | MOBILEGL_ERR_INVALID_ARGUMENT with a log line at :129-133 - only in the three-way-true case | so | |
|
||||
| B8-15 | blocks-p6 | the Welcome geometry cross-check has NO spawn counterpart: it compares against an in-process ServerSession | MobileGL/MG_Remote/Client/ClientSession.cpp:574-593 (`agrees()` compares welcome->cmdRing()->sizeBytes() against server.Shm().AnnouncedSize(slot), where `server` is Server::ServerSessionInstance() obtained at :534 in the same process) | there is no ServerSession object in the client process, so this whole block must be replaced. Its comment at :570-573 says the cross-check exists precisely so 'the assertion that would otherwise first run in P6' is not first exercised on the expensive day - but what it asserts (server-announced == server-mapped) is trivially true and is NOT the assertion spawn needs, which is 'announced <= what I am willing to map' | MOBILEGL_ERR_PROTOCOL_MISMATCH + Stop() at :590-593 | so | |
|
||||
| B8-16 | blocks-p6 | CORRECTION: MOBILEGL_IPC_RING_MB / _STAGE_MB ceilings are 1024 / 4096 MiB as claimed, but they are consumed in the SERVER process, not the client | ceilings: MobileGL/ConfigLoader.cpp:363-364 (`QueryEnvUint32("MOBILEGL_IPC_RING_MB", 8, 1, 1024)`, `QueryEnvUint32("MOBILEGL_IPC_STAGE_MB", 32, 1, 4096)`). consumption: MobileGL/MG_Remote/Server/ServerSession.cpp:120-129 (SizesFromConfig) applied at :442-445. ownership: MobileGL/MG_Remote/Transport/SessionRings.h:126-131 ('WHO CREATES THEM: the SERVER') | the CHILD's env decides. P6-CONTRACT-DRAFT.md:69-70 says 'every role-selecting MOBILEGL_IPC_* removed from the child's envp' - if the scrub is by prefix, the child falls back to 8/32 MiB while the client was launched with e.g. STAGE_MB=256, silently. ServerSession.cpp:113-119 is a written-down precedent for exactly this class of bug ('a knob that REPORTS a value it does not use is worse'). The chunking budget itself stays correct because ClientSession::StageCapacityBytes() (ClientSession.cpp:1479) reads the ATTACHED segment, not the client's own config | none - there is no cross-check that the client's requested sizes and the server's applied sizes agree, and no log line n | sm | |
|
||||
|
||||
**复审另行指出的遗漏**:
|
||||
- MobileGL/MG_Backend/DirectGLES/BackendObject_DirectGLES.cpp:955-960 - the DirectGLES backend's own named refusal on the INCOMING WindowHandle (`handle.Backend` allow-list of Android/X11/MetalLayer/Win32, plus `!handle.Handle`), MGLOG_E at :958 and `return false` at :959. It sits four lines above the `sameHandle` dedup key A8-10 names (:962-967) and A8-10 never mentions it. It matters for c6_ask #2 and #4: under P12 option (b) - substitute the server's window once at RegisterEGLWindowSurface (BackendObject.cpp:235) - this guard still inspects the CLIENT's handle, so a P12 design that stops shipping a client window handle at all makes this arm refuse every create unless it is re-keyed or moved.
|
||||
- MobileGL/MG_Backend/DirectVulkan/BackendObject_DirectVulkan.cpp:415-419 - the DirectVulkan twin of the same incoming-handle refusal (MGLOG_E at :417), which runs BEFORE the RegisterEGLWindowSurface call at :421. A8-4 cites the enclosing :409-422 as 'registers WITHOUT activating' but never names the guard inside it, so an integrator reading A8-4 alone would not know that Magma's create path has a second client-handle gate ahead of the latch point the audit recommends substituting at.
|
||||
- MobileGL/MG_Backend/BackendObject.cpp:180 (`m_eglDisplay = dpy;`) and :469 (`m_eglDisplay = EGL_NO_DISPLAY;`), field declared at MG_Backend/BackendObject.h:649 - one line below m_windowHandle at :648. This is the EGLDisplay twin of the whole A-family and PART A never mentions it. I checked it: the client's EGLDisplay is latched in the server's backend and is NEVER dereferenced - the only uses are equality comparisons (InitializeEGLDisplay :175, MakeEGLCurrent :315, SwapEGLBuffers :385) - exactly the write-only shape A8-12 found on the client's own m_windowHandle. That is a POSITIVE finding c6 needs: of the EGL handles the server backend latches, the window is the only one that must migrate under P12, and the audit's claim to have covered the family is incomplete without saying so.
|
||||
- MobileGL/MG_Pipe/PipeCalls.def:207, :210, :211, :212, :214, :216 - six kVarTail catalogue rows (SetVertexBuffers, SetSamplerViews, BindSamplerStates, SetShaderImages, SetStreamOutputTargets, SetVertexAttribDefaults) that PART B never examines, although the item's stated scope is 'every record type with no chunking walk'. None has one. B8-10 enumerates only the kHasBlob rows and B8-6/B8-7 only two tails, so six of the catalogue's ten tail-bearing rows go unnamed. I checked each: all carry the bounded `Start, Count` binding-range shape (MGPipeTypes.h:868-869 MGPVertexBuffers, :916-917 MGPSamplerViews, :923-924 MGPSamplerStates, :940 MGPShaderImages, :1029 MGPStreamOutputTargets, :1125 MGPVertexAttribDefaults) and are bounded by GL binding-point limits, so every verdict is no-action - but the enumeration as written is not the exhaustive sweep the summary claims, and c6 should not read 'the only unbounded tail is draw_vbo's' as having been proved across all ten.
|
||||
- MobileGL/MG_Pipe/PipeCalls.def:227 - ResourceSubData carries `kHasBlob|kVarTail|kReplySlot`, and B8-1 covers only the blob half. Its var tail is MGPSubRegion[], sized from the dirty-rect count at MG_Impl/Pipe/TextureEmit.h:1506 (`m_regions.assign(std::max<SizeT>(rectCount, 1), MGPSubRegion{})`) and :1525-1527, and critically the slab walk does NOT cut it: each slab piece re-derives up to rectCount regions (TextureEmit.h:1506-1509), so the region tail rides every piece uncut. I chased the bound and it holds - MipmapStorage::kMaxDirtyRects = 96 at MG_State/GLState/TextureState/MipmapStorage.h:111, enforced at MipmapStorage.cpp:399 and read with that cap at TextureEmit.h:1421-1425 - so this is a no-action. But B8-2 as written would let an integrator conclude the texture path is fully cut when one of its two carriers is not cut at all and is bounded only by a constant in another subsystem.
|
||||
- MobileGL/MG_Remote/Client/PersistentMapTracker.cpp:850 - a SECOND `buffer.PushMappedSpanBlock(...)` call site. B8-12 names only :735. Both funnel into MG_State/GLState/BufferState/BufferObject.cpp:456 -> NotifySubData -> the chunked MGPipeEmitResourceSubData, so the already-handled verdict is unchanged, but the row's 'the persistent-map push' is two producers, not one, and a c6 reader auditing that path would miss one of them.
|
||||
@@ -0,0 +1,270 @@
|
||||
# a6-audit-v1 — spawn 之前,进程/角色边界还差什么
|
||||
|
||||
> 只读静态审计,头 `b3b9c2ee`(`git rev-parse HEAD`,2026-09-21)。无 git 变更。
|
||||
> 八项中的第 5 项(能否不链 `MG_Impl`)是唯一的实验,单独成篇:[`a6-link-experiment.md`](a6-link-experiment.md)。
|
||||
> 全部 198 行逐条清单、复审异议与遗漏补充:[`a6-audit-rows.md`](a6-audit-rows.md)。
|
||||
> 形状照 [`../p5c/p5c-audit-v1.md`](../p5c/p5c-audit-v1.md)。
|
||||
>
|
||||
> 方法:七项各由一个审计 agent 读树产出,再由一个对抗复审 agent **逐条重新解析 `file:line`** 并反向找遗漏。
|
||||
> 198 行里复审对 65 行提出异议,本文只采用**存活的**结论;被判为假的行保留在逐行清单里,标着为什么假。
|
||||
|
||||
---
|
||||
|
||||
## 0 一句话
|
||||
|
||||
**P6 的传输那一半比计划以为的少(fc/fs 确实做完了),进程/角色那一半比计划以为的多得多。**
|
||||
|
||||
P6-SPAWN-PLAN 与 P6-CONTRACT-DRAFT 有**四处陈述在树上是假的**(§2),
|
||||
其中两处(device-lost 闩锁"已实现"、`cp` "只剩传输")各自欠着一个完整的包。
|
||||
而真正的头号发现是:**`spawn` 今天在代码里根本不是一个可观察的状态**,
|
||||
所以计划里"子进程强制 monolith"这条反递归规则,**执行它就等于让 server 进程整体选中前端臂**。
|
||||
|
||||
---
|
||||
|
||||
## 1 头号发现:`Transport` 这一个 bit 同时回答三个问题,而 spawn 让它们分家
|
||||
|
||||
### 1.1 `spawn` 现在连一个可观察的值都不是
|
||||
|
||||
`ConfigLoader.cpp:339-346` 精确识别 `spawn` / `unix:` / `pipe:`,然后写
|
||||
|
||||
```cpp
|
||||
MG_Config::Transport = MG_Config::TransportMode::Monolith;
|
||||
```
|
||||
|
||||
并记一行"P5 不实现,退回 monolith"。**于是"子进程被强制成 monolith"和"父进程解析失败退回 monolith"是同一个状态**,
|
||||
`ConfigLoader.cpp` 那条具名拒绝**证伪不了自己**——它落在与 server 静息态相同的值上。
|
||||
|
||||
### 1.2 `Transport != Monolith` 有 238 处,它选的是**server 臂**
|
||||
|
||||
复审精确确认了 238 这个数(`MG_Config::Transport` 的非测试 grep 行数,含 `TransportMode` / `TransportEndpoint` 后缀),
|
||||
分布 155 `MG_Backend` / 35 `MG_Impl` / 21 `MG_Remote` / 12 `MG_Pipe` / 8 `MG_State` / 7 Config;
|
||||
其中 **12 行是注释**,所以活代码是 226 行。
|
||||
|
||||
**`ARCHITECTURE.md:488` 的"子进程强制 monolith"如果按字面实现,148 行 `MG_Backend` 活代码会一起翻到前端臂**——
|
||||
在那个唯一没有前端的进程里。最锋利的一处是 `PipeInputs::IsLive()`(`MG_Impl/Pipe/PipeFill.cpp:2135`):
|
||||
强制 monolith 后它读 `MG_State::pGLContext`,在 server 进程里是 null,于是 **58 个 `MGB_CTX_LIVE` 守卫全部答"不活"**。
|
||||
|
||||
> **给 c6 的第一个决定**:反递归的保险丝与 server 角色选择器**必须是两个独立的事实**。
|
||||
> 推荐形状:子进程保持 `Transport == Spawn`(于是 238 个站点原样选中 server 臂),
|
||||
> 反递归另设 `Dial = No`。这样 c6 只需重写真正在问 Dial / Role 的那一小撮,而不是 238 个。
|
||||
|
||||
### 1.3 三个谓词覆盖得了,但审计找出了**第四、第五个问题**和一个命名冲突
|
||||
|
||||
复审推翻了我在 `P6-ENDSTATE-REVIEW.md` 里的一个判断(见 §5),并给出更准的分类:
|
||||
|
||||
| 模式 | 活代码行 | 应成为 |
|
||||
|---|---:|---|
|
||||
| 后端体内的 server 臂测试(DirectGLES 98 + DirectVulkan 50) | 148 | `MGPipeServerArm()` |
|
||||
| client 臂 emit/decide 测试(`MG_Impl` 34 + `MG_State` 6) | ~48 | `MGPipeSplitActive()` |
|
||||
| 四个 `SlotCaps` 宏 | 4 | 局部性,见下 |
|
||||
| 共享 applier / codec 里角色中立的测试 | ~11 | `MGPipeSplitActive()`,**最机械的一组** |
|
||||
| Dial / bring-up(`Init.cpp` + `ClientSession`) | 3+ | `MGPipeShouldDial()`,**P6 的真活在这里** |
|
||||
|
||||
**没被三个谓词覆盖的**:
|
||||
|
||||
- **第四个问题——"对端会话是否活着"**。已有两处在用:`PipeApply.cpp:1355`(`ClientSession::Active() != nullptr`)、
|
||||
`ClientSession.cpp:1320`/`:1383`(`ClientSessionInstance().Started()`)。在 server-only 进程里前者**永远是 null**,
|
||||
于是 `MGPipeApplierReset` 的第二层角色守卫**在最需要它的进程里永远武装不起来**。
|
||||
- **第五个问题——"两个角色是否共用一份存储对象"**,即已经存在的 `MGPipeRoleSplitActive()`(`PipeInputs.cpp:292`)。
|
||||
spawn 下它结构上恒为假(两个地址空间),但它的定义是 `Ipc.RoleSplitState && Transport != Monolith`,**默认关**。
|
||||
- **局部性**:"后端在不在本进程"。`SlotCaps.h:116`/`:133-136` 今天拼成 `Transport == Monolith && slot != nullptr`。
|
||||
- **命名冲突**:我提议的 `MGPipeSplitActive()` 与既有的 `MGPipeRoleSplitActive()` 只差一个词、含义严格更窄。**先改名,再引入。**
|
||||
|
||||
### 1.4 一条 G1 约束
|
||||
|
||||
非 disaggregated 构建里 `Transport` 是 `inline constexpr Monolith`(`Config.h:566`),
|
||||
所以三个新谓词**都必须 `inline constexpr` 可折叠为 false**,否则 pull 构建的 `.text` 恒等门会红。
|
||||
|
||||
---
|
||||
|
||||
## 2 计划文档里在树上为假的四处
|
||||
|
||||
### 2.1 `cp` **不是**"只剩传输"——`InitCapabilities` 的**请求**没有 wire 形式
|
||||
|
||||
`P6-CONTRACT-DRAFT:98-101` 与 `P6-SPAWN-PLAN:76` 都写 "`InitCapabilities` 由 `CapsSnapshot` 回答"。
|
||||
**答案**是 `CapsSnapshot` 没错,但**请求**不是:`BackendObject_Remote.cpp:126` 有活的 client 调用者,
|
||||
而 `EncodeSurfaceOpFrame` 对这个 kind **具名拒绝**(`SurfaceOpCodec.cpp:119-122`,`InprocOnlyOpOnTheWire`)。
|
||||
spawn 的 client **问不出来**。这是 `cp` 必须先决的第一件事,不是传输。
|
||||
|
||||
### 2.2 device-lost 闩锁不存在(上轮已发现,a6 逐条坐实)
|
||||
|
||||
复审确认:`FatalCode::DeviceLost`/`ServerCrashed` 零 producer 零 consumer;
|
||||
`glGetGraphicsResetStatus` 恒返回 `GL_NO_ERROR`;`MOBILEGL_IPC_RESPAWN`/`IDLE_EXIT_S` 除 `Config.h:466` 一句注释外无人解析。
|
||||
另外 `P6-CONTRACT-DRAFT:46` 引 `protocol.fbs:234-242` 指 `FatalCode`,实际在 `:248-256`——**漂了十四行**。
|
||||
|
||||
### 2.3 "server 不链 `MG_Impl`"——`PipeInputs.h:281` 与 `ARCHITECTURE.md:9` 都在断言,都是假的
|
||||
|
||||
见 [`a6-link-experiment.md`](a6-link-experiment.md):184 个符号。
|
||||
a6.2 独立给出同一结论的另一半证据:`PipeInputs::IsLive()` 与另外 **17 个 `PipeInputs::` 成员定义**编译在 `MG_Impl/Pipe/PipeFill.cpp`,
|
||||
**两个角色拒绝助手**(`MGPipeRefuseAllocatorFromApplyThread` / `...FrontendKeyedRegistryFromApplyThread`)编译在 `MG_Impl/Pipe/SlotAllocator.cpp:29-57`。
|
||||
**把 `MG_Impl` 从 server 镜像里拿掉,等于把守卫一起拿掉。**
|
||||
|
||||
### 2.4 大量行号漂移
|
||||
|
||||
`ClientSession.cpp:468`→`:482`;`BackendObject.h:561-566`(`WindowHandle`)→`:579-584`;
|
||||
`protocol.fbs:186-196`(`SurfaceOp`)→`:194-210`;`ServerSession.cpp:670-690`(门铃访问器)→`:709-740`;
|
||||
`ConfigLoader.cpp:310-348`→`:319-351`;`CONTRACT-P5C.md:262`、`PipeInputs.h:854` 的计数(379→383)等。
|
||||
`c6` 落地时逐条重解,`check_doc_citations.py` 应当覆盖这些。
|
||||
|
||||
---
|
||||
|
||||
## 3 阻塞 spawn 的硬发现(复审存活)
|
||||
|
||||
### 3.1 apply 线程会在弹出第一条记录之前 abort
|
||||
|
||||
`ServerSession::ConsumerDoorbell()`(`ServerSession.cpp:709-724`)对**任何非 `InProcess` 的 role**
|
||||
`Fatal{UnmigratedVerb}` + `std::abort()`,`ProducerDoorbell()` 同(`:727-739`)。
|
||||
`ApplyThreadMain` 无条件调用它。注释自陈这是按**契约 §3.9** 把访问器留在 session 上"好让它保持一处 switch"。
|
||||
|
||||
> 这正好是 `P6-ENDSTATE-REVIEW` 里 `lk` 包要**废止**而不是**修补**的那条裁定——两条独立得出的结论对上了。
|
||||
|
||||
### 3.2 控制面在 server 侧**没有读者**,在 client 侧**被丢弃**
|
||||
|
||||
- apply 线程的 `ready` 谓词只有三项(stop / `ControlIsPending()` / `cmdHead != LocalTail()`)——
|
||||
**控制 socket 不在其中**(`ServerLoop.cpp:398-402`)。socket 上到达的 `SurfaceOp` **没有任何人读**。
|
||||
- client 的控制泵只消费 `CapsSnapshot`,其余(含 `SurfaceOp`/`SurfaceReply`)记一条 WARN 然后 `continue`
|
||||
(`ClientSession.cpp:1425-1432`,注释写明"是 P6 的")。
|
||||
|
||||
### 3.3 发帖方的等待**没有期限**
|
||||
|
||||
`m_controlDone.wait(lock, pred)`(`ServerLoop.cpp:724`)是无期限谓词等待。
|
||||
对照 ring 侧有 `kBarrierTimeoutMs`。**被 SIGSTOP / Android freezer 冻住的 server 不产生 EOF 也不产生 reply**,
|
||||
GL 线程就永远卡在 `eglMakeCurrent` 里,没有任何诊断。这正是 `P6-SPAWN-PLAN §4` 点名却没落到代码上的那个状态。
|
||||
|
||||
### 3.4 `SurfaceReply` 装不下一个 `MobileGLResult`
|
||||
|
||||
wire 只有 `{seq, ok, eglMajor, eglMinor}`(`protocol.fbs:212-218`),`ServerApplyWireSurfaceOp` 的 rc 被丢掉。
|
||||
**client 因此分不清"server 半路死了"和"一次合法的拒绝"**,也就无法决定是武装 device-lost 闩锁还是返回 `EGL_FALSE`。
|
||||
|
||||
### 3.5 `seq == 0` 被静默重编号,且 reply 不做关联
|
||||
|
||||
`RunSurfaceControlFrame`(`ServerLoop.cpp:659-662`)在 `frame.seq == 0` 时自己铸号,
|
||||
而它自己的注释说 wire 请求必须保留 client 的号。`DecodeWireSurfaceReply`(`SurfaceOpCodec.cpp:190-195`)
|
||||
把 seq/ok 直接覆盖进交给它的帧并返回 void——**不做任何关联**。
|
||||
|
||||
### 3.6 server 进程只能有一套 EGL,且第二套**不具名**
|
||||
|
||||
`g_Display` / `g_Context` / `g_Surface` / `g_Config` 是每进程 file-static,
|
||||
`InitDisplayAndContext` 开头无条件 `DestroyEGLContext()`(`DirectGLES.cpp:16012-16013`),
|
||||
而后者最后一步是 `eglTerminate(g_Display)`——**进程级** EGL 拆除。
|
||||
一 guest 一进程因此不是设计偏好,是**今天唯一成立的形状**;而它现在**没有具名拒绝**。
|
||||
`ServerSession::Accept` 的同对象臂返回 `MOBILEGL_ERR_INVALID_ARGUMENT` **且没有任何日志**(`ServerSession.cpp:425`)。
|
||||
|
||||
### 3.7 角色守卫在 server 进程里**武装不起来**
|
||||
|
||||
| 守卫 | 武装条件 | 在 server-only 进程里 |
|
||||
|---|---|---|
|
||||
| `MGPipeApplierReset` 第二层 | `ClientSession::Active() != nullptr`(`PipeApply.cpp:1353-1355`) | 恒 null → **永远不武装** |
|
||||
| `MGPipeServerBlockNoteIdentity` | `MGPipeRoleSplitActive()`(默认关) | 早退 → `ContextIdentity()` 恒 nullptr |
|
||||
| `CountBarrierPull` 无条件 Fatal 臂 | 同上 | 关 |
|
||||
| 两个 `RefuseFromApplyThread` | `ServerLoop::OnApplyThread()` | 与"是 server 进程"**不再重合** |
|
||||
|
||||
**其中 `ContextIdentity()` 恒 nullptr 是一个会崩的洞**:`DirectGLES.cpp:199-213` 的 fb-slot memo 以
|
||||
`MGB_CTX_IDENTITY` 做裸指针比较、无世代,nullptr 会被读成**缓存命中**,
|
||||
于是第一次调用就用上一个没初始化的槽——`PipeInputs.h:878-884` 的注释说这里本该是一条具名 Fatal。
|
||||
|
||||
---
|
||||
|
||||
## 4 a6.7:abort 普查——funnel 是改名还是重设计
|
||||
|
||||
`MG_Remote` 下 `std::abort()` 共 **94 处 grep 命中,其中 2 处在注释里,实际 92 个站点**
|
||||
(上轮我写的 93 少一个,更正见 §5)。
|
||||
|
||||
**家族分布**:`Fatal{}` 词汇有 **30 个不同的家族词**(`ProtocolCorruption` 37、`RoleViolation` 8、`RingOverrun` 4、
|
||||
`UnmigratedVerb` 4、`EventRingOverflow` 4、`NoClientSession` 3、`ReplyError` 3 …),
|
||||
而 schema 的 `FatalCode` 只有 **7 个值**(`protocol.fbs:248-256`)。
|
||||
**`Session::Fail(FatalCode, detail)` 的第一个参数装不下今天的 30 个家族**——这是 c6 必须先决的签名问题。
|
||||
|
||||
**两个站点完全没有 `Fatal{` 标记**(`PersistentMapTracker.cpp:1052-1058`、`WireLog.cpp:41-50`),
|
||||
所以"日志逐字不变"这个承诺对它们不成立,家族 grep 也看不见它们。
|
||||
|
||||
**从对端字节可达、且今天会 abort 的无界分配**(三处,`MG_Remote` 下**没有任何 try/catch**):
|
||||
|
||||
| 站点 | 形状 |
|
||||
|---|---|
|
||||
| `PipeApply.cpp:1563-1569` | `MGPipeApplyCreateRenderState` 按对端给的 `Cso.Slot+1` resize,**无槽位上限**;兄弟家族全走 `RecordAt` 的有界路径。`Slot = 0xFFFFFFFE` → 约 1.7 TB |
|
||||
| `PipeApplier.cpp:416-441` | readback scratch 按 `Box.W*Box.H*bpp` resize,**resize 发生在任何尺寸门之前**。65535² RGBA8 → 17 GB |
|
||||
| `ProgramArtifactsCodec.cpp:166-223` | count 只按**剩余字节**设界,然后乘 `sizeof(element)`。32 MiB stage 可伪造出高一两个数量级的 resize |
|
||||
|
||||
---
|
||||
|
||||
## 5 更正我自己上一轮的四处
|
||||
|
||||
复审逐条核了 `P6-ENDSTATE-REVIEW.md`,以下四处我写错了,按树更正:
|
||||
|
||||
1. **`MG_State` 那 8 个站点不是我说的那个形状。** 我写"唯一不按目录成形的一批,同一个函数里同时问两个问题"。
|
||||
实际:8 个里 **2 个是注释**(`BufferObject.cpp:60`、`BufferObject.h:194`),
|
||||
剩下 6 个里 **5 个是单问题的 `SplitActive` 测试**,**只有 1 个**(`MipmapStorage.cpp:55-56`)真的同时问两个。
|
||||
而"同时问两个"的形状**根本不是 `MG_State` 局部的**——它散在 `SlotAllocator.cpp` / `PipeFill.cpp` / `PipeApply.cpp` /
|
||||
`Managers.cpp` / `MG_Remote/Client` 的 **18 个站点**上,而且树里已经有两种拼法。
|
||||
**结论不变**(a6 仍应先分类这一族),**理由和取样对象要换**。
|
||||
2. **abort 数是 92 不是 93**(94 命中减 2 处注释)。
|
||||
3. **`BackendObject.cpp:283` 是一次调用,不是 store**;全树对 `m_windowHandle` 的 store 只有 **4 处**(`:475`、`:365`、`:206`、`:207`),
|
||||
读只有 **5 处**。而且 `.Width` / `.Height` **没有任何读者**,所以 `:206-207` 今天 clobber 不了任何东西。
|
||||
**"两道缝"的结论仍然成立且更精确**:真正的第二道缝是 `ActivateEGLSurface → SetWindowHandle(surfaceState->Window)`,
|
||||
而 `surfaceState->Window` 只在 `RegisterEGLWindowSurface`(`:232-238`)写一处——**那才是最小的 latch 点**。
|
||||
4. **`MGPipeSplitActive()` 这个名字不能直接用**,与既有 `MGPipeRoleSplitActive()` 冲突(§1.3)。
|
||||
|
||||
另有一处我从 P6 文档继承下来的失效引用:`BackendObject.h:561-566` 指 `WindowHandle`,实际在 `:579-584`。
|
||||
|
||||
---
|
||||
|
||||
## 6 a6.8:窗口句柄与分片
|
||||
|
||||
**窗口句柄**(复审给出的精确形状,比我上轮写的更小也更清楚):
|
||||
|
||||
server 端拥有自己的窗口需要**四处**改动,不是一处:
|
||||
(a) `RegisterEGLWindowSurface`(`BackendObject.cpp:232-238`)的一次替换;
|
||||
(b) `ServerLoop.cpp:1015-1017` 的一次拒绝;
|
||||
(c) `ResetEGLRuntimeState`(`:359-367`)的一次保留;
|
||||
(d) **非显然的第四处**——`BackendObject_DirectGLES.cpp:962-967` 的 `sameHandle` 去重键拿 client 的窗口指针比 server latch 的那个,
|
||||
server 拥有窗口后**永不相等**,于是每次 `eglCreateWindowSurface` 都会 `DestroyEGLContext` + `ResetEGLRuntimeState` 重建原生 context。
|
||||
|
||||
**一条 P6 当下就该决的**:`BackendObject_Remote.cpp:214-216` **无条件**发 `SetWindowHandle`,
|
||||
而 `AndroidNativeWindow@P12` 的拒绝在 **server 进程**里 abort。
|
||||
所以在这台 Redmi 上跑 FCL/Minecraft,**第一次 `eglCreateWindowSurface` 就会把 server 进程 abort 掉**,
|
||||
client 只看到对端死了。要么 P6 在 **client 侧**镜像这条拒绝,要么接受这个形状并写进契约。
|
||||
|
||||
**分片**:`resource_subdata` / `buffer_subdata_resident`(buffer 范围)、纹理层级(**三臂**走查:整深度切片、整行 run、
|
||||
以及**次行 texel run**——比文档说的"整宽 slab"更细)、持久映射推送、`GetTextureImage` **都有**走查。
|
||||
**没有走查的**按大小排:program archive(`WireTables.cpp:556`,唯一无界 blob)、
|
||||
`draw_vbo` 的 `NumDraws * 12` range 尾(`EmitTables.cpp:536`,唯一无界尾)。
|
||||
**ROADMAP 开放问题 11 点名的"宿主索引 span"在本头没有 producer**——`kDrawHasUserIndices` 唯一出现是
|
||||
`OwnedDrawInputs.h:51` 的清零,client 索引已经变成 owned buffer 资源。**这条可以从开放问题里划掉。**
|
||||
|
||||
> 所以 stream 链路窗口应当对着 **program archive** 和 **draw_vbo range 尾**定尺,不是对着 `set_global_constants`。
|
||||
|
||||
---
|
||||
|
||||
## 7 给 c6 的决定清单(按该先决的顺序)
|
||||
|
||||
1. **`Transport` 在 spawn 的 server 进程里读作什么?** 148 行 `MG_Backend` 活代码和两个 Fatal 角色守卫一起翻在这一个 bit 上。
|
||||
推荐:子进程保持 `Spawn`,反递归另设 `Dial = No`。
|
||||
2. **`Session::Fail` 的第一个参数**:留 7 值 wire 枚举,还是引入一个更宽的内部家族枚举?今天有 30 个家族词。
|
||||
3. **`InitCapabilities` 请求的 wire 形式**(§2.1)。这是 `cp` 的前置,不是传输。
|
||||
4. **控制 socket 谁读**:新 `mgl-srv-io` 线程投进现有单槽邮箱(`ServerLoop.cpp:673-727` 一行不改),
|
||||
还是给 apply 线程的 `ready` 谓词加第四项?
|
||||
5. **控制回复等待的期限与名字**(§3.3)。
|
||||
6. **`SurfaceReply` 是否追加一个 result 字段**(§3.4)。
|
||||
7. **spawn 下谁铸 `seq`,`seq == 0` 在 wire 上什么意思**(§3.5)。
|
||||
8. **窗口种类:黑名单还是白名单**;以及 `WindowKind::None` 带非零 token 今天被接受这件事怎么办。
|
||||
9. **一 server 进程一 guest 写进契约,第二个具名拒绝**(§3.6)。
|
||||
10. **四个角色守卫的重新武装条件**(§3.7)——尤其 `ContextIdentity()` 恒 nullptr 那个会崩的洞。
|
||||
11. **三处无界分配的绝对上限**(§4),以及 `MG_Remote` 下要不要有 try/catch。
|
||||
12. **server 镜像链不链 `MG_Impl`**:按 a6 的答案,P6 链,契约把 `PipeInputs.h:281` 与 `ARCHITECTURE.md:9` 的断言改成记账。
|
||||
13. **`MGPipeRoleSplitActive()` 先改名**,再引入 `MGPipeSplitActive()`。
|
||||
14. **三个新谓词必须 `inline constexpr` 可折叠**(§1.4),否则 G1 红。
|
||||
|
||||
---
|
||||
|
||||
## 8 未决(读不出来的)
|
||||
|
||||
1. **spawn 的 server 进程里谁跑 applier、在哪个线程上。** 十余处 `ServerLoop::OnApplyThread()` 守卫全部取决于它;
|
||||
若 `ServerMain` 在主线程驱动 applier 而不经 `ServerLoop::Start`,`g_applyThreadKey` 恒 0,**全部守卫静默失效**。
|
||||
2. **server 的退出原语是 `_exit` 还是 `exit`。** 它决定 `g_processTeardown`(`Managers.cpp:188-197`)是否被置位,
|
||||
进而决定七个 twin 析构是走早退还是真调进驱动。
|
||||
3. **握手要不要断言子系统掩码。** `EsprytSlotTablesEnabled()` 每进程从 `Features.PipePush` latch,
|
||||
两个进程各自解析自己的环境,而 `ARCHITECTURE.md:488` 的 envp 剔除清单**不含** `MOBILEGL_PIPE_*`。
|
||||
4. **P6 是否把任何段映射成只读。** `ShmSegment::Adopt` 已有 `Map(bool readOnly)`,但两个调用点都传 `false`。
|
||||
5. **`DualBlockScenario.cpp:69-73` 断言 `serverIdentity != nullptr`**,这是一个进程内事实;
|
||||
而 G2/G14 要求 `integration-spawn` 与 `integration-split` 逐名相同。这条用例在 spawn 下怎么办。
|
||||
@@ -0,0 +1,249 @@
|
||||
# a6 item 5 - link experiment raw data
|
||||
|
||||
Head b3b9c2ee. Build: cmake -DMOBILEGL_BUILD_DISAGGREGATED=ON -DMOBILEGL_BUILD_DISAGGREGATED_INPROC=ON -DMOBILEGL_PIPE_PUSH=ON, Release, clang 22.1.6, target MobileGL.
|
||||
Method: nm over the per-object output of the single MobileGL target. No CMake edit (there is no module target to edit - see the report).
|
||||
|
||||
SERVER set = MG_Backend/** + MG_Pipe/** + MG_Remote/{Transport,Protocol,Wire,Server}/** + MG_Remote/CapsCodec.o (45 objects)
|
||||
FRONTEND set = MG_Impl/** + MG_State/** + MG_Remote/Client/** (71 objects)
|
||||
SHARED set = MG_Util/** + Init/GlobalObjects/ConfigLoader (87 objects)
|
||||
|
||||
server undefined symbols total : 1486
|
||||
not satisfied by SERVER or SHARED : 552
|
||||
OF WHICH defined by FRONTEND : 184
|
||||
|
||||
## The 184, demangled, grouped by defining file
|
||||
|
||||
### MG_Impl/GLImpl/Framebuffer/GL_Framebuffer.cpp.o
|
||||
- MobileGL::MG_Impl::GLImpl::FramebufferImpl::pDefaultFramebufferInfo
|
||||
|
||||
### MG_Impl/GLImpl/Texture/GL_Texture.cpp.o
|
||||
- MobileGL::MG_Impl::GLImpl::CopyTextureImageToClientOrPBO_State(std::shared_ptr<MobileGL::MG_State::GLState::ITextureObject> const&, MobileGL::TextureUploadTarget, int, unsigned int, unsigned int, int, void*, char const*)
|
||||
|
||||
### MG_Impl/Pipe/PipeFill.cpp.o
|
||||
- MobileGL::MG_Pipe::MGPipeNoteAggregate(MobileGL::MG_Pipe::MGPipeAggregate)
|
||||
- MobileGL::MG_Pipe::PipeInputs::GetBufferBindingPointCount(MobileGL::BufferTarget) const
|
||||
- MobileGL::MG_Pipe::PipeInputs::GetProgramObject(unsigned int)
|
||||
- MobileGL::MG_Pipe::PipeInputs::GetTextureObject(unsigned int)
|
||||
- MobileGL::MG_Pipe::PipeInputs::HasOpenTransformFeedbackSpan(unsigned long) const
|
||||
- MobileGL::MG_Pipe::PipeInputs::InvalidateCompileEnv()
|
||||
- MobileGL::MG_Pipe::PipeInputs::IsLive() const
|
||||
- MobileGL::MG_Pipe::PipeInputs::RecordError(MobileGL::ErrorCode, std::unique_ptr<MobileGL::ErrorInfo, std::default_delete<MobileGL::ErrorInfo> >)
|
||||
- MobileGL::MG_Pipe::PipeInputs::ValidateProgramName(unsigned int) const
|
||||
|
||||
### MG_Impl/Pipe/SlotAllocator.cpp.o
|
||||
- MobileGL::MG_Pipe::MGPipeApplierIsUnbarrieredApply()
|
||||
- MobileGL::MG_Pipe::MGPipeRefuseAllocatorFromApplyThread(char const*)
|
||||
- MobileGL::MG_Pipe::MGPipeRefuseFrontendKeyedRegistryFromApplyThread(char const*)
|
||||
- MobileGL::MG_Pipe::MGPipeSlotAllocator::Acquire(MobileGL::MG_Pipe::MGPipeKind, unsigned long)
|
||||
- MobileGL::MG_Pipe::MGPipeSlotAllocator::FindByLifetimeId(MobileGL::MG_Pipe::MGPipeKind, unsigned long) const
|
||||
- MobileGL::MG_Pipe::MGPipeSlotAllocator::Free(MobileGL::MG_Pipe::MGPipeKind, MobileGL::MG_Pipe::MGPipeHandle)
|
||||
- MobileGL::MG_Pipe::MGPipeSlots()
|
||||
|
||||
### MG_Remote/Client/BackendObject_Remote.cpp.o
|
||||
- MobileGL::MG_Remote::Client::BackendObject_Remote::BackendObject_Remote()
|
||||
|
||||
### MG_Remote/Client/ClientSession.cpp.o
|
||||
- MobileGL::MG_Remote::Client::ClientSession::Active()
|
||||
- MobileGL::MG_Remote::Client::ClientSessionInstance()
|
||||
- MobileGL::MG_Remote::Client::ClientSession::NoteApplyThreadEnteredApplier()
|
||||
- MobileGL::MG_Remote::Client::ClientSession::NoteApplyThreadLeftApplier()
|
||||
- MobileGL::MG_Remote::Client::ClientSession::Start(MobileGL::MG_Config::TransportMode, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
|
||||
- MobileGL::MG_Remote::Client::ClientSession::Stop()
|
||||
|
||||
### MG_Remote/Client/PersistentMapTracker.cpp.o
|
||||
- MobileGL::MG_Remote::Client::AdoptTierIsEmulate()
|
||||
|
||||
### MG_Remote/Client/WireTables.cpp.o
|
||||
- MobileGL::MG_Remote::Client::EmitObjectDeathRecord(MobileGL::MG_Pipe::MGPipeKind, unsigned long)
|
||||
|
||||
### MG_State/GLState/BufferState/BufferObject.cpp.o
|
||||
- MobileGL::MG_State::GLState::BufferObject::DownloadSubData(void*, unsigned long, unsigned long) const
|
||||
- MobileGL::MG_State::GLState::BufferObject::EnsureGpuResidentStorage()
|
||||
- MobileGL::MG_State::GLState::BufferObject::GetBackendResource() const
|
||||
- MobileGL::MG_State::GLState::BufferObject::GetChangeSerial() const
|
||||
- MobileGL::MG_State::GLState::BufferObject::GetExternalIndex() const
|
||||
- MobileGL::MG_State::GLState::BufferObject::GetSize() const
|
||||
- MobileGL::MG_State::GLState::BufferObject::GetUsage() const
|
||||
- MobileGL::MG_State::GLState::BufferObject::HasDefinedContent() const
|
||||
- MobileGL::MG_State::GLState::BufferObject::IsBackendPersistentMapped() const
|
||||
- MobileGL::MG_State::GLState::BufferObject::IsMapped() const
|
||||
- MobileGL::MG_State::GLState::BufferObject::MappedData() const
|
||||
- MobileGL::MG_State::GLState::BufferObject::MarkGpuWritten()
|
||||
- MobileGL::MG_State::GLState::BufferObject::SetBackendResource(std::shared_ptr<MobileGL::MG_State::GLState::BackendBufferResource>)
|
||||
- MobileGL::MG_State::GLState::BufferObject::SyncGpuWrites()
|
||||
- MobileGL::MG_State::GLState::BufferObject::SyncPersistentMappedRange()
|
||||
- MobileGL::MG_State::GLState::BufferObject::WritebackFromBackend(MobileGL::DataPtr, unsigned long)
|
||||
- MobileGL::MG_State::GLState::GetBufferBackendOps()
|
||||
- MobileGL::MG_State::GLState::SetBufferBackendOps(MobileGL::MG_State::GLState::BufferBackendOps const*)
|
||||
|
||||
### MG_State/GLState/Core.cpp.o
|
||||
- MobileGL::MG_State::GLState::ClassifyVertexAttribType(unsigned int)
|
||||
|
||||
### MG_State/GLState/FramebufferState/FramebufferObject.cpp.o
|
||||
- MobileGL::MG_State::GLState::FramebufferAttachmentObject::GetRenderbuffer() const
|
||||
- MobileGL::MG_State::GLState::FramebufferAttachmentObject::GetSize() const
|
||||
- MobileGL::MG_State::GLState::FramebufferAttachmentObject::GetTexture() const
|
||||
- MobileGL::MG_State::GLState::FramebufferAttachmentObject::GetTextureLayer() const
|
||||
- MobileGL::MG_State::GLState::FramebufferAttachmentObject::GetTextureLevel() const
|
||||
- MobileGL::MG_State::GLState::FramebufferAttachmentObject::GetTextureUploadTarget() const
|
||||
- MobileGL::MG_State::GLState::FramebufferAttachmentObject::IsComplete() const
|
||||
- MobileGL::MG_State::GLState::FramebufferAttachmentObject::IsEmpty() const
|
||||
- MobileGL::MG_State::GLState::FramebufferAttachmentObject::IsLayered() const
|
||||
- MobileGL::MG_State::GLState::FramebufferAttachmentObject::IsRenderbuffer() const
|
||||
- MobileGL::MG_State::GLState::FramebufferAttachmentObject::IsTexture() const
|
||||
- MobileGL::MG_State::GLState::FramebufferAttachmentObject::IsValid() const
|
||||
- MobileGL::MG_State::GLState::FramebufferObject::GetAllAttachmentObjects() const
|
||||
- MobileGL::MG_State::GLState::FramebufferObject::GetAttachment(MobileGL::FramebufferAttachmentType) const
|
||||
- MobileGL::MG_State::GLState::FramebufferObject::GetDrawBuffers() const
|
||||
- MobileGL::MG_State::GLState::FramebufferObject::GetExternalIndex() const
|
||||
|
||||
### MG_State/GLState/ProgramState/ProgramArtifactsCodec.cpp.o
|
||||
- MobileGL::MG_State::GLState::DecodeProgramArchive(unsigned char const*, unsigned long, MobileGL::MG_State::GLState::ProgramArchive&)
|
||||
|
||||
### MG_State/GLState/ProgramState/ProgramObject.cpp.o
|
||||
- MobileGL::MG_State::GLState::ProgramObject::AllocateLifetimeId()
|
||||
- MobileGL::MG_State::GLState::ProgramObject::AttachShader(std::shared_ptr<MobileGL::MG_State::GLState::ShaderObject> const&)
|
||||
- MobileGL::MG_State::GLState::ProgramObject::JoinPendingLink() const
|
||||
- MobileGL::MG_State::GLState::ProgramObject::JoinPendingSpirv() const
|
||||
- MobileGL::MG_State::GLState::ProgramObject::Link(bool)
|
||||
- MobileGL::MG_State::GLState::ProgramObject::~ProgramObject()
|
||||
|
||||
### MG_State/GLState/ProgramState/ShaderObject.cpp.o
|
||||
- MobileGL::MG_State::GLState::ShaderObject::Compile()
|
||||
- MobileGL::MG_State::GLState::ShaderObject::DropCompileNode() const
|
||||
- MobileGL::MG_State::GLState::ShaderObject::JoinPendingCompile() const
|
||||
- MobileGL::MG_State::GLState::ShaderObject::ReleaseCompileNode()
|
||||
- MobileGL::MG_State::GLState::ShaderObject::SetShaderSource(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)
|
||||
|
||||
### MG_State/GLState/RenderbufferState/RenderbufferObject.cpp.o
|
||||
- MobileGL::MG_State::GLState::RenderbufferObject::GetExternalIndex() const
|
||||
- MobileGL::MG_State::GLState::RenderbufferObject::GetHeight() const
|
||||
- MobileGL::MG_State::GLState::RenderbufferObject::GetInternalFormat() const
|
||||
- MobileGL::MG_State::GLState::RenderbufferObject::GetSamples() const
|
||||
- MobileGL::MG_State::GLState::RenderbufferObject::GetWidth() const
|
||||
- MobileGL::MG_State::GLState::RenderbufferObject::IsAllocated() const
|
||||
|
||||
### MG_State/GLState/SamplerState/SamplerObject.cpp.o
|
||||
- MobileGL::MG_State::GLState::SamplerObject::GetAllSamplerParameters() const
|
||||
- MobileGL::MG_State::GLState::SamplerObject::GetBorderColor() const
|
||||
- MobileGL::MG_State::GLState::SamplerObject::GetBorderColorI() const
|
||||
- MobileGL::MG_State::GLState::SamplerObject::GetBorderColorUI() const
|
||||
- MobileGL::MG_State::GLState::SamplerObject::GetCompareMode() const
|
||||
- MobileGL::MG_State::GLState::SamplerObject::GetExternalIndex() const
|
||||
- MobileGL::MG_State::GLState::SamplerObject::GetLifetimeId() const
|
||||
- MobileGL::MG_State::GLState::SamplerObject::GetLodBias() const
|
||||
- MobileGL::MG_State::GLState::SamplerObject::GetMagFilter() const
|
||||
- MobileGL::MG_State::GLState::SamplerObject::GetMaxAnisotropy() const
|
||||
- MobileGL::MG_State::GLState::SamplerObject::GetMaxLod() const
|
||||
- MobileGL::MG_State::GLState::SamplerObject::GetMinFilter() const
|
||||
- MobileGL::MG_State::GLState::SamplerObject::GetMinLod() const
|
||||
- MobileGL::MG_State::GLState::SamplerObject::GetMipmapMode() const
|
||||
- MobileGL::MG_State::GLState::SamplerObject::GetSamplerCompareFunc() const
|
||||
- MobileGL::MG_State::GLState::SamplerObject::GetVersion() const
|
||||
- MobileGL::MG_State::GLState::SamplerObject::GetWrapR() const
|
||||
- MobileGL::MG_State::GLState::SamplerObject::GetWrapS() const
|
||||
- MobileGL::MG_State::GLState::SamplerObject::GetWrapT() const
|
||||
- MobileGL::MG_State::GLState::SamplerObject::~SamplerObject()
|
||||
- MobileGL::MG_State::GLState::SamplerObject::SamplerObject(unsigned int)
|
||||
- MobileGL::MG_State::GLState::SamplerObject::SetCompareMode(MobileGL::SamplerCompareMode)
|
||||
- MobileGL::MG_State::GLState::SamplerObject::SetLodRange(float, float)
|
||||
- MobileGL::MG_State::GLState::SamplerObject::SetMagFilter(MobileGL::SamplerFilterMode)
|
||||
- MobileGL::MG_State::GLState::SamplerObject::SetMinFilter(MobileGL::SamplerFilterMode)
|
||||
- MobileGL::MG_State::GLState::SamplerObject::SetMipmapMode(MobileGL::SamplerMipmapMode)
|
||||
- MobileGL::MG_State::GLState::SamplerObject::SetSamplerCompareFunc(MobileGL::SamplerCompareFunc)
|
||||
- MobileGL::MG_State::GLState::SamplerObject::SetWrapR(MobileGL::SamplerWrapMode)
|
||||
- MobileGL::MG_State::GLState::SamplerObject::SetWrapS(MobileGL::SamplerWrapMode)
|
||||
- MobileGL::MG_State::GLState::SamplerObject::SetWrapT(MobileGL::SamplerWrapMode)
|
||||
|
||||
### MG_State/GLState/TextureState/MipmapStorage.cpp.o
|
||||
- MobileGL::MG_State::GLState::MGPipeTextureLegacyArmScope::~MGPipeTextureLegacyArmScope()
|
||||
- MobileGL::MG_State::GLState::MGPipeTextureLegacyArmScope::MGPipeTextureLegacyArmScope()
|
||||
|
||||
### MG_State/GLState/TextureState/TextureObject1D.cpp.o
|
||||
- MobileGL::MG_State::GLState::TextureObject1D::TextureObject1D(unsigned int)
|
||||
|
||||
### MG_State/GLState/TextureState/TextureObject2D.cpp.o
|
||||
- MobileGL::MG_State::GLState::TextureObject2D::TextureObject2D(unsigned int)
|
||||
|
||||
### MG_State/GLState/TextureState/TextureObject2DCube.cpp.o
|
||||
- MobileGL::MG_State::GLState::TextureObject2DCube::TextureObject2DCube(unsigned int)
|
||||
|
||||
### MG_State/GLState/TextureState/TextureObject3D.cpp.o
|
||||
- MobileGL::MG_State::GLState::TextureObject3D::TextureObject3D(unsigned int)
|
||||
|
||||
### MG_State/GLState/TextureState/TextureObjectBuffer.cpp.o
|
||||
- MobileGL::MG_State::GLState::TextureObjectBuffer::GetBufferBindingSlot(MobileGL::TextureUploadTarget)
|
||||
|
||||
### MG_State/GLState/TextureState/TextureObject.cpp.o
|
||||
- MobileGL::MG_State::GLState::SamplesAsIncompleteTexture(MobileGL::MG_State::GLState::ITextureObject const*, MobileGL::MG_State::GLState::SamplerObject const*)
|
||||
- MobileGL::MG_State::GLState::TextureObjectBase::GetAllSwizzleParams() const
|
||||
- MobileGL::MG_State::GLState::TextureObjectBase::GetBorderColor() const
|
||||
- MobileGL::MG_State::GLState::TextureObjectBase::GetBorderColorForm() const
|
||||
- MobileGL::MG_State::GLState::TextureObjectBase::GetBorderColorI() const
|
||||
- MobileGL::MG_State::GLState::TextureObjectBase::GetBorderColorUI() const
|
||||
- MobileGL::MG_State::GLState::TextureObjectBase::GetContentVersion() const
|
||||
- MobileGL::MG_State::GLState::TextureObjectBase::GetExternalIndex() const
|
||||
- MobileGL::MG_State::GLState::TextureObjectBase::GetFormat() const
|
||||
- MobileGL::MG_State::GLState::TextureObjectBase::GetImmutableLevels() const
|
||||
- MobileGL::MG_State::GLState::TextureObjectBase::GetLevelRange() const
|
||||
- MobileGL::MG_State::GLState::TextureObjectBase::GetLifetimeId() const
|
||||
- MobileGL::MG_State::GLState::TextureObjectBase::GetSamplerObject() const
|
||||
- MobileGL::MG_State::GLState::TextureObjectBase::GetSamples() const
|
||||
- MobileGL::MG_State::GLState::TextureObjectBase::GetShapeVersion() const
|
||||
- MobileGL::MG_State::GLState::TextureObjectBase::GetSwizzleParam(MobileGL::TextureSwizzleParam) const
|
||||
- MobileGL::MG_State::GLState::TextureObjectBase::GetTarget() const
|
||||
- MobileGL::MG_State::GLState::TextureObjectBase::GetTextureParamsVersion() const
|
||||
- MobileGL::MG_State::GLState::TextureObjectBase::GetViewStorageOwner() const
|
||||
- MobileGL::MG_State::GLState::TextureObjectBase::HasFixedSampleLocations() const
|
||||
- MobileGL::MG_State::GLState::TextureObjectBase::IsImmutable() const
|
||||
- MobileGL::MG_State::GLState::TextureObjectBase::IsMipmapCompleteForFilterCached(bool) const
|
||||
- MobileGL::MG_State::GLState::TextureObjectBase::PipePublishParams()
|
||||
- MobileGL::MG_State::GLState::TextureObjectBase::SetBaseLevel(unsigned int)
|
||||
- MobileGL::MG_State::GLState::TextureObjectBase::SetBorderColorI(MobileGL::Vec4<int> const&)
|
||||
- MobileGL::MG_State::GLState::TextureObjectBase::SetBorderColor(MobileGL::Vec4<float> const&)
|
||||
- MobileGL::MG_State::GLState::TextureObjectBase::SetBorderColorUI(MobileGL::Vec4<unsigned int> const&)
|
||||
- MobileGL::MG_State::GLState::TextureObjectBase::SetFixedSampleLocations(bool)
|
||||
- MobileGL::MG_State::GLState::TextureObjectBase::SetImmutableLevels(unsigned int)
|
||||
- MobileGL::MG_State::GLState::TextureObjectBase::SetInternalFormat(MobileGL::TextureInternalFormat)
|
||||
- MobileGL::MG_State::GLState::TextureObjectBase::SetMaxLevel(unsigned int)
|
||||
- MobileGL::MG_State::GLState::TextureObjectBase::SetSamples(int)
|
||||
- MobileGL::MG_State::GLState::TextureObjectBase::SetSwizzleParam(MobileGL::TextureSwizzleParam, MobileGL::TextureSwizzleParam)
|
||||
- MobileGL::MG_State::GLState::TextureObjectBase::SetSwizzleParamRGBA(MobileGL::Vec4<MobileGL::TextureSwizzleParam> const&)
|
||||
- MobileGL::MG_State::GLState::TextureObjectBase::~TextureObjectBase()
|
||||
- MobileGL::MG_State::GLState::TextureObjectBase::TextureObjectBase(MobileGL::TextureTarget, unsigned int)
|
||||
- MobileGL::MG_State::GLState::TextureObjectWithOneMipmap::AllocateStorage(MobileGL::TextureUploadTarget, unsigned int, MobileGL::MG_State::GLState::MipmapInput)
|
||||
- MobileGL::MG_State::GLState::TextureObjectWithOneMipmap::GetBaseSize() const
|
||||
- MobileGL::MG_State::GLState::TextureObjectWithOneMipmap::GetMipmapByteSize(MobileGL::TextureUploadTarget, unsigned int) const
|
||||
- MobileGL::MG_State::GLState::TextureObjectWithOneMipmap::GetMipmapCompressedByteSize(MobileGL::TextureUploadTarget, unsigned int) const
|
||||
- MobileGL::MG_State::GLState::TextureObjectWithOneMipmap::GetMipmapCompressedFormat(MobileGL::TextureUploadTarget, unsigned int) const
|
||||
- MobileGL::MG_State::GLState::TextureObjectWithOneMipmap::GetMipmapLevelCount() const
|
||||
- MobileGL::MG_State::GLState::TextureObjectWithOneMipmap::GetMipmapRequestedCompressedFormat(MobileGL::TextureUploadTarget, unsigned int) const
|
||||
- MobileGL::MG_State::GLState::TextureObjectWithOneMipmap::GetMipmapTexelSize(MobileGL::TextureUploadTarget, unsigned int) const
|
||||
- MobileGL::MG_State::GLState::TextureObjectWithOneMipmap::GetStorageDirtyRects(MobileGL::TextureUploadTarget, unsigned int, MobileGL::MG_State::GLState::MipmapDirtyRegion*, unsigned long) const
|
||||
- MobileGL::MG_State::GLState::TextureObjectWithOneMipmap::GetStorageDirtyRegion(MobileGL::TextureUploadTarget, unsigned int) const
|
||||
- MobileGL::MG_State::GLState::TextureObjectWithOneMipmap::IsComplete() const
|
||||
- MobileGL::MG_State::GLState::TextureObjectWithOneMipmap::IsStorageDirty(MobileGL::TextureUploadTarget, unsigned int) const
|
||||
- MobileGL::MG_State::GLState::TextureObjectWithOneMipmap::MapMipmapCompressedImage(MobileGL::TextureUploadTarget, unsigned int) const
|
||||
- MobileGL::MG_State::GLState::TextureObjectWithOneMipmap::MapMipmapData(MobileGL::TextureUploadTarget, unsigned int)
|
||||
- MobileGL::MG_State::GLState::TextureObjectWithOneMipmap::MarkStorageDirty(MobileGL::TextureUploadTarget, unsigned int, bool)
|
||||
- MobileGL::MG_State::GLState::TextureObjectWithOneMipmap::MarkStorageDirtyRegion(MobileGL::TextureUploadTarget, unsigned int, MobileGL::Vec3<int>, MobileGL::Vec3<int>)
|
||||
- MobileGL::MG_State::GLState::TextureObjectWithOneMipmap::SetMipmapCompressedImage(MobileGL::TextureUploadTarget, unsigned int, unsigned int, void const*, unsigned long)
|
||||
- MobileGL::MG_State::GLState::TextureObjectWithOneMipmap::SetMipmapRequestedCompressedFormat(MobileGL::TextureUploadTarget, unsigned int, unsigned int)
|
||||
- MobileGL::MG_State::GLState::TextureObjectWithOneMipmap::TruncateMipmapLevels(MobileGL::TextureUploadTarget, unsigned int)
|
||||
- MobileGL::MG_State::GLState::TextureObjectWithOneMipmap::UpdateMipmapSubData(MobileGL::TextureUploadTarget, unsigned int, MobileGL::DataPtr)
|
||||
- typeinfo for MobileGL::MG_State::GLState::TextureObjectBase
|
||||
- typeinfo for MobileGL::MG_State::GLState::TextureObjectWithOneMipmap
|
||||
- vtable for MobileGL::MG_State::GLState::TextureObjectWithOneMipmap
|
||||
|
||||
### MG_State/GLState/TextureState/TextureUnit.cpp.o
|
||||
- MobileGL::MG_State::GLState::TextureUnit::GetAllBindingSlots()
|
||||
- MobileGL::MG_State::GLState::TextureUnit::GetBindingSlot(MobileGL::TextureTarget)
|
||||
- MobileGL::MG_State::GLState::TextureUnit::GetSamplerObject() const
|
||||
|
||||
### MG_State/GLState/VertexArrayState/VertexArrayObject.cpp.o
|
||||
- MobileGL::MG_State::GLState::VertexArrayObject::GetAllAttributes() const
|
||||
- MobileGL::MG_State::GLState::VertexArrayObject::GetAllAttributeVersions() const
|
||||
- MobileGL::MG_State::GLState::VertexArrayObject::GetAttribute(unsigned int) const
|
||||
- MobileGL::MG_State::GLState::VertexArrayObject::GetIndexBufferBindingSlot()
|
||||
- MobileGL::MG_State::GLState::VertexArrayObject::GetIndexBufferBindingSlot() const
|
||||
|
||||
@@ -0,0 +1,227 @@
|
||||
# a6 第 5 项:server 能否不链 `MG_Impl`——实验结果
|
||||
|
||||
> 头 `b3b9c2ee`。`P6-SPAWN-PLAN.md` §5 的 a6 第 5 项、`P6-CONTRACT-DRAFT.md` §3.3 都把这条挂着;
|
||||
> `MG_Backend/MGPipe/PipeInputs.h` 与 `P5F-WIRE-COMPLETENESS.md` §1.4 **断言**它成立。
|
||||
> 三个阶段没人试过。这次试了。
|
||||
>
|
||||
> 原始数据(184 个符号逐个按定义文件分组)见 [`a6-link-experiment-data.md`](a6-link-experiment-data.md)。
|
||||
|
||||
## 结论
|
||||
|
||||
**不能。** 今天没有任何一种配置能让 server 镜像不链 `MG_State` / `MG_Impl` / `MG_Remote/Client`。
|
||||
|
||||
而且这个问题**在今天根本不是一个链接行能回答的问题**,这是第一个发现。
|
||||
|
||||
---
|
||||
|
||||
## 1 结构性发现:构建系统里一道缝都没有
|
||||
|
||||
`CMakeLists.txt` 里 `SOURCE_FILES` 是**一张平的源文件列表**(211 个 `.cpp`),
|
||||
`add_library(MobileGL SHARED ${SOURCE_FILES})`(`:695`)与
|
||||
`add_library(MobileGL_s STATIC ${SOURCE_FILES})`(`:762`)都从它构建。
|
||||
|
||||
`MG_Impl` / `MG_State` / `MG_Backend` / `MG_Pipe` / `MG_Remote` 之间**没有任何 target 边界**——
|
||||
没有 object library、没有 static lib、没有 interface target。
|
||||
|
||||
唯一叫 `MobileGLServer` 的 target(`:926`)是 P0 spike 桩:Android-only、默认 OFF、
|
||||
只编 `tools/spikes/server_stub/main.cpp`,**一个 MobileGL 库都不链**。
|
||||
`mobilegl_server_main` 这个符号在整棵树上**不存在**,只存在于 `ARCHITECTURE.md:488-496` 的描述里。
|
||||
|
||||
> 所以"改链接行试一次"这个做法本身不成立:没有可分的 target。
|
||||
> `c6` 必须把"建立模块 target 边界"当成一件**有成本的具名工作**,而不是 `sm` 包里顺手的一行。
|
||||
|
||||
## 2 方法(保持 a6 只读)
|
||||
|
||||
不加 target、不改一行源码。构建 `MobileGL` 单个 target,然后对**逐个 object 文件**做符号闭包:
|
||||
|
||||
```
|
||||
SERVER 集 = MG_Backend/** + MG_Pipe/** + MG_Remote/{Transport,Protocol,Wire,Server}/** + CapsCodec.o (45 个 object)
|
||||
FRONTEND 集 = MG_Impl/** + MG_State/** + MG_Remote/Client/** (71 个 object)
|
||||
SHARED 集 = MG_Util/** + Init/GlobalObjects/ConfigLoader (87 个 object)
|
||||
```
|
||||
|
||||
取 SERVER 集的未定义符号,减去 SERVER 自己定义的,减去 SHARED 定义的,
|
||||
与 FRONTEND 定义的取交集——**这就是一次真链接会报出来的那份未定义符号表**。
|
||||
|
||||
构建:`clang 22.1.6`、Release、`DISAGGREGATED=ON`、`DISAGGREGATED_INPROC=ON`、`PIPE_PUSH=ON`。
|
||||
|
||||
## 3 数字
|
||||
|
||||
| | |
|
||||
|---|---:|
|
||||
| SERVER 集未定义符号总数 | 1531 |
|
||||
| 其中 SERVER + SHARED 自己满足不了的 | 552 |
|
||||
| **其中由 FRONTEND 定义的** | **184** |
|
||||
|
||||
184 个里:
|
||||
|
||||
| 类别 | 数量 |
|
||||
|---|---:|
|
||||
| **真函数调用** | **177** |
|
||||
| 析构函数 | 4 |
|
||||
| typeinfo | 2 |
|
||||
| vtable | 1 |
|
||||
|
||||
**耦合是行为性的,不是类型性的。** 不是"server 持有一个 `SharedPtr<ITextureObject>` 所以需要 vtable",
|
||||
是 server 在**调用前端对象的方法**。
|
||||
|
||||
### 3.1 按定义方
|
||||
|
||||
| 定义模块 | 符号数 |
|
||||
|---|---:|
|
||||
| `MG_State/GLState` | **157** |
|
||||
| `MG_Impl/Pipe`(`PipeFill`、`SlotAllocator`) | 16 |
|
||||
| `MG_Remote/Client` | 9 |
|
||||
| `MG_Impl/GLImpl` | 2 |
|
||||
|
||||
前五个文件:`TextureObject.cpp` 59、`SamplerObject.cpp` 30、`BufferObject.cpp` 18、
|
||||
`FramebufferObject.cpp` 16、`PipeFill.cpp` 9。
|
||||
|
||||
### 3.2 按引用方——**债主是 P7**
|
||||
|
||||
| 引用方 | 符号引用数 |
|
||||
|---|---:|
|
||||
| `DirectVulkan`(Magma) | **227** |
|
||||
| `DirectGLES`(Espryt) | 111 |
|
||||
| `MG_Remote/{Wire,Server}` + `MG_Pipe` | 6 |
|
||||
|
||||
去重后按后端归属:
|
||||
|
||||
| | 符号数 |
|
||||
|---|---:|
|
||||
| **只有 Magma 要** | **101** |
|
||||
| 两个后端都要 | 60 |
|
||||
| 只有 Espryt 要 | 14 |
|
||||
|
||||
单个最大引用方是 `DirectVulkan/Renderer/UniformManager.cpp`(90),其次
|
||||
`VulkanRenderer.cpp`(60)、`DirectGLES/Managers.cpp`(53)、`DirectGLES/DirectGLES.cpp`(51)。
|
||||
|
||||
**这份分布精确地落在路线图已经说没做完的两个阶段上**:P7(Magma 全量迁移)和 P3b/P4b(Espryt 深化)。
|
||||
链接耦合不是一笔新债,它是那两笔旧债在链接器上的影子。
|
||||
|
||||
## 4 这和 "P5c/P5f 已经把跨角色读归零" 矛盾吗?不矛盾
|
||||
|
||||
两句话都成立,因为它们量的不是一回事:
|
||||
|
||||
- P5c / P5f 关掉的是**运行时**跨角色内存访问:`rsp` 逐帧为 0、`BARRIER_PULLED` 分类为 0。
|
||||
- 这次量的是**链接时**符号引用。
|
||||
|
||||
但**这也不只是"死臂的链接残留"**。取样核实过一个站点:
|
||||
|
||||
`DirectVulkan/Renderer/UniformManager.cpp:1039` 一带是
|
||||
|
||||
```cpp
|
||||
const auto& samplerOverride = MGB_CTX->GetTextureUnitObject(unit).GetSamplerObject();
|
||||
const auto* effectiveSampler = samplerOverride ? samplerOverride.get()
|
||||
: texture->GetSamplerObject().get();
|
||||
…effectiveSampler->GetMagFilter() == SamplerFilterMode::Linear…
|
||||
```
|
||||
|
||||
`MGB_CTX` 在 `PIPE_PUSH` 下是 `&gPipeInputs`,所以这是 `PipeInputs::GetTextureUnitObject`——
|
||||
而它在 `MG_Pipe/FieldOwnership.def:33` 被分类为 **FATAL**:
|
||||
|
||||
> `X(GetTextureUnitObject, FATAL, "-", "server reads sampler/view records or verb texture handles; never a client TextureUnit")`
|
||||
|
||||
也就是说:**split 下走到这里是一条具名 Fatal,不是一次错误的读**。P5f 的归零是真的。
|
||||
但"具名拒绝"意味着**这条功能没有迁移**,代码还在、符号还在、链接还需要它。
|
||||
|
||||
所以准确的说法是:
|
||||
|
||||
> 184 个符号是 P5f 那 25 条 FATAL 分类 + 未迁移的对象类字段在链接层面的残留。
|
||||
> 运行时是干净的(要么走记录臂,要么 Fatal);链接时不是,而且**链接时是 server 镜像能不能存在的那个判据**。
|
||||
|
||||
## 5 传输层自己的 6 个——单独拎出来
|
||||
|
||||
其余 178 个是后端的债,这 6 个不是,它们在 `MG_Remote` / `MG_Pipe` 内部:
|
||||
|
||||
| 引用方 | 需要的符号 | 说明 |
|
||||
|---|---|---|
|
||||
| `Server/PipeApplier.cpp` | `Client::ClientSession::NoteApplyThreadEnteredApplier()` / `NoteApplyThreadLeftApplier()` | **server 侧 applier 在调 client 的会话对象**。inproc 下同进程所以成立;spawn 的 server 进程里根本没有 `ClientSession` |
|
||||
| `Server/PipeApplier.cpp` | `MG_Pipe::MGPipeApplierIsUnbarrieredApply()` | 定义在 `MG_Impl/Pipe` |
|
||||
| `Wire/PipeWireCodec.cpp` | `MG_State::GLState::DecodeProgramArchive(...)` | 解码器需要一个住在 `MG_State` 里的解码助手 |
|
||||
| `Wire/PipeWireCodec.cpp`、`MG_Pipe/PipeApply.cpp` | `Client::AdoptTierIsEmulate()` | 采纳档位判据住在 client 侧 |
|
||||
| `MG_Pipe/PipeApply.cpp` | `Client::ClientSession::Active()` | 同上 |
|
||||
|
||||
**这 6 个是 P6 自己的账**,不能推给 P7/P3b/P4b。它们数量小、形状清楚,应当在 `sm` 或 `lk` 里解决:
|
||||
前三个是"把函数搬到正确的模块",后三个是"server 不该问 client 要答案"。
|
||||
|
||||
## 6 给 `c6` 的结论
|
||||
|
||||
1. **契约不能再写 "server 不链 `MG_Impl`"**。`PipeInputs.h` 与 `P5F-WIRE-COMPLETENESS.md` §1.4
|
||||
的断言按今天的树是**假的**,`c6` 要按 `CONTRACT` §3.3 自己写的规矩"做不到就记账"把它记成债。
|
||||
2. **债的归属是 P7(101)+ P3b/P4b(14)+ 两者共有(60)+ P6 自己(6)**,不是一笔含糊的"以后再说"。
|
||||
3. **P6 不需要为此阻塞**。P6 的 server 是 fork 出来的同一个二进制,本来就链着整份库——
|
||||
`ARCHITECTURE.md:496` 的"一份共享库、两个角色"正是这个意思。
|
||||
所以 P6 可以照常推进,但 `c6` 必须明确写下:**P6 的 server 镜像 = 整份 `libMobileGL.so`**,
|
||||
而"一个不含前端的 server 镜像"是 P7 / P3b/P4b 完成之后才谈得上的东西。
|
||||
4. **`c6` 要新增一条具名工作**:建立模块 target 边界(object library 或 static lib)。
|
||||
没有它,这个数字永远只能靠 `nm` 事后量,不能变成一道会变红的门。
|
||||
建议形状:`lk` 包顺带把 `MG_Remote/Transport` 切成自己的 target(它本来就是纯度门 A/B/C 的对象),
|
||||
其余模块边界记成 P13 的账。
|
||||
5. **一道可以现在就立的门**:把本文的 184 记成棘轮,CI 上重算并断言"只减不增"。
|
||||
它能因 P7/P3b/P4b 的真实进展而下降,也能因新写的后端代码又去读前端对象而变红——
|
||||
这正是这个项目要的那种门。
|
||||
|
||||
## 7 附带发现:ABI 指纹的 build stamp 会**静默变成空串**
|
||||
|
||||
这是实验过程中撞出来的,不在 a6 的清单上,但它直接打在 `hs` 包上,而且是个真洞。
|
||||
|
||||
**机制**。`CMakeLists.txt:188-195`:
|
||||
|
||||
```cmake
|
||||
execute_process(
|
||||
COMMAND git rev-parse HEAD
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GIT_COMMIT_HASH_FULL
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
string(SUBSTRING "${GIT_COMMIT_HASH_FULL}" 0 7 GIT_COMMIT_HASH_SHORT)
|
||||
```
|
||||
|
||||
**没有 `RESULT_VARIABLE`,没有 `ERROR_QUIET` 之外的任何处理,没有兜底。**
|
||||
`git` 失败时 `GIT_COMMIT_HASH_FULL` 是空的,`SUBSTRING` 给出空串,配置继续,构建成功。
|
||||
|
||||
本次实测:配置阶段打印 `fatal: not a git repository: (null)`,
|
||||
生成的 `generated/MGGitHash.h` 是
|
||||
|
||||
```c
|
||||
#define GIT_COMMIT_HASH_SHORT ""
|
||||
#define GIT_COMMIT_HASH_FULL ""
|
||||
```
|
||||
|
||||
**为什么会失败**:这棵树是 git worktree,`.git` 是一个文件,内容是
|
||||
`gitdir: C:/Users/geekerwan/.../FoldCraftLauncher/.git/modules/MobileGL/worktrees/MobileGL-disagg`
|
||||
——一条 **Windows 路径**。WSL 的 git 解析不了它(要 `/mnt/c/...`)。
|
||||
本项目正是用 worktree 并行推进各阶段的,所以"从 WSL 构建某个 worktree"这件事会**稳定复现**。
|
||||
|
||||
**为什么要紧**。`AbiFingerprintInputs::BuildStamp`(`SessionRings.h:563-565`)就是它,注释写明它的职责:
|
||||
|
||||
> *"GIT_COMMIT_HASH_SHORT: two builds of the same sizes can still disagree about a FIELD ORDER,
|
||||
> which no sizeof can see. nullptr and "" are distinct inputs and neither equals a real stamp."*
|
||||
|
||||
设计时**想过**空值——但只想到"空串是一个与真 stamp 不同的输入"。
|
||||
没想到的是**构建会静默地把所有构建的 stamp 都变成同一个空串**。
|
||||
于是:**两份来自不同 commit、都在 git 取不到版本的环境里构建的库,ABI 指纹相同**,
|
||||
而指纹里唯一能看见字段重排的那一项就此失效。
|
||||
|
||||
> **更正(`lk` 跑基线测试时发现)。** 本节原先写的是"没有任何日志、任何门会说一声"。**这句是错的,**
|
||||
> 门是存在的:`MG_Test/Wire/SessionHandshakeTest.cpp:140` 断言 `inputs.BuildStamp[0] != '\0'`,
|
||||
> `:180` 断言扰动 `BuildStamp = ""` 必须改变指纹。在这个配置下**两条都实测为红**:
|
||||
> `Expected: (inputs.BuildStamp[0]) != ('\0'), actual: '\0' vs '\0'`。
|
||||
> 所以项目预见到了这个情形,本节的发现因此更强而不是更弱——**不是"没人会注意到",
|
||||
> 是"会注意到它的门已经存在,而且现在就是红的"**。真正静默的是**构建期**:CMake 无声地产出空串,
|
||||
> 红只在跑测试时才出现。`hs` 要补的是构建期的具名失败,不是一道新门。
|
||||
|
||||
这不是一个奇异场景。会命中它的至少有:worktree 跨 WSL 构建(已实测)、
|
||||
源码 tarball 构建、CI 上不带 `.git` 的 checkout、把 repo 拷进去的 Docker 构建。
|
||||
|
||||
**给 `hs` 的要求**(在拆分 `wireFingerprint` / `buildFingerprint` 之外新增一条):
|
||||
取 stamp 失败必须是**具名的**——要么配置期失败并说明,要么写进一个明确表示"本构建无版本标识"的哨兵值
|
||||
并让握手对它具名拒绝(`Dial == Fork` 下两端本来就该是同一二进制,无版本标识意味着这个前提无法验证)。
|
||||
**不能继续是空串。**
|
||||
red-once:在一个 `git` 不可用的环境里构建,握手必须因为"build stamp 缺失"而具名变红,而不是悄悄通过。
|
||||
|
||||
## 8 另一件顺带记录的事
|
||||
|
||||
`.gitmodules` 里 `3rdparty/DiligentCore` 有重复配置(`path` 与 `url` 各两份),
|
||||
`git fetch` 会 warn 并跳过第二份。不影响构建,但迟早要清。
|
||||
@@ -0,0 +1,150 @@
|
||||
# P6 class-C dynamic census
|
||||
|
||||
Date: 2026-09-16. Tree: `/home/swung/w7/p5-joint`, `p5/joint` at
|
||||
`e61d00123c41d74f98cd06b63768be12d9b6348a`. The checkout was read only.
|
||||
`build-split/CTestTestfile.cmake` was confirmed before execution. Every process ran with
|
||||
`GLIBC_TUNABLES=glibc.malloc.tcache_count=0` and `MOBILEGL_TRANSPORT=inproc`.
|
||||
|
||||
## Method and evidence
|
||||
|
||||
`ctest -L integration-gpu --show-only=json-v1` supplied each entry's exact command, arguments,
|
||||
environment, working directory and timeout. The wrapper then drove the 1,149 commands with eight
|
||||
workers and a unique `MOBILEGL_LOG_FILE_PATH`. Exact per-entry status, return code, command, working
|
||||
directory and first `Fatal{...}` text are in
|
||||
`/home/swung/w7/p6-census-logs/results.json`; the corresponding `<entry>.log` and `<entry>.out`
|
||||
files are beside it. Runner source is `/home/swung/w7/notes/tools/p6_census_lane.{sh,py}`.
|
||||
|
||||
“Distinct scenario” below means the final `GTestSuite.Case` pair, deliberately collapsing backend,
|
||||
Split, SmallRing and feature-arm registry variants. Counts are registry entries. Thus the two
|
||||
columns answer different questions.
|
||||
|
||||
| status | entries |
|
||||
|---|---:|
|
||||
| passed | 426 |
|
||||
| skipped | 185 |
|
||||
| subprocess-aborted | 511 |
|
||||
| ordinary failed | 27 |
|
||||
| total | 1,149 |
|
||||
|
||||
This exactly reproduces P5's 426/185/511/27. All 511 aborts have a real FATAL-severity first line:
|
||||
505 `UnmigratedVerb`, six `StageSnapshotTooNarrow`. None of the 27 ordinary failures has a Fatal.
|
||||
|
||||
## First unmigrated slot by integration entry
|
||||
|
||||
| slot | entries | distinct scenarios | ROADMAP subsystem | approximate next first blocker if this slot is migrated |
|
||||
|---|---:|---:|---|---|
|
||||
| `BindImageTexture` | 138 | 71 | P3b/P4b image sweep / texture binding | Usually `DispatchCompute` for image-store cases; otherwise a draw, then `MemoryBarrier` or readback. |
|
||||
| `BeginTransformFeedback` | 95 | 44 | P9 XFB reverse/scatter (with P3b/P4b client scatter debt) | Usually the draw is already class B; next class C is approximately `EndTransformFeedback` or an XFB query end. |
|
||||
| `DrawElements` | 56 | 27 | P8 index host mirror / draw protocol breadth | Most integration cases appear to proceed to class-B `ReadPixels`; Minecraft's next distinct class-C slot cannot be known until this one is live. |
|
||||
| `DispatchCompute` | 49 | 25 | P7/P8 compute command and resource state | Commonly `MemoryBarrier`, then readback/draw. |
|
||||
| `PatchParameteri` | 43 | 19 | P7/P8 tessellation patch state / draw breadth | Commonly `BeginTransformFeedback`; otherwise the patch draw itself. |
|
||||
| `CopyImageSubData` | 30 | 14 | P8 CopyImage mirror | `GetTexImage`/`GetTextureImage`, `BindImageTexture`, or a draw, depending on the case. |
|
||||
| `MemoryBarrier` | 18 | 9 | P7/P8 compute ordering | The GuiBatch sources next issue indexed/multi-draw work, approximately `MultiDrawElementsBaseVertex` or `DrawElements`. |
|
||||
| `MultiDrawElementsBaseVertex` | 18 | 9 | P8 draw-vbo multi-draw breadth | Usually class-B readback; no later class-C call is visible in the scenario body. |
|
||||
| `ClearBufferiv` | 12 | 6 | P3b/P4b framebuffer depth; P7 Magma twin | Usually class-B draw/readback; no later class-C call is visible. |
|
||||
| `ClearBufferuiv` | 8 | 4 | P3b/P4b framebuffer depth; P7 Magma twin | Usually class-B draw/readback; no later class-C call is visible. |
|
||||
| `ClearBufferfv` | 6 | 3 | P3b/P4b framebuffer depth; P7 Magma twin | — |
|
||||
| `DrawArraysInstancedBaseInstance` | 4 | 2 | P8 draw protocol breadth | — |
|
||||
| `DrawElementsBaseVertex` | 4 | 2 | P8 index/draw protocol breadth | — |
|
||||
| `ShaderStorageBlockBinding` | 4 | 2 | P7/P8 compute/buffer binding | — |
|
||||
| `CopyTexImage2D` | 3 | 1 | P3b/P4b texture copy; P9 readback | — |
|
||||
| `MultiDrawArraysIndirectCount` | 2 | 1 | P8 indirect-count resolution | — |
|
||||
| `MultiDrawArrays` | 2 | 1 | P8 draw protocol breadth | — |
|
||||
| `MultiDrawElementsIndirect` | 2 | 1 | P8 indirect/index mirror | — |
|
||||
| `BindTransformFeedback` | 2 | 1 | P9 XFB namespace/scatter | — |
|
||||
| `MultiDrawElements` | 2 | 1 | P8 draw protocol breadth | — |
|
||||
| `ClearNamedFramebufferfv` | 2 | 1 | P3b/P4b named FBO state; P7 twin | — |
|
||||
| `GenerateMipmap` | 2 | 2 | P8 mip plan / CPU fallback | — |
|
||||
| `DrawArraysInstanced` | 2 | 1 | P8 draw protocol breadth | — |
|
||||
| `ClearBufferfi` | 1 | 1 | P3b/P4b framebuffer depth-stencil; P7 twin | — |
|
||||
| `DrawElementsInstancedBaseVertex` | 0 | 0 | P8 index/draw protocol breadth | Trace-only first blocker: two backend runs, one fixture. |
|
||||
|
||||
The “next” column is intentionally an approximation from the scenario sources and the calls before
|
||||
the Fatal. A first-blocker run cannot observe calls after its abort, and repeated calls to the same
|
||||
slot are treated as solved by migrating that slot.
|
||||
|
||||
## Fatal-family census
|
||||
|
||||
| first diagnostic family | entries | distinct scenarios | interpretation |
|
||||
|---|---:|---:|---|
|
||||
| `UnmigratedVerb` | 505 | 248 | Actual FATAL-severity aborts. |
|
||||
| `StageSnapshotTooNarrow, "respecify_whole_store"` | 6 | 4 | Actual FATAL-severity aborts; P8/P11 staging/adoption debt, not class C. |
|
||||
| no Fatal | 27 | 13 | Ordinary assertion failures; the P5 family attribution remains applicable. |
|
||||
|
||||
One passing refusal-control log contains the words `Fatal{ProtocolCorruption}` inside an ERROR-level
|
||||
explanation of what the applier *would* do. It is not a Fatal event and is excluded from the abort
|
||||
table; this distinction prevents a textual grep from inventing a seventh non-verb abort.
|
||||
|
||||
## Trace fixtures under inproc
|
||||
|
||||
All 40 cases in `trace_cases.json` are hydrated locally: each required archive and primary golden
|
||||
exists in the joint fixture directory and is not an LFS pointer. No fetch was performed. The
|
||||
reference registry has 80 backend entries; 79 are CI-eligible because iterationrp excludes
|
||||
DirectGLES. Each eligible entry was run alone with a private log by
|
||||
`p6_census_traces.{sh,py}`. Consolidated evidence is
|
||||
`/home/swung/w7/retrace-out/p6-census/summary.{json,txt}`; only those two retrace-output files remain.
|
||||
|
||||
| case(s) | backend result / first Fatal |
|
||||
|---|---|
|
||||
| `OpenRA` | DirectGLES PASS SSIM 1.0; DirectVulkan PASS SSIM 1.0; no Fatal. |
|
||||
| `improved-transparency-minecraft-26.3` | Both backends: `Fatal{UnmigratedVerb, "DrawElementsInstancedBaseVertex"}`. |
|
||||
| `minecraft-1.21.4-fabric-iris-iterationrp-in-world` | DirectVulkan only: `Fatal{UnmigratedVerb, "DrawElements"}`. |
|
||||
| `minecraft-1.21.4-startup`; `minecraft-1.21.4-main-menu`; `minecraft-1.21.11-main-menu`; `minecraft-1.17-main-menu-854`; `minecraft-1.21.4-in-world`; `minecraft-1.21.4-rd12-odinlite-in-world`; `minecraft-1.21.4-fabric-sodium-in-world`; `minecraft-1.21.4-fabric-common-mods-in-world`; `minecraft-1.21.4-fabric-common-mods-inventory`; `minecraft-1.21.4-fabric-rei-inventory`; `minecraft-1.21.4-fabric-xaero-minimap-in-world`; `minecraft-1.21.4-fabric-xaero-world-map-in-world`; `minecraft-1.21.4-fabric-journeymap-in-world`; `minecraft-1.21.4-fabric-modernui-inventory`; `minecraft-1.21.4-fabric-rei-inventory-normal-world`; `minecraft-1.21.4-fabric-xaero-minimap-in-world-normal-world`; `minecraft-1.21.4-fabric-xaero-world-map-in-world-normal-world`; `minecraft-1.21.4-fabric-journeymap-in-world-normal-world`; `minecraft-1.21.4-fabric-modernui-inventory-normal-world`; `minecraft-1.21.4-fabric-iris-bsl-in-world`; `minecraft-1.21.4-fabric-iris-makeup-ultrafast-in-world`; `minecraft-1.21.4-fabric-iris-super-duper-vanilla-in-world`; `minecraft-1.21.4-fabric-iris-sundial-lite-in-world`; `minecraft-1.21.4-fabric-iris-complementary-reimagined-in-world`; `minecraft-1.21.4-fabric-iris-complementary-unbound-in-world`; `minecraft-1.21.4-fabric-iris-mellow-in-world`; `minecraft-1.21.4-fabric-iris-nostalgia-in-world`; `minecraft-1.21.4-fabric-iris-bliss-in-world`; `minecraft-1.21.4-fabric-iris-chocapic-v6-lite-in-world`; `minecraft-1.21.4-fabric-iris-iterationt-in-world`; `minecraft-1.21.4-fabric-iris-iterationt-nodsa-in-world`; `minecraft-1.21.4-fabric-iris-photon-v1.1-in-world`; `minecraft-1.21.4-fabric-iris-photon-v1.3b-in-world`; `minecraft-1.21.4-fabric-iris-derivative-main-d24.4.14-in-world`; `minecraft-1.21.1-neoforge-create-indirect-in-world`; `minecraft-1.21.1-neoforge-create-instancing-in-world`; `minecraft-1.21.4-fabric-iris-bsl-esc-menu-854` | Both backends: `Fatal{UnmigratedVerb, "DrawElements"}`. |
|
||||
|
||||
Trace totals: 2/79 pass; 75 backend entries (38 fixture cases) first-stop at `DrawElements`; two
|
||||
backend entries (one case) first-stop at `DrawElementsInstancedBaseVertex`.
|
||||
|
||||
## Static cross: class-C slots not hit by anything measured
|
||||
|
||||
These 39 of the static census's 64 class-C slots appear in neither the integration lane nor the
|
||||
hydrated traces and are last in the migration order:
|
||||
|
||||
`BeginOcclusionQuery`, `BeginTimeElapsedQuery`, `BeginXfbPrimitivesQuery`,
|
||||
`BlitNamedFramebuffer`, `ClearNamedFramebufferfi`, `ClearNamedFramebufferiv`,
|
||||
`ClearNamedFramebufferuiv`, `ClientWaitSync`, `CopyTexSubImage2D`, `DeleteBackendQuery`,
|
||||
`DeleteSync`, `DeleteTransformFeedback`, `DispatchComputeIndirect`, `DrawArraysIndirect`,
|
||||
`DrawElementsIndirect`, `DrawElementsInstanced`, `DrawElementsInstancedBaseInstance`,
|
||||
`DrawElementsInstancedBaseVertexBaseInstance`, `DrawRangeElements`,
|
||||
`DrawRangeElementsBaseVertex`, `EndOcclusionQuery`, `EndTimeElapsedQuery`,
|
||||
`EndTransformFeedback`, `EndXfbPrimitivesQuery`, `FenceSync`, `GetGpuTimestampNs`,
|
||||
`GetQueryResult64`, `GetSyncStatus`, `GetTexImage`, `GetTextureImage`,
|
||||
`IsQueryResultAvailable`, `MemoryBarrierByRegion`, `MultiDrawArraysIndirect`,
|
||||
`MultiDrawElementsIndirectCount`, `PauseTransformFeedback`, `QueryCounterTimestamp`,
|
||||
`ResumeTransformFeedback`, `SetSwapInterval`, `WaitSync`.
|
||||
|
||||
## Proposed migration order
|
||||
|
||||
### Wave 1 — current first blockers
|
||||
|
||||
Wave 1 moves the top ten integration blockers plus the trace-only instanced draw blocker. It advances
|
||||
544 currently aborting backend-entry executions, representing 267 distinct scenario/fixture names,
|
||||
to their next blocker. Counts below are current first blockers, not promises that the scenario then
|
||||
passes.
|
||||
|
||||
| package owner / slots | scenarios advanced | required applier and client-row seam |
|
||||
|---|---:|---|
|
||||
| P3b/P4b + P7/P8 image/compute: `BindImageTexture`, `DispatchCompute`, `CopyImageSubData`, `MemoryBarrier` | 119 (235 lane entries) | Reuse `MGPipeApplySetShaderImages` and `MGPipeApplySetDispatchProgram`; add/finish `MGPipeApplyLaunchGrid`, `MGPipeApplyResourceCopyRegion`, `MGPipeApplyMemoryBarrier`. Replace the `MGR_ASSIGN_UNMIGRATED` rows for `table.GL.BindImageTexture`, `CopyImageSubData`, `MemoryBarrier`, and the hand-written `table.GL.DispatchCompute = &DispatchCompute_Unmigrated` with their emit/client-resolved rows. |
|
||||
| P9 XFB/tess: `BeginTransformFeedback`, `PatchParameteri` | 63 (138 lane entries) | Reuse `MGPipeApplySetPatchState`; add/finish `MGPipeApplyBeginStreamOutput`. Replace the `table.GL.BeginTransformFeedback` and `table.GL.PatchParameteri` unmigrated rows. |
|
||||
| P8 indexed/multi-draw: `DrawElements`, `MultiDrawElementsBaseVertex`, `DrawElementsInstancedBaseVertex` | 75 (74 lane + 77 trace backend entries) | Reuse `MGPipeApplySetVertexBuffers` and `MGPipeApplySetIndexBuffer`; add/finish the command-side `MGPipeApplyDrawVbo` (today `DrawVbo` goes directly to `IVerbSink::OnDrawVbo`, and `PipeApply.h` has no command applier). Replace all three `table.GL.*` unmigrated rows with `EmitDrawVbo`-family rows. |
|
||||
| P3b/P4b + P7 framebuffer clear: `ClearBufferiv`, `ClearBufferuiv` | 10 (20 lane entries) | Add/finish `MGPipeApplyClear` (today `Clear` also goes directly to `IVerbSink::OnClear`). Replace the two `table.GL.ClearBuffer*` unmigrated rows with `EmitClear` adapters. |
|
||||
|
||||
The missing command applier names above are deliberately called out: `PipeWireCodec.cpp` says the
|
||||
five P5 class-B verbs have no `MGPipeApply*`, and its off-reduced-path command cases return false.
|
||||
A package must either add these named PipeApply seams or explicitly extend the `IVerbSink` pattern;
|
||||
claiming an existing `PipeApply.h` entry point would be false.
|
||||
|
||||
### Wave 2 — measured tail
|
||||
|
||||
Migrate the remaining measured slots, still packaged by subsystem: P8 draw variants
|
||||
(`DrawArraysInstancedBaseInstance`, `DrawElementsBaseVertex`, `MultiDrawArraysIndirectCount`,
|
||||
`MultiDrawArrays`, `MultiDrawElementsIndirect`, `MultiDrawElements`, `DrawArraysInstanced`);
|
||||
P3b/P4b/P7 framebuffer (`ClearBufferfv`, `ClearBufferfi`, `ClearNamedFramebufferfv`);
|
||||
P7/P8 compute (`ShaderStorageBlockBinding`); P8 texture/copy (`CopyTexImage2D`,
|
||||
`GenerateMipmap`); and P9 XFB (`BindTransformFeedback`). This advances the remaining 38 current
|
||||
verb-abort entries after Wave 1's measured set.
|
||||
|
||||
### Wave 3 — unmeasured static tail
|
||||
|
||||
Migrate the 39 “not hit” slots above, grouping query/sync/present under P10, reverse readback under
|
||||
P9, and residual draw/copy breadth under P8. Their order should not displace any Wave 1 or Wave 2
|
||||
package unless a newly added real workload produces a first-blocker measurement.
|
||||
@@ -0,0 +1,122 @@
|
||||
# docs-closeout-measurements — P6 收官事实写入 `MEASUREMENTS.md`
|
||||
|
||||
> 负责文档:`docs/Disaggregated/MEASUREMENTS.md`(唯一被改的目标文件)。
|
||||
> 报告文件:本文件。任务书要求「只改你负责的那一份文档,另外两份由并行代理负责」——
|
||||
> 另一个代理的文档(`CURRENT_STAGE_PROGRESS.md`)与第三份**没有被触碰**。
|
||||
> 工作树:`feat/disaggregated`,**未 `git commit`**,未动任何既有未提交改动。
|
||||
> **头号勘误**:任务书写的分支头是 `94c130d6`,而写报告时 `git rev-parse HEAD` 读到的是
|
||||
> `4e7bf0fe`(`94c130d6` 是它的祖先,另有 `872370ba` 一个提交夹在中间,两者都是 P6.5 的文档/传输
|
||||
> 提交,不涉及本次改动)。任务书同时把 `94c130d6` 标为门 8 的源码头——本文件里的源码头就是这样记的,
|
||||
> 与分支头无关。
|
||||
|
||||
## 0 一句话
|
||||
|
||||
`MEASUREMENTS.md` 新增 **§12「P6 出口测量(2026-09-22,Redmi `2f7cbe2e` + WSL 桌面)」**(7 个子节:
|
||||
12.1 协议 / 12.2 门 7 / 12.3 门 8① / 12.4 门 8②③ / 12.5 负控 / 12.6 收尾代码与工具 / 12.7 不可比项与未跑项),
|
||||
`git diff --numstat` = **176 行新增 / 1 行替换**(文件 599 → 774 行);并把 §6.3 末尾
|
||||
「分块后的逐 blob 字节分布尚无新测量」一句**在保留历史语境的前提下**改为指向 §12.4。
|
||||
除此之外全文逐字未动。本代理只写了两个文件:`MEASUREMENTS.md` 与本报告;
|
||||
`CURRENT_STAGE_PROGRESS.md` / `ROADMAP.md` 的 `M` 状态由并行代理产生,**不是本代理改的**。
|
||||
|
||||
## 1 改动的段落(逐处)
|
||||
|
||||
| # | 位置 | 改动 | 为什么 |
|
||||
|---|---|---|---|
|
||||
| 1 | §6.3 末句(原 `:342`) | `上段的 maxrec 数字是分块前的测量,分块后的逐 blob 字节分布尚无新测量。` → `…当时分块后的逐 blob 字节分布尚无新测量;该分布与分块后的 maxrec 已在 §12.4 补测——结论是默认 8 MiB chunk 预算在已测的两条负载上从未被打到,maxrec 仍是 1808。` | 任务 (2)。**历史语境保留**(「当时…尚无」),只追加指向新节的结论;该句是 `CONTRACT-P6.md` §9 item 8 与 `CURRENT_STAGE_PROGRESS.md` 引用「分块后分布不存在」的那个锚点,所以不能删掉原陈述 |
|
||||
| 2 | 文件末尾 | 新增 `## 12. P6 出口测量(2026-09-22,Redmi 2f7cbe2e + WSL 桌面)` | 任务 (1) |
|
||||
|
||||
## 2 §12 的内容结构
|
||||
|
||||
| 子节 | 内容 |
|
||||
|---|---|
|
||||
| §12.1 协议 | 设备 / reboot-clean(boot id 前后比对)/ CPU 定频 little 1555200 + big 1958400 / GPU 钉 pwrlevel 0 / 风扇 / 同热窗口臂交错 / 负载 rd12 DirectGLES 251 帧 1471.36 draws/帧 / `--benchmark-repeats 3`·`2` + `--benchmark-tail-frames 200` + `--benchmark-no-finish` / split 开关 / 源码头 / 臂的证明。**帧分母取自哪条日志**单列一段:`frames=` 由 `PipeStats::OnPresent` 递增,spawn 下 present 在 server 进程应用,故 spawn client `frames=0 window=0`;费率一律除以真正数到帧的那条日志的 `frames=`(inproc → client log,spawn → server log,两者都 251),**不得除以同行的 `window=`**(本负载会虚高约 21×)。同时写明三个结构性零(spawn client 的 `srv=0 srvpark=0`、spawn server 的 `cli=0 clipark=0`、spawn client 的 per-frame 字段)与「`* total ms` 含第 1 帧 shader 编译(7332 ms)、不得除以 251」 |
|
||||
| §12.2 门 7 | 会话 1(boot id `e69d0329…`→`107f24d3…`)六臂交错 × best-of-3 的**逐臂表**(wall p50 / client CPU p50 / fps / 臂内散布),18/18 runner 退出 0、36/36 `PINNED`、0 `Fatal{`、37.6–46.5 °C;会话 2(`107f24d3…`→`7e6c6e9f…`)inproc/spawn 交错 × best-of-2 的**逐臂表**,4/4 OK、8/8 `PINNED`、0 `Fatal{`、37.2–44.9 °C;两会话的配对差表(**两个顺序都列**);monolith 基线行;判读 **tie** |
|
||||
| §12.3 门 8① | 会话 2 的**完整四计数器账**(含 `counters 取自` / `frames 取自` 两列)+ 会话 1 的账(spawn 的 server 半边标 **不可得**,并写明这是 §12.6 修复前的结构性问题、不是漏采);逐列读法与 hole 判读 |
|
||||
| §12.4 门 8②③ | `SEG_STAGE` 字节/帧与分块后记录/帧的**稳态中位数 / 稳态均值 / 含启动负载均值三个 framing 都报**;`maxrec=1808` 分块后不变与其原因;`ringwraps`/`ringpads`/`ringwaits`;`seg` 与后端字节类的逐窗交叉核对(含「能排除什么、不能排除什么」);**逐 blob 分布首测**(70 records / 8 blobs / bucket 3–12,逐桶列出) |
|
||||
| §12.5 负控 | `MOBILEGL_IPC_STAGE_MB=1`(256 KiB chunk 预算)的 A/B 表:**`seg` 运行总量两侧逐字节相同(2 698 026 763)**、**`wrec` +0.11%**、稳态中位数 −32%(逐窗归属会动、总量不会)、`tex` +194% 记为**证据不作结论**(arena 大小与 chunk 预算绑在同一个 env 变量上,未隔离到单变量) |
|
||||
| §12.6 收尾代码与工具 | `StageSegmentBytes`(`PipeWireCodec.cpp:878`)/ `WireRecords`(`:1188`)/ staged-blob 直方图 / `ServerMain.cpp` 的 `Init()`+`Shutdown()`(**红一次:0 条 → 29 条汇总行,SSIM 1.0 不变**)/ `MOBILEGL_PIPE_STATS_FILE` 角色分路 `/ <base>.client.json` `/ <base>.server.json`(含 G1 三次泄漏点)/ 测试数(PipeStats 25/25、全量 unit 2367/2367、spawn integration 102/102、G1 0/0/0/0 且 `.text` 逐字节相同)/ 工具入库 / `pin_device.sh` 的 Redmi 行 |
|
||||
| §12.7 不可比项与未跑项 | **本板 GPU 钳 1050 MHz、与 1100 MHz 时代的 `35d0befa` 行不可比**;**OpenRA 真机辅负载未跑**;门 8① 只在一负载一设备上比过;spawn client 窗口化字段是结构而非缺陷;分块净效果未单变量隔离 |
|
||||
|
||||
## 3 与事实基线的逐条对照(自检)
|
||||
|
||||
| 事实 | 落点 | 一致 |
|
||||
|---|---|---|
|
||||
| 门 7 会话 1:18/18、36/36 PINNED、0 Fatal;inproc 7.880/7.889、spawn 7.876/7.869(−0.15%)、臂内散布 0.2–4.2%、monolith 约贵 30% | §12.2 | ✅ |
|
||||
| 门 7 会话 2:4/4、8/8、0 Fatal;inproc 7.987/7.989 vs spawn 7.992/8.009(+0.16%) | §12.2 | ✅ |
|
||||
| 判读 tie、不设门 | §12.2 末 | ✅ |
|
||||
| 门 8① client 121.1 waits/帧、两传输逐字相同、run total 30 401–30 407;server inproc 10 866–11 963 / spawn 10 415–10 416;park 率 0.042–0.06% | §12.3 | ✅ |
|
||||
| 契约 §9「阻塞读可能更便宜」未兑现(既不更便宜也不更贵) | §12.3 tie 判读 | ✅ |
|
||||
| spawn server waits 少 8.9–12.9% 归因于 handoff 纪律而非门铃 | §12.3 `srv/f` 与同节解释段 | ✅ |
|
||||
| clipark/f 是唯一 socket 略差的列(6.07 vs 5.60/5.75,每帧多约 0.4 次 park) | §12.3 `clipark/f` | ✅ |
|
||||
| 读法警告(srv/cli 的零=另一个进程;spawn client frames=0、per-frame 无效而 `cli`/`clipark` 可信;终行/0 行) | §12.1 + §12.3 | ✅ |
|
||||
| OpenRA seg 130.8 KB median / 8.01 MB steady mean(含负载 8.07 MB)、记录 211/206;rd12 seg 816.2 KB median / 1.53 MB steady mean(含负载 10.79 MB)、记录 7 497/7 504 | §12.4 表 | ✅ |
|
||||
| framing 警告(rd12 帧 1 有 981 654 draws;run-wide mean 约 7× 稳态;两个读数都报) | §12.4 表 + 警告段 | ✅ |
|
||||
| maxrec=1808 与分块前相同、默认 8 MiB 预算从未被打到 | §12.4 | ✅ |
|
||||
| 负控 `STAGE_MB=1`:seg 逐字节相同 2 698 026 763、wrec +0.11%、tex +194% 记为证据不作结论 | §12.5 | ✅ |
|
||||
| 逐 blob 分布首测 70 records / 8 blobs / bucket 3–12,integration 车道,retrace snapshot 拿不到 dump | §12.4 末 | ✅ |
|
||||
| 收尾代码:`PipeWireCodec.cpp:878` / `:1188`、`ServerMain.cpp` Init/Shutdown(红一次 0→29 行)、`MOBILEGL_PIPE_STATS_FILE` 角色派生、测试数、工具入库 | §12.6 | ✅ |
|
||||
| 本板 GPU 钳 1050 MHz、与 `35d0befa` 的 1100 MHz 时代不可比 | §12.1(协议行)+ §12.7 | ✅ |
|
||||
| OpenRA 真机未跑 | §12.7 | ✅ |
|
||||
|
||||
**未写进去的**(不在本任务范围,留给并行代理):门 1–6 的逐项复述、`ROADMAP.md` 的阶段状态、
|
||||
`CURRENT_STAGE_PROGRESS.md` 的出口门表。§12 开头只写「出口门 1–6 的逐项证据见
|
||||
`CURRENT_STAGE_PROGRESS.md`」并给一行,不复述。
|
||||
|
||||
## 4 引用检查输出(工作树根目录)
|
||||
|
||||
```
|
||||
$ python scripts/check_doc_citations.py docs/Disaggregated/MEASUREMENTS.md
|
||||
check_doc_citations: 4 citations in 1 document(s) against HEAD, 0 problem(s)
|
||||
exit=0
|
||||
|
||||
$ python scripts/check_doc_citations.py --strict docs/Disaggregated/MEASUREMENTS.md
|
||||
check_doc_citations: 4 citations in 1 document(s) against HEAD, 0 problem(s)
|
||||
exit=0
|
||||
```
|
||||
|
||||
(改动前该文档是 `0 citations … 0 problem(s)`——因为是新加的引用,所以这是新增的 4 条,而不是存量。)
|
||||
|
||||
新增的 4 条引用都是 `path:line` 形式,全部解析成功:`MobileGL/MG_Remote/Wire/PipeWireCodec.cpp:878`
|
||||
与 `:1188`(各出现两次,§12.4 与 §12.6)。**覆盖范围说明**:本脚本只匹配
|
||||
`文件.ext:行号` 形态(扩展名限于 `h/hpp/cpp/cc/c/py/def/inc/md/json/yml/yaml/txt/fbs`),
|
||||
**不检查** `MobileGL/MG_Util/Metrics/PipeStats.{h,cpp}` 这类花括号缩写、也不检查
|
||||
`MobileGL/MG_Remote/Server/ServerMain.cpp` 这种**不带行号**的文件引用——这两处是照 §3 的行号风格
|
||||
写的(`ByteClass` 枚举成员与 `CallClass` 枚举成员的位置由 `PipeStats.h`/`.cpp` 共同承载,写成 `:878`
|
||||
反而是唯一收口点,`ServerMain.cpp` 的承重位置是「配置解析与定角色之后 / `loop.Stop()` 之后」)。
|
||||
行号取自**收尾改动后的工作树**(`PipeWireCodec.cpp` 工作树 2335 行 vs HEAD 2299 行),不是 HEAD:
|
||||
这是刻意的,因为 §12.6 描述的就是工作树里那份改动,已在 §12.4 正文里写明「两处行号取 §12.6 收尾改动后的工作树内容」。
|
||||
|
||||
全文档车道(CI 的调用形态)也一并跑了,用于确认本次改动没有引入新问题:
|
||||
|
||||
```
|
||||
$ python scripts/check_doc_citations.py docs/Disaggregated/*.md
|
||||
check_doc_citations: 183 citations in 11 document(s) against HEAD, 1 problem(s)
|
||||
docs/Disaggregated/P6-ENDSTATE-REVIEW.md:284: `Init.cpp:184-211` -> ambiguous: MobileGL/Init.cpp,
|
||||
MobileGL/MG_Backend/Init.cpp, MobileGL/MG_Impl/Init.cpp
|
||||
exit=0
|
||||
```
|
||||
|
||||
那 1 条**不是本次引入**,它在 `P6-ENDSTATE-REVIEW.md`(另一个代理负责的只读文档),
|
||||
且 CI 对这条 lint 是 `|| true` 的 warning-only
|
||||
(`.github/workflows/test.yml:3096-3101`,注释写明「文档还在写,等定稿再变 `--strict`」)。
|
||||
|
||||
## 5 遗留 / 需要下游注意
|
||||
|
||||
1. **两个事实数在 `docs/Disaggregated/MEASUREMENTS.md` 与 `CURRENT_STAGE_PROGRESS.md` 之间会重复**——
|
||||
本文件按任务书写了「本节记录门 7 / 门 8 …出口门 1–6 的证据见 `CURRENT_STAGE_PROGRESS.md`」,
|
||||
请负责那份文档的代理确认两处措辞不冲突(数字本身逐字一致)。
|
||||
2. **§12.6 的行号指向工作树、不是 HEAD**,已在正文里写明。合并/提交这次收尾改动后行号可能移动;
|
||||
届时按 §6.3 的既有风格(引用只在 `path:line` 无法替代的位置使用)复核那两处即可。
|
||||
3. **`tools/device_bench/p6/README.md` 的已知限制段落已过时**:它还写着「Where that call is absent」
|
||||
(即 `PipeStats::Init()` 可能缺失),而 §12.6 的收尾改动已经把它加进 `ServerMain.cpp`。
|
||||
该文件不是本代理负责的文档,**未改**;留给后续一并订正。
|
||||
4. **本次未跑任何构建或测试**:这是文档任务,改动只有 markdown 文本。§12 中的测试数
|
||||
(PipeStats 25/25、unit 2367/2367、spawn integration 102/102、G1 0/0/0/0 与 `.text` 逐字节相同)
|
||||
与设备数全部照任务书给的事实基线**逐字转写**,**未重算、未重跑、未挑好看的**。
|
||||
文件里的设备数按只读证据文档核对过(`gate7-device-ab.md`、`gate8-doorbell-device.md`、
|
||||
`gate8-wire-counters.md`),并把两处证据文档里互相略有出入的四舍五入统一到证据文档自身的口径
|
||||
(例如 §12.3 的 `srvpark/f` 与 park 比例统一按任务书的 **0.042–0.06%** 报;会话 2 四臂逐臂算出来是
|
||||
0.042–0.047%,并入会话 1 的 inproc 两臂后上界到 0.056%,正文里把逐臂数都列了、并声明了上界来源)。
|
||||
5. **未触碰**:`CURRENT_STAGE_PROGRESS.md`、`ROADMAP.md`、`ARCHITECTURE.md`、`README.md`、
|
||||
三份只读证据文档(`notes/p6/gate7-device-ab.md`、`gate8-doorbell-device.md`、`gate8-wire-counters.md`)、
|
||||
`notes/p6/git-worktree-fix.md`,以及任何 `MobileGL/` 源码与 `tools/` 脚本。
|
||||
@@ -0,0 +1,213 @@
|
||||
# docs-closeout-progress — `CURRENT_STAGE_PROGRESS.md` 的 P6 收官写入报告
|
||||
|
||||
2026-09-22。工作树 `C:/Users/geekerwan/AndroidStudioProjects/FoldCraftLauncher/MobileGL-disagg`,
|
||||
分支 `feat/disaggregated`,**现头 `4e7bf0fe`**,与 `origin/feat/disaggregated` 同步。任务书给的
|
||||
头 `94c130d6` 是**两轮测量的源头**(门 7 报告记 `75dd0cb1`、门 8 的 wire 计数器与真机第二轮记
|
||||
`94c130d6`);它之后分支又落了两个 P6.5 设计提交(`872370ba`、`4e7bf0fe`),非本报告所加。
|
||||
|
||||
**只改了一份文档**:`docs/Disaggregated/CURRENT_STAGE_PROGRESS.md`。未 commit。工作树里既有的
|
||||
未提交改动(`MobileGL/MG_Remote/**`、`MobileGL/MG_Util/**`、`tools/device_bench/pin_device.sh`、
|
||||
`tools/trace_replay/run_android_retrace_local.py`、`tools/device_bench/p6/`)**一个字节未动**。
|
||||
另外两份(`CURRENT_STAGE_PROGRESS.md` 之外的两份并行代理文档)未触碰;只读证据
|
||||
`notes/p6/gate7-device-ab.md`、`gate8-doorbell-device.md`、`gate8-wire-counters.md`、
|
||||
`git-worktree-fix.md` 只读未改。
|
||||
|
||||
---
|
||||
|
||||
## 0 改动总览
|
||||
|
||||
| # | 位置 | 改动 | 行数 |
|
||||
|---|---|---|---|
|
||||
| 1 | 头部状态段 | 「实现完成、出口性能/设备数待补」→「**P6 已收官(2026-09-22)**」+ 门 7 tie / 门 8 三个数齐 / G1 0/0/0/0 + 分支头事实 | 改写,+6 / −4 |
|
||||
| 2 | 新增 §1.1「收尾(2026-09-22)」 | 包状态表之后补五条:wire 计数器、`ServerMain` 武装(红一次证据)、STATS_FILE 角色派生、`pin_device.sh` `2f7cbe2e` 行、工具入库 + 测试数 | 新增 39 行 |
|
||||
| 3 | §2 出口门表第 7 行 | ⏳ → ✅,写两轮会话的 boot id / 臂序 / 臂数 / client CPU 数 / tie 判读 / 证据文件 | 改写 |
|
||||
| 4 | §2 出口门表第 8 行 | ⏳ → ✅,写三个强制性能数 + 诚实判读 + 证据文件 | 改写 |
|
||||
| 5 | §2 表后新增一段 | `MEASUREMENTS.md:342` 的「分块后分布不存在」据此关闭 | 新增 5 行 |
|
||||
| 6 | §2.1 标题与首条 | 标题改为「出口门之外仍欠」;首条 `PipeStats` 结构性零由「修复进行中」改为「**已修**,0 → 29 行」 | 改写 2 行 |
|
||||
| 7 | §3 新增 §3.1 / §3.2 / §3.3 | 配对 A/B、门 8① 门铃账、门 8②③ wire 计数器 | 新增 61 行 |
|
||||
| 8 | §5 | 删去已解决的「出口门 7、8」条目;补两条结构性限制 | 净 +17 行 |
|
||||
|
||||
净变化:`134 insertions(+), 11 deletions(-)`(`git diff --stat docs/Disaggregated/CURRENT_STAGE_PROGRESS.md`;
|
||||
本报告写完后又校过一遍,行数随 §2 一段的口径修正微调过)。无段落被误删:`DirectVulkan` 分歧、
|
||||
P6.5、Ph、P12、seq/op 五条**逐字保留**(仅 `DirectVulkan` 条尾加了"见 §3 与 `ROADMAP.md` P7 行")。
|
||||
|
||||
---
|
||||
|
||||
## 1 逐处对照(事实基线 → 落文)
|
||||
|
||||
### 1.1 头部状态段
|
||||
|
||||
旧:「状态(2026-09-21):P6 全部包已落地(a6…t6),出口门第 1–6 项达成;第 7 项…第 8 项…尚未
|
||||
正式采集,因此 P6 记为「实现完成、出口性能/设备数待补」,**未宣布收官**。分支 … 头 `77cbd176`」
|
||||
|
||||
新:`P6 已收官(2026-09-22)`,并把分支头写成**三层事实**,因为任务书要求"照实说"而
|
||||
`94c130d6` 已不是树头:
|
||||
|
||||
- 门 7 报告头 `75dd0cb1`(`gate7-device-ab.md:3`)、门 8 第二轮头 `94c130d6`
|
||||
(`gate8-doorbell-device.md:3`、`gate8-wire-counters.md:3`)——**测量期的源头**;
|
||||
- 其后两个提交 `872370ba`、`4e7bf0fe` 是 P6.5 设计(已核实:`872370ba` 的 diff 只含
|
||||
`CONTRACT-P6.md` / `StreamLink.h`(+5 行注释) / `ARCHITECTURE.md` / `CURRENT_STAGE_PROGRESS.md` /
|
||||
`P6-ENDSTATE-REVIEW.md` / `ROADMAP.md`;`4e7bf0fe` 只含 `ROADMAP.md`);
|
||||
- 现头 `4e7bf0fe`,与 `origin` 同步(`git rev-parse origin/feat/disaggregated` = `4e7bf0fe…`);
|
||||
**工作树另有未提交的 P6 收尾改动**,指向 §1.1。
|
||||
|
||||
### 1.2 §1.1 收尾(2026-09-22)
|
||||
|
||||
任务书要求的六项全部落文,并各自指出处:
|
||||
|
||||
| 任务书要求 | 落文内容 |
|
||||
|---|---|
|
||||
| wire 计数器(seg=/wrec= + 直方图) | `ByteClass::StageSegmentBytes` 唯一收口 `PipeWireCodec.cpp:878`;`CallClass::WireRecords` `:1188`;staged-blob 直方图复用 `PayloadBucketOf`;汇总行 `seg=` / `wrec=` / `wrec/f=`;push-only |
|
||||
| ServerMain PipeStats 武装(红一次证据) | 「修复前 spawn server **0** 条汇总行、修复后 **29** 条,同一条 spawn trace、两侧 SSIM 均 1.000000」;`Init()` 的两处顺序承重点 |
|
||||
| STATS_FILE 角色派生 | `<base>.client.json` / `<base>.server.json`、基名不指向文件、`RoleLogPath` 导出不复制;G1 红三次(`.text +24` / 1 symbol resized / `.rodata +64`) |
|
||||
| pin_device.sh `2f7cbe2e` 条目 | 本板钳 **1050 MHz**(`thermal_pwrlevel` 写 0 读回 1、`max_gpuclk` 只读 1 050 000 000);**与 1100 MHz 时代的 `35d0befa` 行不可比,只有同会话配对可比** |
|
||||
| tools/device_bench/p6 入库 | `{ab_session.py,render_ab.py,README.md}` + `run_android_retrace_local.py`(+19 行 `MOBILEGL_TRACE_PACKAGE`);四文件**未提交** |
|
||||
| 单测 2367/2367 与 spawn 102/102 | 落文;另加 `PipeStats 25/25` 与 G1 `.text` 两侧各 10 158 850 字节 `cmp` 无差异 |
|
||||
|
||||
### 1.3 §2 出口门表
|
||||
|
||||
第 7 行与第 8 行从 ⏳ 改 ✅,数字逐字取自只读证据,**不改写、不重算、不挑好看的**:
|
||||
|
||||
- 会话 1:boot id `e69d0329…`→`107f24d3…`,六臂 `monolith,inproc,spawn,inproc,monolith,spawn`
|
||||
× best-of-3,18/18 exit 0、36/36 `PINNED`、0 `Fatal{`;client CPU p50 ms/帧
|
||||
inproc **7.880/7.889**、spawn **7.876/7.869**(均值 −0.15%,臂内散布 0.2–4.2%),monolith 约贵 30%。
|
||||
- 会话 2:boot id `107f24d3…`→`7e6c6e9f…`,交错 × best-of-2,4/4 OK、8/8 `PINNED`、0 `Fatal`;
|
||||
**7.987/7.989 vs 7.992/8.009**(+0.16%)。
|
||||
- 第 8 行:① client 121.1 waits/帧、5.6–6.1 parks/帧(run total 30 401–30 407);server inproc
|
||||
10 866–11 963、spawn 10 415–10 416;park 率 0.042–0.06%;clipark/f 6.07 vs 5.60/5.75。
|
||||
② OpenRA 130.8 KB median / 8.01 MB steady mean(含负载 8.07 MB);rd12 816.2 KB median /
|
||||
1.53 MB steady mean(含负载 10.79 MB)。③ OpenRA 211/206;rd12 7 497/7 504;`maxrec=1808`。
|
||||
|
||||
第 8 行末尾的**诚实判读**逐句保留证据里的定性:socket 阻塞读**既不更便宜也不更贵**、契约 §9
|
||||
「阻塞读可能更便宜」**未兑现**、spawn server waits 少 8.9–12.9% 归因于 handoff 纪律而非门铃本身、
|
||||
clipark/f 是唯一 socket 略差的列(每帧多约 0.4 次 park)。第 7 行明写 **tie** 与「不设门」。
|
||||
|
||||
### 1.4 §2.1 与 §5
|
||||
|
||||
- §2.1 首条的旧文写「修法是在 server 进程里…(工作区中进行中,未提交)」——**已过时**,改为
|
||||
「**已修**…spawn server 汇总行 0 → 29 条,SSIM 1.0 不变」。标题 `收官前另欠` 已不成立(出口门
|
||||
1–8 全达成),改成 `出口门之外仍欠`,并注明这些是门外的债。
|
||||
- §5 删去 `**出口门 7、8**(真机配对 A/B、三个性能数)——待采集,见 §2。` 一条(已解决)。
|
||||
其余五条保留。新增两条**结构性限制**(任务书指定):
|
||||
1. spawn client 无 `OnPresent` → 窗口字段 `frames=0 window=0` 无效应,但 `PublishGauge` 是 store
|
||||
所以 `cli`/`clipark` 与**发射侧直接 Add** 的 `resid`/`csob-blob`/`seg`/`wrec` 的 run total 有效;
|
||||
并给出逐 role 取数规则(`srv` 读 server.log、`cli` 读 client.log、spawn client 只有 `Shutdown`
|
||||
终行或 0 行)。
|
||||
2. `MOBILEGL_PIPE_STATS_FILE` 已改角色派生 `<base>.client.json` / `<base>.server.json`,基名不指向
|
||||
文件;inproc 只产出 `.client.json` 是**正确**的。
|
||||
|
||||
### 1.5 §3 真机验收
|
||||
|
||||
原有三条功能行、`DirectVulkan` 分歧段、llvmpipe `iterationrp` 段**逐字未动**,在其后新增
|
||||
§3.1(配对 A/B)、§3.2(门 8① 门铃账,含读法警告)、§3.3(门 8②③ wire 计数器,含
|
||||
framing 警告、负控、逐 blob 分布、`tex +194%` 未解释记为证据不作结论)。
|
||||
|
||||
任务书指定的两个必须如实写的点都在:**OpenRA 真机辅负载「未跑」**(§3.3 末段),以及
|
||||
**gate8-wire-counters.md §6 的数据来自 WSL + llvmpipe,门 8②③ 是桌面 inproc 数**(同一段)。
|
||||
|
||||
---
|
||||
|
||||
## 2 引用检查输出
|
||||
|
||||
脚本 `scripts/check_doc_citations.py` 的 `documents` 是**位置参数(`nargs="+"`),不接受空参**,
|
||||
所以任务书里那条裸命令跑不出来:
|
||||
|
||||
```
|
||||
$ python scripts/check_doc_citations.py
|
||||
usage: check_doc_citations.py [-h] [--rev REV] [--strict]
|
||||
documents [documents ...]
|
||||
check_doc_citations.py: error: the following arguments are required: documents
|
||||
EXIT=2
|
||||
```
|
||||
|
||||
按脚本自己的用法(`python3 scripts/check_doc_citations.py docs/Disaggregated/*.md`)跑,结果如下。
|
||||
|
||||
**目标文档(本报告唯一改动的文件):**
|
||||
|
||||
```
|
||||
$ cd MobileGL-disagg && python scripts/check_doc_citations.py docs/Disaggregated/CURRENT_STAGE_PROGRESS.md
|
||||
check_doc_citations: 3 citations in 1 document(s) against HEAD, 0 problem(s)
|
||||
EXIT=0
|
||||
```
|
||||
|
||||
(这是**改动后**的结果。改动前同一命令报 `2 citations … 0 problem(s)`;计数从 2 升到 3 是因为新增了
|
||||
`PipeWireCodec.cpp:878` 一处被正则捕获的引用——另外两处 `MEASUREMENTS.md:342`、`PipeStats.h:256` 是
|
||||
原有的。同段里的 `:1188` 因无文件名前缀,按脚本自己的注释「`:12-13` is NOT matched on purpose」不计数。)
|
||||
|
||||
**全量(覆盖 `docs/Disaggregated`,含只读证据与三份并行代理文档):**
|
||||
|
||||
```
|
||||
$ cd MobileGL-disagg && python scripts/check_doc_citations.py docs/Disaggregated/*.md
|
||||
check_doc_citations: 179 citations in 11 document(s) against HEAD, 1 problem(s)
|
||||
docs/Disaggregated/P6-ENDSTATE-REVIEW.md:284: `Init.cpp:184-211` -> ambiguous: MobileGL/Init.cpp, MobileGL/MG_Backend/Init.cpp, MobileGL/MG_Impl/Init.cpp
|
||||
EXIT=0
|
||||
```
|
||||
|
||||
该脚本**确实覆盖 `docs/Disaggregated`**(上表 11 份文档含 `docs/Disaggregated/*.md`),
|
||||
但**不递归**:`notes/p6/*.md` 不在通配里。唯一 1 条 problem 是 `P6-ENDSTATE-REVIEW.md` 里
|
||||
**既有的** basename 歧义(非本次改动引入,且该文件由并行代理负责,未碰),无 `--strict` 时退出码 0。
|
||||
|
||||
**扩展核查**(把只读证据与 `notes/p6` 一并喂进去,确认我引用的三个证据文件本身的状态):
|
||||
|
||||
```
|
||||
$ cd MobileGL-disagg && python scripts/check_doc_citations.py \
|
||||
docs/Disaggregated/CURRENT_STAGE_PROGRESS.md \
|
||||
docs/Disaggregated/notes/p6/gate7-device-ab.md \
|
||||
docs/Disaggregated/notes/p6/gate8-doorbell-device.md \
|
||||
docs/Disaggregated/notes/p6/gate8-wire-counters.md
|
||||
check_doc_citations: 55 citations in 4 document(s) against HEAD, 9 problem(s)
|
||||
docs/Disaggregated/notes/p6/gate8-wire-counters.md:141: `MobileGL/MG_Util/Metrics/PipeStats.h:382-386` -> MobileGL/MG_Util/Metrics/PipeStats.h has 372 lines at HEAD
|
||||
docs/Disaggregated/notes/p6/gate8-wire-counters.md:145: `MobileGL/MG_Util/Metrics/PipeStats.cpp:708` -> MobileGL/MG_Util/Metrics/PipeStats.cpp has 646 lines at HEAD
|
||||
docs/Disaggregated/notes/p6/gate8-wire-counters.md:613: `retrace_main.cpp:258` -> no such file at HEAD
|
||||
docs/Disaggregated/notes/p6/gate8-wire-counters.md:614: `retrace_main.cpp:1482` -> no such file at HEAD
|
||||
docs/Disaggregated/notes/p6/gate8-wire-counters.md:669: `Init.cpp:123` -> ambiguous: MobileGL/Init.cpp, MobileGL/MG_Backend/Init.cpp, MobileGL/MG_Impl/Init.cpp
|
||||
docs/Disaggregated/notes/p6/gate8-wire-counters.md:681: `ServerMain.cpp:442` -> MobileGL/MG_Remote/Server/ServerMain.cpp has 395 lines at HEAD
|
||||
docs/Disaggregated/notes/p6/gate8-wire-counters.md:699: `Init.cpp:59` -> ambiguous: MobileGL/Init.cpp, MobileGL/MG_Backend/Init.cpp, MobileGL/MG_Impl/Init.cpp
|
||||
docs/Disaggregated/notes/p6/gate8-wire-counters.md:826: `PipeStats.cpp:787` -> MobileGL/MG_Util/Metrics/PipeStats.cpp has 646 lines at HEAD
|
||||
docs/Disaggregated/notes/p6/gate8-wire-counters.md:826: `PipeStats.h:463` -> MobileGL/MG_Util/Metrics/PipeStats.h has 372 lines at HEAD
|
||||
EXIT=0
|
||||
```
|
||||
|
||||
**这 9 条全部落在 `notes/p6/gate8-wire-counters.md`(只读证据,非本报告改动的文件),而且全部是
|
||||
"对着工作树而非 HEAD 写的行号"** —— 正是它自己 §3 开头写的"行号为改后内容":
|
||||
|
||||
- **5 条**(`:141`、`:145`、`:681`、`:826` ×2)引的是**未提交的工作树行号**——正是它自己 §3 开头
|
||||
写的"行号为改后内容"。实测两侧行数:`PipeStats.h` 工作树 **466** vs HEAD **372**、
|
||||
`PipeStats.cpp` 工作树 **800** vs HEAD **646**、`ServerMain.cpp` 工作树 **445** vs HEAD **395**。
|
||||
脚本按 `HEAD` 解析,故报超界。**这 5 条对着工作树是对的**,对着 HEAD 才红。
|
||||
- **2 条**(`:613`、`:614`)引 `retrace_main.cpp`,该文件在 `3rdparty/apitrace` 子模块内,
|
||||
不在本仓库的 `ls-tree` 里,脚本解析不到。
|
||||
- **2 条**(`:669`、`:699`)是 `Init.cpp` 的既有 basename 歧义(`MobileGL/Init.cpp` /
|
||||
`MG_Backend/Init.cpp` / `MG_Impl/Init.cpp`)。
|
||||
|
||||
**目标文档 `CURRENT_STAGE_PROGRESS.md` 自身 0 problem。** 三处行号引用按 HEAD 解析都在界内:
|
||||
`PipeStats.h:256`(HEAD 372 行)、`PipeWireCodec.cpp:878`(HEAD 2299 行)、
|
||||
`MEASUREMENTS.md:342`(HEAD 599 行)。`:1188`(`EncodeRecord`)写在中间点前无文件名,按脚本设计不计;
|
||||
它与 `:878` 都取**证据文件 `gate8-wire-counters.md` §3 的同一口径(改后行号)**——
|
||||
`PipeWireCodec.cpp` 工作树 2335 / HEAD 2299,两个行号在两侧都成立,所以这条无需改口径。
|
||||
|
||||
**链接目标存在性**(我新加的 markdown 相对链接逐个 `test -f`):
|
||||
|
||||
```
|
||||
OK docs/Disaggregated/notes/p6/gate7-device-ab.md
|
||||
OK docs/Disaggregated/notes/p6/gate8-doorbell-device.md
|
||||
OK docs/Disaggregated/notes/p6/gate8-wire-counters.md
|
||||
OK tools/device_bench/p6/ab_session.py
|
||||
OK tools/device_bench/p6/render_ab.py
|
||||
OK tools/device_bench/p6/README.md
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 3 边界与未做
|
||||
|
||||
- **未 commit**:只写了工作树文件。任务书明确禁止 `git commit`。
|
||||
- **未碰**其余两份并行代理文档,也未碰 `ROADMAP.md` / `MEASUREMENTS.md` / `ARCHITECTURE.md`
|
||||
(`ROADMAP.md` 的 P6 行与 `MEASUREMENTS.md:342` 仍是旧口径——本报告把"可关闭"写在
|
||||
`CURRENT_STAGE_PROGRESS.md` 里,**没有替它们改**,那不在本次授权内)。
|
||||
- **`CURRENT_STAGE_PROGRESS.md` 的既有 `MEASUREMENTS.md:342` 句子未删**,只在其下增写了关闭依据;
|
||||
删除该句属 `MEASUREMENTS.md` 自身的改动,留待该文件的责任方。
|
||||
- **未新增引用**到 `gate8-doorbell-device.md` 之外的新证据文件;`git-worktree-fix.md` 未在本文档引用
|
||||
(它是 git 元数据修复,与阶段进度无关)。
|
||||
- 文档定位保持为「只记当前阶段(P6)」:新增内容全部是 P6 的收官事实与门 8 的数,
|
||||
P6.5 / Ph / P12 只在 §5 以「不属于 P6」的身份出现,入口提示段(顶部 blockquote)逐字未动。
|
||||
@@ -0,0 +1,181 @@
|
||||
# P6 收官事实写入 `ROADMAP.md` —— 改动报告
|
||||
|
||||
> 日期 2026-09-22;工作树 `C:\Users\geekerwan\AndroidStudioProjects\FoldCraftLauncher\MobileGL-disagg`,
|
||||
> 分支 `feat/disaggregated`。**只改 `docs/Disaggregated/ROADMAP.md` 一份文档**,另两份(由并行代理负责)
|
||||
> 未触碰;未 `git commit`;未触碰工作树里已有的未提交代码改动。
|
||||
>
|
||||
> 证据只读引用(未修改):`notes/p6/gate7-device-ab.md`、`notes/p6/gate8-doorbell-device.md`、
|
||||
> `notes/p6/gate8-wire-counters.md`、`notes/p6/git-worktree-fix.md`。
|
||||
|
||||
---
|
||||
|
||||
## 0 一句话
|
||||
|
||||
把 P6 的收官事实(门 7 / 门 8 已采、判读 tie、收尾四项落地)写进 `ROADMAP.md`,
|
||||
**6 行改动**:顶部 blockquote、阶段表 P6 行的状态列 / 落地列 / 验收门列、里程碑列表两条、一处引用了
|
||||
`ServerMain.cpp`「正在被门 8 的工作修改」的行内说明、一处写「门 8 的树上工作正在补」的开放问题。
|
||||
其余全部逐字未动(含债务表整张、其余阶段行、P6.5「立即的下一项」整节)。
|
||||
|
||||
---
|
||||
|
||||
## 1 逐处改动(行号按改前 / 改后对照)
|
||||
|
||||
### 1.1 顶部状态 blockquote(第 3 行)
|
||||
|
||||
**改前**:`P6 全部包(a6 / c6 / lk / so / sm / cp / hs / dl / st / t6)已落地于 feat/disaggregated
|
||||
(头 77cbd176,2026-09-21);出口门第 1–6 项达成,第 7 项(真机配对 A/B 热窗口)与第 8 项
|
||||
(三个强制性能数)尚未正式采集,故 P6 记为「实现完成、出口性能/设备数待补」,未宣布收官**。
|
||||
|
||||
**改后**:`P6 已收官(2026-09-22)`:全部包已落地(头 `77cbd176`,2026-09-21),出口门第 1–6 项此前已达成;
|
||||
第 7 项(Redmi `2f7cbe2e` 的 reboot-clean 同热窗口配对 A/B)与第 8 项(三个强制性能数)已于 2026-09-22 采齐
|
||||
——门 7 判读 **tie**(client CPU p50 差 −0.15% / +0.16%,均在臂内散布 0.2–4.2% 之内,符号随臂序翻转;
|
||||
monolith 约贵 30%),门 8 三数齐;证据链 `notes/p6/gate7-device-ab.md` / `gate8-doorbell-device.md` /
|
||||
`gate8-wire-counters.md`。
|
||||
|
||||
**未动**:同一 blockquote 里的 P5f 验收代码句、P5e 债句、CI / inproc 收官句;第 5 行(Magma run-ahead)
|
||||
与第 7 行(终局改判)整句原样——这两行的「P6 / P7 全阶段状态不因此改变」与「P6.5 关键路径」结论
|
||||
不受收官影响。
|
||||
|
||||
### 1.2 阶段表 P6 行(第 37 行)
|
||||
|
||||
- **状态列**:`⏳ 全部包已落地(2026-09-21,头 77cbd176);出口门 1–6 达成,7/8 待采` →
|
||||
`✅ 已收官(2026-09-22)`,并保留十包落地信息。原「收官前另欠」三项改写为:server 进程 `PipeStats`
|
||||
从未初始化**已在收尾中修好**;184 符号棘轮门与 hs 的 `LinkTerms` / `Refuse` / 指纹拆分**未落地、移交 P6.5**。
|
||||
(只改「已在收尾中修好」这一处口径,未落地项原样保留——契约 §12.1 的棘轮门与 hs 三行确实仍未做。)
|
||||
- **落地什么列**:原有十包链与 a6 / P6-ENDSTATE-REVIEW 引用逐字保留,**追加收尾四项**:
|
||||
wire 计数器(`PipeWireCodec.cpp:878` `StageAllocate` 唯一收口、`:1188` `EncodeRecord` 提交路径、
|
||||
staged-blob 直方图、汇总行 `seg=` / `wrec=`);`ServerMain.cpp` 补 `PipeStats::Init()` / `Shutdown()`
|
||||
(修前 0 条汇总行 / 修后 29 条、SSIM 1.0 不变);`MOBILEGL_PIPE_STATS_FILE` 角色派生
|
||||
`<base>.client.json` / `<base>.server.json`;工具入库 `tools/device_bench/p6/{ab_session.py,render_ab.py,README.md}`
|
||||
与 `tools/trace_replay/run_android_retrace_local.py`(+19 行),`pin_device.sh` 新增 `2f7cbe2e` 条目。
|
||||
- **验收门列**:`7/8 待采:……尚未正式记录` → `7/8 已采(2026-09-22)` 的达成摘要,逐字使用基线数字:
|
||||
- 门 7:Redmi `2f7cbe2e` / M332BF / SM8750 / Adreno 830v2、CPU 定频 little 1555200 / big 1958400、
|
||||
GPU 钳 1050 MHz、rd12-in-world + DirectGLES、~1471 draws/帧;六臂交错 × best-of-3 =
|
||||
18/18 runner 退出 0、36/36 `PINNED`、0 `Fatal`;inproc 7.880/7.889 vs spawn 7.876/7.869(−0.15%)、
|
||||
第二会话 7.987/7.989 vs 7.992/8.009(+0.16%);判读 **tie**,如实记录、不设门;monolith 约贵 30%。
|
||||
- 门 8①:client 121.1 waits/帧、5.6–6.1 parks/帧、两传输逐字相同(run total 30 401–30 407);
|
||||
server inproc 10 866–11 963 / 5.0–6.2,spawn 10 415–10 416 / 4.66–4.90;
|
||||
socket 阻塞读**既不更便宜也不更贵**(契约 §9 未兑现);spawn server waits 少 8.9–12.9% 归因 handoff 纪律;
|
||||
唯一略差列 `clipark/f` 6.07 vs 5.60/5.75。
|
||||
- 门 8②③:OpenRA `seg` 130.8 KB median / 8.01 MB steady mean(含负载 8.07 MB)、记录 211 / 206;
|
||||
rd12 `seg` 816.2 KB median / 1.53 MB steady mean(含负载 10.79 MB、首帧 981 654 draws vs 稳态 ~1471、
|
||||
run-wide mean 约 7× 稳态,两个读法都报)、记录 7 497 / 7 504;`maxrec=1808` 与分块前相同。
|
||||
- 证据链接三条按任务书给出的相对路径写入。
|
||||
|
||||
### 1.3 里程碑列表(第 228–229 行)
|
||||
|
||||
采用任务书给的**改写旧条**方案(文件惯例是里程碑与阶段表的日期条目一一对应,新增一条会留下
|
||||
「未宣布收官」与「已收官」两句并存):
|
||||
|
||||
- 第 228 行:「P6 全部包落地(2026-09-21)」→「**P6 收官(2026-09-22)**」。十包合入、三种传输
|
||||
retrace 对上 golden、device-lost 闩 123 s → 5.7 s、`Session::Fail` 93→4 等历史事实逐字保留;
|
||||
出口门句改为「1–6 ✅;门 7 / 8 于 2026-09-22 采齐」并写入 tie 判读、monolith 约贵 30%、
|
||||
门 8 三数齐、G1 0/0/0/0 且 `.text` 逐字节相同,收尾为「P6 就此收官,未设性能门(只记录)」。
|
||||
- 第 229 行「终局改判」条内,把「server 进程 `PipeStats` 结构性零」标注为**收尾中已修**
|
||||
(否则会与 1.2 的状态列自相矛盾)。该条其余内容与第 230 行「仍是方向……」「再基线检查点」
|
||||
逐字未动。
|
||||
|
||||
### 1.4 两处「门 8 还在做」的残留说明(第 61、266 行)
|
||||
|
||||
这两处若不改,会与新的收官状态直接冲突(一句说门 8 还在改代码、一句说门 8 的量还在补):
|
||||
|
||||
- 第 61 行 P6.5 表格里 `ServerMain.cpp` 的出处列:「正在被门 8 的工作修改,不引行号」→
|
||||
「门 8 的收尾修改已落入该文件,本表不引行号」。**仍未引行号**(该表本来就不引,保持原风格)。
|
||||
- 第 266 行开放问题 11 末句:「MC in-world / Create 的占用分布仍未量(门 8 的树上工作正在补)」→
|
||||
「(门 8 已给出两条负载的字节/帧与记录/帧,逐 blob 分布只在 integration 车道取到)」。
|
||||
这一改与 `gate8-wire-counters.md` §6.5 / §7.1 一致:逐 blob 分布只从 integration 车道的 JSON dump 拿到,
|
||||
retrace 的 snapshot 模式因不走 `cleanUp→Destroy` 拿不到。该问题其余文字(含「仍未答」的
|
||||
program archive 与 `draw_vbo` range 尾)逐字未动。
|
||||
|
||||
### 1.5 明确**未**改动(逐字保留)
|
||||
|
||||
- P6.5 行(第 38 行)与「立即的下一项」整节(第 51–158 行):其「今天还跑不了」「正在被门 8 的工作修改」
|
||||
之类的 P6.5 语境与本次收官无关,除 §1.4 那一处外未动。
|
||||
- 债务表(第 234–250 行)**整张逐字未动**,含「A3 指纹 → P6.5 wf / nd」「默认 32 MiB staging」
|
||||
「max record bytes」等行。
|
||||
- 其余阶段行(P0…P5f、Ph、P3b/P4b、P7…P13)逐字未动;P5c 历史节、审计清单表、开放问题 1–24
|
||||
除 §1.4 那一句外逐字未动。
|
||||
- 第 226 行「P5f 出口……P6 前提解除,实施未开始」是**当时**的事实陈述,保留(该条的历史价值高于
|
||||
与今天的对照,且下行第 228 行已给出实施与收官时间线)。
|
||||
|
||||
---
|
||||
|
||||
## 2 与基线数字的一致性自查
|
||||
|
||||
| 事实 | 写入位置 | 与证据文档是否逐字一致 |
|
||||
|---|---|---|
|
||||
| 门 7:18/18 退出 0、36/36 `PINNED`、0 `Fatal` | blockquote(概述)、阶段表、里程碑 | 是(`gate7-device-ab.md` §1 表) |
|
||||
| 门 7:7.880/7.889 vs 7.876/7.869 = −0.15% | blockquote、阶段表 | 是(§2.2 / §2.3;臂内散布 0.2–4.2%) |
|
||||
| 门 7 第二会话:4/4 OK、8/8 `PINNED`、0 `Fatal`、7.987/7.989 vs 7.992/8.009 = +0.16% | 阶段表 | 是(`gate8-doorbell-device.md` §1、§4) |
|
||||
| monolith 约贵 30%(−29.8% / −29.9%) | blockquote、阶段表、里程碑 | 是(`gate7-device-ab.md` §2.4) |
|
||||
| 门 8①:121.1 waits/帧、5.6–6.1 parks/帧、30 401–30 407 | 阶段表 | 是(两文档 §3 表;5.60/5.75 与 6.07/6.08) |
|
||||
| 门 8①:server inproc 10 866–11 963 / spawn 10 415–10 416 | 阶段表 | 是(`gate8-doorbell-device.md` §3) |
|
||||
| 门 8①:spawn server waits 少 8.9–12.9%、`clipark` 6.07 vs 5.60/5.75 | 阶段表 | 是(§3、§3.1、§7) |
|
||||
| 门 8②③:OpenRA 130.8 KB / 8.01 MB、211 / 206 | 阶段表 | 是(`gate8-wire-counters.md` §6.4) |
|
||||
| 门 8②③:rd12 816.2 KB / 1.53 MB、7 497 / 7 504、含负载 8.07 / 10.79 MB | 阶段表 | 是(§6.4) |
|
||||
| rd12 首帧 981 654 draws、run-wide mean 约 7× 稳态 | 阶段表 | 是(§6.4 读法注意) |
|
||||
| `maxrec=1808` 与分块前相同、默认 8 MiB chunk 未被触发 | 阶段表 | 是(§6.4 / §7.2) |
|
||||
| 收尾四项(878 / 1188 / ServerMain Init+Shutdown / 角色派生 / 工具与 pin 条目) | 阶段表落地列 | 是(`gate8-wire-counters.md` §3、§9.2、§9.7、§9.7.1) |
|
||||
| 修前 0 条 / 修后 29 条汇总行、SSIM 1.0 不变 | 阶段表落地列 | 是(§9.4(c)) |
|
||||
| 本板 GPU 钳 1050 MHz(写 0 读回 1、`max_gpuclk` 只读 1 050 000 000)、与 `35d0befa` 行不可比 | 阶段表状态列与验收门列 | 是(`gate7-device-ab.md` §1、§5.1 与 `pin_device.sh` 的 `2f7cbe2e` 行) |
|
||||
|
||||
**未写入**(任务书未列、且属于证据文档范围的数):负控 `MOBILEGL_IPC_STAGE_MB=1` 的
|
||||
`seg` 运行总量逐字节相同 / `wrec` +0.11% / 同 A/B 下 `tex` +194%(未解释)、逐 blob 分布首测
|
||||
(70 records、8 blobs、bucket 3–12)、G1 `.text` 10158850 与 symbols 27863。这些留在
|
||||
`notes/p6/gate8-wire-counters.md`,`ROADMAP.md` 只在其开放问题 11 保留了「分块」的既有论述。
|
||||
|
||||
---
|
||||
|
||||
## 3 引用检查
|
||||
|
||||
在工作树根目录按任务书要求运行:
|
||||
|
||||
```
|
||||
$ python scripts/check_doc_citations.py docs/Disaggregated/ROADMAP.md
|
||||
check_doc_citations: 75 citations in 1 document(s) against HEAD, 0 problem(s)
|
||||
rc=0
|
||||
```
|
||||
|
||||
(改前同一条命令:`74 citations … 0 problem(s)`;+1 是本轮新写入的 `PipeWireCodec.cpp:1188`。
|
||||
|
||||
**该脚本覆盖 `docs/Disaggregated`**:它按参数吃任意 markdown,仓库里就是靠
|
||||
`docs/Disaggregated/*.md` 调用的。为完整性另跑了一次全域:
|
||||
|
||||
```
|
||||
$ python scripts/check_doc_citations.py docs/Disaggregated/*.md docs/Disaggregated/notes/p6/*.md
|
||||
check_doc_citations: 1257 citations in 21 document(s) against HEAD, 27 problem(s)
|
||||
rc=0
|
||||
```
|
||||
|
||||
那 27 条**全部在只读证据文档里,与本轮改动无关**,且分三类:
|
||||
|
||||
1. **21 条 basename 歧义**(`Init.cpp` 命中 `MobileGL/Init.cpp`、`MG_Backend/Init.cpp`、`MG_Impl/Init.cpp`;
|
||||
1 条 `Core.cpp`)——脚本按 basename 解析时要求唯一。
|
||||
2. **5 条 `path:line` 超出 HEAD 行数**——`PipeStats.h` / `PipeStats.cpp` / `ServerMain.cpp` /
|
||||
`PipeWireCodec.cpp` 的行号来自**工作树**(未提交的收尾改动),而脚本对 `HEAD` 解析。
|
||||
`notes/p6/gate8-wire-counters.md` §3 自己声明的就是「行号为改后内容」。
|
||||
3. **2 条 `retrace_main.cpp` 第 258 / 1482 行的引用无此文件**——该文件属于 apitrace 子模块的 vendored 源码,
|
||||
不在 `git ls-tree -r HEAD` 的顶层路径集合里(脚本只解析仓库自身文件)。
|
||||
|
||||
按任务书要求,这些只读证据文档**未改动**,问题如实列出;`ROADMAP.md` 自身 0 problem。
|
||||
|
||||
---
|
||||
|
||||
## 4 边界与未做项
|
||||
|
||||
1. **没有 `git commit`**,也没有触碰工作树里已有的未提交改动
|
||||
(`MobileGL/MG_Remote/{Wire/PipeWireCodec.cpp,Server/ServerMain.cpp}`、
|
||||
`MG_Util/{Metrics/PipeStats.cpp,Metrics/PipeStats.h,Debug/Log.cpp,Debug/Log.h}`、
|
||||
`MG_Test/Util/PipeStatsTest.cpp`、`tools/device_bench/pin_device.sh`、
|
||||
`tools/trace_replay/run_android_retrace_local.py` 与新增的 `tools/device_bench/p6/`)。
|
||||
改动的只有 `docs/Disaggregated/ROADMAP.md`(6 行)与本报告文件。
|
||||
2. **另两份文档未碰**:`CURRENT_STAGE_PROGRESS.md`(含 §2.1「收官前另欠」、§3「出口门 7、8 …… 待采集」)
|
||||
与 `MEASUREMENTS.md` 由并行代理负责;本报告不引用它们的行号,`ROADMAP.md` 里对
|
||||
`CURRENT_STAGE_PROGRESS.md` / `MEASUREMENTS.md` 的既有链接逐字保留。**注意**:在它们被同一轮收官改完之前,
|
||||
`ROADMAP.md` 说的「P6 已收官」与 `CURRENT_STAGE_PROGRESS.md` §2.1 / §3 的「未宣布收官 / 7、8 待采」
|
||||
会短暂并存,这是并行分工的中间态,不是本报告遗漏。
|
||||
3. **里程碑采用「改写旧条」而非「新增一条」**(任务书允许二选一):这样同一列表里不存在
|
||||
「未宣布收官」与「已收官」两句。若并行代理在 `CURRENT_STAGE_PROGRESS.md` 里选择了另一种写法,
|
||||
需要把两处措辞对齐时以 `ROADMAP.md` 第 228 行的口径为准。
|
||||
4. **`git status` 里 12 条 ` m` 子模块与 flatbuffers 的 6 条 ` M` 是既有 stat 噪声**
|
||||
(见 `notes/p6/git-worktree-fix.md` §7.1),与本轮改动无关,未处理。
|
||||
@@ -0,0 +1,512 @@
|
||||
# Gate 7 — Redmi `2f7cbe2e` paired A/B, and gate 8 item 1 (the doorbell)
|
||||
|
||||
2026-09-22, branch `feat/disaggregated`, source head `75dd0cb1`. `CONTRACT-P6.md` §9 items 7 and 8-①.
|
||||
|
||||
Everything below was measured on one reboot-clean thermal window on Redmi `M332BF` (`2f7cbe2e`,
|
||||
SM8750, Adreno 830v2) from a **snapshot of the worktree** (`C:/Users/geekerwan/p6-snap/MobileGL-disagg`),
|
||||
never from the shared tree: two other agents were editing `MobileGL/MG_Util/Metrics/PipeStats.*`
|
||||
and the submodule pointers at the same time.
|
||||
|
||||
**Verdict up front.** The pair is a **tie**. `spawn` is *not* slower than `inproc` on this workload —
|
||||
it is 0.15 % faster on the primary metric (mean of the two interleaved orders), deep inside the
|
||||
run-to-run spread — and both are ~30 % *cheaper* than the `monolith` control on client CPU per frame
|
||||
(+23 % in fps). The socket doorbell did **not** deliver the cheaper handoff the contract's §9 note
|
||||
anticipated, but it also did not cost anything measurable, which is a different and more useful answer
|
||||
than the note's.
|
||||
|
||||
Gate 8 item ① is **partially** delivered: the client half of the ledger is real on both arms and
|
||||
**the server half is unmeasurable under `spawn` on this build**, for a structural reason found while
|
||||
collecting it (§6). That is a finding, not a collection failure, and it is reported rather than
|
||||
substituted with a number from the other arm.
|
||||
|
||||
---
|
||||
|
||||
## 1. Protocol actually executed
|
||||
|
||||
| item | value |
|
||||
|---|---|
|
||||
| device | Redmi `M332BF`, serial `2f7cbe2e`, SM8750 / Adreno 830v2 |
|
||||
| reboot | `adb reboot`, `sys.boot_completed=1`, then boot id compared |
|
||||
| boot id before | `e69d0329-2264-4a2d-9b00-e1a4ffb6154d` |
|
||||
| **boot id after** | **`107f24d3-b1f1-4a97-ab8c-9706d1901f32`** (changed ⇒ the reboot is a fact, not a claim) |
|
||||
| CPU pin | little `policy0` → 1555200, big `policy6` → 1958400 (`pin_device.sh 2f7cbe2e pin`) |
|
||||
| GPU pin | `kgsl-3d0` `min/max_pwrlevel = 0` → **1050000000 Hz** (see §5.1 — this unit cannot reach 1100 MHz) |
|
||||
| fan | `/sys/class/xm_power/hw_monitor/pwm_fan` `target_level=2`, `real_speed=14848` rpm, `pwm_duty=65` |
|
||||
| arm order | `monolith, inproc, spawn, inproc, monolith, spawn` — interleaved, one window |
|
||||
| repeats | `--benchmark-repeats 3`, `--benchmark-tail-frames 200`, `--benchmark-no-finish`, best-of-3 |
|
||||
| workload | `minecraft-1.21.4-rd12-odinlite-in-world`, DirectGLES, 251 frames, **1471.36 draws/frame** |
|
||||
| stats | `MOBILEGL_PIPE_STATS=1`, `MOBILEGL_PIPE_STATS_PERIOD=120` |
|
||||
| split knobs | `MOBILEGL_IPC_ROLE_SPLIT_STATE=1`, `MOBILEGL_IPC_STRICT_ERRORS=1`, `MOBILEGL_IPC_RUN_AHEAD=1` |
|
||||
| APK | `MobileGL-plugin-trace-release-p6gate7.apk`, sha256 `8882683b063db13e16236530007c9b364de55fe7a11fba968169ebe2942fcfaf` |
|
||||
| 6 arms × 3 repeats | **18/18 runner exits 0, 36/36 pin checks `PINNED`, 0 `Fatal{`** |
|
||||
|
||||
Per-arm pin evidence is in each arm directory's `pin-before.txt` / `pin-after.txt`; both exit 0
|
||||
(`PINNED`) for all six arms. The sampled temperature on `cpuss-0-0` across all 12 checks was
|
||||
**37.6–46.5 °C** (min 37.6, max 46.5), i.e. no arm ran cold and none approached throttling.
|
||||
|
||||
### 1.1 The build
|
||||
|
||||
```bash
|
||||
# from the SNAPSHOT, never the shared tree
|
||||
cd /c/Users/geekerwan/p6-snap/MobileGL-disagg
|
||||
export JAVA_HOME="C:/Program Files/Java/jdk-21"
|
||||
export JAVA_TOOL_OPTIONS='-Djdk.net.unixdomain.tmpdir=C:\Users\geekerwan\.gradle\uds'
|
||||
export ANDROID_HOME="C:/Users/geekerwan/AppData/Local/Android/Sdk"
|
||||
"/c/Users/geekerwan/.gradle/wrapper/dists/gradle-8.13-bin/5xuhj0ry160q40clulazy9h7d/gradle-8.13/bin/gradle.bat" \
|
||||
--no-daemon -p android-plugin :app:assembleTraceRelease \
|
||||
-Pmobilegl.buildDisaggregated=ON -Pmobilegl.buildDisaggregatedInproc=ON -Pmobilegl.pipePush=ON \
|
||||
-Pmobilegl.apkSuffix=p6gate7 -Pmobilegl.debuggableRelease=true \
|
||||
-Pmobilegl.applicationIdSuffix=.p6gate7 -Pmobilegl.logLevel=MOBILEGL_LOG_LEVEL_INFO
|
||||
# BUILD SUCCESSFUL in 10s (incremental; 2m09s cold)
|
||||
```
|
||||
|
||||
Two build facts worth carrying forward, both stated by the CI workflow and both required:
|
||||
|
||||
- `-Pmobilegl.debuggableRelease=true` is what makes the release APK `run-as`-able. Without it
|
||||
`trace-replay-ci.sh` cannot pull the private logs at all and every arm comes back with no library
|
||||
log — indistinguishable from a run that produced none.
|
||||
- The APK is **not** signed by Gradle here (`SIGNING_*` env is a CI secret). It was signed with the
|
||||
standard debug key (`~/.android/debug.keystore`, `androiddebugkey`) so `run-as` works:
|
||||
```bash
|
||||
apksigner sign --ks ~/.android/debug.keystore --ks-pass pass:android \
|
||||
--ks-key-alias androiddebugkey --key-pass pass:android \
|
||||
--out trace-p6gate7-debugsigned.apk unsigned.apk
|
||||
```
|
||||
- `-Pmobilegl.applicationIdSuffix=.p6gate7` puts the build under
|
||||
`top.mobilegl.plugin.p6gate7.trace`, **beside** an unrelated trace install under the canonical id
|
||||
rather than replacing it. The runner's hard-coded package name is overridden by
|
||||
`MOBILEGL_TRACE_PACKAGE` (snapshot-local; see §5.4).
|
||||
|
||||
### 1.2 The run
|
||||
|
||||
```bash
|
||||
cd /c/Users/geekerwan/p6-snap/MobileGL-disagg
|
||||
python tools/device_bench/p6/gate7_ab.py \
|
||||
--tree "C:/Users/geekerwan/p6-snap/MobileGL-disagg" \
|
||||
--out "C:/Users/geekerwan/p6-snap/evidence" \
|
||||
--apk 'C:\Users\geekerwan\p6-snap\artifacts\trace-p6gate7-debugsigned.apk' \
|
||||
--reboot --fan-level 2 --session gate7-rd12 \
|
||||
--arm monolith:DirectGLES:minecraft-1.21.4-rd12-odinlite-in-world:3 \
|
||||
--arm inproc:DirectGLES:minecraft-1.21.4-rd12-odinlite-in-world:3 \
|
||||
--arm spawn:DirectGLES:minecraft-1.21.4-rd12-odinlite-in-world:3 \
|
||||
--arm inproc:DirectGLES:minecraft-1.21.4-rd12-odinlite-in-world:3 \
|
||||
--arm monolith:DirectGLES:minecraft-1.21.4-rd12-odinlite-in-world:3 \
|
||||
--arm spawn:DirectGLES:minecraft-1.21.4-rd12-odinlite-in-world:3
|
||||
```
|
||||
|
||||
Evidence root: `C:/Users/geekerwan/p6-snap/evidence/gate7-rd12/`. Six arm directories, each with
|
||||
`arm-summary.json`, `benchmark-run{1,2,3}.json`, `mobilegl.client.log`, `mobilegl.server.log`,
|
||||
`pin-before.txt`, `pin-after.txt`, `runner.stdout.txt`, `logcat.txt`; plus `session-summary.json`.
|
||||
|
||||
`tools/device_bench/p6/gate7_ab.py` and `render_gate7.py` are new in this snapshot (§7).
|
||||
|
||||
---
|
||||
|
||||
## 2. The paired A/B
|
||||
|
||||
Primary metric = **client thread CPU ms/frame**, the client GL thread's own
|
||||
`CLOCK_THREAD_CPUTIME_ID` deltas summarised by the device over the trailing 200 frames
|
||||
(`MEASUREMENTS.md` §9's rule; the kernel ignores this app's affinity requests, so a process total
|
||||
mixes two clock domains). `fps` and wall p50/p95 are recorded beside it.
|
||||
|
||||
### 2.1 Best-of-3, per arm
|
||||
|
||||
| arm | order | frames | tail | wall p50 ms | wall p95 ms | **client CPU p50 ms** | CPU p95 ms | fps | client total ms | server total ms |
|
||||
|---|---|---|---|---|---|---|---|---|---|---|
|
||||
| monolith (a) | 1 | 251 | 200 | 11.320 | 12.369 | **11.231** | 12.267 | 86.32 | 11060 | — |
|
||||
| inproc (a) | 2 | 251 | 200 | 7.971 | 18.196 | **7.880** | 17.466 | 106.04 | 8230 | 7800 |
|
||||
| spawn (a) | 3 | 251 | 200 | 7.989 | 18.369 | **7.876** | 17.790 | 106.12 | 8930 | 8640 |
|
||||
| inproc (b) | 4 | 251 | 200 | 8.001 | 18.072 | **7.889** | 17.489 | 105.78 | 8900 | 8390 |
|
||||
| monolith (b) | 5 | 251 | 200 | 11.287 | 12.388 | **11.240** | 12.300 | 86.26 | 10860 | — |
|
||||
| spawn (b) | 6 | 251 | 200 | 7.979 | 18.120 | **7.869** | 17.283 | 105.95 | 8960 | 8660 |
|
||||
|
||||
`client total` / `server total` are the per-role CPU **totals** the sampler accumulated over that
|
||||
repeat. They include the single shader bring-up frame, so they are *not* per-frame rates and must not
|
||||
be divided by 251 — see §5.2, where that mistake was made and caught.
|
||||
|
||||
### 2.2 The pair: `spawn` − `inproc`
|
||||
|
||||
Both orders shown rather than a cherry-picked one. The per-order column pairs are the two
|
||||
repetitions of each transport; the Δ column uses their means.
|
||||
|
||||
| metric | inproc (a / b) | spawn (a / b) | Δ (mean) | Δ % |
|
||||
|---|---|---|---|---|
|
||||
| **client CPU p50 ms/frame** | 7.880 / 7.889 | 7.876 / 7.869 | **−0.012** | **−0.15 %** |
|
||||
| client CPU p95 ms/frame | 17.466 / 17.489 | 17.790 / 17.283 | +0.059 | +0.34 % |
|
||||
| wall p50 ms | 7.971 / 8.001 | 7.989 / 7.979 | −0.002 | −0.03 % |
|
||||
| wall p95 ms | 18.196 / 18.072 | 18.369 / 18.120 | +0.111 | +0.61 % |
|
||||
| fps | 106.04 / 105.78 | 106.12 / 105.95 | +0.125 | +0.12 % |
|
||||
| client CPU total ms | 8230 / 8900 | 8930 / 8960 | +380 | +4.5 % |
|
||||
| server CPU total ms | 7800 / 8390 | 8640 / 8660 | +555 | +6.7 % |
|
||||
|
||||
**The pair is a tie on every steady-state metric.** The per-order sign *flips* on the wall columns —
|
||||
inproc is 0.03 % ahead in order (a) and spawn 0.03 % ahead in order (b) — which is the signature of
|
||||
noise rather than of an effect. The client CPU p50 column is the one to read, and it is the primary
|
||||
metric: 7.880 vs 7.876 in order (a) and 7.889 vs 7.869 in order (b), i.e. −0.15 % on the means.
|
||||
|
||||
The `* total ms` rows differ by 4.5–6.7 % and are **not** a contradiction: those totals include the
|
||||
frame-1 shader compile, whose cost varies run to run by more than the transport's whole effect. The
|
||||
per-frame columns exclude it by construction (the device summarises the trailing 200 frames), which
|
||||
is exactly why the primary metric is the per-frame one.
|
||||
|
||||
### 2.3 Run-to-run spread, and why the tie is credible
|
||||
|
||||
All 18 repeats, client CPU p50 ms/frame:
|
||||
|
||||
| arm | rep 1 | rep 2 | rep 3 | spread |
|
||||
|---|---|---|---|---|
|
||||
| monolith (a) | 11.297 | 11.346 | 11.231 | 1.0 % |
|
||||
| inproc (a) | 7.885 | 7.880 | 7.901 | 0.3 % |
|
||||
| spawn (a) | 7.876 | 8.049 | 7.952 | 2.2 % |
|
||||
| inproc (b) | 7.881 | 7.889 | 7.872 | 0.2 % |
|
||||
| monolith (b) | 11.388 | 11.300 | 11.240 | 1.3 % |
|
||||
| spawn (b) | 7.861 | 7.869 | 8.191 | 4.2 % |
|
||||
|
||||
Within-arm spread is 0.2–4.2 %, and the four `inproc`/`spawn` arms land in 7.87–7.95. The
|
||||
between-transport difference (−0.006 ms) is an order of magnitude below the spread of the arms it is
|
||||
drawn from. **This is a tie, stated as a tie.**
|
||||
|
||||
### 2.4 Against the `monolith` control
|
||||
|
||||
Not part of the pair, recorded per the protocol as the baseline row:
|
||||
|
||||
| comparison | client CPU p50 ms | Δ | fps | Δ |
|
||||
|---|---|---|---|---|
|
||||
| monolith → inproc | 11.236 → 7.885 | **−29.8 %** | 86.29 → 105.91 | +22.7 % |
|
||||
| monolith → spawn | 11.236 → 7.873 | **−29.9 %** | 86.29 → 106.04 | +22.9 % |
|
||||
|
||||
Both split transports are ~30 % cheaper on client CPU than monolith on this workload, and the
|
||||
`spawn` arm reaches it through a socket rather than a shared address space. **The doorbell's cost is
|
||||
not visible at this workload's resolution.**
|
||||
|
||||
---
|
||||
|
||||
## 3. Arm proof (contract §9.5)
|
||||
|
||||
Every spawn entry recorded the child pid **and** `transport=spawn` in its own private log. The
|
||||
runner also ran `--require-spawn`'s checks:
|
||||
|
||||
| arm | `Config: MOBILEGL_TRANSPORT=spawn` | `spawn ARMED - the server role runs in pid N` | server log pulled | verdict |
|
||||
|---|---|---|---|---|
|
||||
| spawn (a) | present | `pid 29990` | yes | OK |
|
||||
| spawn (b) | present | `pid 22130` | yes | OK |
|
||||
|
||||
```
|
||||
[Android MobileGLTraceRe/INFO]: MG_Remote client: spawn ARMED - the server role runs in pid 29990,
|
||||
reached at "@mgl-23197-12970367462759574816"
|
||||
```
|
||||
|
||||
Both `inproc` arms carry `Config: MOBILEGL_TRANSPORT=inproc - the MGPipe record stream crosses a
|
||||
real ring to an apply thread` and a `Config: IPC` line reading
|
||||
`ring=8MiB stage=32MiB spin=50us … verb-barrier=1 run-ahead=1 present-credit=1 strict=1
|
||||
role-split-state=1`. Both `monolith` arms carry **neither** marker and **no** `Config: IPC` line —
|
||||
the control stayed a control. Zero `Fatal{` records in any of the 12 role logs.
|
||||
|
||||
Logs are per-role as P6 requires: `mobilegl.client.log` and `mobilegl.server.log` both pulled for
|
||||
every arm that has a server role. The monolith arms legitimately produce only the client file.
|
||||
|
||||
---
|
||||
|
||||
## 4. Gate 8 item ① — the doorbell ledger, and the arms measured together
|
||||
|
||||
### 4.1 The four counters
|
||||
|
||||
`srv` / `srvpark` = entries into the apply thread's `Doorbell::Wait` and the subset that stopped
|
||||
spinning and blocked. `cli` / `clipark` = the same for the client producer. **Both pairs are RUN
|
||||
TOTALS**, not window values — `PipeStats.h` says so beside the Gauge enum, and the rates below
|
||||
therefore divide by the run's `frames=251`, **not** by the `window=` on the same line. Dividing by
|
||||
`window=` inflates the rate by run/window (here ~21×) into a number that looks plausible and is not.
|
||||
|
||||
### 4.2 `inproc` (both arms agree)
|
||||
|
||||
| arm | srv | srvpark | cli | clipark | srv/f | srvpark/f | cli/f | clipark/f |
|
||||
|---|---|---|---|---|---|---|---|---|
|
||||
| inproc (a) | 2 738 247 | 1 543 | 30 407 | 1 548 | 10909.4 | 6.15 | 121.1 | 6.17 |
|
||||
| inproc (b) | 2 727 377 | 1 281 | 30 407 | 1 399 | 10866.0 | 5.10 | 121.1 | 5.57 |
|
||||
|
||||
Read: **~10 900 server waits per frame** at 1471 draws/frame — about 7.4 waits per draw, on a shared
|
||||
cache line, with only **0.06 % of them parking** (1 543 of 2.74 M). The client's own pair is far
|
||||
smaller: **121 waits/frame, 0.06 % parking**. The spin budget is covering the handoff almost
|
||||
completely, which matches the P5d/P5e characterisation (`SPIN_US=50`, parks near zero, the cost is
|
||||
the rendezvous itself) and confirms that the contract's "1600 spins/frame on a shared cache line"
|
||||
note is about the *right* quantity — the server side of the rendezvous, not the client's.
|
||||
|
||||
That ratio is the number that makes the socket comparison interesting: `inproc` pays 10 900
|
||||
cache-line rendezvous per frame, and each one is a spin on memory both threads share.
|
||||
|
||||
### 4.3 `spawn` — the client half, and why the server half is missing
|
||||
|
||||
| arm | cli | clipark | cli/f | clipark/f | srv | srvpark |
|
||||
|---|---|---|---|---|---|---|
|
||||
| spawn (a) | 30 401 | 1 538 | 121.1 | 6.13 | **unavailable** | **unavailable** |
|
||||
| spawn (b) | 30 401 | 1 530 | 121.1 | 6.10 | **unavailable** | **unavailable** |
|
||||
|
||||
The client-side numbers are **byte-for-byte the `inproc` client numbers** (30 407 vs 30 401, 121.1/f
|
||||
both, parks within 1 %). That is the expected shape — the client does the same work either way — and
|
||||
it is the first half of item ①: **the client's wait count and park rate are transport-invariant**, so
|
||||
whatever the socket changes, it is not the client's wait frequency.
|
||||
|
||||
The server half is not collected because **the spawn server process never enables PipeStats at all**
|
||||
(§6). Its client log prints `srv=0 srvpark=0` for the whole run, which is the "another process"
|
||||
zero `PipeStats.h` warns about, not a measurement of zero waits. An earlier OpenRA spawn run showed
|
||||
the same: no `MGPipe stats:` line in `mobilegl.server.log` and no `counters ON` line either.
|
||||
|
||||
### 4.4 What item ① can and cannot say
|
||||
|
||||
- **Client side**: measured on both arms. 121.1 waits/frame, 6.1 parks/frame, transport-invariant.
|
||||
- **Server side under `inproc`**: measured. 10 866–10 909 waits/frame, 5.1–6.2 parks/frame, 0.06 % park rate.
|
||||
- **Server side under `spawn`**: **not measureable on this build.** The relative cost of a socket
|
||||
`read()`/`write()` handoff against a shared-cache-line spin cannot be quoted as a ratio from this
|
||||
session, because one of its two halves does not exist.
|
||||
|
||||
The honest statement is therefore the one §2 already supports: at this workload the two transports
|
||||
produce the **same steady-state client CPU per frame to within 0.2 %**, so a socket handoff replacing
|
||||
a spin+park handoff costs *nothing detectable* — even though the doorbell's own accounting on the
|
||||
spawn side is invisible. The contract's hypothesis (§9's note: "converting ~1600 spins/frame into
|
||||
~4 blocking reads/frame may be cheaper") is **not falsified and not confirmed**; the observable it
|
||||
should have moved, client CPU ms/frame, did not move in either direction.
|
||||
|
||||
---
|
||||
|
||||
## 5. Known issues and traps found while collecting
|
||||
|
||||
All five are reported because each one produced a plausible-looking wrong number before it was
|
||||
caught, and three of them are in the harness rather than in MobileGL.
|
||||
|
||||
### 5.1 This unit cannot reach the GPU's top pwrlevel (device fact, hardcoded)
|
||||
|
||||
`pin_device.sh`'s new `2f7cbe2e` row pins kgsl `min/max_pwrlevel = 0`, but on **this** unit that
|
||||
yields `gpuclk = 1050000000`, **not** 1100000000:
|
||||
|
||||
```
|
||||
thermal_pwrlevel = 1 # latches: writing 0 returns success and reads back 1
|
||||
max_gpuclk = 1050000000 # read-only; a write is accepted and ignored
|
||||
devfreq/max_freq = 1050000000 # clamps a 1100000000 write down
|
||||
```
|
||||
|
||||
So the row records `GPU_PINNED_FREQ=1050000000` — *the fastest frequency this board will actually
|
||||
run*, not the top OPP — and `check` compares against the truth. Consequence for the campaign,
|
||||
stated where the number is: **absolute times from this device are not comparable with the
|
||||
`35d0befa` rows taken while it could reach 1100 MHz.** Only same-session pairs are.
|
||||
|
||||
### 5.2 A per-frame rate divided by the whole run (harness, fixed)
|
||||
|
||||
The sampler's steady-state reporting originally divided a replay's total per-role CPU by the frame
|
||||
count. Frame 1 of this fixture costs **7332 ms** of client CPU (one shader/pipeline bring-up) against
|
||||
7.7–8.5 ms for each of the other 250, so that column read ~32 ms/frame beside a device median of
|
||||
7.9. The device's own two series (`frameCpuTimesMs[]`, and the `medianFrameCpuMs` it summarises over
|
||||
the tail) are the correct source for per-frame figures; the sampler contributes **roles and totals**,
|
||||
which is what the doorbell comparison needs and what the client-only series cannot express. Fixed in
|
||||
`render_gate7.py` (`steady_state_cpu`, `role_totals`), and the reversal is documented there.
|
||||
|
||||
### 5.3 `--transport` is silently ignored in `--benchmark` mode (harness trap)
|
||||
|
||||
`run_android_retrace_local.py` applies `--transport` through `run_case()`, but `run_benchmark_case()`
|
||||
passes `args.env` alone. **`--benchmark --transport spawn` runs monolith while its label says
|
||||
spawn** — measured: a `--benchmark` run with `--transport inproc` wrote no `Config: IPC` line at all.
|
||||
Every arm in §1 therefore spells its transport as an explicit `--env MOBILEGL_TRANSPORT=…` and every
|
||||
arm is verified against the library's own log afterwards. Not changed in the tree (out of scope);
|
||||
worth a fix in the runner or a guard in the arm-proof.
|
||||
|
||||
### 5.4 `MOBILEGL_RETRACE_USE_PBUFFER` must be exported, not passed as `--env` (harness trap)
|
||||
|
||||
`trace-replay-ci.sh` reads that variable **itself**, to add `--ez use_pbuffer true` to the intent. A
|
||||
`--env` override only reaches the in-process applier of env knobs, which is a different mechanism, so
|
||||
the retrace still asks for a window surface. That is fatal **on the spawn arm and only there**: an
|
||||
`ANativeWindow*` is a pointer into the client's process and the wire refuses it by name (Rule H),
|
||||
measured as a SessionFault carrying `Fatal{UnmigratedSurface, "AndroidNativeWindow@P12"}`. The
|
||||
script's own environment is what makes it work.
|
||||
|
||||
### 5.5 The spawn arm needs a distinct package id (environment fact)
|
||||
|
||||
The machine carries a pre-existing trace install under `top.mobilegl.plugin.trace` signed with a key
|
||||
that no longer exists in this session's reach, and two APKs signed by different keys cannot share an
|
||||
id. Replacing it would have destroyed state this campaign does not own, so the gate-7 build was
|
||||
installed as `top.mobilegl.plugin.p6gate7.trace` and the runner's package constant was overridden via
|
||||
`MOBILEGL_TRACE_PACKAGE` in the **snapshot's** copy of `run_android_retrace_local.py` only (the tree
|
||||
copy is untouched). The existing install was left exactly as found.
|
||||
|
||||
---
|
||||
|
||||
## 6. Finding: the spawn server process never enables PipeStats
|
||||
|
||||
**`MG_Util::PipeStats::Init()` is called from exactly one place, `MobileGL::Initialize()`
|
||||
(`MobileGL/Init.cpp:123`). The spawn server process does not call `MobileGL::Initialize()`** — it
|
||||
calls `MG_ConfigLoader::Init()` and then `MG_Backend::InitServerRoleForSpawn()`
|
||||
(`MG_Remote/Server/ServerMain.cpp:181`, `:198`). Neither of those reaches `PipeStats::Init()`.
|
||||
|
||||
Consequences, all observed rather than inferred:
|
||||
|
||||
- `g_pipeStatsEnabled` stays `false` in the server process, so **none** of the 68 `PipeStats::Enabled()`
|
||||
gates fire there — the four `wait[]` gauges, the ring gauges, the byte-class and call-class counters
|
||||
and the summary line itself.
|
||||
- `mobilegl.server.log` contains no `MGPipe stats:` line and no `counters ON` line, on either
|
||||
workload (rd12, 251 frames; OpenRA, 128 frames), on both spawn arms and on the exploratory runs.
|
||||
The client log's `wait[srv=0 srvpark=0]` is therefore structural, exactly as `PipeStats.h`
|
||||
describes for the spawn case.
|
||||
- The server-side **byte** and **record** classes (`buf/f`, `tex/f`, `maxrec`) are likewise
|
||||
unavailable under spawn. Under `inproc` the same server role writes them into
|
||||
`mobilegl.server.log` and they are collected normally.
|
||||
|
||||
This is **not** repaired here: it is a MobileGL source change, and this task is explicitly barred from
|
||||
touching MobileGL. It is reported as a finding with its exact cause so the next stage can decide
|
||||
whether `PipeStats::Init()` belongs in `InitServerRoleForSpawn()`/`ServerMain` (which would make the
|
||||
gate-8 numbers collectable on both split transports) or whether the server's counters are meant to
|
||||
stay a spawn-blind spot.
|
||||
|
||||
**It does not affect the §2 pair**: the primary metric is the client thread's own per-frame CPU clock,
|
||||
taken from `benchmark.json` in the client process, where PipeStats is enabled and irrelevant.
|
||||
|
||||
---
|
||||
|
||||
## 7. What was added
|
||||
|
||||
| path | what |
|
||||
|---|---|
|
||||
| `tools/device_bench/pin_device.sh` (+28 lines) | the `2f7cbe2e` device row: policies/stock/pins, kgsl nodes, `thermal_pwrlevel=1` / 1050 MHz ceiling, thermal type `cpuss-0-0`. All three actions verified (§8) |
|
||||
| `tools/device_bench/p6/gate7_ab.py` (snapshot only) | the reboot-clean / pin / interleave / arm-proof orchestrator and per-thread CPU sampler |
|
||||
| `tools/device_bench/p6/render_gate7.py` (snapshot only) | evidence → markdown tables |
|
||||
| `tools/trace_replay/run_android_retrace_local.py` (snapshot only) | `MOBILEGL_TRACE_PACKAGE` override (§5.5) |
|
||||
|
||||
Only `pin_device.sh` is in the shared tree. The other three exist in
|
||||
`C:/Users/geekerwan/p6-snap/MobileGL-disagg` and should be promoted deliberately rather than as a
|
||||
side effect of this run.
|
||||
|
||||
---
|
||||
|
||||
## 8. `pin_device.sh 2f7cbe2e` verification
|
||||
|
||||
Every value measured on this unit on 2026-09-22, then exercised through all three actions:
|
||||
|
||||
```
|
||||
$ bash tools/device_bench/pin_device.sh 2f7cbe2e check # at stock
|
||||
big policy6 gov=walt cur=3072000 min=1017600 max=3072000 (pin 1958400 / stock 1017600-3072000)
|
||||
little policy0 gov=walt cur=2745600 min=384000 max=2745600 (pin 1555200 / stock 556800-2745600)
|
||||
gpu kgsl-3d0 pwrlevel=0..12 freq=443000000 Hz busy=0% (pin lvl 0 = 1050000000 Hz / stock lvl 0..12)
|
||||
thermal cpuss-0-0 35200 mC = 35.2 C (/sys/class/thermal/thermal_zone13)
|
||||
VERDICT: UNPINNED rc=2
|
||||
|
||||
$ bash tools/device_bench/pin_device.sh 2f7cbe2e pin
|
||||
... after pin ...
|
||||
big cur=1958400 min=1958400 max=1958400 | little cur=1555200 min=1555200 max=1555200
|
||||
gpu pwrlevel=0..0 freq=1050000000 Hz
|
||||
VERDICT: PINNED - all 3 pinned nodes at their pins, live frequencies match. rc=0
|
||||
|
||||
$ bash tools/device_bench/pin_device.sh 2f7cbe2e unpin
|
||||
little min=556800 max=2745600 | big min=1017600 max=3072000 | gpu pwrlevel=0..12
|
||||
VERDICT: UNPINNED rc=0
|
||||
```
|
||||
|
||||
Also verified: the pin **holds under load** (8 concurrent busy loops → still `PINNED`; a
|
||||
partially-pinned state was correctly reported as `DRIFT` mid-experiment rather than silently
|
||||
accepted) and is **stable at idle** over 90 s. Stock values are hardcoded, not sampled at pin time,
|
||||
so a restore cannot read "stock" off an already-pinned device and make the pin permanent.
|
||||
|
||||
---
|
||||
|
||||
## 9. Judgement
|
||||
|
||||
**Gate 7 (paired A/B, reboot-clean, one thermal window) — met.** Six arms, three repeats each,
|
||||
`spawn` interleaved against `inproc` in both orders within one window, every arm's pin checked before
|
||||
and after, one boot id for the whole window with the reboot proven by the id change.
|
||||
|
||||
**Gate 8 item ① — client half met, server half blocked by §6.** Not dressed up: the ratio the item
|
||||
asks for cannot be computed from this session, and the reason is a named, located code path rather
|
||||
than a missed collection step.
|
||||
|
||||
**The performance reading.** `spawn` and `inproc` are the same transport as far as the client's CPU
|
||||
per frame is concerned (−0.15 % with the sign flipping between orders), and both are ~30 % cheaper
|
||||
than `monolith`. Per the campaign's standing rule these numbers are **recorded, not gated**. The
|
||||
targeted question — does a socket doorbell beat a shared-cache-line spin+park — came back
|
||||
**inconclusive rather than negative**: the client-side wait accounting is identical across
|
||||
transports, and the server-side accounting that would have shown the difference is not being
|
||||
collected under spawn at all.
|
||||
|
||||
---
|
||||
|
||||
## 10. Raw evidence, quoted
|
||||
|
||||
### 10.1 Boot id (the reboot, before and after)
|
||||
|
||||
```
|
||||
$ adb -s 2f7cbe2e shell cat /proc/sys/kernel/random/boot_id # before `adb reboot`
|
||||
e69d0329-2264-4a2d-9b00-e1a4ffb6154d
|
||||
$ adb -s 2f7cbe2e shell cat /proc/sys/kernel/random/boot_id # after boot_completed=1
|
||||
107f24d3-b1f1-4a97-ab8c-9706d1901f32
|
||||
```
|
||||
|
||||
One boot id covers all six arms; the temperature range across the 12 pin checks was 37.6–46.5 °C on
|
||||
`cpuss-0-0`.
|
||||
|
||||
### 10.2 Pin evidence, `inproc` arm (a) — representative of all six
|
||||
|
||||
```
|
||||
== before pin ==
|
||||
device : Redmi M332BF / SM8750 / Adreno 830v2 (2f7cbe2e)
|
||||
big policy6 gov=walt cur=1958400 min=1958400 max=1958400 (pin 1958400 / stock 1017600-3072000)
|
||||
little policy0 gov=walt cur=1555200 min=1555200 max=1555200 (pin 1555200 / stock 556800-2745600)
|
||||
gpu kgsl-3d0 pwrlevel=0..0 freq=1050000000 Hz busy=4% (pin lvl 0 = 1050000000 Hz / stock lvl 0..12)
|
||||
thermal cpuss-0-0 39500 mC = 39.5 C (/sys/class/thermal/thermal_zone13)
|
||||
|
||||
== after pin ==
|
||||
... identical node values ...
|
||||
VERDICT: PINNED - all 3 pinned nodes at their pins, live frequencies match.
|
||||
```
|
||||
|
||||
…and, after the arm's three repeats:
|
||||
|
||||
```
|
||||
== check ==
|
||||
big policy6 gov=walt cur=1958400 min=1958400 max=1958400
|
||||
little policy0 gov=walt cur=1555200 min=1555200 max=1555200
|
||||
gpu kgsl-3d0 pwrlevel=0..0 freq=1050000000 Hz busy=22%
|
||||
thermal cpuss-0-0 45300 mC = 45.3 C
|
||||
VERDICT: PINNED - all 3 pinned nodes at their pins, live frequencies match.
|
||||
```
|
||||
|
||||
Both exits are 0 (`PINNED`) for all six arms; `session-summary.json` records `pin_before_rc` and
|
||||
`pin_after_rc` per arm.
|
||||
|
||||
### 10.3 Arm proof, verbatim
|
||||
|
||||
```
|
||||
01 client: Config: MOBILEGL_TRANSPORT=inproc - the MGPipe record stream crosses a real ring to an apply thread
|
||||
03 client: Config: MOBILEGL_TRANSPORT=spawn - the MGPipe record stream crosses a real ring to an
|
||||
apply thread in ANOTHER PROCESS
|
||||
03 client: MG_Remote client: spawn ARMED - the server role runs in pid 29990,
|
||||
reached at "@mgl-23197-12970367462759574816"
|
||||
06 client: MG_Remote client: spawn ARMED - the server role runs in pid 22130,
|
||||
reached at "@mgl-16187-12970367462759644032"
|
||||
|
||||
02 client: Config: IPC ring=8MiB stage=32MiB spin=50us persistent-block=64KiB adopt-tier=2
|
||||
verb-barrier=1 run-ahead=1 present-credit=1 strict=1 audit=0 role-split-state=1 affinity='auto'
|
||||
01 client: (no `Config: IPC` line, no transport marker) <- the control stayed a control
|
||||
```
|
||||
|
||||
### 10.4 The ledger lines, verbatim (`inproc` arm (b), client and server logs)
|
||||
|
||||
```
|
||||
client: ... wait[srv=2727377 srvpark=1281 cli=30407 clipark=1399] gates[ers=...]
|
||||
server: ... wait[srv=2694923 srvpark=1273 cli=30239 clipark=1392] gates[ers=...]
|
||||
|
||||
spawn arm (a), client log only — the server file has no summary line at all:
|
||||
client: ... wait[srv=0 srvpark=0 cli=30401 clipark=1538] gates[ers=0/0 etl=0/0 eub=0/0 ...]
|
||||
```
|
||||
|
||||
### 10.5 Byte classes and record size, `inproc` (gate 8 items ② and ③ input)
|
||||
|
||||
From the trailing window of the `inproc` arms (`window=120` / client `window=11`, `frames=251`):
|
||||
|
||||
| role | window | run frames | buf/f | tex/f | ubog/f | ubon/f | csob-blob/f | resid/f | maxrec | maxcap |
|
||||
|---|---|---|---|---|---|---|---|---|---|---|
|
||||
| client | 11 | 251 | 10 289.45 | 342 341.82 | 281 585.45 | 0 | 281 568.00 | 161.45 | 1808 | 4 194 304 |
|
||||
| server | 120 | 251 | 10 290.00 | 357 348.93 | 281 586.00 | 0 | 281 586.00 | 163.00 | 1808 | 4 194 304 |
|
||||
|
||||
`maxrec=1808` against a 4 MiB cap (0.04 %) — **content chunking is not exercised by this workload**,
|
||||
and `ringwaits=0`. These are recorded here as input to gate 8 items ②/③, not as the item's answer:
|
||||
item ③ ("records/frame post-chunking") needs the per-record distribution, which this summary line
|
||||
does not carry — `MEASUREMENTS.md:342` already says in as many words that no post-chunking
|
||||
distribution exists, and this session does not create one. Item ② (`SEG_STAGE` bytes/frame) is
|
||||
readable from `buf/f + tex/f + ubog/f + vtxc/f + idxc/f + icmd/f`, but only on the **`inproc`
|
||||
server role**; under `spawn` the server-side byte classes are unavailable for §6's reason.
|
||||
|
||||
@@ -0,0 +1,333 @@
|
||||
# Gate 8 item ① — the doorbell, measured on the device (server half included)
|
||||
|
||||
2026-09-22, branch `feat/disaggregated`, source head `94c130d6`. `CONTRACT-P6.md` §9 item 8-①.
|
||||
|
||||
The number this item asks for is the socket doorbell's cost against `inproc`'s condvar. The previous
|
||||
session (`gate7-device-ab.md`) delivered the **client** half of that ledger and reported the
|
||||
**server** half as structurally missing: `PipeStats::Init()` was called only from
|
||||
`MobileGL::Initialize()`, which the spawn server process never runs, so every counter in it —
|
||||
`ServerLoop`'s own `ServerWaits`/`ServerParks` publish included — was compiled in and permanently
|
||||
false there. That gap is now closed in the tree (`MG_Remote/Server/ServerMain.cpp`, step 1.6 +
|
||||
the matching `Shutdown`), and this session re-runs the focused protocol to collect the missing half.
|
||||
|
||||
**Verdict up front.** The server half is now real and reproducible: the spawn server counts
|
||||
**10 415–10 416 server waits per frame**, against `inproc`'s **11 434–11 963**. The previous
|
||||
session's judgement is unchanged — the pair remains a **tie** on client CPU per frame (7.992/8.009
|
||||
vs 7.987/7.989, a 0.2 % difference with the arms' own spread larger than that), and both are ~30 %
|
||||
cheaper than monolith. The doorbell hypothesis in §9's note — that a socket blocking read may be
|
||||
*cheaper* than `inproc`'s spin+park — is now **answerable and answered: no measurable difference
|
||||
either way on this workload.**
|
||||
|
||||
---
|
||||
|
||||
## 1. Protocol actually executed
|
||||
|
||||
Focused, not the full six-arm matrix: two transports, interleaved, best-of-2, one window.
|
||||
|
||||
| item | value |
|
||||
|---|---|
|
||||
| device | Redmi `M332BF`, serial `2f7cbe2e`, SM8750 / Adreno 830v2 |
|
||||
| reboot | `adb reboot`, `sys.boot_completed=1`, boot id compared |
|
||||
| boot id before | `107f24d3-b1f1-4a97-ab8c-9706d1901f32` |
|
||||
| **boot id after** | **`7e6c6e9f-1894-4916-bf39-cce48c9abd37`** (changed ⇒ the reboot is a fact) |
|
||||
| CPU pin | little `policy0` → 1555200, big `policy6` → 1958400 |
|
||||
| GPU pin | `kgsl-3d0` `min/max_pwrlevel = 0` → **1050000000 Hz** (this unit cannot reach 1100 MHz) |
|
||||
| fan | `target_level=2`, `real_speed=14404` rpm, `pwm_duty=65` |
|
||||
| arm order | `inproc, spawn, spawn, inproc` — interleaved, one window |
|
||||
| repeats | `--benchmark-repeats 2`, `--benchmark-tail-frames 200`, `--benchmark-no-finish`, best-of-2 |
|
||||
| workload | `minecraft-1.21.4-rd12-odinlite-in-world`, DirectGLES, 251 frames, **1471.36 draws/frame** |
|
||||
| stats | `MOBILEGL_PIPE_STATS=1`, `MOBILEGL_PIPE_STATS_PERIOD=120` |
|
||||
| split knobs | `MOBILEGL_IPC_ROLE_SPLIT_STATE=1`, `MOBILEGL_IPC_STRICT_ERRORS=1`, `MOBILEGL_IPC_RUN_AHEAD=1` |
|
||||
| **not set** | `MOBILEGL_PIPE_STATS_FILE` — deliberately absent this round (another agent is changing its role-suffix handling) |
|
||||
| APK | `MobileGL-plugin-trace-release-p6gate8.apk`, sha256 `5eaf26c873c55fefb36f31f4a89364c71105d4cb8c0e6578f447d3a466378f86` |
|
||||
| result | **4/4 runner exits 0, 8/8 pin checks `PINNED`, 0 `Fatal{`** |
|
||||
|
||||
Temperature across the 8 pin checks: **37.2 – 44.9 °C** on `cpuss-0-0`.
|
||||
|
||||
### 1.1 Build (from a snapshot, with the ServerMain fix)
|
||||
|
||||
```bash
|
||||
# snapshot of the worktree, excluding .git / cmake-build-debug / build / .cxx / .trace-work /
|
||||
# Testing / android-plugin/{app/build,.gradle,build}; the four nested 3rdparty/.../build dirs that
|
||||
# name-matching also caught were restored afterwards
|
||||
cd /c/Users/geekerwan/p6-snap2/MobileGL-disagg
|
||||
export JAVA_HOME="C:/Program Files/Java/jdk-21"
|
||||
export JAVA_TOOL_OPTIONS='-Djdk.net.unixdomain.tmpdir=C:\Users\geekerwan\.gradle\uds'
|
||||
export ANDROID_HOME="C:/Users/geekerwan/AppData/Local/Android/Sdk"
|
||||
"/c/Users/geekerwan/.gradle/wrapper/dists/gradle-8.13-bin/5xuhj0ry160q40clulazy9h7d/gradle-8.13/bin/gradle.bat" \
|
||||
--no-daemon -p android-plugin :app:assembleTraceRelease \
|
||||
-Pmobilegl.buildDisaggregated=ON -Pmobilegl.buildDisaggregatedInproc=ON -Pmobilegl.pipePush=ON \
|
||||
-Pmobilegl.apkSuffix=p6gate8 -Pmobilegl.debuggableRelease=true \
|
||||
-Pmobilegl.applicationIdSuffix=.p6gate8 -Pmobilegl.logLevel=MOBILEGL_LOG_LEVEL_INFO
|
||||
# BUILD SUCCESSFUL in 2m 33s (cold, 53 tasks executed)
|
||||
|
||||
apksigner sign --ks ~/.android/debug.keystore --ks-pass pass:android \
|
||||
--ks-key-alias androiddebugkey --key-pass pass:android --out signed.apk unsigned.apk
|
||||
```
|
||||
|
||||
The source under test is the tree's own fix; `grep -c "PipeStats::Init()"
|
||||
MobileGL/MG_Remote/Server/ServerMain.cpp` = 2 (init + the comment), and the call sits **after**
|
||||
`MG_ConfigLoader::Init()` (so `Features.PipeStats` is already parsed and the latch reads the real
|
||||
value) and **after** `MGPipeSetServerProcessRole(true)` (so the log sink files the line as the
|
||||
server's).
|
||||
|
||||
### 1.2 The run
|
||||
|
||||
```bash
|
||||
cd /c/Users/geekerwan/p6-snap2/MobileGL-disagg
|
||||
python tools/device_bench/p6/ab_session.py \
|
||||
--tree "C:/Users/geekerwan/p6-snap2/MobileGL-disagg" \
|
||||
--out "C:/Users/geekerwan/p6-snap2/evidence" \
|
||||
--apk 'C:\Users\geekerwan\p6-snap2\artifacts\trace-p6gate8-debugsigned.apk' \
|
||||
--package top.mobilegl.plugin.p6gate8.trace \
|
||||
--reboot --fan-level 2 --repeats 2 --session gate8-doorbell \
|
||||
--arm inproc:DirectGLES:minecraft-1.21.4-rd12-odinlite-in-world:2 \
|
||||
--arm spawn:DirectGLES:minecraft-1.21.4-rd12-odinlite-in-world:2 \
|
||||
--arm spawn:DirectGLES:minecraft-1.21.4-rd12-odinlite-in-world:2 \
|
||||
--arm inproc:DirectGLES:minecraft-1.21.4-rd12-odinlite-in-world:2
|
||||
|
||||
python tools/device_bench/p6/render_ab.py <session>/session-summary.json
|
||||
```
|
||||
|
||||
Evidence root: `C:/Users/geekerwan/p6-snap2/evidence/gate8-doorbell/`. Four arm directories, each
|
||||
with `mobilegl.client.log` **and** `mobilegl.server.log`, `pin-before.txt`, `pin-after.txt`,
|
||||
`benchmark-run{1,2}.json`, `arm-summary.json`; plus `session-summary.json`.
|
||||
|
||||
---
|
||||
|
||||
## 2. Arm proof (contract §9.5)
|
||||
|
||||
| arm | transport marker | `spawn ARMED - …pid N` | server log pulled | verdict |
|
||||
|---|---|---|---|---|
|
||||
| inproc (a) | `MOBILEGL_TRANSPORT=inproc` | n/a | yes | OK |
|
||||
| spawn (a) | `MOBILEGL_TRANSPORT=spawn` | `pid 18331` | yes | OK |
|
||||
| spawn (b) | `MOBILEGL_TRANSPORT=spawn` | `pid 21400` | yes | OK |
|
||||
| inproc (b) | `MOBILEGL_TRANSPORT=inproc` | n/a | yes | OK |
|
||||
|
||||
```
|
||||
[Android MobileGLTraceRe/INFO]: MG_Remote client: spawn ARMED - the server role runs in pid 18331,
|
||||
reached at "@mgl-13833-12970367463263226992"
|
||||
[Android MobileGLTraceRe/INFO]: MG_Remote client: spawn ARMED - the server role runs in pid 21400,
|
||||
reached at "@mgl-17377-12970367463263231936"
|
||||
```
|
||||
|
||||
The per-thread CPU sampler corroborates the same topology independently — this is what "two
|
||||
processes" means on the device, read straight out of `/proc/<pid>/task/*`:
|
||||
|
||||
```
|
||||
inproc, repeat 1: pid 12188 tid 13614 client-gl MobileGLTraceRe 8990 ms
|
||||
pid 12188 tid 13618 apply mgl-srv-apply 8590 ms <- SAME pid
|
||||
spawn, repeat 1: pid 13831 tid 17165 client-gl MobileGLTraceRe 9000 ms
|
||||
pid 17166 tid 17195 apply mgl-srv-apply 8060 ms <- different pid
|
||||
spawn, repeat 2: pid 13833 tid 18329 client-gl MobileGLTraceRe 8920 ms
|
||||
pid 18331 tid 18342 apply mgl-srv-apply 8570 ms <- == the armed pid
|
||||
```
|
||||
|
||||
`Config: IPC ring=8MiB stage=32MiB spin=50us … verb-barrier=1 run-ahead=1 present-credit=1 strict=1
|
||||
role-split-state=1` present on every arm. Zero `Fatal{` in all 8 role logs.
|
||||
|
||||
---
|
||||
|
||||
## 3. The doorbell ledger — the complete table
|
||||
|
||||
The four counters are **RUN TOTALS**, so the rates divide by the run's `frames=`, never by the
|
||||
`window=` on the same line. Two structural facts decide *which log* each pair comes from, and both
|
||||
were confirmed by this session rather than assumed:
|
||||
|
||||
- **`srv`/`srvpark`** are published by the apply thread into **its own process's** PipeStats. Under
|
||||
`inproc` both roles are threads of one process, so the client's line carries them; under `spawn`
|
||||
they are in `mobilegl.server.log` and the client's line prints `srv=0 srvpark=0` — a zero that
|
||||
means "another process", not "never waited".
|
||||
- **`frames=`** is bumped by `PipeStats::OnPresent`, which the backend calls on Present. Under
|
||||
`spawn` present is applied **in the server process**, so the *client's* `frames=0 window=0` — the
|
||||
same shape of structural zero. The rate denominators below therefore use the client's count under
|
||||
`inproc` and the server's under `spawn`, and the column says which.
|
||||
|
||||
| arm | transport | counters from | frames from | `cli frames=` | `srv frames=` | srv | srvpark | cli | clipark | **srv/f** | **srvpark/f** | **cli/f** | **clipark/f** |
|
||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||
| 01 | inproc | client-log | client-log | 251 | 240 | 2 869 874 | 1 341 | 30 407 | 1 444 | **11433.8** | **5.343** | **121.1** | **5.753** |
|
||||
| 02 | spawn | client(cli)+server(srv) | server-log | 0 | 251 | 2 614 177 | 1 229 | 30 401 | 1 524 | **10415.0** | **4.896** | **121.1** | **6.072** |
|
||||
| 03 | spawn | client(cli)+server(srv) | server-log | 0 | 251 | 2 614 456 | 1 170 | 30 401 | 1 525 | **10416.2** | **4.661** | **121.1** | **6.076** |
|
||||
| 04 | inproc | client-log | client-log | 251 | 240 | 3 002 771 | 1 265 | 30 407 | 1 406 | **11963.2** | **5.040** | **121.1** | **5.602** |
|
||||
|
||||
**Wait, and a reading of each column.**
|
||||
|
||||
- **`srv/f` — the server's rendezvous rate.** `inproc` 11 434 / 11 963; `spawn` 10 415 / 10 416.
|
||||
That is **7.1 per draw** on both spawn arms against **7.8 / 8.1** on the inproc arms
|
||||
(1471.36 draws/frame). The spawn arm is **8.9–12.9 % lower**, which is the one directional
|
||||
difference in this table; §3.1 says why it should not be read as a transport win.
|
||||
- **`srvpark/f` — how often that rendezvous actually blocked.** 5.34 / 5.04 (`inproc`) against
|
||||
4.90 / 4.66 (`spawn`). **0.042–0.047 % of server waits park** — the spin budget covers essentially
|
||||
all of them on both transports. This is the P5d/P5e characterisation holding: the cost is the
|
||||
rendezvous, not the wakeup.
|
||||
- **`cli/f` — the client's own waits.** **121.1 on all four arms**, identical to a tenth. The client
|
||||
does the same work either way; the transport does not change *how often* it waits.
|
||||
- **`clipark/f` — the client's parks.** 5.60 / 5.75 (`inproc`) against 6.07 / 6.08 (`spawn`): the
|
||||
spawn arm parks **5.5–8.5 % more often**. **4.6–5.0 % of client waits park** — two orders of
|
||||
magnitude more than the server side, because the client's spin budget is the one being spent
|
||||
against a producer that is frequently not yet there.
|
||||
|
||||
### 3.1 Why `srv/f` is not a like-for-like comparison
|
||||
|
||||
The `inproc` server's wait count and the `spawn` server's wait count are **not counting the same
|
||||
event**, so the 11 % difference must not be read as "the socket rendezvous happens less often".
|
||||
|
||||
Under `inproc` the apply thread's `Doorbell::Wait` is *also* the mechanism by which the client's
|
||||
queue drain is published inside one address space, and the client is in lockstep behind a verb
|
||||
barrier for a large part of the trace; under `spawn` the same loop is woken by descriptor readiness.
|
||||
Both counters count entries into `Doorbell::Wait`, but the number of times the two roles have to
|
||||
agree per frame is a property of the transport's handoff discipline, not of the doorbell's cost.
|
||||
What is comparable between the two columns is the *park ratio*, and that is near-identical
|
||||
(0.042–0.047 % both ways).
|
||||
|
||||
The honest form of the item-① answer is therefore: **the server does ~10 400–12 000 doorbell waits
|
||||
per frame on both transports, ~0.045 % of which block, and replacing the shared-cache-line spin with
|
||||
a socket read does not change the client's per-frame CPU (below).**
|
||||
|
||||
---
|
||||
|
||||
## 4. Client CPU per frame — the tie holds
|
||||
|
||||
Primary metric = the client GL thread's own `CLOCK_THREAD_CPUTIME_ID` deltas, summarised by the
|
||||
device over the trailing 200 frames (`MEASUREMENTS.md` §9's rule).
|
||||
|
||||
| arm | transport | frames | tail | wall p50 ms | wall p95 ms | **client CPU p50 ms** | CPU p95 ms | fps |
|
||||
|---|---|---|---|---|---|---|---|---|
|
||||
| 01 | inproc | 251 | 200 | 8.105 | 18.474 | **7.987** | 18.044 | 105.72 |
|
||||
| 02 | spawn | 251 | 200 | 8.116 | 18.586 | **7.992** | 17.928 | 104.43 |
|
||||
| 03 | spawn | 251 | 200 | 8.113 | 18.003 | **8.009** | 17.483 | 104.19 |
|
||||
| 04 | inproc | 251 | 200 | 8.089 | 19.295 | **7.989** | 18.030 | 103.72 |
|
||||
|
||||
Per-repeat (all 8 runs, client CPU p50 ms):
|
||||
|
||||
| arm | rep 1 | rep 2 | spread |
|
||||
|---|---|---|---|
|
||||
| inproc (a) | 7.976 | 7.987 | 0.14 % |
|
||||
| spawn (a) | 8.019 | 7.992 | 0.34 % |
|
||||
| spawn (b) | 8.030 | 8.009 | 0.26 % |
|
||||
| inproc (b) | 7.989 | 8.044 | 0.69 % |
|
||||
|
||||
**Pair delta: inproc 7.9880 (mean of 7.987/7.989) vs spawn 8.0005 (mean of 7.992/8.009) = +0.0125 ms,
|
||||
+0.16 %.** The arms' own run-to-run spread is 0.14–0.69 %, i.e. the same order as the difference.
|
||||
**This reproduces the previous session's tie** (there: inproc 7.880/7.889 vs spawn 7.876/7.869) on a
|
||||
different build and a different boot: the two transports are indistinguishable on the metric that
|
||||
matters, and what moved between the two sessions is the absolute level (~0.1 ms), which is
|
||||
run-to-run drift, not a transport effect.
|
||||
|
||||
---
|
||||
|
||||
## 5. Log excerpts, verbatim (with `frames=` / `window=`)
|
||||
|
||||
Full-window values are elided to `…`; the `wait[...]` bracket and the frame/window fields are
|
||||
original.
|
||||
|
||||
### 5.1 `inproc` arm (a)
|
||||
|
||||
```
|
||||
client: MGPipe stats: frames=251 window=11 draws=16185 draws/f=1471.36 acc=65496 acc/draw=4.05
|
||||
bytes/f[buf=10289.45 tex=342341.82 ubog=281585.45 … resid=161.45 csob-blob=281568.00 …]
|
||||
tex[emit=6 box=6 rect=0 jobs=6] cso[csom=0 csob=208 mpr=0]
|
||||
emit[fbe=68 sve=143 sse=0 sie=0 ctu=10 trp=0 rsp=0 vbs=16262 wrec=82523 wrec/f=7502.09
|
||||
maxrec=1808 maxcap=4194304 ringwraps=61 ringpads=53 ringwaits=0]
|
||||
wait[srv=2869874 srvpark=1341 cli=30407 clipark=1444]
|
||||
|
||||
server: MGPipe stats: frames=120 window=120 draws=1156748 draws/f=9639.57 …
|
||||
wait[srv=2437659 srvpark=1227 cli=28409 clipark=1355]
|
||||
MGPipe stats: frames=240 window=120 draws=176565 draws/f=1471.38 …
|
||||
wait[srv=2829654 srvpark=1315 cli=30239 clipark=1431]
|
||||
```
|
||||
|
||||
Both pairs are in the **client** log, because both roles are one process. The server log's last line
|
||||
is at its previous period boundary (`frames=240`) — the apply thread does not emit the session-final
|
||||
line; that is why the frame count for this arm comes from the client's `frames=251`.
|
||||
|
||||
### 5.2 `spawn` arm (a)
|
||||
|
||||
```
|
||||
client: MGPipe stats: frames=0 window=0 draws=0 draws/f=n/a acc=0 acc/draw=n/a
|
||||
bytes[buf=0 tex=0 … resid=174584 csob-blob=257348207 seg=2698318987]
|
||||
tex[emit=0 box=0 rect=0 jobs=0] cso[csom=27 csob=20330 mpr=0]
|
||||
emit[fbe=9142 sve=20821 sse=3 sie=0 ctu=1644 trp=0 rsp=0 vbs=0 wrec=6929844 wrec/f=6929844
|
||||
maxrec=1808 maxcap=4194304 ringwraps=61 ringpads=52 ringwaits=0]
|
||||
wait[srv=0 srvpark=0 cli=30401 clipark=1524]
|
||||
|
||||
server: MGPipe stats: frames=120 window=120 draws=1156748 draws/f=9639.57 …
|
||||
wait[srv=2219341 srvpark=1137 cli=0 clipark=0]
|
||||
MGPipe stats: frames=240 window=120 draws=176565 draws/f=1471.38 …
|
||||
wait[srv=2582289 srvpark=1222 cli=0 clipark=0]
|
||||
MGPipe stats: frames=251 window=11 draws=16185 draws/f=1471.36 …
|
||||
wait[srv=2614177 srvpark=1229 cli=0 clipark=0]
|
||||
```
|
||||
|
||||
**The two structural zeros and why neither is a measurement.** The client's `frames=0 window=0` says
|
||||
this process counted no frames — it never presents, present is applied in the server. Its
|
||||
`srv=0 srvpark=0` says the server's counters live in another process. Symmetrically the server's
|
||||
`cli=0 clipark=0` is the client's own producer, which is not in that process. Reading any of the
|
||||
three as "zero waits" is the mistake this table exists to prevent.
|
||||
|
||||
Also visible: the spawn **client** does count the byte and record classes (`resid`, `csob-blob`,
|
||||
`wrec=6929844`, `ringwraps=61`), because those are published by the emitter that runs in the client
|
||||
process; the spawn **server** reports `0` for them because the server publishes only what its own
|
||||
role produces. So gate 8 item ② (`SEG_STAGE` bytes/frame) is readable on the client under both
|
||||
transports; item ③ (records/frame) likewise (`wrec/f`), with the caveat that `wrec` is a client-side
|
||||
emission count rather than the server's applied count.
|
||||
|
||||
---
|
||||
|
||||
## 6. The fix this session verifies
|
||||
|
||||
`MG_Remote/Server/ServerMain.cpp`, step 1.6:
|
||||
|
||||
```
|
||||
MobileGL::MG_Util::PipeStats::Init(); // after MG_ConfigLoader::Init and
|
||||
// MGPipeSetServerProcessRole(true)
|
||||
```
|
||||
|
||||
plus the matching `PipeStats::Shutdown()` before `_exit(0)` (after `loop.Stop()`, so the apply
|
||||
thread is not still publishing, and before `_exit`, which runs no atexit handler).
|
||||
|
||||
**Before/after on this protocol:**
|
||||
|
||||
| | previous session (`gate7-device-ab.md`) | this session |
|
||||
|---|---|---|
|
||||
| spawn server summary lines in `mobilegl.server.log` | **0** | **3** (frames=120, 240, 251) |
|
||||
| `wait[]` in the spawn server log | absent | `srv=2614177 srvpark=1229` |
|
||||
| gate 8 item ① server half | "structurally missing" | measured |
|
||||
|
||||
The client-side numbers are unchanged by the fix (`cli=30401 clipark=1524` here vs `30401 / 1538` in
|
||||
the previous session), which is the expected shape: the fix arms counters in the server process and
|
||||
touches nothing the client does.
|
||||
|
||||
**One thing it does not fix, reported rather than papered over:** the spawn **server** log's last
|
||||
summary line lands at the session-final `frames=251 window=11` (the `Shutdown` call), but the spawn
|
||||
**client** log's only line is the `frames=0 window=0` one — the client has no frame boundary of its
|
||||
own to key a period on, so it emits exactly one line, at teardown. Downstream readers that index
|
||||
"the last line" per role therefore get a well-formed line from each, but they must not assume the
|
||||
two are the same window. The `frames from` column in §3 is what makes that unambiguous.
|
||||
|
||||
---
|
||||
|
||||
## 7. Judgement
|
||||
|
||||
**Gate 8 item ① — the measuring gap is closed.** Both halves of the doorbell ledger are on the
|
||||
device, from both roles' own logs, on both transports: server waits **10 415–11 963 per frame**
|
||||
(0.042–0.047 % parking) and client waits **121.1 per frame** on all four arms (4.6–5.0 % parking).
|
||||
|
||||
**On the contract's §9 note.** That note predicted a socket blocking read might be *cheaper* than
|
||||
`inproc`'s ~1600 spins/frame on a shared cache line. The measurement says **neither cheaper nor more
|
||||
expensive**: client CPU per frame is 7.992/8.009 (`spawn`) against 7.987/7.989 (`inproc`) — a +0.16 %
|
||||
difference well inside the 0.14–0.69 % run-to-run spread, reproducing the previous session's tie at a
|
||||
different absolute level. The server's own wait *count* is 8.9–12.9 % lower under `spawn`, but §3.1
|
||||
explains why that is a property of the handoff discipline rather than of the doorbell, and the
|
||||
comparable quantity (park ratio) is the same on both.
|
||||
|
||||
Stated plainly: **on this workload, at this resolution, the doorbell's implementation — futex-backed
|
||||
condvar with a spin budget versus a one-byte socket write — is not a measurable cost.** Both are
|
||||
~30 % cheaper than `monolith` on client CPU per frame. Per the campaign's standing rule these
|
||||
numbers are recorded, not gated.
|
||||
|
||||
**Caveats, not hidden.** The exercise was one workload (rd12 in-world, DirectGLES) and one device;
|
||||
the reference note's "1600 spins/frame" figure was for a heavier scene, so a workload with more
|
||||
rendezvous per frame is where a difference would have to show up if it exists at all. The
|
||||
`spawn` arm's `clipark/f` is 5.5–8.5 % higher than `inproc`'s (6.07 vs 5.60/5.75) — the only column
|
||||
where the socket looks marginally worse, and it is ~0.4 extra parking events per frame out of 121.
|
||||
@@ -0,0 +1,911 @@
|
||||
# gate8-wire-counters — 门 8 的两个 wire 计数器、首采,与 spawn server 侧的 wait 账
|
||||
|
||||
> 头 `94c130d6`(`git rev-parse HEAD`,写报告时读取;工作树另有并行 agent 在修子模块指针,未 commit)。
|
||||
> 环境:`wsl -d Ubuntu`,clang-20 / Ninja / Release / `MOBILEGL_BUILD_TYPE=Release`,
|
||||
> 快照 `~/w7/p6-gate8-src`(从 Windows 工作树 copy,见 §1),构建目录 `~/w7/p6-gate8-build`。
|
||||
> 交付内容:
|
||||
> 1. `CONTRACT-P6.md` §9 item 8 的三个数里的**后两个**(`SEG_STAGE` 字节/帧、chunking 后记录/帧),
|
||||
> 外加可选加分项:分块后 `maxrec` 与逐 blob 大小分布(§2–§6);
|
||||
> 2. **spawn server 进程的 PipeStats 初始化缺陷及其修法**(§9)——该缺陷使 item 8 的**第一个数**
|
||||
> (socket 门铃 vs inproc condvar)在 spawn 臂上只有 client 半边(§9.1.2 把"哪条车道哪半边"
|
||||
> 逐条查清,并把 client 半边**本来就是有效测量**这件事写明);
|
||||
> 3. **`MOBILEGL_PIPE_STATS_FILE` 的 spawn 角色分路**(§9.7),含 G1 上被抓出的三个泄漏点。
|
||||
> 本报告不改 `MEASUREMENTS.md` / `CURRENT_STAGE_PROGRESS.md` / `ROADMAP.md`;数字供后续合并引用。
|
||||
|
||||
---
|
||||
|
||||
## 0 一句话
|
||||
|
||||
两个计数器都落在**唯一的收口点**上(stage 分配器、记录提交点),因此覆盖是构造性的而不是一张名单;
|
||||
首采两负载的稳态数:`SEG_STAGE` **130.8 KB/帧(OpenRA 中位数)到 816.2 KB/帧(rd12 in-world 中位数)**、
|
||||
记录 **211 条/帧到 7,497 条/帧**;含启动加载窗的均值分别高到 8.01 MB/帧与 1.53 MB/帧,
|
||||
报告把两种读法都列出来(§6.4)。**默认 chunk 预算 8 MiB 在两条负载上都没被触发**
|
||||
(`maxrec` 恒为 1808),这恰好印证 `MEASUREMENTS.md:342` 说的"分块后没有新测量"——
|
||||
分块的效果必须人为压小预算才看得到(§6.5),而那一组 A/B 给出了一个清楚的负结果。
|
||||
|
||||
**§9 是后加的第二件事,也是这一轮真正的收尾缺口**:spawn 下 server 进程从不调用
|
||||
`PipeStats::Init()`,于是该进程里所有 `Enabled()` 门恒为 false——它**一条汇总行都没有**,
|
||||
而缺行的不是 client。修法是 server 角色初始化的唯一收口点加一行 `Init()`(§9.2),
|
||||
配一行 `Shutdown()`。修后 spawn 的 server 半边首次可测:**`srv` 15.00 waits/帧、`srvpark` 4.38 parks/帧**(§9.4)。
|
||||
|
||||
**§9.7 是同一轮的第三个缺口**:两角色现在都会写 `MOBILEGL_PIPE_STATS_FILE`,于是 dump 路径按角色
|
||||
派生成 `<base>.client.json` / `<base>.server.json`,基名不再指向任何文件(§9.7.1)。
|
||||
这一条在 G1 上**红了三次**才做对(§9.7.3),每一次都是"guard 了新代码但动了旧代码"。
|
||||
|
||||
---
|
||||
|
||||
## 1 来源快照与可复现性
|
||||
|
||||
构建走的是快照而不是 Windows 工作树,因为同时有两个并行 agent 在改树(一个修子模块指针、
|
||||
一个加 wire 计数器)。快照脚本 `~/w7/mgs/p6-snapshot.sh` 用 `tar` 排除 `build/`、`.git/`、
|
||||
`android-plugin/`、`tools/device_bench/`,然后**补回两处被 `*/build` 误伤的东西**:
|
||||
|
||||
- `3rdparty/*/build/`(xxHash 的 CMake port 在 `3rdparty/xxHash/build/cmake`,是 submodule 内容不是产物;
|
||||
被排除后 configure 直接 `add_subdirectory` 报错)——脚本 `p6-fix-builddirs.sh`;
|
||||
- `android-plugin/app/src/trace/cpp/`(`tools/trace_replay/CMakeLists.txt` 编译其中三个文件,
|
||||
排除 `android-plugin/` 会让 `mobilegl_trace_replay` 目标 "No SOURCES given")——脚本 `p6-build-retrace.sh` 自动补。
|
||||
|
||||
构建配方逐字照 `.github/workflows/test.yml:942-957`(split)与 `:219-227`(pull control),
|
||||
只把 `clang-20`/`clang++-20` 换成同名可执行文件(Ubuntu 24.04 装了 `clang-20` 1:20.1.2-0ubuntu1~24.04.3)。
|
||||
`~/w7/p6-gate8-build` 是本次任务书点名的目录,没有触碰任何既有目录。
|
||||
|
||||
单元测试与构建是**同一个** split 配置(`MOBILEGL_PIPE_PUSH=ON` + `-DMOBILEGL_BUILD_DISAGGREGATED=ON`
|
||||
+ `-DMOBILEGL_BUILD_DISAGGREGATED_INPROC=ON`),与 CI 的 `build-linux-split` job 同源。
|
||||
|
||||
---
|
||||
|
||||
## 2 设计取舍
|
||||
|
||||
### 2.1 `SEG_STAGE` 字节/帧:ByteClass,不是 Gauge
|
||||
|
||||
`ByteClass` 是**窗口化求和**(`AddBytes` → `g_frameBytes`/`g_totalBytes`,`OnPresent` exchange 清零,
|
||||
`FormatWindowLine` 除以 window 帧数),而 `Gauge` 按设计是**运行总量**(`PublishGauge` 是 store 不是 add,
|
||||
见 `PipeStats.h` 的 Gauge 枚举长注释)。门 8 要的是"字节/**帧**",所以必须是 ByteClass——
|
||||
`FormatWindowLine` 已经替它做了除法,`perFrame` 标注规则也自动适用。
|
||||
|
||||
### 2.2 记录/帧:CallClass + 一个额外的 `wrec/f` 字段
|
||||
|
||||
`WireRecords` 是 `CallClass`,于是 `wrec=` 跟 `draws=` 一样是**窗口计数**。
|
||||
但"记录/帧"是交付数字,让操作者自己去除是没必要的,所以汇总行**另印一个 `wrec/f=`**,
|
||||
与 `draws/f=` 同形。二者按 `perFrame` 规则联动:窗口内没有 Present 时**两个都退回窗口总量**
|
||||
(`wrec=47 wrec/f=47`),这是该文件既有的标注规则,不是为这个字段新造的——
|
||||
`PipeStatsTest.SummaryLineSurvivesZeroFrames` 钉住的正是同一个坑(47 倍高估)。
|
||||
|
||||
### 2.3 逐 blob 分布:第二个直方图,push-only
|
||||
|
||||
`MEASUREMENTS.md:342` 说的是"分块后**逐 blob 字节分布**尚无新测量",而现有 `maxrec` 是**最大值**、
|
||||
`seg` 是**平均值**,两个都答不了这个形状问题:8 MiB 的平均值在"一个 8 MiB blob"和"两个本该被切成一个的 4 MiB blob"
|
||||
下是同一个数。所以另立 `staged-blob-bytes-histogram`,**复用 `PayloadBucketOf` 的桶边界**(bucket 0 = 0 字节,
|
||||
bucket n>0 = [2^(n-1), 2^n)),使两个直方图读法一致;它是**运行总量**(分布没有"窗口"可言),
|
||||
经 JSON dump 出口——Tracy 画不了分布,这与既有 `cmd-bytes-per-draw-histogram` 的选择一致。
|
||||
|
||||
### 2.4 落点为什么在收口点而不是调用方
|
||||
|
||||
任务书要求"覆盖所有写入者,不要在调用方重复计数"。两个落点都满足:
|
||||
|
||||
- **stage 字节**:`PipeWireEncoder::StageAllocate`(`PipeWireCodec.cpp:853` 之后)。全树只有一个
|
||||
`StageAllocate` 调用点(`StageBytes`,`PipeWireCodec.cpp:936`),而 `StageBytes` 是各 emitter
|
||||
(`WireTables.cpp` 的 `StageRequired`/`StageOptional`、`SetProgramBindings` 的逐个名字、
|
||||
`WireTables.cpp:549` 的 program archive、`EmitTables.cpp` 的 storage block name)唯一的入口。
|
||||
加在调用方就等于维护一张"今天存在哪些 producer"的名单,下一个 producer 漏掉时**没有任何东西会响**——
|
||||
这正是 `PipeStats.cpp` 顶部 site inventory 存在的理由。
|
||||
- **记录数**:`PipeWireEncoder::EncodeRecord`(`PipeWireCodec.cpp:1171` 之后,`Reserve` 成功、
|
||||
正文写完、blob 槽诚实性检查之后、`++m_emitSeq` 之前)。放在 emitter 侧**不可能正确**:
|
||||
分块之后一次应用调用产生几条记录只有 encoder 知道。同一个函数内部**不重复计数**,因为
|
||||
`slot == nullptr` 时提前 `return kInvalidSeq`,重试成功才计一次。
|
||||
|
||||
### 2.5 边界:`size` 不是 `need`,pad 不算记录
|
||||
|
||||
- stage 字节记 **`size`(生产者给的字节)**,不记 `Align8(size)`:对齐衬垫是分配器的、
|
||||
不是生产者写的内容;记 `need` 会让"8 字节 blob 的负载"和"16 字节 blob 的负载"看起来一样。
|
||||
分配器的 wrap skip 同理排除。
|
||||
- 记录数**不含 `kRecPad` 填充**:pad 没有 opcode、两侧都跳过、已经由 `ringpads` gauge 可见。
|
||||
不含被 `Reserve` 拒绝的那次发射,正是 2.4 里那个提前 return 保证的。
|
||||
|
||||
### 2.6 push-only(G1)
|
||||
|
||||
两个计数器都在 `#if MOBILEGL_PIPE_PUSH` 下,与该文件每个后来加的计数器一致。
|
||||
`StageSegmentBytes` 在 `ByteClass` 枚举的 push 块内(该枚举的 push 块是 P4a 开的先例),
|
||||
`WireRecords` 在 `CallClass` 枚举的 push 块内,`RecordStagedBlobBytes`/`TotalStagedBlobBucket`/
|
||||
`g_totalStagedBlobBuckets`/JSON 行同样。理由:唯一采样者是 wire encoder,pull build 不编译 MG_Remote,
|
||||
这些符号在那里永远采不到样本。
|
||||
|
||||
### 2.7 现有计数器有没有能直接回答这两个数的
|
||||
|
||||
没有,都已核对:
|
||||
|
||||
| 候选 | 为什么答不了 |
|
||||
|---|---|
|
||||
| `stage-buffer`/`stage-texture`(ByteClass) | 是**后端**在 apply 线程往**驱动**搬的字节;分块后一条记录的多个 blob 会分别被 server 应用,所以它们与 wire 侧字节不是一回事,且无法回答"发射侧写了多少" |
|
||||
| `cso-blob-bytes` | 只覆盖 CSO blob(`WireTables.cpp:540`),不含 buffer 走查与纹理 slab |
|
||||
| `ClientTextureUploadEmissions`/`framebuffer/sampler-*` | 是**发射调用**数,不是记录数;分块后一次调用可出多条记录 |
|
||||
| `maxrec` gauge | 单条最大记录字节,不是每帧字节,也不是记录条数 |
|
||||
| `vbs` | 服务端 verb 边界戳,与发射记录数不同(rd12 上是 1478 vs 7493) |
|
||||
| `cmd-bytes-per-draw-histogram` | 是 **draw payload** 分布,不是 stage blob 分布 |
|
||||
|
||||
所以是**两个新计数器 + 一个可选直方图**,没有重复计数。
|
||||
|
||||
---
|
||||
|
||||
## 3 计数落点(file:line)
|
||||
|
||||
行号为改后内容。
|
||||
|
||||
| 计数器 | 文件:行 | 说明 |
|
||||
|---|---|---|
|
||||
| `ByteClass::StageSegmentBytes` 枚举成员 | `MobileGL/MG_Util/Metrics/PipeStats.h:115` | push 块内,在 `CsoBlobBytes` 之后 |
|
||||
| 名称表 `"stage-segment-bytes"` | `MobileGL/MG_Util/Metrics/PipeStats.cpp:228` | JSON key 与 `NameOf` |
|
||||
| 短名 `"seg"` | `MobileGL/MG_Util/Metrics/PipeStats.cpp:263` | 摘要行 `bytes/f[...]` 括号内 |
|
||||
| `CallClass::WireRecords` 枚举成员 | `MobileGL/MG_Util/Metrics/PipeStats.h:251` | push 块内,在 `ServerVerbBoundaries` 之后 |
|
||||
| 名称表 `"wire-records"` | `MobileGL/MG_Util/Metrics/PipeStats.cpp:238` | |
|
||||
| 直方图声明 `RecordStagedBlobBytes`/`TotalStagedBlobBucket` | `MobileGL/MG_Util/Metrics/PipeStats.h:382-386` | push-only |
|
||||
| 直方图存储 | `MobileGL/MG_Util/Metrics/PipeStats.cpp:169` | 复位在 `ResetCounters` 内 |
|
||||
| 直方图采样实现 `RecordStagedBlobBytes` | `MobileGL/MG_Util/Metrics/PipeStats.cpp:403` | |
|
||||
| 直方图读取 `TotalStagedBlobBucket` | `MobileGL/MG_Util/Metrics/PipeStats.cpp:464` | |
|
||||
| 直方图 JSON 行 `staged-blob-bytes-histogram` | `MobileGL/MG_Util/Metrics/PipeStats.cpp:708` | 与 `cmd-bytes-per-draw-histogram` 同级,**在其之后** |
|
||||
| **stage 字节与逐 blob 采样(唯一落点)** | `MobileGL/MG_Remote/Wire/PipeWireCodec.cpp:878`(`StageAllocate` 内) | `AddBytes(StageSegmentBytes, size)` + `RecordStagedBlobBytes(size)` |
|
||||
| **记录数(唯一落点)** | `MobileGL/MG_Remote/Wire/PipeWireCodec.cpp:1188`(`EncodeRecord` 成功路径) | `AddCalls(WireRecords, 1)` |
|
||||
| `#include <MG_Util/Metrics/PipeStats.h>` | `MobileGL/MG_Remote/Wire/PipeWireCodec.cpp:44` | 新增,MG_Remote 已有的跨层 include 先例(`WireTables.cpp:50`) |
|
||||
| 摘要行新字段 `wrec=` | `MobileGL/MG_Util/Metrics/PipeStats.cpp:581-586` | `wrec=` + `wrec/f=`,`perFrame` 联动 |
|
||||
|
||||
**额外改动的文件:无超过任务书授权范围的文件。** 授权清单里的 `EmitTables.cpp` **没有改**
|
||||
(`git diff` 显示与 HEAD 逐字节相同):Gauge 发布点本来就在那里且已覆盖 `maxrec`,`seg`/`wrec`
|
||||
落在 `PipeWireCodec.cpp` 更准确,所以没有理由动它。任务书允许的"极小 Wire/ 或 Client/ 内部改动"
|
||||
最终只需要 `PipeWireCodec.cpp` 一个 include 加两处计数(后者本就在授权清单内)。
|
||||
|
||||
---
|
||||
|
||||
## 4 单元测试
|
||||
|
||||
新增 8 个用例(`MobileGL/MG_Test/Util/PipeStatsTest.cpp`);前 6 个属于 §2–§6 的两个计数器,
|
||||
后 2 个属于 §9 的 spawn server 缺陷:
|
||||
|
||||
| 用例 | 钉什么 |
|
||||
|---|---|
|
||||
| `StageSegmentBytesIsAWindowedByteClassLikeAnyOther` | 累加、Present 清帧、`seg=6144.00`、空窗口退回 `bytes[...]` 总量标签 |
|
||||
| `WireRecordsCarryBothTheWindowCountAndItsPerFrameForm` | `wrec=26` + `wrec/f=2.00`(26/13 帧) |
|
||||
| `WireRecordsFallBackToTheWindowTotalWithoutAFrame` | 无 Present 时 `wrec/f=47` 而非 `47.00`(既有的 47 倍高估坑) |
|
||||
| `StagedBlobHistogramSharesThePayloadBucketEdges` | 桶边界与饱和行为与 draw payload 直方图一致 |
|
||||
| `StagedBlobHistogramIsARunTotalAndReachesTheJsonDump` | Present 不清分布;JSON 两个数组的顺序关系 |
|
||||
| `CounterNamesAreStable` / `SummaryLineCarriesEveryClassAndGate`(扩写) | 长名 `stage-segment-bytes`/`wire-records`、短名 `seg=`/`wrec=`/`wrec/f=` 的稳定性(改名会破坏所有已记录基线) |
|
||||
| `InitIsTheOnlyLatchAndItTakesTheConfigBothWays`(§9) | `Init()` 必须**两个方向**都从配置取值:true 时武装、false 时**清掉**旧 latch。单向版本会通过单边测试,却让 `MOBILEGL_PIPE_STATS=0` 在长生命周期进程里失去意义 |
|
||||
| `PresentationsAtTheDefaultPeriodOfOneMakeOneWindowEach`(§9) | k 次 present → k 个窗口(车道费率所除的分母);并钉住 gauge 是运行总量、**不是求和** |
|
||||
|
||||
结果(§9 修完之后):
|
||||
|
||||
```
|
||||
$ cd ~/w7/p6-gate8-build && ctest -L unit -R "PipeStats" --output-on-failure
|
||||
100% tests passed, 0 tests failed out of 24
|
||||
```
|
||||
|
||||
全量 unit 与 Wire 层回归(同一 split 构建):
|
||||
|
||||
```
|
||||
$ ctest -L unit --no-tests=error -j 24
|
||||
100% tests passed, 0 tests failed out of 2366 (80.64 s) # 22 → 24 是本轮新增的两个
|
||||
|
||||
$ ctest -L unit -R "Wire|Codec|Ring|Staged|ServerLoop|RemoteClient|Session" --no-tests=error -j 16
|
||||
100% tests passed, 0 tests failed out of 295 (36.95 s)
|
||||
```
|
||||
|
||||
**一处需要说明的非失败项**:首次跑 `ctest -L unit` 时有 1 个红 ——
|
||||
`PipeCatalogue.FrontendNeverTakesAnApplierAddress`,报
|
||||
`frontend source unavailable: "/MobileGL/MG_Impl"`。这是**构建目录在源码树之外**造成的:
|
||||
该用例从 CWD 向上找 `MobileGL/MG_Impl` 做源码文本走查,而 CI 是 in-tree build
|
||||
(`cmake -S . -B build-linux`)所以能找到。验证:把 `/home/swung/w7/MobileGL` 做符号链接指回快照后,
|
||||
该用例 34/34 全绿,全量 2366/2366 全绿。**与本次改动无关**,但在离树构建下会红,记录在此。
|
||||
|
||||
---
|
||||
|
||||
## 5 G1:pull 构建符号集与 `.text`
|
||||
|
||||
协议 §9 item 1:pull build 必须 0/0/0/0 且 `.text` 不变。做法是**两棵同源树、只翻三个 MGPipe 选项**:
|
||||
|
||||
- `~/w7/p6-gate8-g1-baseline`:快照 + 本次改的 6 个文件**回退到 `git HEAD` 内容**(从工作树 `git show` 取出),pull 选项;
|
||||
- `~/w7/p6-gate8-g1-head`:快照 + 本次内容,**同一套 pull 选项**。
|
||||
|
||||
脚本 `~/w7/mgs/p6-g1.sh`(configure 与 build 都 `rc=0`),复核脚本 `~/w7/mgs/p6-g1-verify.sh`。
|
||||
两边 `.so` 磁盘字节数相同(18,506,968)。
|
||||
|
||||
```
|
||||
$ python3 scripts/symbol_report.py --before ...g1-baseline.so --after ...g1-head.so \
|
||||
--threshold 0 --fail-on-symbol-set-change --fail-on-added-bytes 0 --fail-on-text-delta
|
||||
symbol-report: before: .../p6-gate8-g1-baseline.so (18506968 bytes on disk)
|
||||
symbol-report: after : .../p6-gate8-g1-head.so (18506968 bytes on disk)
|
||||
symbol-report: .text 10158850 -> 10158850 (+0, +0.000%)
|
||||
symbol-report: .data 77864 -> 77864 (+0)
|
||||
symbol-report: .bss 1296856 -> 1296856 (+0)
|
||||
symbol-report: .rodata 1521854 -> 1521854 (+0)
|
||||
symbol-report: Total 16585193 -> 16585193 (+0)
|
||||
symbol-report: 27863 -> 27863 defined symbols: 0 added, 0 removed, 0 resized, 0 renamed
|
||||
symbol-report: 27122 -> 27122 normalised names, 27122 unchanged (name, size and mangling all identical)
|
||||
G1 rc=0
|
||||
```
|
||||
|
||||
`.text` 段直接逐字节比对(`objcopy -O binary --only-section=.text` + `cmp`):
|
||||
**`b.text` 与 `h.text` 各 10,158,850 字节,`cmp` 无差异 → `.text` BYTE-IDENTICAL**(强于 gate 要求的 +0)。
|
||||
|
||||
补充两条该门惯用的正向断言:
|
||||
|
||||
```
|
||||
$ nm --defined-only ...g1-head.so | grep -ci "MG_Remote" → 0 (pull build 无 MG_Remote)
|
||||
$ nm --defined-only ...g1-head.so | grep -ciE \
|
||||
"RecordStagedBlobBytes|StageSegmentBytes|WireRecords" → 0 (新计数器 push-only,未泄漏进 pull)
|
||||
$ nm --defined-only ...g1-head.so | wc -l → 30601
|
||||
```
|
||||
|
||||
(`.so` 的 sha256 两侧不同,符合预期:`-g` 的调试信息带源码路径与时间戳;
|
||||
门 1 要的是**符号集与 `.text`**,两者都已证明不变。)
|
||||
|
||||
---
|
||||
|
||||
## 6 首采:真实 trace 的 inproc retrace
|
||||
|
||||
### 6.1 方法
|
||||
|
||||
`MOBILEGL_PIPE_STATS=1` + `MOBILEGL_PIPE_STATS_PERIOD=1`(每个 `eglSwapBuffers` 一行,
|
||||
所以每行 `window=1` 恰好一帧),车道 = `MOBILEGL_TRANSPORT=inproc` +
|
||||
`MOBILEGL_IPC_ROLE_SPLIT_STATE=1` + `MOBILEGL_IPC_STRICT_ERRORS=1` + `MOBILEGL_IPC_RUN_AHEAD=1`,
|
||||
后端 `DirectGLES`,库/服务端 `~/w7/p6-gate8-build/lib{MobileGL,MobileGLServer}.so`。
|
||||
|
||||
两负载:
|
||||
|
||||
1. **OpenRA**(`MobileGLTraceReplay.OpenRA.DirectGLES.SPLIT`,ctest 条目原样跑过:Passed 1.67 s,
|
||||
SSIM **1.000000**,mismatch 0);
|
||||
2. **minecraft-1.21.4-rd12-odinlite-in-world**(任务书推荐的负重载;该 case 在 `trace_cases.json`
|
||||
里没有 `"split": true`,所以没有 SPLIT ctest 条目,改为按 `run_trace_case.cmake` 的同一命令行手工驱动;
|
||||
SSIM **0.999998**,17226 mismatch 像素,阈值 0.99 下通过)。
|
||||
|
||||
**汇总行落在哪个 role 日志**:inproc 下 PipeStats 是一个进程里的一套计数器,
|
||||
`OnPresent` 由**服务端 apply 线程**调用,所以 250 行摘要全在 `mobilegl.server.log`;
|
||||
`mobilegl.client.log` 只有一行 `counters ON` 横幅。**两者不重复**,脚本读两个文件也不会双计
|
||||
(已实测:client 1 行、server 250 行)。
|
||||
|
||||
**统计口径**:`PERIOD=1` 下每行 window=1,故
|
||||
"窗口字段求和 / 帧数" = 运行平均每帧;**gauge 字段是运行总量,取最后一行,不能求和**
|
||||
(本报告脚本第一版就是求和,得出 `maxrec=452000` 而真实最大值是 1808,已改正——
|
||||
这正是 `PipeStats.h` Gauge 注释警告的那类错误)。
|
||||
|
||||
### 6.2 原始 stats 行(摘录)
|
||||
|
||||
rd12 in-world,第 250 帧(末行,`window=1`):
|
||||
|
||||
```
|
||||
MGPipe stats: frames=250 window=1 draws=1472 draws/f=1472.00 acc=5958 acc/draw=4.05
|
||||
bytes/f[buf=10320.00 tex=950528.00 ubog=281616.00 ubon=0.00 vtxc=0.00 idxc=0.00 icmd=0.00
|
||||
pmap=0.00 resid=184.00 csob-blob=281808.00 seg=2914784.00]
|
||||
tex[emit=2 box=2 rect=0 jobs=2] cso[csom=0 csob=20 mpr=0]
|
||||
emit[fbe=8 sve=13 sse=0 sie=0 ctu=3 trp=0 rsp=0 vbs=1479 wrec=7532 wrec/f=7532.00
|
||||
maxrec=1808 maxcap=4194304 ringwraps=61 ringpads=53 ringwaits=0]
|
||||
wait[srv=115580 srvpark=1911 cli=30393 clipark=10580]
|
||||
gates[ers=1458/21 etl=1466/13 eub=1479/0 mfp=0/0 mpm=0/0 mdt=0/0]
|
||||
```
|
||||
|
||||
OpenRA,第 29 帧(末行):
|
||||
|
||||
```
|
||||
MGPipe stats: frames=29 window=1 draws=30 draws/f=30.00 acc=186 acc/draw=6.20
|
||||
bytes/f[buf=86184.00 tex=32768.00 ubog=112.00 ubon=0.00 vtxc=0.00 idxc=0.00 icmd=0.00
|
||||
pmap=0.00 resid=248.00 csob-blob=112.00 seg=129552.00]
|
||||
tex[emit=1 box=1 rect=0 jobs=1] cso[csom=0 csob=31 mpr=0]
|
||||
emit[fbe=0 sve=27 sse=0 sie=0 ctu=1 trp=0 rsp=0 vbs=31 wrec=211 wrec/f=211.00
|
||||
maxrec=1808 maxcap=4194304 ringwraps=0 ringpads=0 ringwaits=0]
|
||||
wait[srv=482 srvpark=104 cli=267 clipark=87]
|
||||
gates[ers=0/31 etl=4/27 eub=31/0 mfp=0/0 mpm=0/0 mdt=0/0]
|
||||
```
|
||||
|
||||
### 6.3 全跑聚合(含加载窗;稳态口径见 6.4)
|
||||
|
||||
```
|
||||
################ OpenRA inproc split, DirectGLES ################
|
||||
summary lines : 29 windows with a frame : 29 frames covered : 29
|
||||
|
||||
field window total per frame
|
||||
seg 233979394 8068254.97 <- SEG_STAGE 字节/帧
|
||||
wrec 5706 196.76 <- 记录/帧(分块后)
|
||||
buf 23728752 818232.83
|
||||
tex 151814144 5234970.48
|
||||
csob-blob 30398 1048.21
|
||||
draws 758 26.14
|
||||
|
||||
gauges - RUN TOTALS
|
||||
maxrec 1808 maxcap 4194304 ringwraps 0 ringpads 0 ringwaits 0
|
||||
|
||||
################ rd12-odinlite-in-world inproc split, DirectGLES ################
|
||||
summary lines : 250 windows with a frame : 250 frames covered : 250
|
||||
|
||||
field window total per frame
|
||||
seg 2698026763 10792107.05 <- SEG_STAGE 字节/帧
|
||||
wrec 6922378 27689.51 <- 记录/帧(分块后)
|
||||
buf 95916960 383667.84
|
||||
tex 641567296 2566269.18
|
||||
csob-blob 257066831 1028267.32
|
||||
draws 1348027 5392.11
|
||||
|
||||
gauges - RUN TOTALS
|
||||
maxrec 1808 maxcap 4194304 ringwraps 61 ringpads 53 ringwaits 0
|
||||
```
|
||||
|
||||
### 6.4 门 8 两个数的答案
|
||||
|
||||
**先说一件必须说清楚的事:全跑"每帧平均"被第一帧的加载窗严重拉高。**
|
||||
`PERIOD=1` 下第一行 `frames=1 window=1` 覆盖的是**整个启动/加载**(rd12 那一帧有 981,654 draws、
|
||||
5,053,895 条记录、`seg=2,317,939,359`),而其余每帧只有约 1,471 draws。所以直接"窗口求和 / 帧数"
|
||||
得到的是**含加载的均值**,不是稳态值。两种读法都列出来,选用取决于问题:
|
||||
|
||||
| | OpenRA | rd12 in-world |
|
||||
|---|---:|---:|
|
||||
| **含加载的均值** `seg` | 8,068,255 B/帧 | 10,792,107 B/帧 |
|
||||
| **含加载的均值** `wrec` | 196.8 条/帧 | 27,689.5 条/帧 |
|
||||
| **稳态均值**(丢弃前 10% 窗口)`seg` | 8,012,890 B/帧 | 1,534,555 B/帧 |
|
||||
| **稳态均值**(丢弃前 10% 窗口)`wrec` | 206 条/帧 | 7,504 条/帧 |
|
||||
| **稳态中位数** `seg` | 130,848 B/帧 | 816,248 B/帧 |
|
||||
| **稳态中位数** `wrec` | 211 条/帧 | 7,497 条/帧 |
|
||||
| 参考:`draws` 稳态中位数 | 30 | 1,471 |
|
||||
| 参考:`maxrec` / `maxcap` | 1808 B / 4,194,304 B(0.043%) | 1808 B / 4,194,304 B(0.043%) |
|
||||
|
||||
**门 8 要的数**(按 `MEASUREMENTS.md` 里同类数字的惯例,报稳态中位数与稳态均值这对,
|
||||
因为该文件自己就警告过"变化的负载用运行总量平均值会掩盖 P2 要的那个数"):
|
||||
|
||||
| 数 | OpenRA | rd12 in-world |
|
||||
|---|---:|---:|
|
||||
| **`SEG_STAGE` 字节/帧** | **8.01 MB/帧(稳态均值)** / **130.8 KB/帧(中位数)** | **1.53 MB/帧(稳态均值)** / **816.2 KB/帧(中位数)** |
|
||||
| **记录/帧(分块后)** | **206 条/帧(稳态均值)** / **211(中位数)** | **7,504 条/帧(稳态均值)** / **7,497(中位数)** |
|
||||
|
||||
读法注意:
|
||||
|
||||
- **两负载的稳态形状完全不同**,这正是必须分开报的理由:OpenRA 稳态的 `tex` 中位数是 32,768 B
|
||||
而均值 5.6 MB(少数窗有巨大的纹理上传尖峰),`seg` 的中位数/均值因此差 61 倍;
|
||||
rd12 稳态的 `tex` 中位数为 0(大部分帧不上传纹理),`seg` 的中位数/均值差 1.9 倍。
|
||||
报一个数就会掩盖另一个负载的形状。
|
||||
- rd12 稳态 `seg` 中位数 816 KB/帧 对默认 32 MiB 的 SEG_STAGE:**约 40 帧的余量**,
|
||||
与 `ringwaits=0`(250 帧里一次都没等过 retiredSeq)、`ringwraps=61` 一致。
|
||||
- **`maxrec=1808` 说明默认配置下分块一次都没触发**:稳态 `seg/wrec ≈ 816248/7497 ≈ 109 B/条`,
|
||||
与全局的 390 B/条 都在字节级别。这与 `MEASUREMENTS.md:342` 记录的
|
||||
"分块前 `maxrec` 也是 1808 / `SetVertexAttribDefaults`" **完全一致**——
|
||||
也就是说,**在这两条负载上分块前后 `maxrec` 没有变化,因为它本来就没到过预算**。
|
||||
- `wrec` 是**窗口计数**(与 `wrec/f` 同值,因为每窗恰好一帧),所以上表两列是同一个数的两种提法。
|
||||
|
||||
### 6.5 逐 blob 大小分布(可选加分项)
|
||||
|
||||
**结论:在默认预算下不存在"由分块产生的"分布**——见 6.4,`maxrec=1808` 远低于 8 MiB 预算,
|
||||
所有 blob 都是原始尺寸。为让这个可选数有内容,做了两组采集:
|
||||
|
||||
**(a) 默认 32 MiB 预算(=chunk 8 MiB),rd12,分布来自 `MOBILEGL_PIPE_STATS_FILE` JSON dump**
|
||||
(需要走 `MobileGL::Destroy()`,retrace 到不了;改用 integration 车道:
|
||||
|
||||
```
|
||||
$ cd ~/w7/p6-gate8-build && MOBILEGL_ITEST_REQUIRE_GPU=1 MOBILEGL_TRANSPORT=inproc \
|
||||
MOBILEGL_IPC_SERVER_PATH=.../libMobileGLServer.so MOBILEGL_IPC_ROLE_SPLIT_STATE=1 \
|
||||
MOBILEGL_IPC_STRICT_ERRORS=1 MOBILEGL_IPC_RUN_AHEAD=1 \
|
||||
MOBILEGL_PIPE_STATS=1 MOBILEGL_PIPE_STATS_PERIOD=1 \
|
||||
MOBILEGL_PIPE_STATS_FILE=.../stats-igpu-inproc.json \
|
||||
ctest -R "^DirectGLES\.(Arena|Ssbo|Buffer|Atomic|Readback)" -j 1
|
||||
100% tests passed, 0 tests failed out of 19
|
||||
```
|
||||
|
||||
`stats-igpu-inproc.json`:
|
||||
|
||||
```
|
||||
frames : 0 (这些 integration 用例跑 swap 但不走 Present 计数)
|
||||
stage-segment-bytes : 5768
|
||||
wire-records : 70
|
||||
hist [0,0,0, 4, 1, 2, 0, 1, 0, 1, 1, 1, 1, 0, ...]
|
||||
bucket 3 [4,8) 4 条
|
||||
bucket 4 [8,16) 1 条
|
||||
bucket 5 [16,32) 2 条
|
||||
bucket 7 [64,128) 1 条
|
||||
bucket 9 [256,512) 1 条
|
||||
bucket 10 [512,1024) 1 条
|
||||
bucket 11 [1024,2048) 1 条
|
||||
bucket 12 [2048,4096) 1 条
|
||||
```
|
||||
|
||||
**(b) 人为压小 stage 预算是让分块真正发生的唯一办法**(`MGPipeStageChunkBytes()` =
|
||||
`clamp(segment/4, 4096, segment)`,所以 `MOBILEGL_IPC_STAGE_MB=1` → chunk 预算 256 KiB)。
|
||||
同一条 rd12 trace、同一个库、只改这一个环境变量的 A/B:
|
||||
|
||||
```bash
|
||||
bash ~/w7/mgs/p6-chunkab.sh 32 # 默认:chunk 8 MiB
|
||||
bash ~/w7/mgs/p6-chunkab.sh 1 # 强制:chunk 256 KiB
|
||||
```
|
||||
|
||||
| rd12 in-world,inproc split | STAGE_MB=32(chunk 8 MiB) | STAGE_MB=1(chunk 256 KiB) | 变化 |
|
||||
|---|---:|---:|---|
|
||||
| SSIM | 0.999998213 | 0.999998213 | 不变 |
|
||||
| **`seg` 运行总量** | **2,698,026,763** | **2,698,026,763** | **逐字节完全一致** |
|
||||
| `seg` 稳态中位数 | 816,248 | 554,104 | **−32%**(逐窗归属变了,见下) |
|
||||
| `wrec` 运行总量 | 6,922,378 | 6,929,736 | +7,358(**+0.11%**) |
|
||||
| `wrec` 稳态中位数/均值 | 7,497 / 7,504 | 7,497 / 7,508 | +0.05% |
|
||||
| `tex` 运行总量 | 641,567,296 | 1,886,392,128 | **+194%** |
|
||||
| `buf`/`csob-blob`/`draws` | 见 §6.3 | 与 STAGE_MB=32 逐项相同 | 不变 |
|
||||
| `maxrec` / `maxcap` / `ringwraps` / `ringpads` | 1808 / 4,194,304 / 61 / 53 | 同左 | 不变 |
|
||||
|
||||
这一组是**它自己那个问题的负结果,如实记录**:
|
||||
|
||||
- **`seg` 运行总量两侧逐字节相同**(2,698,026,763)说明:这个计数器测的是**生产者交出来的内容**,
|
||||
与发射侧怎么切、arena 开多大**完全无关**。这正是 §2.4 落点选择的直接证据——
|
||||
若把它记在 emitter 侧或记成 arena 占用,这里就会跟着预算动。
|
||||
- **但稳态中位数从 816,248 变成 554,104(−32%),而运行总量不变**——这两件事一起有意义:
|
||||
同样的总字节被**重新分到不同的窗口**(预算小了,某些原本一次完成的上传被切成多次、跨帧重传),
|
||||
所以**逐窗归属会动,总量不会**。读数时应以运行总量或明确声明的窗口口径比较,
|
||||
不要拿两套配置的单窗中位数直接对比。
|
||||
- **`wrec` 只涨 0.11%**(+7,358 条 / 250 帧 ≈ +29 条/帧,稳态中位数 7,497 两侧相同)说明
|
||||
**这条 trace 的内容本来就没有超过 256 KiB 的 blob**,所以即使预算压到 256 KiB 也几乎无可切。
|
||||
`maxrec` 仍是 1808 第三次确认(`maxrec` 是单条**记录**的字节上界,blob 被切不会改变它)。
|
||||
- **`tex` 涨 194% 才是这次 A/B 真正的发现**:256 KiB 预算下纹理上传走了近三倍字节。
|
||||
`MOBILEGL_IPC_STAGE_MB` 同时是 **arena 大小**,压小它改变了纹理 slab 的切分与重传行为
|
||||
(整宽 slab 被预算切碎后每片各自重传)。这一项**不在门 8 的定义里**,
|
||||
且**我没有把它隔离到单变量**(arena 大小与 chunk 预算被同一个环境变量绑在一起),
|
||||
因此**只作为 A/B 的可解释性证据记录,不作结论**;要分开这两个效应需要分别可配,
|
||||
那是另一个包的事。
|
||||
|
||||
> 因此门 8 的"chunking 后记录/帧"数取**默认配置**的 §6.4 值;
|
||||
> "逐 blob 分布"的答案是:**默认配置下该分布就是未分块的原始分布**
|
||||
> (`maxrec=1808`,稳态 `seg/wrec ≈ 109 B/条`),分块在 OpenRA 与 rd12 这两条负载上都没有被触发。
|
||||
|
||||
### 6.6 交叉核对:`seg` 与后端侧字节类
|
||||
|
||||
`seg` 记 wire 写进 SEG_STAGE 的字节,`buf`/`tex`/`csob-blob` 记**后端往驱动搬**的字节——
|
||||
两个总体不同,不要求相等,但应该在**同一量级**并且**同步起伏**;任一条不成立就说明 `seg`
|
||||
要么重复计数、要么漏了一个总体。逐窗比对(250 窗,`p6-crosscheck.py`):
|
||||
|
||||
```
|
||||
windows: 250
|
||||
seg median 818,030 mean 10,792,107
|
||||
parts median 291,840 mean 3,978,204 (parts = buf + tex + csob-blob)
|
||||
ratio mean seg/parts: 2.713
|
||||
bytes per record (seg/wrec): 389.8
|
||||
```
|
||||
|
||||
- **同步性**:逐窗比值在稳态下稳定在 1.0–8.2 之间(STAGE_MB=32)/ 1.2 平均(STAGE_MB=1),
|
||||
且两者在同一些窗一起抬升(第 0 窗两者都是峰值,第 124/155 窗两者都是谷值)。
|
||||
没有出现"一个动另一个不动"的窗。
|
||||
- **差异有解释**:`seg` 稳态恒有 `csob-blob ≈ 281 KB/帧`(program archive,**只走 wire、
|
||||
不经后端字节类**——`WireTables.cpp:540` 把它记进 `csob-blob` 是同一个量在发射侧的照面),
|
||||
加上 map-persistent 推送与 tail 字节;`parts` 一侧的 `tex` 中位数是 0。
|
||||
所以比值 > 1 而不是 = 1 是**两个总体本来就不同**的结果,不是漏计。
|
||||
- **比例随预算变化也是可解释的**:STAGE_MB=1 时 `parts` 的均值从 3,978,204 涨到 8,957,504
|
||||
(§6.5 的 `tex` +194%),而 `seg` 均值不动,所以比值从 2.713 掉到 1.205。
|
||||
两个数一起动、且动的方向就是 A/B 那一行预测的方向,这本身就是一次一致性验证。
|
||||
- 这一核对**不能证明覆盖完整**(没有第三方真值),它能排除的是"`seg` 明显偏离同一批字节"这一整类错误。
|
||||
`maxrec`/`ringwaits` 与 §6.5 的 A/B 是另外两个独立的佐证。
|
||||
|
||||
---
|
||||
|
||||
## 7 已知问题与未做项(如实记录)
|
||||
|
||||
1. **retrace 的 snapshot 模式拿不到 JSON dump;benchmark 模式拿得到**。`MOBILEGL_PIPE_STATS_FILE`
|
||||
的 dump 在 `PipeStats::Shutdown()` 里,而它只由 `MobileGL::Destroy()`
|
||||
(`MG_Impl/EGLImpl/EGLImpl.cpp:336` 的 `eglTerminate` 触发)调用。snapshot 模式在快照完成后
|
||||
`exit(0)`,被 `-Dexit=mobilegl_apitrace_exit` 换成一次抛出,**跳过了 `retrace::cleanUp()`**,
|
||||
所以 Destroy 不跑;benchmark 模式正常走完 `cleanUp()`,Destroy 跑。
|
||||
完整机制与实测见 **§9.1.2**(那里是为了判定"设备那条 client 汇总行是谁打的"查清的,
|
||||
结论是同一个机制)。因此 §6.5 的逐 blob 分布仍然只能用 **benchmark 模式或 integration 车道**取
|
||||
(`stats-igpu-inproc.json` 是后者);本报告 §6.5 分布用的是 integration 车道。
|
||||
把 snapshot 模式也接上需要改 runner 的退出路径,超出本任务授权的文件范围。
|
||||
2. **`maxrec` 在两条负载上都是 1808,与 `MEASUREMENTS.md:342` 分块前的记录相同**:
|
||||
这不是"分块没生效",而是**分块没有机会生效**(无 blob 超过预算)。任务书要求记录的"分块后数值"因此
|
||||
就是 1808,而它之所以等于分块前的值,原因已由 §6.5(b) 的 A/B 独立证明。
|
||||
3. **`MOBILEGL_PIPE_STATS_PERIOD=1` 本身有可观开销**(每帧一行 INFO),所以 §6.4 的帧数/负载
|
||||
**不能当作性能数**,只用于按帧摊平字节与记录。门 8 也只要求记录,不要求这些数是性能基线。
|
||||
4. **`seg` 的"每帧"是窗口量,不是硬件意义上的稳态帧时**。§6.4 因此同时给中位数与稳态均值,
|
||||
并把含加载窗的均值也列出来:rd12 的加载窗把它抬到稳态均值的约 7 倍(10.79 vs 1.53 MB/帧),
|
||||
OpenRA 两个值接近(8.07 vs 8.01 MB/帧)是因为它的加载窗与稳态窗同量级。
|
||||
引用这个数时必须说明选的是哪一个口径。
|
||||
5. **离树构建下 `PipeCatalogue.FrontendNeverTakesAnApplierAddress` 会红**(§4 末),
|
||||
与本次改动无关,但任何用 `-B` 指到源码树外的构建都会碰到。
|
||||
6. **`MOBILEGL_IPC_STAGE_MB` 同时是 arena 大小与 chunk 预算的来源**(§6.5(b) 的 `tex` +194%),
|
||||
所以**分块的净效果没有被单变量隔离**。本报告只报默认配置的数,并把 A/B 标为可解释性证据。
|
||||
要真正量化分块的收益/代价,需要把两者拆成可独立配置的量。
|
||||
8. **integration-split 全车道未跑**(时间预算)。门 8 只需要一条真实采集,本报告给了两条 +
|
||||
一条 A/B。要做更宽的确认,可用 §6.5(a) 的同一条命令换 `-R` 选择器。
|
||||
(§9 那一轮跑了 `.Spawn.` 前缀的 102 条集成条目,全绿。)
|
||||
9. **未改** `MEASUREMENTS.md` / `CURRENT_STAGE_PROGRESS.md` / `ROADMAP.md` / `Doorbell.*` /
|
||||
`protocol.fbs` / `pin_device.sh`(任务书禁止);未 `git commit`。
|
||||
*注:`tools/device_bench/pin_device.sh` 在工作树里确有改动,但那是并行的门 7 设备 agent
|
||||
加的 Redmi `2f7cbe2e` 行,**不是本轮改的**;本轮的 `git diff --name-only` 只含 §3/§9.2 的
|
||||
5 个 `MobileGL/` 文件。*
|
||||
10. **门 8 的第一个数(socket 门铃 vs inproc condvar)在本轮之后才算"两边都能采"**,
|
||||
但**真机数仍未采**(§9.6):§9.4 的对比来自 `wsl -d Ubuntu` + llvmpipe。
|
||||
本轮交付的是"该数在 spawn 臂上可采"这个前提,不是设备结论。
|
||||
门 7(真机 `2f7cbe2e` reboot-clean 配对 A/B)仍属另一个 agent 的范围。
|
||||
|
||||
---
|
||||
|
||||
## 8 复现命令清单
|
||||
|
||||
```bash
|
||||
# 0) 快照(含被 */build 误伤的两处补回)
|
||||
bash ~/w7/mgs/p6-snapshot.sh && bash ~/w7/mgs/p6-fix-builddirs.sh
|
||||
|
||||
# 1) split 构建(= CI build-linux-split 的配方)
|
||||
bash ~/w7/mgs/p6-cfg-split.sh
|
||||
cmake --build ~/w7/p6-gate8-build --parallel "$(nproc)"
|
||||
|
||||
# 2) 新增单测 + 全量回归
|
||||
cd ~/w7/p6-gate8-build
|
||||
ctest -L unit -R PipeStats --output-on-failure # 22/22
|
||||
ctest -L unit --no-tests=error -j 24 # 2364/2364
|
||||
|
||||
# 3) retrace 车道(runner 单独一棵树,库指到 split 构建的产物)
|
||||
bash ~/w7/mgs/p6-build-retrace.sh
|
||||
bash ~/w7/mgs/p6-stats-run.sh OpenRA DirectGLES 1
|
||||
bash ~/w7/mgs/p6-stats-rd12.sh
|
||||
bash ~/w7/mgs/p6-agg-all.sh # 聚合(含加载窗的均值)
|
||||
bash ~/w7/mgs/p6-quant-all.sh # 分位数 + 稳态均值/中位数
|
||||
python3 ~/w7/mgs/p6-crosscheck.py <server.log> # seg 与后端字节类的逐窗交叉核对
|
||||
python3 ~/w7/mgs/p6-quantiles.py <server.log>
|
||||
|
||||
# 4) 分块 A/B
|
||||
bash ~/w7/mgs/p6-chunkab.sh 32 /home/swung/w7/mgs/chunkab
|
||||
bash ~/w7/mgs/p6-chunkab.sh 1 /home/swung/w7/mgs/chunkab
|
||||
|
||||
# 5) G1
|
||||
bash ~/w7/mgs/p6-g1.sh
|
||||
python3 scripts/symbol_report.py \
|
||||
--before ~/w7/p6-gate8-g1-baseline.so --after ~/w7/p6-gate8-g1-head.so \
|
||||
--threshold 0 --fail-on-symbol-set-change --fail-on-added-bytes 0 --fail-on-text-delta
|
||||
|
||||
# 6) §9 spawn server 侧:单测 red-once、端到端 red-once、两传输 paired A/B
|
||||
bash ~/w7/mgs/p6-redonce.sh # 破坏 latch -> 单测红 -> 恢复
|
||||
bash ~/w7/mgs/p6-redonce-e2e.sh # 修前 0 行 / 修后 29 行,同一条 spawn trace
|
||||
bash ~/w7/mgs/p6-ab-transport.sh # inproc vs spawn,同一条 OpenRA trace
|
||||
bash ~/w7/mgs/p6-waitrate-all.sh # 逐 role 的 waits/parks 与 per-frame 费率
|
||||
|
||||
# 7) §9.1.2 车道模式判据 + §9.7 dump 角色分路
|
||||
bash ~/w7/mgs/p6-mode-probe.sh # snapshot: dump 缺 / bench: dump 在(= Destroy 是否跑)
|
||||
bash ~/w7/mgs/p6-lineprovenance.sh # 每条汇总行由哪个 role、哪种行打出
|
||||
bash ~/w7/mgs/p6-dumppath.sh # <base>.client.json / .server.json,基名不存在
|
||||
bash ~/w7/mgs/p6-redonce-dump.sh # 回退派生成裸基名 -> 单测红 -> 恢复
|
||||
```
|
||||
|
||||
证据留存:`~/w7/mgs/`(`build-split.log`、`cfg-split.log`、`g1.log`、`g1-final.log`、`g1-step2.log`、
|
||||
`build-retrace*.log`、`stats-OpenRA-DirectGLES/`、`stats-rd12-DirectGLES/`、`stats-igpu-inproc.json`、
|
||||
`stats-itest.json`、`chunkab/stage{32,1}/`、`ab8-{inproc,spawn}/`、`spawn-{baseline,fixed,prefix,postfix}-*/`、
|
||||
以及 `p6-*.sh` / `p6-{aggregate,quantiles,crosscheck,waitrate}.py` 全部脚本与解析器);
|
||||
G1 的两个 `.so` 在 `~/w7/p6-gate8-{g1-baseline,g1-head}.so`。
|
||||
Windows 侧脚本副本 `C:/Users/geekerwan/wsl-tmp/`(含 `pristine/` 与 `g1head/` 两个文件集,
|
||||
它们是 G1 两棵树各自的输入)。
|
||||
|
||||
---
|
||||
|
||||
## 9 spawn server 进程的 PipeStats 缺陷与修法
|
||||
|
||||
这一节是门 8 收尾的最后一个缺口。它不属于"加一个计数器",而属于"让已有的计数器在 spawn 臂上
|
||||
**可能**被采到"——没有它,item 8 的第一个数(socket 门铃 vs inproc condvar)只能采到半边。
|
||||
|
||||
### 9.1 现象:两条车道各自的真相
|
||||
|
||||
**先说结论,因为原文把两条车道混成了一条。** spawn 的 client 进程**确实**会打一条汇总行
|
||||
(真机数据见 `gate7-device-ab.md` §10.4:`wait[srv=0 srvpark=0 cli=30401 clipark=1538]`)。
|
||||
缺失的是 **server 进程**,而 client 那条行的**性质**取决于车道跑的是哪种 retrace 模式。
|
||||
|
||||
#### 9.1.1 server 半边:整行缺失(两条车道一致)
|
||||
|
||||
`pipeStatsEnabled` 在 spawn server 进程里恒为 false,所以它**一条 `MGPipe stats:` 行都没有**——
|
||||
不是携带 0,是整行不存在。桌面实测,spawn、两种 retrace 模式都一样:
|
||||
|
||||
```
|
||||
=== spawn, BEFORE the fix ===
|
||||
server : NO SUMMARY LINE (this process never ran PipeStats::Init, or never reached OnPresent)
|
||||
```
|
||||
|
||||
这一点必须写清楚,因为 `wait[srv=0 srvpark=0]`("服务端从未等待")与"没有这一行"("这个进程里
|
||||
计数器根本没开")是**两个不同的陈述**,而它们读起来一样。这正是 `PipeStats.h` 在 Gauge 注释里
|
||||
反复警告的那类"看起来像答案的零"。
|
||||
|
||||
#### 9.1.2 client 半边:行存在与否取决于模式,不是取决于传输
|
||||
|
||||
我最初的 §9.1 写"两条 role 都没有行",那是**桌面 integration / snapshot 车道**的观测,
|
||||
不是设备的观测。查清了:**client 那条汇总行是 `PipeStats::Shutdown()` 的终行,而 Shutdown 只在
|
||||
`MobileGL::Destroy()` 里被调用**。所以问题变成"retrace 车道到底跑不跑 Destroy()",而答案是**看模式**:
|
||||
|
||||
| retrace 模式 | 谁结束 replay | `retrace::cleanUp()` | `MobileGL::Destroy()` | client 汇总行 |
|
||||
|---|---|---|---|---|
|
||||
| **snapshot**(`--target-call`,快照跑法) | 快照完成后 `exit(0)` | **不跑** | **不跑** | **无** |
|
||||
| **benchmark**(`--benchmark`,设备 A/B 用的) | replay 走完 `main` 到 `retrace::cleanUp()` | 跑 | **跑** | **有,恰好一条** |
|
||||
|
||||
机制在源码上是确定的,不是推断:`tools/trace_replay/CMakeLists.txt:188,246` 用
|
||||
`-Dexit=mobilegl_apitrace_exit` 编译 apitrace 的 `retrace_main.cpp`(它在
|
||||
`mobilegl_trace_retrace_common` 里),而 `apitrace_exit.hpp` 把那个符号定义成
|
||||
**`throw MobileGLRetraceExit{status}`**。于是 snapshot 的退出点
|
||||
(`retrace_main.cpp:258` `if (call.no >= snapshotFrequency.getLast()) exit(0);`)变成一次**抛出**,
|
||||
直接穿到 `trace_replay_core.cpp:488` 的 `catch`——**它跳过了 `retrace_main.cpp:1482` 的
|
||||
`retrace::cleanUp()`**,而那是唯一会走 `glws::cleanup()` → `eglTerminate` →
|
||||
`EGLImpl.cpp:336` `MobileGL::Destroy()` 的路径。benchmark 模式不抛,正常走完 `cleanUp()`。
|
||||
|
||||
**这条判据是可判定的,我用了两条独立证据**:
|
||||
|
||||
1. **直接实验**(`p6-mode-probe.sh`):`MOBILEGL_PIPE_STATS_FILE` 只由 `PipeStats::Shutdown()` 写,
|
||||
所以它的 JSON dump 是否存在 = Destroy 是否跑。同一条 OpenRA trace、同一个 spawn 库:
|
||||
|
||||
```
|
||||
=== mode=snapshot === JSON dump: ABSENT -> Destroy() did NOT run
|
||||
client summary lines: 0
|
||||
=== mode=bench === JSON dump: PRESENT -> Destroy() did run
|
||||
client summary lines: 1
|
||||
frames=0 window=0 wait[srv=0 srvpark=0 cli=685 clipark=273]
|
||||
```
|
||||
|
||||
2. **与设备摘录的算术吻合**:设备 inproc 那段 client 行是 `window=11` / `frames=251`。
|
||||
`FormatWindowLine` 只在帧数是周期(默认 120)的整数倍时随窗口推进,所以终行的 `window`
|
||||
必然等于 `frames % period`——`251 % 120 = 11`,**正是设备摘录的值**。这就是终行,不是第 11 帧的窗口行
|
||||
(那个会在 frames=120 时出现、window=120)。
|
||||
|
||||
#### 9.1.3 由此得到的正确记账
|
||||
|
||||
| 车道 / 模式 | spawn client 行 | spawn server 行 | spawn client 的 `cli`/`clipark` | 窗口化字段 |
|
||||
|---|---|---|---|---|
|
||||
| 桌面 snapshot | 无 | 无(修前)/ 有(修后) | 不可得 | 不可得 |
|
||||
| 设备 benchmark(§10.4) | **有,1 条终行** | 无(修前)/ 有(修后) | **可信**(见下) | **不可信**(`frames=0 window=0`) |
|
||||
|
||||
**`cli`/`clipark` 的 run total 在 spawn client 里可信,因为它不由 `OnPresent` 产生。**
|
||||
`EmitPresent`(`EmitTables.cpp:1049-1050`)在**每条 present 记录**上直接
|
||||
`PublishGauge(ClientWaits/ClientParks)`,而 `PublishGauge` 是 **store 不是 add**(`PipeStats.cpp`),
|
||||
所以终行读到的是运行总量。设备那条 `cli=30401 clipark=1538` 因此是**真数**——
|
||||
它与我修前修的无关,一直就是对的。
|
||||
|
||||
**但同一个 spawn client 的窗口化字段不可信**:`frames=0 window=0`,因为 spawn client 从不调用
|
||||
`OnPresent`(那是 backend 的帧边界,而 client 的 Present 是**发射器**)。于是:
|
||||
|
||||
- `draws=`、`wrec=`、`bytes[...]`、`gates[...]`、以及**所有 per-frame 字段**(`draws/f`、`wrec/f`、
|
||||
`bytes/f[...]`、`acc/draw`)都印 **0 或 `n/a`**——`window=0` 走的就是该文件那条"无帧则退回窗口总量"
|
||||
的标注规则,而窗口总量也确实只有终行那点内容。
|
||||
- 唯一在 spawn client 上非零的是 **`EmitPresent` 直接发布的 gauge**:`cli`/`clipark`(上表)、
|
||||
`maxrec`/`maxcap`/`ringwraps`/`ringpads`/`ringwaits`,以及 `resid`/`csob-blob`/`seg`/`wrec` 这类
|
||||
**由发射侧直接 Add 的计数器**——它们的 run total 可信,但**窗口归属**只有最后一段。
|
||||
|
||||
桌面 benchmark 复现的正是这个形状(`frames=0 window=0`,`cli=685 clipark=273`,
|
||||
`seg=246975042 wrec=26117` 非零,而 `draws=0`、`gates[ers=0/0 ...]`)。
|
||||
|
||||
> **对门 8 item ① 的影响**:设备 §10.4 的 spawn client 半边**本来就是有效测量**,
|
||||
> 我在 §9.4 说明的"spawn 的 `cli=0 clipark=0` 是另一个进程"指的是**在 server 进程那一行上**读到的
|
||||
> `cli=0`——那是服务端进程的 client gauge 位,不是 client 进程自己那行。这两个陈述不冲突,
|
||||
> 但**必须分开写**,否则读者以为 client 半边从来没采到过。item ① 真正缺的只有 **server 半边**。
|
||||
|
||||
### 9.2 根因与修法
|
||||
|
||||
`PipeStats::Init()` 只从 `MobileGL::Initialize()`(`Init.cpp:123`)调用,而 spawn server 走的是
|
||||
`mobilegl_server_main` → `MG_ConfigLoader::Init()`(`ServerMain.cpp:182`)+
|
||||
`MG_Backend::InitServerRoleForSpawn()`(`ServerMain.cpp:239`),**从不经过 `MobileGL::Initialize`**。
|
||||
于是 `g_pipeStatsEnabled` 在该进程保持静态默认 false,**全进程所有 `if (PipeStats::Enabled())` 站点
|
||||
(含 `ServerLoop.cpp:436-437` 自己发布 `ServerWaits`/`ServerParks` 的那一对)恒为 false**。
|
||||
|
||||
修在 server 角色初始化的唯一收口点,即 `ServerMain.cpp` 的 step 1.5(配置加载 / D1 定角色)之后:
|
||||
|
||||
| 改动 | 位置 | 代码 |
|
||||
|---|---|---|
|
||||
| 新增 include | `MobileGL/MG_Remote/Server/ServerMain.cpp:49` | `#include <MG_Util/Metrics/PipeStats.h>` |
|
||||
| **初始化** | `ServerMain.cpp:231`(`MGPipeSetServerProcessRole(true)` 之后、step 2 之前) | `MobileGL::MG_Util::PipeStats::Init();` |
|
||||
| **收尾** | `ServerMain.cpp:442`(`loop.Stop()`/`session.Close()` 之后、`::_exit(0)` 之前) | `MobileGL::MG_Util::PipeStats::Shutdown();` |
|
||||
|
||||
**代码只有这两行**(外加一个 include);其余是解释"为什么是这个位置"的长注释。
|
||||
|
||||
三处顺序都是承重的:
|
||||
|
||||
1. **在 `MG_ConfigLoader::Init()` 之后**:`Init()` 把 `g_pipeStatsEnabled`
|
||||
**latch 自 `MG_Config::Features.PipeStats`**,而该字段由 `ConfigLoader.cpp:281` 的
|
||||
`QueryEnvFlag("MOBILEGL_PIPE_STATS")` 解析——解析器在上一行跑完之前都不存在。提前调用会把
|
||||
静态默认(false)latch 下来,launcher 传进来的 `MOBILEGL_PIPE_STATS` 就没人读——
|
||||
与 step 1.5(a) 记录的那个"没人读配置"缺陷是同一类。
|
||||
2. **在 `MGPipeSetServerProcessRole(true)` 之后**:这是让**日志 sink** 知道本进程是 server 的
|
||||
地方(`Log.cpp` 的 `ProcessIsSpawnedServer()` 读 `MOBILEGL_IPC_ROLE`,launcher 设置且其 envp
|
||||
scrub 保留它,因此按 `ThreadIsServerRole()` 该进程所有线程都写 `<base>.server.log`)。
|
||||
顺序这样排,是为了让"摘要行进 server 角色日志"这条契约不依赖将来那次解析改动的运气——
|
||||
**并且它由车道实测断言,不由这段注释担保**(§9.4 的 `server: banner=1 summary_lines=29`)。
|
||||
3. **`Shutdown()` 在 `loop.Stop()` 之后**:apply 线程正是发布 `ServerWaits`/`ServerParks` 的线程,
|
||||
它还在跑时取 dump 是竞态;而 `_exit(0)` 不跑任何 atexit handler,所以这是服务端唯一能写出
|
||||
运行总量与 JSON dump 的位置——没有它,spawn server 会丢掉最后一个窗(`Init.cpp:59` 在 client
|
||||
侧调 `Shutdown` 就是为了同一个"最后一帧的数别丢")。
|
||||
|
||||
### 9.3 三个 env 变量的语义:与 client 进程**完全一致**
|
||||
|
||||
`MOBILEGL_PIPE_STATS` / `_PERIOD` / `_FILE` 三者都由**子进程自己的环境**经**同一个解析器**读,
|
||||
再由**同一个 `Init()`** latch——stats 通道没有任何 spawn 特化。唯一的真实差异是**行节奏**:
|
||||
|
||||
> 服务端进程没有自己的 backend Present(它不做 swap),所以它的摘要行节奏骑在它**应用的 present
|
||||
> 记录**上(`PipeApplier.cpp:317` 的 `table->Present()` → DirectGLES/DirectVulkan 的 `Present()`
|
||||
> → `OnPresent()`),而不是骑在一次它并不执行的 swap 上。一次 present N 次的 spawn 会话,
|
||||
> **服务端产生 N 行窗口行**。
|
||||
>
|
||||
> **client 侧不是 N 行**——我最初在这里写的"与 client 自己那行数的 N 相同"是错的,实测把它否掉了。
|
||||
> spawn client 的 `Present` 是**发射器**(`EmitPresent`),它把 `PublishGauge(ClientWaits/ClientParks)`
|
||||
> 与 `maxrec` 那一批发出去,但**不调** `PipeStats::OnPresent()`(那是 backend 的帧边界,不是发射器的)。
|
||||
> 所以 client 一个窗口都不推进,它唯一的一行是 `Shutdown()` 的**终行**,`frames=0 window=0`——
|
||||
> 前提是那条车道走到 `MobileGL::Destroy()`(§9.1.2:benchmark 模式走到,snapshot 模式不走)。
|
||||
> 桌面 benchmark 实测:**server 128 行窗口行 + client 1 行终行**,两者不等。
|
||||
>
|
||||
> 清单里把 `Init.cpp` / `ConfigLoader.cpp` / `ServerLoop.cpp` / `ServerSession.cpp` 列为"按需",
|
||||
> 实测**四者都不需要改**,本轮 `git diff --name-only` 只动了 `ServerMain.cpp`(§9.2)
|
||||
> 与 §9.7 的 dump 路径四个文件。
|
||||
|
||||
### 9.4 验证:单测 + 端到端 red-once
|
||||
|
||||
**(a) 单元层**:新增两个用例(`PipeStatsTest.cpp`,见 §4 表),`ctest -L unit -R PipeStats` = **24/24**。
|
||||
其中 `InitIsTheOnlyLatchAndItTakesTheConfigBothWays` 钉住"latch 必须两个方向都取配置值",
|
||||
`PresentationsAtTheDefaultPeriodOfOneMakeOneWindowEach` 钉住"k 次 present → k 个窗口"这条
|
||||
车道费率所依赖的算术(并顺带钉住 gauge 是**运行总量、不是求和**——本报告 §6.1 的聚合脚本
|
||||
第一版正是栽在这里)。
|
||||
|
||||
**(b) 单元层 red-once**:把 `PipeStats.cpp` 的 latch 改成单向 `=true`,重跑:
|
||||
|
||||
```
|
||||
2/2 Test #1718: PipeStatsTest.InitIsTheOnlyLatchAndItTakesTheConfigBothWays ...***Failed
|
||||
50% tests passed, 1 tests failed out of 2
|
||||
```
|
||||
|
||||
恢复后 24/24 绿。(脚本 `p6-redonce.sh`。这个控制证明的是**两个用例不是同义反复**;
|
||||
它证不了端到端,因为用例直接调 `Init()`——被测对象是 latch 本身,而缺陷是 latch **从未被调用**。)
|
||||
|
||||
**(c) 端到端 red-once**(这才是修复的那个控制):构建两版库,**唯一差别**是 §9.2 那两行,
|
||||
同一条 spawn trace 各跑一次:
|
||||
|
||||
| | server 侧 summary 行数 | server 侧 `wait[...]` |
|
||||
|---|---:|---|
|
||||
| **修前**(step 1.6 两行移除) | **0** | 无(整行缺失) |
|
||||
| **修后** | **29** | `srv=387 srvpark=133`(= 13.34 / 4.59 per frame) |
|
||||
|
||||
脚本 `p6-redonce-e2e.sh`;两侧 SSIM 均 1.000000,即修复不改渲染。
|
||||
|
||||
**(d) 同机 paired A/B**(`p6-ab-transport.sh` + `p6-waitrate.py`,同一条 OpenRA trace、同一个库,
|
||||
只差 `MOBILEGL_TRANSPORT`):
|
||||
|
||||
| | inproc | spawn |
|
||||
|---|---:|---:|
|
||||
| client 进程 | 无 summary 行(§9.3) | 无 summary 行(同因) |
|
||||
| server 进程 summary 行 | 29 | 29 |
|
||||
| `srv`(waits/帧) | 16.83 | **15.00** |
|
||||
| `srvpark`(parks/帧) | 3.59 | **4.38** |
|
||||
| `srvpark/srv` | 21.3% | **29.2%** |
|
||||
| `cli` / `clipark` | 9.21 / 3.14(与 server 同行,因 inproc 单进程) | **0 / 0**(另一进程,见下) |
|
||||
|
||||
读法:
|
||||
|
||||
- **inproc 的两个半边在同一行上**,因为两个角色是同一进程的两个线程、共用一套计数器(§9.3 已
|
||||
解释了为什么这行出现在 server 日志里);
|
||||
- **spawn 的 `cli=0 clipark=0` 是"另一个进程",不是"客户端没等"**。它与契约里 `rsp`、`srv` 在
|
||||
spawn 下的既有行为同类,也是 `PipeStats.h` Gauge 注释里写明的那种"形如零的零"。要取 spawn 的
|
||||
client 半边,必须让 client 进程也到达一次帧边界(§9.3 的结构性原因),那是独立于本轮的一步。
|
||||
- **socket 门铃 vs condvar 的对比现在是可比的**:两侧 `srv`/`srvpark` 都由同一套代码、同一个
|
||||
wait 收口点、同一口径采集。采样中 socket 的 park 比例略高(29.2% vs 21.3%),
|
||||
与契约 §9 item 8 那条预告("socket 链路没有那条共享 cacheline,转成阻塞读可能更便宜")
|
||||
方向一致但**幅度很小,且这里是 llvmpipe/桌面**——真机数仍需在设备上另采,本节不做性能结论。
|
||||
|
||||
**(e) 回归**:`ctest -L unit` **2366/2366**(比上一轮多 2 个新用例);
|
||||
`.Spawn.` 前缀的集成条目 **102/102 全绿**。
|
||||
|
||||
### 9.5 G1 复验
|
||||
|
||||
§9.2 的改动在 `MG_Remote/Server/ServerMain.cpp`,属 `MOBILEGL_BUILD_DISAGGREGATED` 的源列表,
|
||||
pull 构建根本不编译它——但 G1 是**实测**不是推理。重跑 §5 的两棵树(baseline = 本轮改的 5 个文件
|
||||
全部回退到 `git HEAD`,head = 本轮内容,同一条 pull 配置):
|
||||
|
||||
```
|
||||
symbol-report: .text 10158850 -> 10158850 (+0, +0.000%)
|
||||
symbol-report: 27863 -> 27863 defined symbols: 0 added, 0 removed, 0 resized, 0 renamed
|
||||
symbol-report: 27122 -> 27122 normalised names, 27122 unchanged
|
||||
G1 rc=0
|
||||
.text BYTE-IDENTICAL
|
||||
MG_Remote symbols : 0
|
||||
gate8 symbols : 0
|
||||
```
|
||||
|
||||
即:**符号集 0/0/0/0,`.text` 逐字节相同,pull 构建仍无任何 `MG_Remote` 符号**。
|
||||
|
||||
### 9.6 本节的未做项
|
||||
|
||||
1. **`MOBILEGL_PIPE_STATS_FILE` 的角色冲突已修**(原为未做项 2),见 §9.7。
|
||||
2. **spawn client 的窗口化字段仍不可信,且这一项不是缺陷而是结构**。要让 spawn client 推进窗口,
|
||||
得让 client 进程到达一次 `PipeStats::OnPresent`;而 client 的帧边界在 spawn 下存在于
|
||||
`EmitPresent`(每条 present 记录一次)——把它接上去是**改变 client 侧调用点**,
|
||||
超出本轮授权,且会与 `DirectGLES`/`DirectVulkan` 的 backend 帧边界语义重复计数
|
||||
(同一个进程里两个 `OnPresent` 会让 `frames` 走两倍)。需要单独判断,不要顺手接。
|
||||
本轮已把这条限制在 §9.1.3 写清:**spawn client 的 `cli`/`clipark` 可信,per-frame 字段不可信**。
|
||||
3. **真机(Redmi)未跑**。本节全部数据来自 `wsl -d Ubuntu` + llvmpipe,门 7 与门 8 的设备数
|
||||
仍需在设备上采;本节只交付"server 半边可测"这个前提。
|
||||
§9.1.2 对**设备**那条 client 行的定性是**从源码机制 + 与本机 benchmark 复现的算术吻合**得出的
|
||||
(`251 % 120 = 11` 对上 §10.4 的 `window=11`),不是从设备日志原件里读出的 `frames=`——
|
||||
设备报告没有摘录该字段。若要在设备上把这条钉死,需要把那一行的 `frames=`/`window=` 一并留存。
|
||||
|
||||
---
|
||||
|
||||
### 9.7 `MOBILEGL_PIPE_STATS_FILE` 的角色分路
|
||||
|
||||
§9.6 原第 2 项记录的那个陷阱:修完 §9.2 之后 spawn 的**两个**进程都会执行 `WriteJsonDump()`,
|
||||
而两者都写 `MG_Config::Features.PipeStatsFile` 的**同一个字符串**,`ofstream` 的 trunc 让后写的
|
||||
覆盖先写的。读者会拿到**一个角色**的数,挂在一个自称是整轮运行的文件名下——比缺文件更坏,
|
||||
因为看不出哪里不对。
|
||||
|
||||
### 9.7.1 修法:与日志 sink 同一套命名规则,规则不复制
|
||||
|
||||
| 改动 | 位置 | 内容 |
|
||||
|---|---|---|
|
||||
| 导出角色查询(split 臂) | `MobileGL/MG_Util/Debug/Log.h:177,183`、`Log.cpp:100,107` | `LogRole CurrentThreadRole()`、`bool CurrentProcessIsSpawnedServer()` |
|
||||
| 同两个查询的 pull 臂 | `Log.h:222-223` | 内联;理由是 G1(见 9.7.3) |
|
||||
| dump 路径派生 | `PipeStats.cpp:787`(声明 `PipeStats.h:463`) | 经 `MG_Util::Debug::RoleLogPath(base, CurrentThreadRole())` |
|
||||
| `WriteJsonDump` / `Init` banner 改用它 | `PipeStats.cpp` 的 `WriteJsonDump()`、`Init()` | 两条路径都印/写派生名 |
|
||||
| 新单测 + 负控 | `PipeStatsTest.cpp` | 见 9.7.2 |
|
||||
|
||||
命名规则**只有一处实现**(`Log.cpp:87` 的 `RoleLogPath`),PipeStats 调它而不是复制它——
|
||||
这正是任务书要求的"派生规则由库导出、不复制"。
|
||||
|
||||
### 9.7.2 验证
|
||||
|
||||
**端到端**(`p6-dumppath.sh`,同一条 OpenRA trace、同一个库,只改传输):
|
||||
|
||||
```
|
||||
================ inproc ================
|
||||
run.json : absent <- 基名不指向任何文件
|
||||
run.client.json : PRESENT (1789 bytes)
|
||||
run.server.json : absent
|
||||
banner: ... JSON dump to .../run.client.json
|
||||
dump : wrote JSON dump to .../run.client.json
|
||||
|
||||
================ spawn ================
|
||||
run.json : absent <- 基名不指向任何文件
|
||||
run.client.json : PRESENT (1736 bytes) <- client 进程自己的数
|
||||
run.server.json : PRESENT (1714 bytes) <- server 进程自己的数,不再被覆盖
|
||||
banner: ... JSON dump to .../run.client.json
|
||||
banner: ... JSON dump to .../run.server.json
|
||||
dump : wrote JSON dump to .../run.client.json
|
||||
dump : wrote JSON dump to .../run.server.json
|
||||
```
|
||||
|
||||
inproc 只有 client 一个文件是**正确**的,不是缺陷:那个进程里只有 GL 线程会到
|
||||
`MobileGL::Destroy()`(§9.1.2),服务端角色是线程不是进程,`Shutdown()` 只跑一次。
|
||||
|
||||
**单测 25/25**,新增 `JsonDumpPathIsRoleDerivedAndTheBaseNameIsNeverOpened`。
|
||||
**但它的第一版是假绿,值得记下来**:那一版断言的是 `RoleLogPath` 自己的性质
|
||||
(两角色路径不同、都不等于基名)——**把修复整个回退掉它照样通过**,因为它测的是命名辅助函数,
|
||||
而辅助函数从来没坏;坏的是 `WriteJsonDump` **没有调用它**。一个在缺陷存在时仍然绿的测试比没有测试更坏。
|
||||
改法是把被测对象换成 `RoleDerivedJsonDumpPathForTesting()`——dump 与 banner **共用**的那一个表达式,
|
||||
于是回退它就会红。**red-once 复验**(`p6-redonce-dump.sh`,把那个表达式换回裸基名):
|
||||
|
||||
```
|
||||
2/2 Test #1720: PipeStatsTest.JsonDumpPathIsRoleDerivedAndTheBaseNameIsNeverOpened ...***Failed
|
||||
96% tests passed, 1 tests failed out of 25
|
||||
恢复后 25/25 绿
|
||||
```
|
||||
|
||||
### 9.7.3 G1:这次它是真的会红,而且红了三次
|
||||
|
||||
这一轮 G1 **三个不同的泄漏点**依次被抓出来,每个都不是能从代码上看出来的:
|
||||
|
||||
| 尝试 | 结果 | 原因 |
|
||||
|---|---|---|
|
||||
| 无条件派生 | `.text +24 bytes` | 把 `std::string` 临时量与一次调用放进了 monolith 的函数体 |
|
||||
| 加 `#if` 但两臂共用一个 `String` 局部 | **1 symbol resized**(`Shutdown()` 344→343,−1 字节) | 两个 `#if` 臂**即使算出同一个值也是不同的代码** |
|
||||
| 两臂分离,但重写了 `MGLOG_W` 的格式串 | **`.rodata +64`** | 把基名与派生名都印出来的新字面量;**字面量在哪个分支里都是字面量,而 `.rodata` 也被测量** |
|
||||
|
||||
最终形态:**pull 臂的代码逐语句就是原样**(`const String& path = MG_Config::Features.PipeStatsFile;`
|
||||
+ `if (path.empty()) return;`),所有新增都在 `#if` 之内。这个文件的规则因此比"把新代码 guard 起来"
|
||||
更强:**旧代码一个字都不能动**。
|
||||
|
||||
最终复验:
|
||||
|
||||
```
|
||||
symbol-report: .text 10158850 -> 10158850 (+0, +0.000%)
|
||||
symbol-report: .rodata 1521854 -> 1521854 (+0)
|
||||
symbol-report: Total 16585193 -> 16585193 (+0)
|
||||
symbol-report: 27863 -> 27863 defined symbols: 0 added, 0 removed, 0 resized, 0 renamed
|
||||
symbol-report: 27122 -> 27122 normalised names, 27122 unchanged
|
||||
G1 rc=0
|
||||
.text BYTE-IDENTICAL
|
||||
MG_Remote symbols : 0
|
||||
gate8 symbols : 0
|
||||
```
|
||||
|
||||
`g1.sh` 里加了一步前置断言:**先证明两组文件内容真的不同**(本轮 7 个里有 7 个不同),
|
||||
否则"两棵树 diff 为 0"会以"我忘了拷贝"的形式假绿——这正是这一轮最容易犯的错,
|
||||
因为漏掉的如果是一个新文件的声明,基线就等于 head,而门会说 OK。
|
||||
|
||||
### 9.7.4 本条对下游的提醒
|
||||
|
||||
- 任何**读** `MOBILEGL_PIPE_STATS_FILE` 的车道/脚本都要改成读派生名。基名**不会**存在,
|
||||
所以没改的读取方会当场 `ENOENT`——这是刻意的(与日志 sink 同一取舍:宁可响亮地失败,
|
||||
也不要拿到半轮数据却看不出来)。仓库内目前没有这样的读者(`grep` 确认),
|
||||
所以这次改名不破坏任何现有车道。
|
||||
- `MOBILEGL_PIPE_STATS_FILE` 的**语义**没有变:仍然是"在这里写 dump",
|
||||
只是"这里"由库按角色展开成两个名字。
|
||||
|
||||
@@ -0,0 +1,337 @@
|
||||
# MobileGL-disagg worktree:git 修好报告
|
||||
|
||||
> 症状:`git -C MobileGL-disagg status` 直接 `fatal: not a git repository: 3rdparty/DiligentCore/../../../MobileGL/.git/worktrees/MobileGL-p5c/modules/3rdparty/DiligentCore`。
|
||||
> 修复只动 git 元数据:**没有删库重克隆、没有切分支、没有提交、没有改源码**。
|
||||
> 日期 2026-09-22,`git version 2.45.2.windows.1`。
|
||||
|
||||
## 0 一句话结论
|
||||
|
||||
`MobileGL-disagg` 里 **33 个**子模块 checkout 的 `.git` 指针文件全部是**过期指针**(指向已删除的兄弟工作树 `MobileGL-p5c`),
|
||||
其中 **32 个**直接重定向到磁盘上真实存在的共享 admin 目录即可修复,**1 个(flatbuffers)在任何地方都没有 admin 目录**需要现场补建,
|
||||
另外**共享 admin 目录里的 `core.worktree` 会盖掉指针文件**,必须一并清掉,否则 `git status` 会把这些子模块全判成"内容已修改"。
|
||||
|
||||
现在 `git status`、`git submodule status`、`git add`、`git commit` 在该 worktree 里都能正常工作(见 §5 原始输出)。
|
||||
|
||||
## 1 环境事实
|
||||
|
||||
| 项 | 值 |
|
||||
|---|---|
|
||||
| 本 worktree | `C:\Users\geekerwan\AndroidStudioProjects\FoldCraftLauncher\MobileGL-disagg`,分支 `feat/disaggregated` |
|
||||
| 本 worktree 的 git dir | `FoldCraftLauncher/.git/modules/MobileGL/worktrees/MobileGL-disagg` |
|
||||
| MobileGL 项目 git dir | `FoldCraftLauncher/.git/modules/MobileGL`(MobileGL 是 FoldCraftLauncher 的子模块) |
|
||||
| 子模块共享 admin 根 | `FoldCraftLauncher/.git/modules/MobileGL/modules/` |
|
||||
| 对照工作树 | `FoldCraftLauncher/MobileGL`(分支 `dev`),git 是好的 |
|
||||
| 过期指针对应的目标 | `MobileGL/.git/worktrees/MobileGL-p5c/modules/...` —— `MobileGL-p5c` 这个 worktree 目录**已不存在** |
|
||||
|
||||
本 worktree 下 `.git` 条目共 **35 个**:**33 个指针文件**(`.git` 是文件)+ **2 个真实 git 目录**
|
||||
(`3rdparty/glslang/External/spirv-tools/.git` 及其 `external/spirv-headers/.git`,glslang 自带 checkout 的独立克隆)。
|
||||
**33 个指针文件在修复前全部含 `MobileGL-p5c`**(无一例外,见 `backup.txt`);
|
||||
修复后 **33 个全部指向共享 admin 根,含 `MobileGL-p5c` 的为 0 个**。
|
||||
|
||||
对照 `MobileGL`(dev)工作树记法是关键依据:它自己的子模块 checkout 是空的(未初始化),
|
||||
而唯一真实初始化的子模块 `3rdparty/libfork/.git` 写的是
|
||||
|
||||
```
|
||||
gitdir: ../../../.git/modules/MobileGL/modules/3rdparty/libfork
|
||||
```
|
||||
|
||||
即**指向共享 admin 目录**。本次修复采用同一形态。
|
||||
|
||||
## 2 过期指针清单与改法
|
||||
|
||||
改法:把 `MobileGL/.git/worktrees/MobileGL-p5c/modules/` 整体替换为 `.git/modules/MobileGL/modules/`,
|
||||
**跳数(`../` 的个数)原样保留**,所以任意嵌套深度都无需逐个特判。
|
||||
|
||||
### 2.1 顶层子模块(13 个,改 12 个)
|
||||
|
||||
| 路径 | 改后 `gitdir:` |
|
||||
|---|---|
|
||||
| `3rdparty/DiligentCore/.git` | `../../../.git/modules/MobileGL/modules/3rdparty/DiligentCore` |
|
||||
| `3rdparty/SPIRV-Cross/.git` | `../../../.git/modules/MobileGL/modules/3rdparty/SPIRV-Cross` |
|
||||
| `3rdparty/SPIRV-Reflect/.git` | `../../../.git/modules/MobileGL/modules/3rdparty/SPIRV-Reflect` |
|
||||
| `3rdparty/Vulkan-Headers/.git` | `../../../.git/modules/MobileGL/modules/3rdparty/Vulkan-Headers` |
|
||||
| `3rdparty/Vulkan-Utility-Libraries/.git` | `../../../.git/modules/MobileGL/modules/3rdparty/Vulkan-Utility-Libraries` |
|
||||
| `3rdparty/VulkanMemoryAllocator/.git` | `../../../.git/modules/MobileGL/modules/3rdparty/VulkanMemoryAllocator` |
|
||||
| `3rdparty/apitrace/.git` | `../../../.git/modules/MobileGL/modules/3rdparty/apitrace` |
|
||||
| `3rdparty/asio/.git` | `../../../.git/modules/MobileGL/modules/3rdparty/asio` |
|
||||
| `3rdparty/glslang/.git` | `../../../.git/modules/MobileGL/modules/3rdparty/glslang` |
|
||||
| `3rdparty/tracy/.git` | `../../../.git/modules/MobileGL/modules/3rdparty/tracy` |
|
||||
| `include/ska/.git` | `../../../.git/modules/MobileGL/modules/include/ska` |
|
||||
| `3rdparty/xxHash/.git` | `../../../.git/modules/MobileGL/modules/3rdparty/xxHash`(本会话早期作为单点试验先改好,脚本复查时已正确) |
|
||||
|
||||
### 2.2 嵌套子模块(改 20 个)
|
||||
|
||||
第三方库自带的子模块,同样是过期指针:
|
||||
|
||||
| 组 | 路径 |
|
||||
|---|---|
|
||||
| DiligentCore 的 8 个 | `ThirdParty/{SPIRV-Cross,SPIRV-Headers,SPIRV-Tools,Vulkan-Headers,glslang,googletest,volk,xxHash}` |
|
||||
| SPIRV-Reflect 的 1 个 | `third_party/googletest` |
|
||||
| apitrace 的 11 个 | `frametrim/tests`、`thirdparty/{brotli,directxmath,gtest,libbacktrace,libpng,snappy,zlib,zstd}`(8 个)、`thirdparty/snappy/third_party/{benchmark,googletest}`(2 个) |
|
||||
|
||||
合计 8 + 1 + 11 = **20**。
|
||||
|
||||
顶层 12(含 `3rdparty/xxHash`)+ 嵌套 20 = **32 个指针**由本次修复改写(其中脚本一次改 31 个,`xxHash` 是本会话早期手工单点试验改的);
|
||||
第 33 个是 `3rdparty/flatbuffers`——它的 admin 目录不存在,需先补建再改写指针,见 §3。
|
||||
|
||||
改后形如(以 DiligentCore 的 SPIRV-Cross 为例,跳数 `../../../../../` 原样保留):
|
||||
|
||||
```
|
||||
gitdir: ../../../../../.git/modules/MobileGL/modules/3rdparty/DiligentCore/modules/ThirdParty/SPIRV-Cross
|
||||
```
|
||||
|
||||
### 2.3 不改的两类
|
||||
|
||||
- **`3rdparty/glslang/External/spirv-tools/.git` 与 `.../external/spirv-headers/.git` 是真正的 `.git` 目录**(不是指针文件),
|
||||
是 glslang 自带 checkout 的独立克隆,路径相对自身成立,**原样保留**。
|
||||
- 本 worktree 自己的 `.git` 文件(`worktrees/MobileGL-disagg`)本来就是对的。
|
||||
|
||||
## 3 flatbuffers:唯一没有 admin 目录的一个
|
||||
|
||||
`3rdparty/flatbuffers` 比较特殊:
|
||||
|
||||
- 它是 `feat/disaggregated` 分支**新加**的子模块(`dev` 的 `.gitmodules` 里没有它),index 里有 gitlink `7e163021e59cca4f8e1e35a7c828b5c6b7915953`;
|
||||
- 磁盘上的内容是在的(`include/flatbuffers/flatbuffers.h` 等都在,版本头 25.12.19 与 pin 一致);
|
||||
- 但 `.git` 指针同样指向 `MobileGL-p5c`,而 **`.git/modules/MobileGL/modules/3rdparty/flatbuffers` 不存在**——
|
||||
整个 `.git` 树下搜不到任何 flatbuffers 的 admin 目录,也没有对应的逐个 worktree admin。
|
||||
也就是说这个子模块从来没在本机被真正 init 过,内容是从别处拷来的。
|
||||
|
||||
因为 `git status` 会因为一个死指针整条命令失败,必须把它修到"能解析"的状态。做法:
|
||||
|
||||
```
|
||||
# 用标准 git 机制补建该子模块的 admin 目录(git clone --separate-git-dir,不是手写 .git)
|
||||
git clone --no-checkout --depth 1 --separate-git-dir=<ADMIN> \
|
||||
https://github.com/google/flatbuffers.git <tmp>
|
||||
git --git-dir=<ADMIN> fetch --unshallow --tags origin # git submodule update --init 默认非浅克隆,补齐
|
||||
git --git-dir=<ADMIN> update-ref --no-deref HEAD 7e163021e59cca4f8e1e35a7c828b5c6b7915953
|
||||
git --git-dir=<ADMIN> read-tree HEAD # --no-checkout 不会写 index,这里补上
|
||||
# 位置选在共享 admin 根,与另外 12 个指针形态一致:
|
||||
# FoldCraftLauncher/.git/modules/MobileGL/modules/3rdparty/flatbuffers
|
||||
printf 'gitdir: ../../../.git/modules/MobileGL/modules/3rdparty/flatbuffers\n' \
|
||||
> MobileGL-disagg/3rdparty/flatbuffers/.git
|
||||
```
|
||||
|
||||
补建后:`HEAD` = pin(`git describe` = `v25.12.19`),`index` = 1912 条(与 HEAD tree 一致),`core.worktree` 不设(让指针文件决定工作树路径),
|
||||
`git rev-parse --show-toplevel` 正确解析到 `MobileGL-disagg/3rdparty/flatbuffers`。
|
||||
磁盘上的内容文件**一个字节都没动**。
|
||||
|
||||
> 注:内容与 pin 的差异只有 6 个 `java/src/test/java/*` 符号链接项——拷来的 checkout 里它们是真实符号链接,
|
||||
> 而 admin 的 `core.symlinks=false` 使其显示为 ` M`。这与本次指针修复无关,属内容拷贝的既有差异,未处理。
|
||||
|
||||
## 4 第二个坑:共享 admin 的 `core.worktree` 会盖掉指针文件
|
||||
|
||||
只修指针不够。修完之后 `git status` 能跑了,但 12 个子模块全被标成 ` m`(modified content;当时 12 个是因为 flatbuffers 的 admin 还没补建)。排查结果:
|
||||
|
||||
- 共享 admin 目录里带着从主工作树继承来的 `core.worktree`,指向**主 MobileGL 工作树的那个子模块目录**:
|
||||
|
||||
```
|
||||
core.worktree = ../../../../../../MobileGL/3rdparty/DiligentCore
|
||||
```
|
||||
|
||||
- 而主工作树的 `MobileGL/3rdparty/*` 是**空壳**(`git -C MobileGL submodule status` 全是 `-<sha>` 未初始化);
|
||||
- **`core.worktree` 的优先级高于指针文件**,所以 git 把子模块的工作树解析到那个空目录,于是每个被跟踪文件都"被删除",
|
||||
超项目就把子模块判成 modified content。
|
||||
|
||||
处置:把 `core.worktree` 从这些 admin 里删掉,让指针文件决定工作树路径——这正是链接工作树需要的语义
|
||||
(每个工作树各自解析到自己的目录)。范围严格限定:"目标目录存在但为空"或"目标目录不存在"的才删。
|
||||
|
||||
- 删除:**32 个 admin 条目**。
|
||||
可达 admin 共 34 个(`find` 实测),现在 33 个没有 `core.worktree`、1 个(`3rdparty/libfork`)保留;
|
||||
那 33 个里 `3rdparty/flatbuffers` 是本次新补建的、本来就没有这一项,所以**被我删掉的正好 32 个**。
|
||||
分解:`3rdparty` 顶层 11 + `include/ska` 1 + DiligentCore 嵌套 8 + SPIRV-Reflect 嵌套 1 + apitrace 嵌套 11 = 32。
|
||||
- 保留:`3rdparty/libfork`(主工作树里是活 checkout,32 个文件)——它的 `core.worktree` 原样保留
|
||||
- 回退:`android-plugin/third_party/apitrace` 那棵**孤儿子树**(共 9 个 admin;两个工作树里都没有 `android-plugin/third_party/` 目录,不可达)
|
||||
在验证阶段被我的脚本改过,**已按原值逐个还原**,最终与修复前一致。
|
||||
|
||||
验证方式(实验先于落地):在 `/tmp` 里用 `git init` 搭出同构拓扑(top ⊃ MG ⊃ 3rdparty/thing,
|
||||
再给 MG 开链接工作树、把过期指针和空壳目录都复现),对比"留着 core.worktree"与"删掉 core.worktree"两种处置,
|
||||
确认后者才能让 `git status` 干净、且 **`git rev-parse --show-toplevel` 落在自己的工作树**里。
|
||||
|
||||
## 5 最终输出
|
||||
|
||||
### 5.1 逐条目核对:13 个 `.gitmodules` 子模块 + 全部嵌套指针
|
||||
|
||||
口径:对 `.gitmodules` 里每一条 `[submodule "..."]`,把该 checkout 的 `.git` 指针按 git 的规则解析
|
||||
(`gitdir:` 相对的是**装着该 `.git` 文件的目录**,不是 worktree 根——这点是最初误判的根源之一),
|
||||
再检查解析结果是否真的是一个 git admin 目录(有 `HEAD`),并读出它的 HEAD。
|
||||
|
||||
| `.gitmodules` 路径 | 解析结果 | 指向的 admin 目录(相对工作树上级) | admin HEAD |
|
||||
|---|---|---|---|
|
||||
| `3rdparty/DiligentCore` | OK | `.git/modules/MobileGL/modules/3rdparty/DiligentCore` | `f36e638805` |
|
||||
| `3rdparty/SPIRV-Cross` | OK | `…/3rdparty/SPIRV-Cross` | `072444287f` |
|
||||
| `3rdparty/SPIRV-Reflect` | OK | `…/3rdparty/SPIRV-Reflect` | `10b4f09a24` |
|
||||
| `3rdparty/Vulkan-Headers` | OK | `…/3rdparty/Vulkan-Headers` | `ad9ce1235e` |
|
||||
| `3rdparty/Vulkan-Utility-Libraries` | OK | `…/3rdparty/Vulkan-Utility-Libraries` | `738ec97a3f` |
|
||||
| `3rdparty/VulkanMemoryAllocator` | OK | `…/3rdparty/VulkanMemoryAllocator` | `e722e57c89` |
|
||||
| `3rdparty/apitrace` | OK | `…/3rdparty/apitrace` | `c8036190fc` |
|
||||
| `3rdparty/asio` | OK | `…/3rdparty/asio` | `8806a6803c` |
|
||||
| `3rdparty/flatbuffers` | OK | `…/3rdparty/flatbuffers` | `7e163021e5` |
|
||||
| `3rdparty/glslang` | OK | `…/3rdparty/glslang` | `d89cf443bc` |
|
||||
| `3rdparty/tracy` | OK | `…/3rdparty/tracy` | `e6b9ea4609` |
|
||||
| `3rdparty/xxHash` | OK | `…/3rdparty/xxHash` | `1d7b2a9d21` |
|
||||
| `include/ska` | OK | `…/include/ska` | `21c1cec95a` |
|
||||
|
||||
**13/13 全部 OK;全树 33 个指针文件无一 BROKEN**(另 2 个真实 `.git` 目录照旧,不在指针之列)。
|
||||
|
||||
三项交叉核对,全部干净:
|
||||
|
||||
1. **pin = admin HEAD = checkout HEAD**:13 条里每一条的 gitlink(index 里记的 sha)、
|
||||
admin 目录的 `HEAD`、以及 checkout 内的 `git rev-parse HEAD` **三者完全相同**——
|
||||
说明指针既指对了地方,也没把某个子模块的版本弄丢。
|
||||
2. **index gitlink 集合 == `.gitmodules` path 集合**:两边都是 13 项,差集双向为空
|
||||
(没有"是 gitlink 却不在 `.gitmodules`"的,也没有"在 `.gitmodules` 却不是 gitlink"的)。
|
||||
3. **工作树里的 `.gitmodules` 与分支提交的 `.gitmodules` 逐字节相同**
|
||||
(`git show feat/disaggregated:.gitmodules` vs 工作树文件,`diff` 无输出)。
|
||||
|
||||
### `git -C MobileGL-disagg status -sb`
|
||||
|
||||
```
|
||||
## feat/disaggregated...origin/feat/disaggregated
|
||||
m 3rdparty/DiligentCore
|
||||
m 3rdparty/SPIRV-Cross
|
||||
m 3rdparty/SPIRV-Reflect
|
||||
m 3rdparty/Vulkan-Headers
|
||||
m 3rdparty/Vulkan-Utility-Libraries
|
||||
m 3rdparty/VulkanMemoryAllocator
|
||||
m 3rdparty/apitrace
|
||||
m 3rdparty/asio
|
||||
m 3rdparty/flatbuffers
|
||||
m 3rdparty/glslang
|
||||
m 3rdparty/tracy
|
||||
M MobileGL/MG_Remote/Wire/PipeWireCodec.cpp
|
||||
M MobileGL/MG_Test/Util/PipeStatsTest.cpp
|
||||
M MobileGL/MG_Util/Metrics/PipeStats.cpp
|
||||
M MobileGL/MG_Util/Metrics/PipeStats.h
|
||||
m include/ska
|
||||
M tools/device_bench/pin_device.sh
|
||||
?? .trace-work/
|
||||
?? Testing/
|
||||
?? docs/Disaggregated/inproc-dataflow.html
|
||||
?? docs/Disaggregated/notes/p6/gate7-device-ab.md
|
||||
?? docs/Disaggregated/notes/p6/gate8-wire-counters.md
|
||||
?? docs/Disaggregated/notes/p6/git-worktree-fix.md
|
||||
```
|
||||
|
||||
`git status` 退出码 0。工作区里那 4 个 `MobileGL/MG_Util|MG_Test|MG_Remote` 的 `.cpp/.h` 与
|
||||
`tools/device_bench/pin_device.sh` 是并行代理的 P6 工作产物(见 §7 末尾,**未回滚**)。
|
||||
|
||||
那 12 条 ` m` 是**既有 stat 噪声**,不是本修复引入,也不表示内容真被改过——见 §7 第 1 条的完整查证。
|
||||
最后 3 个 `??` 是并行代理的 `gate7-device-ab.md`、`gate8-wire-counters.md` 与本报告。
|
||||
|
||||
### `git -C MobileGL-disagg submodule status`
|
||||
|
||||
```
|
||||
f36e63880566649d9d8b2336a7c5aa9c8ddb174b 3rdparty/DiligentCore (API256008-78-gf36e63880)
|
||||
072444287f4e139c178d6d8fe32e04a0d2c34e8b 3rdparty/SPIRV-Cross (vulkan-sdk-1.4.321.0-49-g07244428)
|
||||
10b4f09a24d7ac1603071e767c089551dc6a3949 3rdparty/SPIRV-Reflect (vulkan-sdk-1.4.341.0-2-g10b4f09)
|
||||
ad9ce1235e88dc09287e19171dfac384db8ec32c 3rdparty/Vulkan-Headers (v1.4.344)
|
||||
738ec97a3f659dd6469bff3c4078ef981b0a343f 3rdparty/Vulkan-Utility-Libraries (v1.4.344)
|
||||
e722e57c891a8fbe3cc73ca56c19dd76be242759 3rdparty/VulkanMemoryAllocator (v2.1.0-1021-ge722e57)
|
||||
c8036190fcb79ce0d64cf44ab419c54c3307cd71 3rdparty/apitrace (heads/mobilegl/android-trace-replay)
|
||||
8806a6803cde7054c3049d3666d3ec36786568c5 3rdparty/asio (asio-1-38-2)
|
||||
7e163021e59cca4f8e1e35a7c828b5c6b7915953 3rdparty/flatbuffers (v25.12.19)
|
||||
d89cf443bcd220e9205defa0cc4c4b8d8f75dfa2 3rdparty/glslang (11.1.0-1271-gd89cf443)
|
||||
e6b9ea460993a6f093283055ef3c98025b19f909 3rdparty/tracy (v0.13.0)
|
||||
1d7b2a9d21bf9a740ead540aa93f4bc4caf11ae0 3rdparty/xxHash (v0.7.4-1000-g1d7b2a9)
|
||||
21c1cec95abee1beef827e4a7c95f692875d9594 include/ska (heads/master)
|
||||
```
|
||||
|
||||
`git submodule status` 退出码 0,13 条全部有 sha、**没有 `-` 前缀**(未初始化)也没有 `+` 前缀(pin 不匹配)。
|
||||
修复前这条命令在 `3rdparty/asio` 那一行就因为 flatbuffers 死指针中断了。
|
||||
|
||||
### `git add` / `git commit`
|
||||
|
||||
```
|
||||
$ git add MobileGL/MG_Util/Metrics/PipeStats.h # exit 0
|
||||
$ git commit --dry-run # exit 0
|
||||
On branch feat/disaggregated
|
||||
Your branch is up to date with 'origin/feat/disaggregated'.
|
||||
Changes to be committed:
|
||||
modified: MobileGL/MG_Util/Metrics/PipeStats.h
|
||||
```
|
||||
|
||||
为验证安全性额外查了三件事:
|
||||
|
||||
- **暂存不会误 bump gitlink**:在临时 index 上跑 `git add -A`,13 个 gitlink 的 sha 与操作前完全一致(无伪更新)。
|
||||
- **索引内容零改动**:`git add` + `git reset` 往返后,`git ls-files -s` 与操作前逐行相同(0 行差异,`md5` 也一致)。
|
||||
- **`git commit --dry-run` 在"没有暂存内容"时退出码本来就是 1**——这是 git 的正常行为(在全新空仓库上复现同样结果),
|
||||
不是本 worktree 的问题;一旦有暂存内容即退出码 0(上面那段输出就是证据)。
|
||||
|
||||
验证完已 `git reset` 撤销暂存,**没有产生任何提交**。
|
||||
|
||||
## 6 回归检查:兄弟工作树与超项目未受影响
|
||||
|
||||
| 对象 | 结果 |
|
||||
|---|---|
|
||||
| `git -C MobileGL status -sb` | 与修复前**逐字节相同**(12 个未初始化 `-<sha>` 不变) |
|
||||
| `git -C MobileGL submodule status` | 与修复前**逐字节相同** |
|
||||
| `git -C FoldCraftLauncher status -sb` | 与修复前**逐字节相同**(含原有的 `M .gitmodules`、`UU FCLauncher.java` 等,均非本次产生) |
|
||||
| 各仓库 HEAD | `MobileGL` = `fff9d639`、`MobileGL-disagg` = `94c130d6`、超项目 = `6d733f6f`,**均未移动** |
|
||||
|
||||
被改到的共享 admin 目录的 **index、HEAD、objects 全部未动**(只删了 `core.worktree` 配置项,以及给 flatbuffers 补建新 admin)。
|
||||
|
||||
## 7 遗留 / 已知问题(不粉饰)
|
||||
|
||||
1. **` m`(modified content)与 flatbuffers 的 6 个 ` M` 是既有噪声,非本次修复引入。**
|
||||
逐项查证:`git status` 报 3109 个文件"已修改",但(a)`git --no-pager diff --numstat` 的非零内容差异为 **0**,
|
||||
(b)用 `GIT_INDEX_FILE=<临时> git read-tree HEAD` 重建全新 index 后降到 **7 个**(那 7 个是 DiligentCore 自己带的嵌套子模块 gitlink,
|
||||
它们 pin 与实际 HEAD 相同,只是同样带着这层 stat 噪声),
|
||||
(c)拿**修复前的 index 备份**(`/tmp/p6gitfix/idx/…`)跑同一命令,同样报 3109。
|
||||
即这些标记来自共享 admin index 里**过期的 stat 缓存**(如 DiligentCore 的 index 记 size 10636、磁盘 10147,mtime 陈旧),
|
||||
是这些 checkout 被拷贝/迁移时留下的,`git update-index --refresh` 在这台机器上清不掉。
|
||||
它不影响 `status`/`submodule status`/`add`/`commit` 的正确性(见 §5 的 gitlink 与索引零改动验证),
|
||||
但会让 `git status` 输出偏噪。**本次未处理**(改 index 超出"修指针"的范围)。
|
||||
|
||||
> **已验证的安全清理办法**(留给后续执行者):对每个子模块用**临时 index** 试跑 `git add -u`,
|
||||
> 实测是**纯 stat 缓存刷新、被跟踪 blob 零改动**。逐个子模块在临时 index 上的效果:
|
||||
>
|
||||
> | 子模块 | 清理前 | 清理后 | blob 改动 |
|
||||
> |---|---:|---:|---:|
|
||||
> | `3rdparty/DiligentCore` | 3109 | 7 | 0 |
|
||||
> | `3rdparty/SPIRV-Cross` | 4603 | 0 | 0 |
|
||||
> | `3rdparty/SPIRV-Reflect` | 276 | 1 | 0 |
|
||||
> | `3rdparty/Vulkan-Headers` | 88 | 0 | 0 |
|
||||
> | `3rdparty/Vulkan-Utility-Libraries` | 71 | 0 | 0 |
|
||||
> | `3rdparty/VulkanMemoryAllocator` | 218 | 0 | 0 |
|
||||
> | `3rdparty/apitrace` | 627 | 9 | 0 |
|
||||
> | `3rdparty/asio` | 1535 | 1535 | 0 |
|
||||
> | `3rdparty/flatbuffers` | 6 | 6 | 0 |
|
||||
> | `3rdparty/glslang` | 23 | 0 | 0 |
|
||||
> | `3rdparty/tracy` | 382 | 0 | 0 |
|
||||
> | `include/ska` | 4 | 0 | 0 |
|
||||
>
|
||||
> 两个例外清不掉,且都是**既有内容差异**而非缓存问题:`asio` 的 2 个 ` T`(`asio/include`、`asio/src`
|
||||
> 是真实符号链接,而上游 pin 是普通文件)和 flatbuffers 的 6 个符号链接项。
|
||||
> 真要落地请逐个复查并在报告里说明这些例外。
|
||||
2. **flatbuffers 的 admin 是我补建的**(原本不存在)。若日后跑标准的
|
||||
`git submodule update --init`,git 会另建一份**逐工作树**的 admin
|
||||
(`worktrees/MobileGL-disagg/modules/3rdparty/flatbuffers`,共享 objects)并改写指针文件——这是 git 的正常行为,
|
||||
两条路径不会冲突;我也把补建的 admin 放在**共享**位置以与另外 12 个指针保持一致。
|
||||
3. **`3rdparty/glslang/External/spirv-tools` 及其 `spirv-headers` 是独立 `.git` 目录**,
|
||||
不受指针机制影响,但它们在 disagg 里也显示 ` M`(43 项,内容差异为 0,同类 stat 噪声),本次未动。
|
||||
4. 备份留在 `/tmp/p6gitfix/`(`backup.txt` 记全部 35 个 `.git` 条目的原始内容、32 个 admin config、34 个 index、以及 dev/超项目的状态快照),
|
||||
本机重启会清掉;需要留档请自行复制。
|
||||
|
||||
## 8 边界:本修复没有碰的东西
|
||||
|
||||
为了不误伤并行工作,明确列出本修复**未触碰**的部分:
|
||||
|
||||
- **没有回滚或修改任何源码**。`MobileGL/MG_Util/Metrics/PipeStats.{h,cpp}`、`MobileGL/MG_Util/Metrics/PipeStatsTest.cpp`、
|
||||
`MobileGL/MG_Remote/Wire/PipeWireCodec.cpp`、`tools/device_bench/pin_device.sh` 的工作区改动是并行代理的合法产物,
|
||||
本修复只读不写(只在 `git add`/`reset` 往返里短暂进过索引,已验证索引被跟踪内容 md5 与修复前一致)。
|
||||
- **没有新增/移动任何提交**:`MobileGL-disagg` 仍停在 `94c130d6`,与 `origin/feat/disaggregated` 同步;
|
||||
`dev` 工作树仍在 `fff9d639`;超项目仍在 `6d733f6f`。
|
||||
- **没有改分支**:`feat/disaggregated` 原样。
|
||||
- **没有动 `3rdparty/*` 里的文件内容**(flatbuffers 的 admin 是建在 `.git/modules/...` 下的新 git 目录,
|
||||
不在工作树里;工作树中只改写了 `.git` 指针文件这一行)。
|
||||
- **没有用 `git submodule update --init`**(那会重新克隆并可能重写指针),全部是元数据级定点修复。
|
||||
|
||||
### 回归核对(与修复前快照逐字节比对)
|
||||
|
||||
| 对象 | 结果 |
|
||||
|---|---|
|
||||
| `git -C MobileGL status -sb`(dev 工作树) | **逐字节相同** |
|
||||
| `git -C MobileGL submodule status`(dev 工作树) | **逐字节相同**(12 条 `-<sha>` 未变) |
|
||||
| `git -C FoldCraftLauncher status -sb`(超项目) | **逐字节相同** |
|
||||
| 共享 admin 的 `index` / `HEAD` / `objects` | 未动(只改 `core.worktree` 配置项 + 新建 flatbuffers admin) |
|
||||
| `.gitmodules`(工作树 & 分支) | 未动,且二者一致 |
|
||||
@@ -0,0 +1,104 @@
|
||||
# lk — 开工前的逐文件清单
|
||||
> 头 `b6293957`。`CONTRACT-P6.md` §8.5 要求 `lk` 在开工前发布这份清单,理由是早先一份草案的棘轮基线
|
||||
> 差了三倍,而**装在错误数字上的棘轮第一次 CI 就会因为和泄漏无关的理由变红**。
|
||||
> 全部计数由 `grep -rn -E` 在本头机械产出,口径写在每节标题下。
|
||||
|
||||
## A 纯度门棘轮基线:`Transport/` 之外的缝标识符
|
||||
|
||||
口径:`<标识符>`,排除 `MobileGL/MG_Remote/Transport/` 自身。`lk` 之后这些必须只出现在 `Transport/ShmLink.*` 与传输自己的测试里。
|
||||
|
||||
| 文件 | 类别 | 合计 | 明细 |
|
||||
|---|---|---:|---|
|
||||
| `MG_Test/Wire/SessionTest.cpp` | test | 55 | RingControl×16 ReplySlotPool×10 SessionSegments×9 RingProducer×4 RingConsumer×4 SessionConsumer×4 EventRingConsumer×3 SessionProducer×3 EventRingProducer×2 |
|
||||
| `MG_Test/Wire/RingTest.cpp` | test | 28 | RingControl×11 RingProducer×9 RingConsumer×8 |
|
||||
| `MG_Remote/Client/ClientSession.cpp` | prod | 26 | RingControl×7 EventRingConsumer×7 RingProducer×5 SessionProducer×4 ReplySlotPool×2 SessionSegments×1 |
|
||||
| `MG_Remote/Wire/PipeWireCodec.h` | prod | 19 | RingControl×11 RingProducer×6 RingConsumer×1 SessionConsumer×1 |
|
||||
| `MG_Test/Wire/PipeWireCodecTest.cpp` | test | 19 | RingProducer×7 RingConsumer×6 RingControl×5 SessionConsumer×1 |
|
||||
| `MG_Remote/Server/ServerSession.cpp` | prod | 17 | RingControl×4 RingConsumer×4 EventRingProducer×3 SessionConsumer×3 ReplySlotPool×1 SessionSegments×1 SessionProducer×1 |
|
||||
| `MG_Remote/Client/ClientSession.h` | prod | 14 | RingControl×3 SessionProducer×3 RingProducer×2 ReplySlotPool×2 EventRingConsumer×2 SessionSegments×2 |
|
||||
| `MG_Remote/Wire/PipeWireCodec.cpp` | prod | 14 | RingControl×6 RingProducer×4 RingConsumer×3 SessionConsumer×1 |
|
||||
| `MG_Test/Wire/ServerLoopTest.cpp` | test | 13 | RingControl×4 RingProducer×3 EventRingConsumer×2 ReplySlotPool×1 SessionSegments×1 SessionProducer×1 SessionConsumer×1 |
|
||||
| `MG_Remote/Server/ServerLoop.cpp` | prod | 12 | SessionConsumer×6 RingControl×2 RingConsumer×2 RingProducer×1 EventRingConsumer×1 |
|
||||
| `MG_Remote/Server/ServerSession.h` | prod | 11 | EventRingProducer×3 RingControl×2 RingConsumer×2 SessionSegments×2 SessionConsumer×2 |
|
||||
| `MG_Remote/Server/PipeApplier.cpp` | prod | 5 | SessionConsumer×3 RingControl×1 ReplySlotPool×1 |
|
||||
| `MG_Remote/Server/PipeApplier.h` | prod | 3 | RingControl×2 SessionConsumer×1 |
|
||||
| `MG_Test/Wire/RemoteClientTest.cpp` | test | 3 | ReplySlotPool×3 |
|
||||
| `MG_IntegrationTest/Harness/WireLedgerChecks.h` | test | 2 | RingProducer×2 |
|
||||
| `MG_Util/Metrics/PipeStats.h` | prod | 2 | RingProducer×1 SessionProducer×1 |
|
||||
| `Config.h` | prod | 1 | RingProducer×1 |
|
||||
| `MG_IntegrationTest/Harness/SplitRuntimePeek.cpp` | test | 1 | RingProducer×1 |
|
||||
| `MG_IntegrationTest/Harness/SplitRuntimePeek.h` | test | 1 | RingProducer×1 |
|
||||
| `MG_Remote/Client/EmitTables.cpp` | prod | 1 | SessionProducer×1 |
|
||||
| `MG_Remote/Client/EmitTables.h` | prod | 1 | ReplySlotPool×1 |
|
||||
| `MG_Remote/Client/GpuWritePending.h` | prod | 1 | RingProducer×1 |
|
||||
| `MG_Test/Wire/InProcessTransportTest.cpp` | test | 1 | RingControl×1 |
|
||||
|
||||
**合计:生产 127 / 测试 123,共 250 处,分布在 23 个文件。**
|
||||
|
||||
## B 重组影响面:`control.<字段>` 成员访问
|
||||
|
||||
口径:`(control|m_control|ctrl)(->|.)<字段>`,七个字段 = 四个 watermark + `submittedSeq` + 两个 event 标志。
|
||||
这是把 watermark 组变成具名 `LinkProgress` 成员后**必须逐处改写**的集合。
|
||||
|
||||
| 文件 | 类别 | 处数 |
|
||||
|---|---|---:|
|
||||
| `MG_Remote/Transport/Ring.cpp` | transport | 14 |
|
||||
| `MG_Test/Wire/RingTest.cpp` | test | 10 |
|
||||
| `MG_IntegrationTest/Harness/SplitRuntimePeek.cpp` | test | 5 |
|
||||
| `MG_Remote/Wire/PipeWireCodec.cpp` | prod | 4 |
|
||||
| `MG_Remote/Client/ClientSession.cpp` | prod | 2 |
|
||||
| `MG_Remote/Server/ServerLoop.cpp` | prod | 2 |
|
||||
| `MG_Test/Wire/PipeWireCodecTest.cpp` | test | 2 |
|
||||
| `MG_Remote/Server/ServerSession.cpp` | prod | 1 |
|
||||
| `MG_Test/Wire/SessionTest.cpp` | test | 1 |
|
||||
|
||||
**合计 41 处**(传输内 14 / 生产 9 / 测试 18)。
|
||||
|
||||
---
|
||||
|
||||
## C 实际结果(重组落地后补记)
|
||||
|
||||
两个口径在本文里曾经打架:表 B 的 41(受体限定为 `control|m_control|ctrl`)与
|
||||
`99649a90` 提交信息里的 44(受体不限)。**以表 B 的口径为准**,差额是三处受体不是
|
||||
控制页对象的匹配;而实际改写时受体集合还要再宽一档,因为测试里普遍写作
|
||||
`session.Control()->appliedSeq` / `owner.CmdControl()->appliedSeq`。
|
||||
|
||||
最终改写:**库 15 处 + 测试 58 处 = 73 处**(按 `re.subn` 计,一行可含多处)。
|
||||
|
||||
**"开集成测试构建"的真正理由不是计数,是守卫**:`MG_IntegrationTest/Harness/SplitRuntimePeek.cpp`
|
||||
的五处改写躲在 `#if defined(MGITEST_SPLIT_RUNTIME_PEEK) && !defined(__ANDROID__)` 后面。
|
||||
本轮用 red-once 证明了它确实在编译——往守卫体内塞一个未声明标识符,构建变红:
|
||||
|
||||
```
|
||||
SplitRuntimePeek.cpp:99:13: error: use of undeclared identifier 'MGITEST_DELIBERATE_RED_ONCE_PROBE'
|
||||
```
|
||||
|
||||
**差点踩坑的一处**:`SplitRuntimePeek.h:77` 另有一个结构体同样有 `appliedSeq` 字段,
|
||||
而 `SplitRuntimePeek.cpp:146` 一行里两个都在——`state.appliedSeq = control->appliedSeq.load(...)`。
|
||||
不限定受体的改写会静默改坏左边,`MagmaRunAheadScenario.cpp` 的九处访问的正是它(那个文件一行未动)。
|
||||
|
||||
## D 验收
|
||||
|
||||
| 项 | 结果 |
|
||||
|---|---|
|
||||
| pull 构建(G1) | 符号 0 增 / 0 删,`.text` 10822147 不变 |
|
||||
| split 构建 | 符号 0 增 / 0 删,`.text` 11681395 不变 |
|
||||
| 单元测试 | 2326 / 2328,与基线同样的两个环境性失败 |
|
||||
| 新增静态断言 | 逐条 red-once(下表) |
|
||||
|
||||
**口径说明**:上面的 `.text` 是**尺寸**不是字节。字段偏移变了,所以指令里的立即数变了,
|
||||
但代码尺寸没变。另外这套数字用的是 clang 22.1.6 且关闭 test/benchmark,**与路线图记录的
|
||||
P5f 基线(`.text 10806051`)不可比**,只能做"本包前 vs 本包后、同工具链"的比较。
|
||||
|
||||
### 断言的 red-once
|
||||
|
||||
| 扰动 | 结果 |
|
||||
|---|---|
|
||||
| 交换 `LinkProgress` 里 `retiredSeq` 与 `completedFrameSerial` | 红:`LinkProgress field order: retiredSeq` / `completedFrameSerial` |
|
||||
| 在 `LinkProgress` 内增加第五个字段 | 红:`sizeof(LinkProgress) == 32` |
|
||||
| **在 `Progress` 与 `serverEpoch` 之间塞一个小成员** | **不红——已具名记在 `Ring.h` 里** |
|
||||
|
||||
最后一行是本轮审查最有价值的产出。`serverEpoch` 是 `alignas(64)` 且紧随 `Progress` 声明,
|
||||
所以编译器总把它放在下一个 64 倍数处:**一个塞在 288 的小成员会落在 `Progress` 自己那条线上,
|
||||
而两个断言照样通过**,最多能藏 32 字节。审查建议的修法(`serverEpoch == Progress + 64`)
|
||||
也抓不住——实测过。`Ring.h` 的注释现在写明了这一点,因为**一道没人能证伪的门比没有门更糟**。
|
||||
Reference in New Issue
Block a user