[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:
2026-10-15 20:01:45 -04:00
parent 0e3e2b7761
commit aabca3c171
1035 changed files with 410 additions and 398 deletions
@@ -0,0 +1,203 @@
# CI / inproc 功能补齐交接(2026-09-20,用户要求停止)
> 用户最后明确要求:“写个交接文档,不要继续你未完成的任务了”。已停止继续实现、构建、测试和推送,只整理本交接。所有子 agent 已结束/中断;停止时检查没有本任务的 retrace / CTest / replay 进程在运行。最后启动的完整 retrace 已自行结束,结果已读入本文。
>
> **任务尚未完成,GitHub CI 尚不能宣称全绿。本轮修复没有 push,也没有合并到 `feat/disaggregated`。**
## 1. 用户确定的范围
- `feat/disaggregated` 的主产物必须编译拆分实现,并实际以 `inproc` 执行主验收。
- 普通 OpenGL 功能场景、完整 retrace 矩阵都应迁移并通过。不得用 skip、降低 SSIM、缩矩阵、吞退出码或“仅记录 census”替代实现。
- 明确验证 monolith 内部机制的对照保留 monolith,不强改成 inproc。
- D/P 只是 `MOBILEGL_BUILD_DISAGGREGATED` / `MOBILEGL_PIPE_PUSH` 两个编译开关;运行时还需 `MOBILEGL_TRANSPORT=inproc`。已向用户解释,后续尽量直接说中文。
- 本轮是此前 P5f / Magma run-ahead / RD32 性能工作的后续 CI 修复。历史 P5f 完成不等于现在扩展出的全部 inproc 功能验收完成。
## 2. 工作树、提交与未提交改动
基础目录:`C:/Users/geekerwan/AndroidStudioProjects/FoldCraftLauncher/`。
| 用途 | 路径 / 分支 | 停止时 HEAD |
|---|---|---|
| 本轮所有实现,后续应从这里继续 | `MobileGL-ci-fix` / `codex/fix-github-ci` | **`70c8230b3e05a8d62d881d4996db27e0ad251936`** |
| 用户交付树,尚未集成本轮修复 | `MobileGL-disagg` / `feat/disaggregated` | **`30b1bf25a4ea5ed8394dc9909c420051633c5115`** |
| WSL Arch 测试树 | `/home/swung/w7/p5f-int` / `codex/ci-fix` | **`70c8230b3e05a8d62d881d4996db27e0ad251936`** |
| 默认会话 cwd | `MobileGL` / `dev` | 不是本轮修改树,勿误改 |
`MobileGL-ci-fix` 有两份**未提交、不能当成已验证成品**的改动:
- `.github/workflows/test.yml`
- `.github/workflows/apk.yml`
这是 fm 最后审查 artifact 清理时留下的修改:Linux cleanup 等待/识别 `retrace-split`;保留失败 case 的 fixture 和结果;两工作流先成功读取完整 GitHub 分页 inventory,再执行删除,避免 process substitution 的 API 失败被当成“没有失败用例”。修改已落盘,但 agent 随后结束,未拿到完整最终校验/提交回报。后续先审 diff,不要直接丢掉,也不要假定已测试。
本交接文档另外新增在 CI 树和交付树,尚未提交。交付树原 `HANDOFF-P5F.md` 顶部增加了本交接入口。
### 必须保留的交付树现有修改
- `MobileGL-disagg/build.gradle`:SHA256 `331C22D6509AC5E5794F135E27D024675808220EC5001E404803BAB889DF1FF5`
- `MobileGL-disagg/android-plugin/app/build.gradle.kts`:SHA256 `FA7F21664A05A7172376DD47E00F435158D20E2F6422626C5D932B3228CF950C`
- `.trace-work/`、`Testing/`、`docs/Disaggregated/inproc-dataflow.html` 均为停止时已有未跟踪内容。
- 前两份 Gradle 改动是先前 FCL 本地测试 plumbing,与本轮新提交的 Gradle wiring 有重叠。最终集成要逐项协调,尤其旧 embedded-FCL arm64 限制;不要 reset 或把无关修改一起提交。
- FCL 父仓库此前有 `UU FCL/src/main/java/com/tungsten/fclauncher/FCLauncher.java` 等用户改动,不属于本轮。
- 不修复既有 DiligentCore gitdir 噪声。看状态/差异可用 `--ignore-submodules` / `--ignore-submodules=all`。
### WSL 状态
停止时除了 `tools/trace_replay/fixtures/` 的 LFS 实体文件外,WSL tracked 源码无差异。fixture 显示很多 `M`:这是把 LFS pointer 替换成已按 pointer SHA256 校验的真实文件,**不是换 golden**。共补齐 92 个 LFS 文件,来源为已有 `/home/swung/mgl/MobileGL` 或 Windows CI 树。不要直接 reset 成 pointer 后又把解包失败误当 renderer 失败。
未跟踪的 `Testing/`、`build-pull/`、`build-trace-ci/` 保留。`build-pull/` 原已存在。
Windows → WSL 的正常同步方式(不要让 Linux git 直接操作 Windows 工作树):
```bash
git -C ~/w7/p5f-int fetch /mnt/c/Users/geekerwan/AndroidStudioProjects/FoldCraftLauncher/.git/modules/MobileGL refs/heads/codex/fix-github-ci
git -C ~/w7/p5f-int -c submodule.recurse=false merge --ff-only FETCH_HEAD
```
## 3. 已完成的实现与关键提交
以下均已提交在 CI 分支;“已实现”不替代第 4 节的实际验证范围。
| 主题 | 提交 / 说明 |
|---|---|
| CI 主产物与完整双模式矩阵 | `7e82ea0f`、`bb3a5199`、`97ce032f`:目标分支主库/APK 开 D/P + INPROC;完整 **77 个 case/backend × 2 transport = 154**;日志、artifact、汇总分模式;独立 OFF/pull 库供错误库负控 |
| 清除旧“预期红 / census 算通过” | `347bb90c`:客户端数组专用通道必须绿并纳入主 GPU/split 标签;全量 inproc CTest 退出码为硬门 |
| 合法 monolith 对照 | `11132981`:指针/slot ABA、CSO 开关、resource/object mask、direct-adoption 计数等机制对照明确 monolith;普通像素功能保持当前模式。`03c6b8c9` 纠正 TextureUploadShape,应仍测 inproc,测试内等真实 applied boundary |
| 原 Linux CI 红 | `08c63f77`:统计等绘制 Present applied;`10bfd29f`:E1 负控改为观察真实协议 wait,避免要求所有 run-ahead draw 在 VERB_BARRIER=0 时必崩 |
| Android 回放生命周期 | `7fd83133`:retained ReplaySession、重建时取消旧 callback/unbind、trace configChanges 整数资源、native 原子 lease、ANativeWindow 生命周期;防两个 Activity 同时进入 JNI 全局回放 |
| 客户端顶点/索引 | `beba0256`:复制到 owned 普通 wire buffer;GPU EBO/indirect/count 先真实同步;保留 baseVertex/baseInstance/drawID;新增 GL 回归 |
| XFB / 查询 | `d0c6fdbc`、`70df57bb`、`8eaebc90`、`e2d6e33d`:Magma wire capture、真实 native query/result、XFB lifetime 删除、空捕获 buffer lazy readback;`4610b573` 防首次握手在 renderer 未创建时调用 Vulkan timer hook;`c7de0dff` 补齐 32 个 verb-boundary 的逐项断言 |
| GLES image / view / SSO | `c1bf7e15`、`57e0f6be`:server-owned promotion、native view;`c3a5d2f5`:空 image slot 保持实际 unit,避免高位空槽误解绑 unit 0,非当前 SSBO 程序先发布;`e2d6e33d`:sampler high-water tracker、whitebox peek 在 apply 线程执行 |
| 纹理读回 / PBO | `29b5e064`、`7875e28c`、`c0b40ff5`、`859c0efb`、`44cac27b`:真实服务端 GPU bytes、PACK/PBO 由 client 写入、texture 大回复分块、完整目的范围检查、避免同步 PBO 回复后虚构 pending GPU write;`f5234b9e` signed/half depth 编码 |
| sparse mip / packed format | `cf0f77b0` 暂时隔离 GLES native BASE/MAX;`40c5443f` **MGPSubData 72 → 88 字节**,携带完整 level extent;`ed01f4e3` 同时修 GLES hook 与通用 applier 的 adoption;`616f3c90` 按 Vulkan format 能力设置 attachment usage、只允许真正无 backing 且非 GPU-dirty 的 server stage 读回;`d339053e` RGB 展开前真实长度/溢出检查 |
| framebuffer / MSAA | `1389e8e7` cube face→layer;`ec4ca06d` color resolve;`0cb0e9af` RP2 depth/stencil resolve;`7b926429` 经纯 GPU 单 aspect buffer 中转保留另一 aspect,并补正确 resolve-write 屏障 |
| packed-float mip 生成 | `5310ff62` 缺 native blit 时用真实 GPU shader 逐 mip/layer 生成;`2426abb8` backend 裁 logical mip window;`70c8230b` frontend immutable/view 不再重分配或截断 owner,mutable 只更新生成窗口,新增窗口回归 |
注意:`MGPMipPlan.LevelCount` 在当前组合里保持 **logical end-exclusive**,不是 `BaseLevel` 后的数量。backend 先减 logical base,再映射 storage root。这个语义不可单边改。
GLES 的 texture-view 功能原本需 `MOBILEGL_ESPRYT_ENABLE_TEXTURE_VIEW=1`。相关功能 case 的 CTest recipe 已显式开启;早先 view construction 失败不是 CapsMirror 非虚函数问题。
## 4. 验证快照:不要混淆不同提交
统一证据目录:
- WSL:`/home/swung/w7/ci-fix-logs/`
- Windows:`C:/Users/geekerwan/.codex/tmp/github-ci-fix-20260920/`
### 4.1 完整 unit / GPU 最近一次整轮
**`5922e54b`**:`/home/swung/w7/ci-fix-logs/full-5922e54b/`
- unit:2319 总数,2308 pass、10 skip、1 fail。唯一失败为 `FieldOwnershipTest.VerbBoundaryOpsCoverEveryVerbShapedCall`,已在 `c7de0dff` 修复并单项复测 PASS。
- GPU inproc:1443 总数,1198 pass、221 skip、24 fail。
- 24 个失败都曾用独立日志重新复现:`full-5922-failure-probes/summary.json`,有 command、原输出、XML、首 Fatal。
- 后续 **`ed01f4e3` 的这 24 个精确失败全部复测 PASS,0 skip**:`failure-recheck-ed01/summary.json`。
- **没有在最终 `70c8230b` 上重跑完整 unit、完整 GPU、完整 monolith GPU。** 不能把“24/24 修复”写成“最后完整门全绿”。221 个 skip 也尚未做最终逐项分类审计。
其它已执行证据:
- E1 三个协议用例 baseline 绿 → 关必要 barrier 仅两个指定断言红 → restored 绿;smoke/redcheck 通过。见 `e1-control-current2/`、`e1-control-driver2.log`、`control-smoke-current.log`、`redcheck-control-current.log`。尚需最终头完整 split 负控(包括 E3)与其它出口门。
- `4610b573` 的 Magma query 13 项:13 PASS / 0 SKIP / 0 FAIL,真正 inproc/REQUIRE_GPU=1,零 Fatal:`magma-init-4610-query13/summary.json`。此前 6 个 skip 的直接原因是旧 query 返回 0,并非仅 COUNTER_BITS 广告问题。
- `40c5443f` 的 4 项 GLES XFB / TextureParams:4 PASS,相关 tracker 回归 PASS:`gles-final4-40c5/summary.json`。
- depth/stencil aspect 修复:`depth-aspect-buffer.{log,stdout,xml}`,增强 case PASS,Vulkan/sync validation 无 VUID/SYNC 错误。
### 4.2 最新新增窗口回归仍有一个失败
在 **`70c8230b`**:
- `F1WireScenario.GenerateMipmapHonorsMutableBaseAndMaxWithoutChangingOtherLevels`:两后端 PASS。证据 `mip-window-70c/summary.json`。
- `F1WireScenario.GenerateMipmapThroughViewKeepsOwnerLevelsAndLayersOutsideItsWindow`:Magma PASS,**GLES FAIL**。证据 `mip-view-window-70c/summary.json`。
- 断言:`F1WireScenario.cpp:596`,`owner mip 3, layer 0` 有 4/4 texel 不对。该 view 应只改变 root mip 3 / layer 1;窗口外 layer 0 被改变。
- 已分给 fr,但该 agent 随后退出,**没有这项修复的未提交半成品或完成报告**。仍需定位 GLES view mip 生成 / owner stage replay,不能减断言。
### 4.3 完整 Linux inproc retrace 已结束:67/77,10 失败
**这是停止整理时读取的最终结果,不是最初工具尚在运行时的 15/77 进度。**
证据:`/home/swung/w7/ci-fix-logs/retrace-inproc-70c8230b-hydrated/`
- `results.xml`、`ctest.log`、`matrix.json`、`cases.txt`
- **77 总数,67 PASS、10 FAIL、0 SKIP**,原阈值未修改。
- 单 case `result.json`、`mobilegl.log`、`retrace.log`、actual/diff 在:
`/home/swung/w7/p5f-int/build-trace-ci/tools/trace_replay/<case>/<backend>/output/`
- 首次 `retrace-inproc-ed01f4e3/` 是 LFS pointer 解包失败,不能当 renderer 结果。之后校验补齐 92 个实体文件才跑上面这轮。
10 个失败:
| case | backend |
|---|---|
| `minecraft-1.21.4-fabric-iris-sundial-lite-in-world` | DirectVulkan |
| `minecraft-1.21.4-fabric-iris-iterationt-in-world` | DirectGLES、DirectVulkan |
| `minecraft-1.21.4-fabric-iris-iterationt-nodsa-in-world` | DirectGLES、DirectVulkan |
| `improved-transparency-minecraft-26.3` | DirectGLES、DirectVulkan |
| `minecraft-1.21.4-fabric-iris-iterationrp-in-world` | DirectVulkan |
| `minecraft-1.21.4-fabric-iris-bsl-esc-menu-854` | DirectGLES、DirectVulkan |
停止时只读取了已有输出,未继续诊断或修复:
- Sundial Vulkan:`ssim=0.000046370`,阈值 `0.99`,mismatchPixels `408472`,真实图像不匹配。
- 其余日志中有 7 次 `Fatal{RingOverrun, "SEG_STAGE"}`:单 blob `34,603,008` / `56,623,104` / `134,217,728` 字节超过 `33,554,432` 字节 stage。
- 另有 2 次 `Fatal{InitialBytesNotCarried, "resource_respecify"}`,描述 initial content 的后续 subdata 没有发出。
- 尚未逐 case 完成这 9 个 Fatal 的对应/根因分析。不能把放大 stage、放宽阈值或跳过 case 直接当迁移完成。
- 完整 monolith retrace 本轮未跑;新头 Android retrace / AVD lifecycle 实跑也未完成。
### 4.4 Android 构建与旧远端失败
Windows 已成功编译 trace/plugin Release APK,各含 arm64-v8a + x86_64,D/P/INPROC=ON:
- `android-plugin/app/build/outputs/apk/trace/release/MobileGL-plugin-trace-release-5922e54.apk`
- `android-plugin/app/build/outputs/apk/plugin/release/MobileGL-plugin-release-5922e54.apk`
- 日志:Windows evidence 目录的 `android-gradle-full-ready.log`,`BUILD SUCCESSFUL in 8m 8s`。
- APK/native SHA 和二进制 marker:`android-local-built-identity.json`。这是较早 5922 标记产物,**不是最终头产物,也没有声称已在设备/AVD 跑过本轮 APK**。
- 主库及 trace 编译依赖已初始化(排除了 DiligentCore);glslang 的 `update_glslang_sources.py` 已成功执行。
- Windows Java selector loopback 需要当前命令的 `JAVA_TOOL_OPTIONS=-Djdk.net.unixdomain.tmpdir=C:/T`;Gradle `-Pmobilegl.xxx=...` 参数在 PowerShell 要整段加引号。
旧远端 `30b1bf25` 两轮均已完成且红:
- Test run `35513925180`:`integration-split-strict` job `106089389584`,`integration-split` job `106089389592`。
- APK run `35513925171`:Vulkan create-indirect retrace job `106089768679`。
- Windows `android-latest-vulkan/` 的 logcat 确认 Activity relaunch 后两个回放 TID(2276 / 2289)重叠;与先前 Bliss 的重复 JNI 生命周期根因一致。`7fd83133` 是代码修复,仍需新头远端验证。
- **本轮新修复从未 push,远端还没有这些提交的 CI 结果。**
## 5. 后续明确的未完成事项
仅在用户重新授权继续后执行:
1. 先审查并收尾两份未提交的 artifact-cleanup workflow diff。
2. 修最新 GLES view mip-window 回归。
3. 修上述 10 个完整 retrace 失败:大 stage blob、initial bytes 携带、Sundial 实际像素错误;保持完整矩阵与阈值。
4. 最终头重跑完整 unit、完整 inproc GPU、明确 monolith 对照;审查剩余 skip 的真实原因。
5. 跑完整 split strict / dual-block / clientarray / E1/E3 / run-ahead / generated/include/模式证明等适用门。部分已有老头证据,不等于最终头全绿。
6. 重建最后提交的两 ABI Android APK;验证真实 AVD overlay/recreate 生命周期和完整两 transport retrace。
7. push 修复分支,实际观察 GitHub workflows 结束并修远端差异;再协调交付树 Gradle 现有修改,合入/push `feat/disaggregated`,确认远端 SHA。
8. 写最终报告。不要把当前 handoff 或历史 P5f close-report 当成本轮完工证明。
## 6. 恢复所需命令与工具说明(未在停止后执行)
WSL `build-split` 已配置 D/P/INPROC。`build-trace-ci` 是独立 replay runner,使用:
```text
MOBILEGL_TRACE_REPLAY_MOBILEGL_LIBRARY=/home/swung/w7/p5f-int/build-split/libMobileGL.so
```
retrace 用的是共享库,**只 build `MobileGLIntegrationTest` 不会更新它**;修改后需构建 `MobileGL`。CTest integration 多数链接静态库。
Windows evidence 目录已有复现助手,都是本任务临时脚本,不是产品代码:
- `run-feature-probes.py`:从 CTest discovery 保留 recipe,强制真实 inproc/strict/role/REQUIRE_GPU,逐 case 私有 log/stdout/XML;可 `--regex` 或 `--failed-junit`。
- `run-ci-retrace.py`:按原 `github-test-matrix` 精确选 77 项,`ctest --tests-from-file`,mode 参数为 inproc/monolith;输出按 HEAD 命名。
- `run-current-full.sh`:完整 unit 后完整 inproc GPU,两个退出码均报告。
- `summarize-results.py`:只读 JUnit 汇总。
- `hydrate-trace-fixtures.py`:校验 LFS pointer SHA 后从现有实体缓存复制,初次已成功,无需盲目重复。
当前 replay 已结束,无需恢复旧 session。未来两 transport 运行会共用 build-trace-ci 的 case 输出目录,**不要同时跑它们覆盖同名图片/日志**,下一轮前先归档已有失败证据。
多 agent 曾共享同一文件并发生提交夹带:`c3a5d2f5` 带入 query agent nativeDelete hunk,`e2d6e33d` 又带入 root LevelWidth adoption,直到 `40c5443f` 才是完整可编译组合。现在提交链配套已齐全。以后每次提交逐 hunk 检查归属;不要让另一 agent 的未完成 hunk 混入独立提交。
子 agent 在 completed/errored 后,`send_message` 不会启动新工作;恢复需 `followup_task`。本次所有 agent 已停止,不存在后台继续修复的约定。
## 7. 历史设备成果,仅作背景
本轮之前已交付 Magma inproc / run-ahead / RD32 性能修复;`70fb6689` 下 RD32 Magma inproc **116.73 FPS**,同包 monolith **115.01 FPS**。Redmi `2f7cbe2e`,FCL 包尾 `.mgdebug.debug`,MC `26.3-rc-3`。历史已安装库 SHA256:`11f26ca1f1d6c9a3d89134c31b2348306e669b1d9ebcc2fc77c7f5def2b4f818`。
这些是历史头证据,**不代表 `70c8230b` 或后续代码已完成 Redmi E2E/性能验收**。原世界/options 已在先前工作恢复并核验,勿无故再改。
+80
View File
@@ -0,0 +1,80 @@
# P5f 交接:已全部收官
> **后续 CI / 全量 inproc 工作尚未完成,已按用户要求停止(2026-09-20)。**
> 最新接续点见 [CI / inproc 交接](HANDOFF-CI-INPROC-20260920.md):实现树停在 `70c8230b`,尚未合并或 push;完整 inproc retrace 为 67/77,另有一个新增 GLES view mip 回归未解决。下文“已收官”仅指此前 P5f 范围,不能作为本轮 CI 全绿证明。
> 2026-09-20。交付 worktree:
> `C:/Users/geekerwan/AndroidStudioProjects/FoldCraftLauncher/MobileGL-disagg`,分支 `feat/disaggregated`。
> 完整结果见 [close-report.md](close-report.md),设备见 [device-report.md](device-report.md),
> 阶段终审见 [close-review.md](close-review.md)。原 P5f 行为验收头 `cfca93c7`;
> 后续 Magma run-ahead 的最终行为头为 `194382c9`,见下。
>
> **Magma RD32 性能补修(2026-09-20,`70fb6689`)**:修复重复view/framebuffer创建销毁和
> 临时render-pass句柄造成的pipeline缓存退化;inproc **116.73 FPS**,同包monolith **115.01 FPS**。
> 缓存回归、Vulkan同步验证及主机全门通过。见 [性能报告](magma-rd32-performance-fix.md)。
>
> **Magma run-ahead 已完成(2026-09-20)**:独立 readiness 已开启,GPU 提交/资源
> 退休时序、真实排队/credit 1/3、负控、Vulkan 同步验证均通过。Redmi 同一
> `.mgdebug.debug` APK 的 Magma RA=1 / RA=0 与 GLES RA=1 三臂均完成至少60秒
> 世界运行与验图;修复了实机发现的 VAO 身份哈希碰撞。见 [最终报告](magma-runahead.md)。
>
> **Magma inproc 游戏修复(2026-09-20)**:已补 server buffer consumers 与 Android quarter-turn
> color blit。`38919d45` 的 `.mgdebug.debug` FCL 在 MC `26.3-rc-3` 世界 `test` 上,
> Magma inproc、GLES inproc 和 Magma monolith 均完成至少60秒运行与人工验图。
> 该历史包仍 lockstep、约20 FPS;当前版本以上面的 run-ahead 报告为准。
> 不是 P7 全量完成。见 [修复报告](magma-inproc-fix.md)。
> 旧 [fcl-e2e-report.md](fcl-e2e-report.md) 保留 `aa78f102` 的真实失败,不代表当前结果。
## 0. 当前结论
**P5f 已全部完成。不要重开 fe / fm 或 fs / fr / fv,也不要重复设备六臂。**
P6 的 P5f 前提解除;P6 的 a6 审计、c6 契约冻结和 spawn 实现均未开工。
| 包 | 完成证据 |
|---|---|
| f0 | `e75e00cb`,八份历史普查 |
| f1 | `cfcc12f7` + `418c765c`;[f1-report.md](f1-report.md) |
| fc | `b5c60d5a`;[fc-report.md](fc-report.md) |
| fe | `203f59cc`;[fe-report.md](fe-report.md) |
| fm | `3cc397d3`,行为代码 `552ade5b`;[fm-report.md](fm-report.md) |
| fs | `863fd1f5`;[fs-report.md](fs-report.md) |
| fr | `bf5ad470`;[fr-report.md](fr-report.md) |
| fv | `4cc4504b`,行为代码 `1153c561`;[fv-report.md](fv-report.md) |
| 字段 / 逐帧 RSP / 结果集门 / 回调终审修复 | 已集成到 `cfca93c7`;[close-report.md](close-report.md) |
| Redmi / 跨模型族终审 | 六个 clean-boot 臂完成;审查两项 P1/P2 均真实红转绿,无未决项 |
- 字段归属 **41 record / 6 derived / 0 barrier / 16 fatal**。遗留指针 getter 被禁止,
消费者读 server records;8 个 whole-field refusal 保留,未用重标分类掩盖指针。
- unit **2310:2300 PASS + 10 skip**;GPU **1377:1118 PASS + 259 skip**;均零失败。
- 普通 / strict split **180:176 PASS + 4 skip**;双块 **212:206 PASS + 6 skip**。
两份 marker 棘轮为空;strict 的 Fatal / Admitted / ESCALATED 均零。
- 双后端独立逐帧 RSP 门 **2 PASS / 0 skip**;Redmi 六臂 **60 PASS / 6 既有 skip / 0 failed**,
36 个 stats windows 全部 `rsp=0`。设备 skip 仅 Magma 两个既有 clip-distance 限制各跑三臂。
- G1 `.text +0`、symbols 0/0/0/0;G2 **3016 == 3016**;G14 **3646 → 3744,+98 / -0**。
## 1. 下一阶段需要知道的边界
- Magma 已发布 `kCapRunAheadApply`;`RUN_AHEAD=0` 保留配对对照。
可达路径已经在 role-split + strict 下验证,没有 frontend registry/allocator 豁免。
其余 P7/P8 shape 限制仍具名拒绝;run-ahead 不代表 P7 全量完成。
- P8 client arrays、P12 window/present 到达语义等路线图债保留;不是未完成的 P5f 包。
- server context 的 unpack/render shadow 按 native generation / served serial / role 核键。
XFB 以 lifetime id 分区;served context 切换保留暂停 span,native context 销毁才废弃旧
driver objects。不要把 P6 的 reset 设计写成“所有 reset 都清所有活对象”。
- P6 a6 要核查进程启动和配置边界。P5f 不声称已经运行两个 OS 进程。
控制帧、静态量迁移、反向回调归属已经落地,不应再列为 P6 待实现项。
## 2. 环境与复现
- Windows 收口树 `../MobileGL-p5f-close`,分支 `codex/p5f-close`;WSL 集成树
`/home/swung/w7/p5f-int`,分支 `codex/p5f-final`。各包参考树保留,不 reset。
- 原始主机日志 `/home/swung/w7/p5f-logs/`;最终前缀 `exit-reviewed-*`。
门脚本 `/home/swung/w7/notes/tools/p5f_gate.sh int <step>`。脚本末尾 grep 不能替代
实际构建退出码或 JUnit;strict / dualblock / GPU 共用私有日志,必须串行。
- 设备最终证据 `C:/Users/geekerwan/.codex/tmp/p5f-redmi-exit-cfca93c7/`;库 hash 与
六个 boot-id 已钉在设备报告。工具已入仓 `tools/device_bench/p5f/`。
- Windows → WSL 从 Windows gitdir fetch 完整 ref;WSL → Windows 用 bundle。
不用 Linux git 直接操作含 Windows 绝对 `.git` 路径的 worktree。
- 主 Windows 树原有 `build.gradle`、`android-plugin/app/build.gradle.kts` 未提交配置,
以及 `.trace-work/`、`Testing/`,均保留,未混入 P5f。WSL `build-pull/` 为构建产物。
既有 DiligentCore 子模块 gitdir 噪音不在本次范围。
@@ -0,0 +1,302 @@
# P5f — 一切状态上 wire:跨进程前的最后一次归零
> **已收官(2026-09-20)**:f0 / f1 / fc / fe / fm / fs / fr / fv、字段归属收口、
> 主机出口门、Redmi 双后端六个 clean-boot 臂与跨模型族终审均完成。
> 最终行为验收头 `cfca93c7`;[`收口报告`](close-report.md) 为当前结论,
> [`交接`](HANDOFF-P5F.md) 为下一阶段入口。P6 的 a6 / c6 / spawn 尚未实施。
> 当前字段:41 RECORD_SUPPLIED / 6 APPLIER_DERIVED / **0 BARRIER_PULLED** / 16 FATAL;
> 两份 marker 棘轮为空,双后端逐帧 `rsp=0`。旧指针 getter 保持 FATAL,不以改名消债。
>
> 以下 §0–4 保留立项背景与设计,§1–2 的读点、行号及 15 字段数字均是
> **历史基线 `feat/disaggregated @ 7f1d2134`**,其中“今天”“尚未”等不代表当前状态。
> 路径在 `MobileGL/` 下;各包报告保留其提交时快照,后续闭环见收口报告。
---
## 0 目标与出口判据
**目标**:两个角色之间,除 `SEG_CMD` / `SEG_STAGE` / `SEG_REPLY` / `SEG_EVENT` / caps 快照 / 控制帧
之外零交换。不得有任何一方读写另一方的内存、也不得依赖"两者其实是同一个对象"。
P5c 立过同样的规则(规则 E),但它的判据是**审计**——人读 59 行清单。P5f 的判据是**机器**:
> **出口判据**:`inproc` 下给两个角色**各自一份 `PipeInputs`**(§1),以及各自一份所有
> per-context 的进程级静态,整条 `integration-split` 仍然全绿,且
> `MOBILEGL_IPC_STRICT_ERRORS=1` 下 `Harness/strict-expected-markers.txt` **为空**。
这条判据的价值在于它**不需要第二个进程**就能证伪跨进程的假设。今天两个角色共享一份
`gPipeInputs`,所以"server 读到了 client 填的值"和"server 读到了记录送来的值"在运行时完全
无法区分——这正是 P6 第一天会踩的坑。把块拆成两份,前者立刻变成 poison Fatal。
---
## 1 `gPipeInputs` 是什么,拆进程后它会怎样
### 1.1 它是什么
`MG_Backend/MGPipe/PipeInputs.h:835`:
```cpp
inline PipeInputs& gPipeInputs = *new PipeInputs();
```
一个**普通的进程级全局对象**,不在任何共享内存段里。它是“后端被推送的状态块”——backend 不再每
draw 去读 `MG_State::pGLContext`,改为读这个块。每个字段带一个**归属类**
(CONTRACT-P5 表 2 / R-7,手维护的一半在 `MG_Pipe/FieldOwnership.def`):
| 归属类 | 量 | 含义 |
|---|---|---|
| `RECORD_SUPPLIED` | **41 个字段**(P5c rv 之前 32);**由推导得出,不列在表里** | 推送的记录供给**整个**字段,server 永远不需要 client |
| `APPLIER_DERIVED` | 4 行 | applier 从它已经应用的记录里写出它 |
| `BARRIER_PULLED` | **21 行 / 15 个字段** | **P5 的债**:server 读的是 client 的残余填充留在“那唯一一份共享的 `gPipeInputs`”里的值 |
| `FATAL` | 4 行 | 没有载体,缩减路径也不读;读到即 abort |
**最要紧的一点,先说:`BARRIER_PULLED` 里好几个字段存的不是值,是指向 client 对象的指针。**
```cpp
// MG_Impl/Pipe/PipeFill.cpp:274 —— 裸指针,指进 client 的纹理单元数组
dst.m_textureUnitBase = &ctx.GetTextureUnitObject(0);
// MG_Impl/Pipe/PipeFill.cpp:245 —— 前端对象的 SharedPtr
dst.m_programForDraw = ctx.GetProgramForDraw();
```
读侧照着解引用(`PipeInputs.h:669`):
```cpp
TextureUnit& GetTextureUnitObject(Int unit) { return m_textureUnitBase[unit]; }
```
`PipeFill.cpp:2591-2592` 对 `set_shader_buffers` 那组的说法是同一件事:该字段是
“four raw bases into the frontend's binding-point table”。**所以这不是一块照搬过去就能用的状态。**
### 1.2 一次 draw 的完整生命周期
以 `glBindTexture(GL_TEXTURE_2D, 7)` 之后一次 `glDrawArrays(GL_TRIANGLES, 0, 3)` 为例。
**① `glBindTexture`**:MG_Impl 更新 `MG_State` 的影子状态,tracker 置脏位。**什么都不发。**
推送只发生在 verb 边界。
**② `glDrawArrays`** → `MGPipeValidateForVerb(kVerbDrawArrays)`(`MG_Impl/Pipe/PipeFill.cpp:3347`),
四步:
| 步 | 做什么 | 碰 `gPipeInputs` 吗 |
|---|---|---|
| 1 | 判定本条记录设不设障(`barriered` / `fillOwed`) | 决定第 4 步填不填 |
| 2 | 脏位走查 `tracker.Update(*ctx, verbClass)` | 否 |
| 3 | **发射**:14 个 emitter 把脏子系统变成**记录**;纹理绑定变成 `set_texture_bindings`,带的是**句柄** | 否 |
| 4 | **残余填充**:记录没供给的字段,`CopyField(inputs, *ctx, field)` 从活的 GLContext 抄进块里,盖上本 verb 的世代戳 | **是——`BARRIER_PULLED` 就是这一步** |
随后 draw 记录本身写进 `SEG_CMD` ring 并敲门铃。设障就等 `appliedSeq`;不设障就直接返回(P5e)。
**③ server apply 线程**:从 ring 取记录 → `PipeApplier::ApplyOne` → 分发到 verb sink → 调后端
`DirectGLES::DrawArrays`。
**④ 后端 `PrepareForDraw()` 取它要的东西**,两条路:
- **走记录**:用记录带来的句柄查 **server 自己的对象表**。跨进程成立。
- **走 `gPipeInputs`**:`GetTextureUnitObject(0)` 返回 `m_textureUnitBase[0]`,而那个指针指进
**client 的数组**。今天成立,只因为两个角色同地址空间、且 barrier 保证此刻 client 停着。
**⑤** 后端发出真正的 `glDrawArrays` 给厂商驱动。
**字段的寿命**:第 4 步填入并盖上 verb N 的戳;后端在 verb N 的 apply 期间读;到 verb N+1 若不
重填,读到的就是旧戳 → `Fatal{UnmigratedPipeInput, "<Field>@<Verb>"}`(`MOBILEGL_PIPE_POISON`)。
**一个 verb 一次,不跨 verb 存活。**
同一个例子今天分两条臂,正好是 §2.1 那张表的缩影:
| | 纹理绑定怎么到后端 |
|---|---|
| **Espryt** | 走记录:`set_texture_bindings` 带句柄 → server 自己的表。P5e 已退役 `GetTextureUnitObject`。**跨进程成立。** |
| **Magma** | 仍读 `gPipeInputs.GetTextureUnitObject(0)` → client 的数组。**跨进程不成立。** |
`FieldOwnership.def` 里这一行的原文就是 `"P5e (Espryt unbarriered), P7 (Magma)"`。
### 1.3 为什么今天能工作
因为两个角色在**同一个进程、同一个 `gPipeInputs` 对象**上,而 verb barrier 保证同一时刻
{GL 线程, apply 线程} 至多一个可运行——所以这个块任何瞬间只有一个写者
(`PipeInputs.h:904-908` 的裁定)。client 填,server 读,中间不经过任何载体。
`BARRIER_PULLED` 这一类的定义就是这句话:“server 在 barrier 把两个线程隔开时,读 client 的残余
填充留在 `gPipeInputs` 里的值。**合法,并且被计数**(`PipeStats::CallClass::ResidualPulls`)。”
### 1.4 拆进程后它会怎样
**client 进程和 server 进程各有一个 `gPipeInputs`,是两个不同的对象。**
- `RECORD_SUPPLIED` / `APPLIER_DERIVED` 的 **45 个字段**没问题:值本来就由记录或 server 自身产生,
server 侧的块会被正常填上。
- `BARRIER_PULLED` 的 **15 个字段没有填充者**。第 4 步写的是 **client 那一份**;server 那一份从来
没人写过,`FilledGen` 恒为 0 → 后端每次读都 `Fatal{UnmigratedPipeInput}`。
- `MG_Impl` 根本不在 server 进程里,所以连“让 server 自己去 fill”这条退路都没有。
**而且不能靠“把这个块也放进共享内存”解决**(这是最容易想歪的一步):里面存的是裸指针和
`SharedPtr`(§1.1)。就算两个进程映射同一段内存,`m_textureUnitBase` 指向的 client 堆地址在
server 进程里没有意义,`SharedPtr` 的引用计数更跨不过去。
头文件自己写着这件事(`PipeInputs.h:279`):当前 verb 边界的清理“对 inproc 足够——两个角色共享
一个进程、一个 `gPipeInputs`——**而对 P6 是误导的,那里 `MG_Impl` 根本不在 server 里**”。
以及 `:902`:`rsp` 的值“**就是 P6/P7/P8 债务的大小**”。
**所以 P5f 对 `gPipeInputs` 的要求**:不是共享它,而是让这 15 个字段**各自换一个不依赖对方地址
空间的来源**——升成 `RECORD_SUPPLIED`(值随记录过线)、升成 `APPLIER_DERIVED`(server 自己推)、
或确认缩减路径根本不读它而降成 `FATAL`。
这也正是 §4 双块演练为什么有效:`inproc` 下就给两个角色各一份,第 4 步写 client 的、后端读
server 的,**今天所有靠“其实是同一个对象”蒙混过去的路径立刻变成具名 Fatal**,带字段名和 verb 名
——不用拆进程就拿到完整清单。
---
## 2 清单(在基线头上实测)
### 2.1 `BARRIER_PULLED` 的 15 个字段
| 字段 | 退役阶段(`FieldOwnership.def` 原文) |
|---|---|
| `GetBoundVertexArray` | P5e (Espryt unbarriered), **P7 (Magma)** |
| `GetBufferBindingPoint` | P5e (Espryt unbarriered), **P7 (Magma)** |
| `GetFramebufferBindingSlot` | P5e (Espryt unbarriered), **P7 (Magma)** |
| `GetImageTextureBinding` | P5e (Espryt unbarriered), **P7 (Magma)** |
| `GetProgramForDraw` | P5e (Espryt unbarriered), **P7 (Magma)** |
| `GetProgramForDispatch` | P5e (Espryt unbarriered), **P7 (Magma)** |
| `GetTextureUnitObject` | P5e (Espryt unbarriered), **P7 (Magma)** |
| `GetTextureObject` | P7 |
| `GetBufferBindingPointCount` | P7/P13 |
| `HasOpenTransformFeedbackSpan` | P7/P9 |
| `GetTransformFeedbackProgram` | P3b/P4b (Espryt), **P7 (Magma)** |
| `GetProgramObject` | P9 |
| `ValidateProgramName` | P9 |
| `RecordError` | P9 |
| `GetBufferBindingSlot` | P8 (indirect), P9 (readback), P13 (transfer) |
**八个字段 P5e 只为 Espryt 的未设障路径退役了,Magma 一条都没动。** 这是清单里最大的一块。
strict 车道当前实测活着 **10 对** `<field>@<verb>`(`Harness/strict-expected-markers.txt`),
其中两对是 escalation-barriered 的 client vertex array 条目(P8)。
### 2.2 Magma(DirectVulkan)
P7 原本是"全量迁移 10 个子系统",里面混着与拆分无关的工作(内容寻址 CSO、内部 shader 烘焙、
定宽重写)。**P5f 只取其中会阻碍跨进程的部分**:§2.1 里带 "P7 (Magma)" 的那 9 个字段,以及
Magma 侧一切直接读前端对象 / 写 client 存储的站点。P5c 审计的 **T5** 是已知的一条:
Magma 生成 mip 直接写 client 的 level 存储(`DirectVulkan/Renderer/VulkanRenderer.cpp:1562-1590`)。
Magma 今天不发布 `kCapRunAheadApply`,所以它跑 lockstep——**lockstep 掩盖的正是这类缺陷**,
与 P5e 的 ID-132 是同一条教训。
### 2.3 EGL / surface 控制面(P5c 审计 G4)
十二个 `Server*` forwarder(`MG_Remote/Server/ServerLoop.cpp:802-1022`)经单槽邮箱传
**函数指针 + 栈上 `void*`**(`ServerLoop.cpp:533-568`、`:645`)。`protocol.fbs:166-205` 的
`SurfaceOp` / `SurfaceReply` / `WindowKind` schema 已定但**无人使用**。
跨进程后函数指针与栈地址都无意义。
> **fc 已落地**:行号以基线 `7f1d2134` 为准(本节是"在基线头上实测"的清单);落地后的形态、
> 逐 op 映射与契约草稿见 [`notes/p5f/fc-report.md`](fc-report.md) 与
> [`notes/p5f/fc-contract-draft.md`](fc-contract-draft.md)。
### 2.4 进程级静态,语义却是 per-context
已知两个:`g_syncedRenderStateParameters`(`MG_Backend/DirectGLES/DirectGLES.cpp:4586`)与
`ScopedDefaultUnpackState::s_synced`(`CONTRACT-P5C.md:538-539` 记为 P6 的)。
**完整清单未知**——这类缺陷 `inproc` 结构性看不见,必须普查。
### 2.5 P5c 留下的具名豁免 scope
`MGPipeFrontendKeyedRegistryScope` 在 `DirectGLES.cpp` 还有约 **12 个活跃站点**
(`:2542`、`:4505`、`:5540`、`:5659`、`:5940`、`:6490`、`:6576`、`:7092`、`:7682`、`:8213`、`:11231` …),
背 P3b/P4b 的债:registry 仍按前端地址 / lifetime-id 键控。
### 2.6 反向通道(P9 的一部分)
XFB scatter 对 client shadow 读改写、`OnXfbScatterReady`、`OnTexturePullRequest` 与终止符、
`OnGlError` 有序化。其中**凡是直接触碰 client 内存的**归 P5f;纯粹的异步化 / 批处理 / 排序
(`SEG_REPLY` 异步槽池、PBO fire-and-forget、epoch 排序)仍归 P9。
### 2.7 class C
`MG_Remote/Client/EmitTables.cpp` 里 10 处具名拒绝。**不归 P5f**:拒绝是诚实的,
`Fatal{UnmigratedVerb}` 在两个进程下行为一致。它们限制的是 spawn 车道的覆盖面,不是它的正确性。
---
## 3 范围边界
| 取 | 不取 |
|---|---|
| §2.1 全部 15 个字段(含 Magma 的 9 个) | P7 的性能与架构项:内容寻址 CSO、内部 shader 烘焙、`DynamicBackendParameters` 定宽重写 |
| §2.2 Magma 侧一切跨角色读写 | Magma 的功能补齐(占位纹理原生化、具名 UBO host payload 等),除非它们本身是跨角色读写 |
| §2.3 控制面帧(原 P6 的) | 真窗口到达(P12) |
| §2.4 静态量按世代/角色分区 | — |
| §2.5 registry 按句柄重键 | P3b/P4b 的其余项(view 索引重映射、workaround 删除) |
| §2.6 反向通道里触碰 client 内存的部分 | P9 的异步化与排序 |
| — | class C(§2.7)、chunked readback(P9)、persistent map 分档(P11) |
**判断准则只有一条**:*它在另一个地址空间里还成立吗?* 不成立 → P5f。成立但慢/丑 → 留给原阶段。
---
## 4 中心机制:双块演练
P5f 的每一条都靠同一个机制证伪,而不是靠审计:
1. **`PipeInputs` 按角色分区**:`gPipeInputs` 变成"取当前角色的块"。client 的 fill 写 client 的块,
backend 的读取 server 的块。任何今天依赖"两者是同一个对象"的路径,立刻变成
`Fatal{UnmigratedPipeInput, "<Field>@<Verb>"}`,带字段名和 verb 名。
2. **per-context 静态按角色 + 世代分区**,同理。
3. 两者都由一个旋钮武装(建议 `MOBILEGL_IPC_ROLE_SPLIT_STATE=1`),默认关,CI 开一条车道。
这等于在**不拆进程**的前提下把进程拆分的语义先跑一遍。代价是一个旋钮和一次分区;
回报是 P6 那天不会有任何一条"第一次执行"的路径。
---
## 5 包(全部完成;ID-137 分工)
```
f0 普查(已集成):§2.4 的完整静态清单 + §2.6 的逐站点清单 + 字段载体判定
└─ f1 双块机制 + 旋钮 + 车道(已集成;初始红清单已全部退役)
├─ fe Espryt 字段读者 + XFB 快照 + 共用记录接线(已集成)
├─ fm Magma 的 9 个字段 + T5 + Magma 侧跨角色读写(已集成)
├─ fc 控制面帧(§2.3,已集成)
├─ fs 静态量按角色/世代分区、XFB lifetime、server liveness(已集成)
├─ fr frontend registry / allocator 无 apply-side 豁免(已集成)
└─ fv 反向事件 callback 所有权与 frontend fallback 退役(已集成)
└─ 收口(完成):字段归属零残余、两份空棘轮、逐帧 rsp 门、设备及异族审查
```
`f1` 先落是故意的:**让红先出现,再逐包消红**,而不是各包自称做完之后再找一个判据。
---
## 6 出口门
**七项均已完成**,数字与原始证据路径见 [close-report.md](close-report.md)。
双块 212 项为 206 PASS + 6 个按名称和原因锁定的既有 skip;RSP 独立门必须为
双后端 2 PASS / 0 skip。缺失、重复、未运行的 JUnit 条目或额外 skip 均不能过门。
1. 双块车道(§4)`integration-split` 全绿。
2. `MOBILEGL_IPC_STRICT_ERRORS=1` 下 `strict-expected-markers.txt` **为空**,且两侧棘轮仍在
(空表 + 出现任何一对即红)。
3. `FieldOwnership.def` 零 `BARRIER_PULLED` 行;`rsp` 计数器逐帧读零。
4. **Magma 与 Espryt 跑同一套判据**,且 Magma 发布 `kCapRunAheadApply`——或者明确说明它为什么
不发布,并给出不发布也不掩盖缺陷的理由(ID-132)。
5. G1 0/0/0/0;G2 名集合不变;G14 测试名只增不删。
6. 逐包 red-once。
7. 设备:Redmi `2f7cbe2e`,双后端,reboot-clean 配对 A/B。性能只记录。
**阴性对照**:关掉双块(回到共享一块)必须让至少一条具名用例**由绿转红**——否则这个机制
什么也没证明。这是 ID-122 的教训:对照要证伪的是机制本身。
---
## 7 与 P6 的关系
P5f 已完成跨角色内存依赖归零的机器门,P6 的前置条件解除。
P6 的 `a6` 仍须核对独立进程的启动、句柄/映射和配置边界;本阶段的 inproc 演练不代替
spawn 实现与跨进程设备验证。P6 尚未开工。
`P6-SPAWN-PLAN.md` 与 `P6-CONTRACT-DRAFT.md` 里凡写"`PENDING a6`"的行,
其中属于 §2 的部分改由 P5f 回答。
+61
View File
@@ -0,0 +1,61 @@
# P5f — 一切状态上 wire(2026-09-20 收官)
> 本页是该阶段的**阶段汇总**:阶段表行、实测与落地形状的完整文本(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)。
## 摘要
- 目标:两个角色之间除 `SEG_CMD` / `SEG_STAGE` / `SEG_REPLY` / `SEG_EVENT` / caps 快照 / 控制帧之外零交换,判据由人读审计改为**机器**(双块演练:`inproc` 下两个角色各自一份 `PipeInputs`)。计划与设计见 [`P5F-WIRE-COMPLETENESS.md`](P5F-WIRE-COMPLETENESS.md)(2026-09-24 从上层移入)。
- 包:f0 普查、f1 双块、fc 控制帧、fe Espryt 字段、fm Magma record consumers、fs 静态世代 / 角色 / liveness、fr registry、fv 反向回调。
- 结果:字段归属 **41 RECORD_SUPPLIED / 6 APPLIER_DERIVED / 0 BARRIER_PULLED / 16 FATAL**;strict / dualblock marker 表均空;双后端逐帧 `rsp=0`;unit 2310、GPU 1377 零失败;G1 恒等;Redmi 六个 clean-boot 臂 60 PASS / 6 skip / 0 failed。验收代码 WSL `cfca93c7`(Windows `c42577a4`)。收口 [`close-report.md`](close-report.md)、审查 [`close-review.md`](close-review.md)、设备 [`device-report.md`](device-report.md)。
- 之后同目录还记了两件事:**Magma run-ahead**(`194382c9`,[`magma-runahead.md`](magma-runahead.md))与 Magma inproc 实际游戏修复 / RD32 性能修复;以及 **CI / inproc 功能补齐**(2026-09-21 收官,`e1bf3677`,交接 [`HANDOFF-CI-INPROC-20260920.md`](HANDOFF-CI-INPROC-20260920.md))。
## 阶段表行(原 `ROADMAP.md`)
- **阶段**:**P5f** 一切状态上 wire
- **状态**:✅ **已收官(2026-09-20)**;验收代码 Windows `c42577a4` / WSL `cfca93c7885f`
- **落地什么 / 范围**:f0 普查、f1 双块、fc 控制帧、fe Espryt 字段、fm Magma record consumers、fs 静态世代/角色及 liveness、fr registry、fv 反向回调均已合并。字段归属 **41 RECORD_SUPPLIED / 6 APPLIER_DERIVED / 0 BARRIER_PULLED / 16 FATAL**;strict / dualblock 预期 marker 集合均空。控制帧与静态量工作已完成,不再列为 P6 待实现项
- **验收门 / 证据**:unit **2310 = 2300 PASS + 10 skip**;GPU **1377** 零失败;ordinary / strict split **180 = 176 PASS + 4 skip**;双块 **212 = 206 PASS + 6 精确具名 skip**;双后端 RSP 门 **2 PASS / 0 skip**、逐帧 rsp=0。G1 `.text` 10806051、symbols 27815 恒等且 0/0/0/0;G2 3016 同名;G14 3646→3744 无删名。逐包与收官修复均有 red-once;Claude 异族终审 P1/P2 已修;Redmi 六 clean-boot 臂 **60 PASS / 6 skip / 0 failed**、36 个窗口 rsp=0。详见 [`close-report`](close-report.md)
## 状态注记(原 `ROADMAP.md` 页首)
> **P5f 后续 Magma run-ahead 已完成**(`194382c9`,2026-09-20):主机真实排队、credit、负控及 Vulkan 同步验证通过,Redmi 同包 Magma 开/关与 GLES 三臂 FCL 世界实测通过。见 [报告](magma-runahead.md)。P6 / P7 全阶段状态不因此改变。
## 里程碑记录(原 `ROADMAP.md`)
- **P5f 出口(2026-09-20)**:双块和 strict 空棘轮、逐帧 rsp=0、零 BARRIER_PULLED、主机全门、异模型族审查修复和 Redmi 六 clean-boot 臂全部完成;P6 前提解除,实施未开始。
- **CI / inproc 收尾出口(2026-09-21)**:`feat/disaggregated` 主产物拆分编译 + inproc 主验收全绿——unit 2328 零失败、`integration-gpu` 双 transport 各 1455 零失败、retrace 77 例 monolith 77/77 且 inproc 的唯一间歇项(`bsl-esc-menu-854` DirectVulkan,lavapipe 固有 texture-handle 注册停顿越过旧 30 s barrier 预算)在预算修正为 120 s 后隔离 10/10 绿、18 项 CI 门全绿、双 ABI APK 与 AVD 生命周期验证通过;合入头 `e1bf3677`,最终矩阵以远端 CI 为准。
## 本目录
| 文件 | 内容 |
|---|---|
| [`close-report.md`](close-report.md) | P5f 收口报告 |
| [`close-review.md`](close-review.md) | P5f 阶段末跨模型族审查 |
| [`device-report.md`](device-report.md) | P5f Redmi 设备门 |
| [`f0-dualblock-recon.md`](f0-dualblock-recon.md) | P5f / f0 — f1 双块机制设计侦察(只读普查) |
| [`f0-egl.md`](f0-egl.md) | f0-egl — P5f §2.3 EGL / surface 控制面普查(只读) |
| [`f0-env.md`](f0-env.md) | P5f / f0 — 构建与门禁机制侦察(实现代理 cheatsheet) |
| [`f0-fields.md`](f0-fields.md) | f0 普查 · §2.1 BARRIER_PULLED 15 字段逐字段载体判定 |
| [`f0-magma.md`](f0-magma.md) | f0 普查 · §2.2 Magma(DirectVulkan)跨角色读写 |
| [`f0-registry.md`](f0-registry.md) | f0 普查子项:§2.5 registry 重键普查(`MGPipeFrontendKeyedRegistryScope`) |
| [`f0-reverse-channel.md`](f0-reverse-channel.md) | f0-reverse-channel — P5f §2.6 反向通道逐站点普查(只读) |
| [`f0-statics.md`](f0-statics.md) | P5f f0 普查(只读):进程级静态量中语义属于 per-context / per-session 的成员 |
| [`f1-report.md`](f1-report.md) | P5f / f1 — 双块演练机制:落地报告 |
| [`fc-contract-draft.md`](fc-contract-draft.md) | fc — 控制面帧契约草稿(P5f 包 fc;CONTRACT-P5F.md 本体留给集成收口) |
| [`fc-report.md`](fc-report.md) | P5f / fc — EGL/surface 控制面帧化:落地报告 |
| [`fcl-e2e-report.md`](fcl-e2e-report.md) | P5f FCL / Minecraft 端到端补测 |
| [`fe-report.md`](fe-report.md) | P5f / fe — Espryt 字段退役报告 |
| [`fm-report.md`](fm-report.md) | P5f fm — Magma 跨角色读写退役 |
| [`fr-report.md`](fr-report.md) | P5f / fr — registry 身份边收口 |
| [`fs-report.md`](fs-report.md) | P5f fs — 静态状态世代与 server liveness |
| [`fv-report.md`](fv-report.md) | P5f fv — 反向通道归属与遗留对象边界 |
| [`HANDOFF-CI-INPROC-20260920.md`](HANDOFF-CI-INPROC-20260920.md) | CI / inproc 功能补齐交接(2026-09-20,用户要求停止) |
| [`HANDOFF-P5F.md`](HANDOFF-P5F.md) | P5f 交接:已全部收官 |
| [`magma-inproc-fix.md`](magma-inproc-fix.md) | Magma inproc 实际游戏修复 |
| [`magma-rd32-performance-fix.json`](magma-rd32-performance-fix.json) | 脚本 / 数据 |
| [`magma-rd32-performance-fix.md`](magma-rd32-performance-fix.md) | Magma RD32 inproc 性能修复 |
| [`magma-runahead.md`](magma-runahead.md) | Magma run-ahead |
| [`P5F-WIRE-COMPLETENESS.md`](P5F-WIRE-COMPLETENESS.md) | P5f — 一切状态上 wire:跨进程前的最后一次归零 |
| [`rd32-fourway.json`](rd32-fourway.json) | 脚本 / 数据 |
| [`rd32-fourway.md`](rd32-fourway.md) | Redmi RD32 四组合性能记录 |
| [`wave2-report.md`](wave2-report.md) | P5f 波次 2 集成报告 |
+115
View File
@@ -0,0 +1,115 @@
# P5f 收口报告
**状态:DONE,2026-09-20。** f0 / f1 / fc / fe / fm / fs / fr / fv 已全部集成,
字段归属、主机出口门、Redmi 设备门与跨模型族阶段审查均完成。P6 前置条件解除,
其 a6 / c6 / spawn 仍未实施。本报告取代各分包报告中的阶段中间状态。
最终行为验收头 **`cfca93c7885fd8db1e881f91189ba59090ae9c52`**(WSL `codex/p5f-final`),
包含 Windows 收口头 `c42577a4` 的全部修复;之后仅补文档与设备复现工具。
交付分支为 `feat/disaggregated`。包提交与环境入口见 [HANDOFF-P5F.md](HANDOFF-P5F.md)。
用户随后要求的 [首次 FCL 游戏端到端补测](fcl-e2e-report.md) 暴露 Magma inproc 的 P7
`buffer-legacy-arm`。后续 [Magma 游戏修复](magma-inproc-fix.md) 补齐 buffer consumers 与
Android 旋转 blit,`38919d45` 已在同一 MC `26.3-rc-3` 世界正常运行。本文余下数字保留原
P5f 收口快照。随后 `194382c9` 已完成 [Magma run-ahead](magma-runahead.md),
有独立主机门和 FCL 实测证据;P7 全量迁移仍未收官。
## 1. 完成的行为
波次 2 的 fc / fe / fm 已把 EGL 控制面、Espryt 对象读点、XFB Begin 快照与 Magma 可达
资源/渲染路径改成值帧、server archive / handles / staged bytes。波次 3 完成剩余边界:
- **fs**:unpack/render shadow 按 native generation、served context serial 和角色核键;
XFB server namespace 以 lifetime id 索引,包括 name 0 的 native 对象隔离。served context
切换保留仍活着的 paused span,native context 销毁清旧世代。raw-depth sampler 走纯 native
对象;server liveness 只由控制生命周期提供,verb stamp 不会复活它;双块诊断位按角色持有。
- **fr**:apply-side frontend registry / allocator 不再允许任何旧 scope 豁免;wrapper 在
选择 legacy 臂前拒绝。无调用的前端 program-name helper 从 D-P 编译中移除,pull 不变。
- **fv**:错误经保留 message 的 OnGlError 发到事件环;callback 安装/关闭/重接受和单 owner
CAS 有明确生命周期。旧 GPU-written object fallback 在解引用前拒绝,Magma transport
初始化不再构造两组隐藏 frontend 资源。四个 callback 统一投递实际 active session。
字段机器表最终为 **41 RECORD_SUPPLIED / 6 APPLIER_DERIVED / 0 BARRIER_PULLED / 16 FATAL**。
带 client 指针的旧 getter 为 FATAL;消费者直接读取 server records,没有把句柄记录谎称为
“供给整个旧指针字段”。`EmittedCallSuppliesTheWholeField` 的 8 个拒绝保留。
生成器拒绝任何 production BARRIER_PULLED 行,历史 debt 仅在 synthetic admission fixture
中测试。即使伪造 fresh stamp,FATAL getter 也必须拒绝;sticky forwards 同样执行归属。
新 `EachWireFrameHasZeroResidualPulls` 在两后端各注册独立 RSP 车道:连续三个改变 uniform
的帧逐个断言像素、真实 applied verbs 和 `rsp=0`。Magma 的 draws stat 尚未实现,绘制证据
取实际变化的像素,未以缺少 draws 计数假称执行过 draw。
## 2. 七项出口门
| 出口 | 最终结果 |
|---|---|
| 1 双块车道 | **212:206 PASS / 6 既有 skip / 0 failed**;两后端,同一归属与拒绝机制 |
| 2 strict / 棘轮 | ordinary / strict split **180:176 PASS / 4 skip / 0 failed**;Fatal、普通 Admitted、ESCALATED 均零;strict 与 dualblock 两份 expected 文件为空 |
| 3 字段 / 逐帧 RSP | production **0 BARRIER_PULLED**;`integration-p5f-rsp` **2 PASS / 0 skip**;设备 36 windows 全零 |
| 4 两后端能力声明 | GLES run-ahead ARMED;Magma 明确不发布 capability、运行 lockstep;理由如下,无 frontend 豁免 |
| 5 G1 / G2 / G14 | pull `.text` **10806051 → 10806051**,defined symbols **27815 → 27815**,added/removed/resized/renamed **0/0/0/0**,data/bss/rodata 不变;pull/push CTest **3016 == 3016**;f1 名集合 **3646 → 3744,+98 / -0**,无重复名 |
| 6 red-once | 逐包控制均真红后还原绿;f1 双块 knob=1 绿 / knob=0 真断言红;fresh FATAL、结果集完整性、非 singleton callback 修复均各有真实红转绿 |
| 7 Redmi | 指定 `2f7cbe2e`,六个不同 boot-id,同一最终库,两后端 role0/role1 clean-boot 配对及 monolith sanity;**60 PASS / 6 skip / 0 failed** |
Magma 不发布 run-ahead 的原因仍是 P7 buffer/native-format 功能边界,以及 wire render-pass
提交后等待 GPU 再退休对象的现有生命周期/性能契约。role-split 下 server 块没有 client
指针,lockstep 不能掩盖这种读;registry/allocator guard 对 barriered 记录同样拒绝。
fs/fv/字段收口已经完成,不再用这些已解决事项作为不发布 capability 的理由。
## 3. 主机完整验证与门的可信性
| 检查 | 结果 |
|---|---|
| split / pull / push 构建 | 全部通过 |
| unit | **2310:2300 PASS / 10 既有 skip / 0 failed** |
| GPU(审查修复后的最终代码) | **1377:1118 PASS / 259 既有功能、驱动、专属车道 skip / 0 failed** |
| field generator | check 通过;**19 个 negative controls + 13 个 synthetic admission controls** |
| pipe / dirty-surface / include closure | check 与现有 self-test 通过;include closure 4 probes、0 skipped / 0 problems |
| 文档引用 | 两处旧 basename 歧义改为完整路径,strict 检查通过 |
双块 gate 不只检查“空观测集合等于空预期集合”:必须有非空 discovery,JUnit 与发现集合
完整且一一对应,missing / extra / duplicate / notrun / disabled 均失败;绿和 skip 条目也
扫描 marker,GLES/Magma 私有日志均核所有权。CI 空 expected 表要求 ctest rc=0。
六个允许 skip 按**确切名称和原因**锁定:四个专属计数车道的 sibling,两个 Magma clip
功能限制。任何额外 skip 都失败;RSP 另有不可 skip 的双后端独立门。
P7 已知红 `integration-magma-p7-known-red` 真实执行唯一用例,**1 failed / 0 skip**,
退出码 8,具名 `Fatal{UnmigratedVerb, "Magma:mipmap-native-format@P7"}`。
这是保留的功能边界,不计入 PASS。旧 readback fixture 也已补完整 FBO/pack/context/sampler
records,在无 residual fill 时通过,`DstSize=80` / tight reply `48` 断言未放松。
## 4. 阶段审查与设备
跨模型族审查通过只读 Claude Code 完成,结果记录 `claude-opus-5[1m]` /
`claude-haiku-4-5`,实现方为 GPT 系列。发现 P1 结果集可不完整、P2 三个 callback 投错
singleton,均已修复并真跑红转绿;没有遗留本次审查 P0/P1/P2。详情、原文及局限见
[close-review.md](close-review.md)。
最终库 SHA256 `764a790d024fbe1b83ebdec5d896cc77ecda4f4a2698d63d2b2d16239f40e74c`,
六臂都核主机/设备 hash 一致。GLES 每臂 11 PASS;Magma 每臂 9 PASS + 两个既有
per-distance clip-enable skip。全部 36 个 stats windows `rsp=0`;两 inproc GLES 臂各
`vbs=72`,Magma 各 `vbs=68`,monolith 为 0。实际 backend、strict/role 和 capability
日志均核对,不以环境回显代替运行证据。
设备 runner 使用公开 GL/EGL、AImageReader native window:clip distance 3 项、layered copy
6 项、mipmap 2 项。没有把 host 私有 F1/Ct/DualBlock 测试冒称 Android 覆盖。
suite 时间只记录一次 clean-boot 样本,不作为 MC/FPS 性能结论;数值与全部 boot-id 见
[device-report.md](device-report.md)。复现工具位于 `tools/device_bench/p5f/`。
## 5. 证据索引与边界
主机证据根 `/home/swung/w7/p5f-logs/`:
- `exit-reviewed-{unit,gpu}.log/xml`:审查修复后的完整主机结果。
- `exit-reviewed-{strict,dualblock,negctl}-gate.log`:最终 marker、双块与机关控制。
- `exit-reviewed-g1.log`、`exit-reviewed-name-gates.log`:二进制与测试名门。
- `exit-rsp.log/xml`、`exit-rsp-lane.json`:双后端逐帧 RSP;`exit-known-red.log/xml`:P7 拒绝。
- `close-fresh-{red,green}.log`、`exit-review-gate-{red-once,green}.log`、`fv-review-*.log`:收口修复控制。
- 各分包报告列出该包独立门与 red-once;中间计数不替代本文最终计数。
设备证据 `C:/Users/geekerwan/.codex/tmp/p5f-redmi-exit-cfca93c7/`;审查原始结果
`C:/Users/geekerwan/.codex/tmp/p5f-final-review-de78f47d/result.json`。
P7 的 Magma buffer/native-format 等功能、P8 client arrays、P12 window/present 到达,
以及 P5e 历史 E1 对照设计条目继续按其原阶段跟踪。它们保留具名边界,不是未完成的 P5f。
本次不启动 P6,也不宣称两进程 spawn 已实现。
+78
View File
@@ -0,0 +1,78 @@
# P5f 阶段末跨模型族审查
实现方为 GPT 系列;审查通过本机 Claude Code 只读 CLI 执行,限定 Read/Glob/Grep、无 MCP,
没有修改文件或运行 shell。审查头 `de78f47d`,基线 `e75e00cb`。CLI 成功返回;模型记录含
`claude-opus-5[1m]` 与 `claude-haiku-4-5`,与实现方错开模型族。原始结果保存在
`C:/Users/geekerwan/.codex/tmp/p5f-final-review-de78f47d/result.json`。
## 原始审查结果
## 审查发现
### P1 — 最终 dual-block“硬绿”门可在测试未完整执行时伪绿
- **位置**
- `.github/workflows/test.yml:1387-1400`
- `MobileGL/MG_IntegrationTest/Harness/split_log_paths.py:138-160`
- `MobileGL/MG_IntegrationTest/CMakeLists.txt:2580-2601`
- `MobileGL/MG_IntegrationTest/Scenarios/F1WireScenario.cpp:99-103`
- **触发条件**
1. 当前 `dualblock-expected-fatals.txt` 为空;
2. `ctest` 因空选择、提前中断或基础设施错误返回非零;或者新加的某个 `DirectGLES/DirectVulkan.Split.P5fRsp.*` 用例因环境标记或 split runtime 不满足而 skip/未出现在 JUnit 中。
- **失败路径**
- workflow 用 `|| rc=$?` 吞掉 `ctest` 的非零状态;
- 随后仅在“`rc == 0` 且预期表非空”时失败。当前预期表为空,因此任何非零 `rc` 都不会直接使步骤失败;
- `expect_fatal()` 只遍历 JUnit 中实际出现的 testcase,不把 `dualblock-lane.json` 的发现集合与 JUnit 集合比较;skip 被直接计数后忽略,缺失用例也完全不可见;
- 最终空观测集合与空预期集合相等,helper 返回成功。
- 因而阶段出口要求的双后端逐帧 `rsp=0` 用例可以没有实际执行,步骤仍打印硬绿。
- **最小修复建议**
1. 当前阶段预期表为空时,无条件要求 `rc == 0`;
2. 在 `expect_fatal()` 中比较 JSON 发现集合与 JUnit 集合,拒绝 missing、notrun、disabled;硬绿模式还应拒绝所有 skip;
3. 对 `integration-p5f-rsp` 增加独立核验:必须恰好执行 DirectGLES、DirectVulkan 两条,`2 PASS / 0 skip / 0 failed`。
### P2 — 三个反向回调没有投递给实际取得所有权的 `ServerSession`
- **位置**
- `MobileGL/MG_Remote/Server/ServerSession.cpp:264-315`
- 对照正确的错误回调:`MobileGL/MG_Remote/Server/ServerSession.cpp:332-340`
- active owner 发布点:`MobileGL/MG_Remote/Server/ServerSession.cpp:567-573`
- **触发条件**
- 首个成功 `Accept()` 的对象不是 `ServerSessionInstance()`,而是另一个合法的 `ServerSession` 实例;
- 之后后端调用 `OnBufferWriteback`、`OnGpuWritten` 或 `OnSurfaceChanged`。
- **失败路径**
- `Accept()` 将实际 owner 发布到 `g_active`,并把全局回调表安装为该 session 的生产者;
- 但三个生产函数仍硬编码调用 `ServerSessionInstance()`,而不是 `ServerSession::Active()`;
- 事件因此写向未接受连接的 singleton,而非拥有 SEG_EVENT 的 session,通常在无效 event producer 上落入 `Fatal{EventRingOverflow}`;即使 singleton 状态发生变化,也会投递到错误 session。
- `ServerOnGlError()` 已正确通过 `Active()` 解析 owner,四个回调的所有权语义目前不一致。`g_sessionOwner` 对任意 `ServerSession*` 做 CAS,也说明所有权并未限定为 singleton。
- **最小修复建议**
- 让三个生产函数与 `ServerOnGlError()` 一样解析 `ServerSession::Active()`;没有 active owner 时给出具名 `RoleViolation`;
- 增加一个“非 singleton session 首先 Accept,四种回调均进入其 event ring”的测试。
## 审查局限
本次严格保持只读,仅使用 `Read/Glob/Grep`;未运行构建、测试或设备门。因此未评价当前 pending validation 的通过与否,也未将其视为代码缺陷。除此之外,在指定的跨角色访问、上下文/XFB/raw sampler 生命周期、控制帧保真及 Magma record/resource 路径中,未发现其他具有充分代码依据的 P0/P1/P2 问题。
## 处置(均已完成)
1. **P1,结果集不完整可伪绿**:`c42577a4` 给空表要求 ctest rc=0;对 JSON 发现全集与
JUnit 做非空、完整、一一对应核验;拒绝 missing/extra/duplicate/notrun/disabled。
对已执行的 green/skip 也扫描 marker,而非仅扫描 failed 条目。GLES 与 Magma 私有日志
所有权同样校验。新增独立 `integration-p5f-rsp` 硬门,必须恰两后端 2 PASS / 0 skip。
仅保留既有六个 skip,严格匹配名称和原因;不采用“所有 skip 都拒绝”,因为四个是专属
计数车道的普通/SmallRing sibling,另两个是已有 Magma clip-feature 限制。其他 skip 均红。
9 个结果核对回归测试全绿;旧 helper 对“缺一个 JUnit 条目”没有拒绝,控制真实失败为
`ValueError not raised`,新 helper 通过。日志 `exit-review-gate-{red-once,green}.log`。
2. **P2,非 singleton callback owner**:`53699b5a` 让四种 producer 统一取 `Active()`,
无 active owner 时均具名 RoleViolation。新增非 singleton 首先 Accept 后四事件落入其
ring 的生产测试,以及 Close 后缓存的四 callback 不可再投递测试。旧版真实 abort 于
`kEventGpuWritten` 的 `EventRingOverflow`,修复后 11 项反向通道测试全绿;原 readback
fixture 与握手也通过。日志 `fv-review-*.log`。
两项均有实际红转绿证据,未把审查建议当作验证结果。修复后的最终 Android 库也重新部署,
六个 clean-boot 臂全部重新运行。没有留待 P6 的本次审查 P0/P1/P2 项。
+64
View File
@@ -0,0 +1,64 @@
# P5f Redmi 设备门
2026-09-20,指定序列号 `2f7cbe2e`,Xiaomi `M332BF` / Android 16 / SM8750。
验证库源头 **`cfca93c7885fd8db1e881f91189ba59090ae9c52`**,包含跨模型审查的两项修复。
每臂先 reboot,等待 boot complete;六个 boot-id 不同。没有 pin 时钟、清 app 数据、安装 APK
或修改 FCL 设置。测试是独立 shell ELF + AImageReader native window,真实硬件 GPU。
P5F §6.7 的 A/B 取本阶段中心机制:同一 split binary、inproc、strict=1、role0/role1。
额外单体 sanity 也使用同一 binary。P5e 的 MC 30秒/FPS性能阈值没有被移植成 P5f 新要求;
这里的性能只记录,不宣称游戏性能改善或完整 P7 工作负载已支持。
## 身份与结果
NDK 27.3、API26、arm64、RelWithDebInfo;仅在部署副本去掉 debug 数据,原始符号保留。
三份 ELF 的设备 hash 与主机逐项一致:
- `libMobileGL.so`: `764a790d024fbe1b83ebdec5d896cc77ecda4f4a2698d63d2b2d16239f40e74c`
- `P5fDevicePixels`: `76c81e540f723782141054ecc6e99b6a92fff1a55f413d63796ff53e630cec0b`
- `libc++_shared.so`: `d523468d62d9b603cb3354294d70d4b2feabf2c3f1e43b0c96c9aabf32813708`
| 臂 | PASS | skip | vbs 合计 | stats windows | suite 秒(仅记录) | boot-id |
|---|---:|---:|---:|---:|---:|---|
| GLES-monolith | 11 | 0 | 0 | 6 | 0.518 | `9497f21b-f91f-4d95-a403-5729eb537d5f` |
| GLES-role0 | 11 | 0 | 72 | 6 | 0.741 | `02acddae-f9f8-4fff-bfed-bf1ac03ea0b2` |
| GLES-role1 | 11 | 0 | 72 | 6 | 0.314 | `17f16009-86dd-49c4-9da5-bc3bf377e827` |
| Magma-monolith | 9 | 2 | 0 | 6 | 0.259 | `db46e8b0-b74e-4c3f-a97f-a38c373fa2a9` |
| Magma-role1 | 9 | 2 | 68 | 6 | 0.369 | `8d0672c7-bfb1-45d9-8436-764a074a1087` |
| Magma-role0 | 9 | 2 | 68 | 6 | 0.543 | `bfd92cb2-7854-4e54-99ad-de911660ab5e` |
**所有六臂 failed=0,36个统计窗口全部 rsp=0**。GLES 的两 inproc 臂 vbs 同为72,Magma
同为68;单体 vbs=0。运行日志也核了实际 backend、inproc strict/role配置、Espryt run-ahead
ARMED 与 Magma 不发布能力而 lockstep 的明确记录,不能只用环境回显当跑对臂的证据。
Magma 每臂两项 skip 是同一组既有功能限制:
`ClipDistanceScenario.ADisabledClipDistanceRemovesNothing` 与
`ClipDistanceScenario.TheEnablesAreIndependentPerDistance`。程序在像素观察后明确报出
“不实现 per-distance enable masking”的原因;单体、role0、role1一致,不是 preflight/GPU
不可用,也没有计为 PASS。其余9项必须真正通过。GLES 的11项全部真正通过。
## 覆盖与局限
公开 GL 用例为 ClipDistance 三项、CopyImageLayered 六项,以及独立 public mipmap 两项:
CPU红底生成 mip 链;先GPU写绿后生成链且不得被旧CPU红影子覆盖。全部 mip/base 都核像素。
Android 原有 CMake 提前 return,F1/Ct/DualBlock 与私有 peek 不进入 Android binary,因此本次
没有冒称那些 host 私有用例在手机执行,也没有添加 shipping export ABI。
运行时间含测试初始化/驱动缓存影响,只有一次 clean-boot 样本,不能据此推导性能回归或提升。
已保留 P7 buffer/native-format、P8 client arrays、P12窗口到达等具名边界;它们不属于本门
选择的可执行子集。
## 复现与证据
可复用工具已入仓 `tools/device_bench/p5f/`,包含构建/运行/验证脚本及独立 public mipmap 源。
入仓 verifier 核对确切的 11 个唯一用例及每条 `status=run`、`result=completed/skipped`,
已只读复核全部六臂。复制证据的 missing / duplicate / disabled 三个反例均在对应断言拒绝;
原证据文件 hash 前后不变,控制结果保存在
`C:/Users/geekerwan/.codex/tmp/p5f-verify-arm-controls-7nrrujzt/`。两个 shell 脚本的
`bash -n` 与 Python 语法检查也通过。
原始六臂证据:`C:/Users/geekerwan/.codex/tmp/p5f-redmi-exit-cfca93c7/`,每臂有 XML、stdout、
库日志、boot-id、设备/主机SHA256、退出码及 crash-buffer;`summary.json` 汇总上表。
最终 bundle:`/home/swung/w7/p5f-android-cfca93c7885f/bundle`。
Android增量构建复用先前 cache,完整库与符号在
`/home/swung/w7/p5f-android-de78f47df595/library`;其最后 reconfigure/build 对应最终源头。
审查修复前的 de78 预跑证据另存,未混入上表、未代替最终库的六臂复跑。
@@ -0,0 +1,428 @@
# P5f / f0 — f1 双块机制设计侦察(只读普查)
> 只读普查产物,未修改任何代码、未构建、未跑测试。所有 `file:line` 以
> `feat/disaggregated @ 8b68b92c`(代码头 `25fba0d5`)为准。
> 姊妹篇:`f0-env.md`(旋钮/车道环境一览)、`f0-statics.md`、`f0-magma.md` 等。
> 本文聚焦 `gPipeInputs` 的双块拆分(P5F-WIRE-COMPLETENESS.md §4)的设计侦察,
> 回答任务单 (1)–(7)。
---
## 1 `gPipeInputs` 的声明与全树引用点分类
### 1.1 声明
`MobileGL/MG_Backend/MGPipe/PipeInputs.h:835`:
```cpp
inline PipeInputs& gPipeInputs = *new PipeInputs();
```
- inline 引用变量,无 .cpp 定义;**leak-at-exit**(`PipeInputs.h:818-834`):O 类成员是指向前端
对象的 `SharedPtr`,退出时析构会沿 slot allocator / applier / twin 表触发不安全的销毁链,
所以永不释放。
- 尺寸预算 `static_assert(sizeof(PipeInputs) < 20 * 1024)`(`PipeInputs.h:843`)。
- 该头只在 `MOBILEGL_PIPE_PUSH` 构建里经由 `MG_Pipe/PipeInputsSwitch.h:17-21` 进入 include
闭包(`PipeInputs.h:39-43` 的论证);`PipeInputs.cpp` 也只在此条件下编译
(`PipeInputs.cpp:11-13`)。**pull 构建从符号层面就看不见它**,双块改动若同样关在
`MOBILEGL_BUILD_DISAGGREGATED` 里则对 G1 零扰动。
### 1.2 引用点全清单(非测试代码),按角色/线程分类
**写者 — client 角色(GL 线程,`MG_Impl`)**:
| 位置 | 写什么 |
|---|---|
| `MG_Impl/Pipe/PipeFill.cpp:3348`(`MGPipeValidateForVerb`) | 绑定 `PipeInputs& inputs = gPipeInputs;`;`:3385` SetIdentity(**每个 verb 都写**,含 run-ahead);`:3423` `++CurrentVerbSerial`;`:3437` `MGPipeServerClearVerbBoundary()`;`:3439` SetVerb;`:3746-3763` step 4 残余填充 `CopyField` + `FilledGen[i] = CurrentVerbSerial`(sticky 一次性盖 1,`:3753`) |
| `PipeFill.cpp:2204-2230`(`MGPipeLeaveVerb`) | `:2225` 再 bump serial(无 verb 时使旧戳过期);`:2228` clear;`:2230` SetVerb(kVerbCount) |
| `PipeFill.cpp:702-724`(`MGPipeNoteFrontendMutation`) | 单字段刷新(P3a D-H2 类:后端在自己 verb 内改了前端对象后的回填) |
| `PipeFill.cpp:1217`(`MGPipeReleaseResidualFillPins`) | 释放四个 O 类 SharedPtr |
| `PipeFill.cpp:565-566, 627, 653, 663, 679`(verify 臂) | `g_snapshot` / `g_readScratch` 与 `gPipeInputs` 的入口比较、compare-at-read hook(`MOBILEGL_PIPE_VERIFY` 构建限定) |
**写者 — server 角色(apply 线程 `mgl-srv-apply`)**:
| 位置 | 写什么 |
|---|---|
| `MG_Backend/MGPipe/PipeInputs.cpp:265-305`(`MGPipeServerStampVerbBoundary`) | bump serial、SetVerb、按 `AnswerableMaskForVerb` 盖 RECORD_SUPPLIED/APPLIER_DERIVED、**清零** BARRIER_PULLED/FATAL 的戳(`:300-303`)、置 `m_serverStampedVerb`(`:304`)。调用点:`MG_Remote/Server/PipeApplier.cpp:1255-1258`(仅 Clear/DrawVbo/ReadPixels/Blit 四个 verb 形 op) |
| `PipeInputs.cpp:307`(`MGPipeServerClearVerbBoundary`) | 清 `m_serverStampedVerb`。**双角色都调它**:server 侧 `PipeApplier::LeaveApplier`(`PipeApplier.cpp:1261`),client 侧 `PipeFill.cpp:3437` 与 `:2228` |
| `MG_Pipe/PipeApply.cpp`(经 `MGPipeApplyAccess` 门,`PipeInputs.h:732-738`) | `:1524-1534` BindRenderState、`:1552-1557` SetDynamicState、`:1561` SetPixelPackState、`:1573` SetContextValues、`:1584-1638` SetPatchState、`:1643-1690` SetVertexAttribDefaults;`:1724` 是读(trip wire 比较)。**故意不盖戳**(`PipeInputs.h:735-737`) |
**读者 — server 角色(apply 线程)**:
- **后端主通道**:`MG_Pipe/PipeInputsSwitch.h:19-21` 的 `MGB_CTX` 宏 = `&gPipeInputs`。
全树 `MGB_CTX` 共 **379 处 / 24 文件**;生产后端:DirectGLES.cpp 103、Managers.cpp 24、
MultiDraw.cpp 7、Utils.cpp 2、DirectVulkan.cpp 48、VulkanRenderer.cpp 133、
UniformManager.cpp 23 等。inproc 下这些读全部发生在 `PipeApplier::ApplyOne`
(`PipeApplier.cpp:1159-1243`)内部,即 apply 线程;monolith 下在 GL 线程。
- 直读(不经宏):`MG_Backend/DirectGLES/DirectGLES.cpp:267`(`gPipeInputs.CurrentVerb()`);
`PipeApplier.cpp:402`(GetPixelStoreParameters)、`:505`(GetMaxTouchedTextureUnit)、
`:858-859`(GetTextureObject)。
- 七个 F 类 sticky forward 的函数体在 `PipeFill.cpp:2131-2186`,**逻辑上被 server 调用、
物理上在 apply 线程执行**(经后端调用进入),体内 `MGP_STICKY_FORWARD_PULL` 调
`MGPipeStickyForwardPull`,后者读 `gPipeInputs.ServerStampedVerb()/CurrentVerb()`
(`PipeInputs.cpp:376-377`)。
**读者 — client 角色(GL 线程)**:
- `PipeFill.cpp:3016`(`VertexAttribDefaultsOf`,emitter 自查)、`:629`(Fatal 消息取名);
verify hook 的 `&self == &gPipeInputs` 判等(`:663`)。
- `EmitTables.cpp:1200` 的注释明确反面规则:client 侧**不得**经 MGB_CTX 问问题
("on this side of a split MGB_CTX is gPipeInputs, which is the SERVER's view")。
**测试引用**(非生产,但双块要决定它们落在哪块上):`MG_Test/Pipe/PipeInputsTest.cpp`、
`FieldOwnershipTest.cpp`(约 40 处)、`RenderStateSpansTest.cpp`、`MG_Test/Wire/
ServerLoopTest.cpp:572-586`、`PipeWireCodecTest.cpp:1366-1380`、`RemoteClientTest.cpp:
2053-2364`(角色守卫死亡测试)。测试均跑 monolith/单线程形态,knob 关闭时行为必须逐字节不变。
**纯注释引用**(无代码语义):`PipeMutation.h:223,248`、`PipeApply.h:21,802,1086`、
`ClientSession.h:25,150,191-199`、`WireTables.h:29`、`CapsMirror.cpp:37`、
`Init.cpp:80`、`PipeStats.h:172`、`SlotAllocator.cpp:428`、`EmitTables.cpp:256,812,1394`、
`PipeWireCodec.cpp:2257`、`Config.h:523`、`ConfigLoader.cpp:386`。
**今天为何能工作**:两角色同进程同对象,verb barrier 保证 {GL 线程, apply 线程} 同一时刻至多
一个可运行(`PipeInputs.h:904-908` 引 CONTRACT-P5 表 3 的裁定),所以单写者成立;client 填、
server 读,BARRIER_PULLED 就是"读对方留在同一块里的残余"。
**P5f 处置建议**:写侧/读侧的代码边界恰好是文件边界 —— **所有 client 写集中在
`MG_Impl/Pipe/PipeFill.cpp`,所有 server 写在 `MG_Backend/MGPipe/PipeInputs.cpp` +
`MG_Pipe/PipeApply.cpp`,所有后端读经 `MGB_CTX` 一个宏**。这意味着双块不需要碰 379 个后端
读点,只需要:(a) 在 `PipeInputs.h` 加第二块与选择函数;(b) 把 PipeFill.cpp 里约 10 处
`gPipeInputs` 拼写换成 client 块;(c) server 侧保持 `gPipeInputs` 拼写不变。详见 §7。
---
## 2 运行时如何知道当前角色
### 2.1 server 侧:线程身份
- `ServerLoop::OnApplyThread()`(`MG_Remote/Server/ServerLoop.h:246-252`):一次 relaxed
读 `Detail::g_applyThreadKey` + 与当前线程 key 比较;key 由 apply 线程自己在
`ApplyThreadMain` 第一行发布(`ServerLoop.cpp:337`),在与 `m_running` 清空的**同一个临界
区**内清零(`ServerLoop.cpp:519`,理由见 `:496-518` 的长注释——身份必须与 m_running 同死)。
key==0 时短路返回 false,所以 monolith/未启动/已停止都答"否"(`ServerLoop.h:248-251`)。
- 别名 `RunsAsTheServerRole() = OnApplyThread()`(`MG_Remote/Client/WireTables.cpp:87`),
WireTables 每条发射路径用它分流 monolith/split。
- 它是**全树每个角色守卫的谓词**(`ServerLoop.h:89-92` 列举:BufferObject 的 legacy-arm
守卫、PersistentMapTracker::OnServerRole、RefusePipeInputsTouchWhileApplierOwnsIt、
分配器守卫等)。
### 2.2 client 侧:会话标志 + 线程局部
- `thread_local Bool g_inBarrierWait`(`MG_Remote/Client/ClientSession.cpp:117`,由
`BarrierWaitScope` :120-122 举起)——"本线程是否在等 barrier",**必须** thread_local
(`ClientSession.cpp:1278-1284` 的论证)。
- `std::atomic<Bool> g_applyThreadInsideApplier`(`:118`),由 applier 侧的
`ScopedApplierEntry` 在整个 `ApplyOne` 期间举起(`PipeApplier.cpp:1173`;
Note* 函数在 `ClientSession.cpp:1381-1386`)。
- `ClientSessionInstance().RunAheadArmed()` / `BarrierArmed()` / `Started()`:
会话级标志,守卫链按"常量优先"顺序短路(`ClientSession.cpp:1292-1305`)。
### 2.3 P5c 角色守卫本体
`ClientSession::RefusePipeInputsTouchWhileApplierOwnsIt`(`ClientSession.cpp:1290-1380`),
被 PipeFill 的四个写点调用:`:723`(NoteFrontendMutation)、`:2214`(LeaveVerb)、
`:3412`(ValidateForVerb phase 1)、`:3737`(ValidateForVerb/residual phase 2)。
run-ahead 臂(`:1318-1354`):除"barriered fill 且 applier 不在 applier 内"外,GL 线程触碰
即 `Fatal{RoleViolation, "gPipeInputs"}`;lockstep + BatchWaits==0 臂(`:1361-1379`)同理。
**读侧线程**:server 读全部在 apply 线程(`mgl-srv-apply`,`ServerLoop.cpp:338` 命名),
具体在 `PipeApplier::ApplyOne` 的 stamp→decode→LeaveApplier 区间内。
**填侧线程**:GL 线程(app 调 GL 入口 → `MGPipeValidateForVerb`)。
**今天为何能工作**:角色判定不靠"你在哪个进程",而靠"你在哪条线程 + 会话是否 started/armed"。
双块机制可以复用同一套谓词,但更稳的轴是**代码位置**(§1.2:填侧全在 PipeFill.cpp)而不是
线程——线程谓词在 monolith 下会把 client 和 backend 判成同一角色,恰好正确;在 inproc 下
分开,也恰好正确。两条轴等价,代码位置轴更便宜(无热路径谓词)。
**P5f 处置建议**:块选择函数内部**不需要**调 `OnApplyThread()`(它在 P5d 被压成一次 relaxed
load 但仍是每 draw 的成本,`ServerLoop.h:89-99`)。填侧站点是静态已知的(PipeFill.cpp 的
~10 处拼写),直接拼 `MGPipeClientInputs()`;读侧拼 `gPipeInputs`(server 块)。线程谓词只在
调试断言/新守卫里用。
---
## 3 poison / Fatal{UnmigratedPipeInput} / FilledGen 世代戳机制
### 3.1 戳的结构与判定
- `MGPipeFilledState { Uint64 CurrentVerbSerial; Uint64 FilledGen[63]; }`
(`MG_Pipe/generated/PipeFilled.inc:407-410`;63 = `kMGPipeInputFieldCount`,`:96`)。
- 新鲜判定 `MGPipeInputFieldIsFresh`(`PipeFilled.inc:421-426`):`gen==0` → false
("从未填过",两个分支同义);sticky → true;否则 `gen == CurrentVerbSerial`。
- **serial 从 1 起**(`PipeFill.cpp:3420-3423` 与 `PipeInputs.cpp:280-283` 两处同述):
0 保留给"从未填过",所以 server 的清零(`PipeInputs.cpp:300-303`)是真撤回而不是"碰巧旧"。
### 3.2 Fatal 形态
- 基础版:`MGPipeInputPoisonFatal`(`PipeFilled.inc:412-416`)——
`MGPipe: Fatal{UnmigratedPipeInput, "<field>@<verb>"}` + `std::abort()`;verb 取名经
`MGPipeInputPoisonFatalForVerb`(`PipeInputs.cpp:30-32`,首个 verb 前是 `"<none>"`)。
- split 四路裁定 `MGPipeInputUnfreshRead`(`PipeInputs.cpp:312-345`):
非 server-stamped → monolith 语义 Fatal;server-stamped + RECORD_SUPPLIED/APPLIER_DERIVED →
`Fatal{RoleViolation, "<field>"}`(P5c gt,`:333-341`);BARRIER_PULLED 且在本 verb 类内 →
`CountBarrierPull`;其余 → poison Fatal。
- `CountBarrierPull`(`PipeInputs.cpp:162-187`)三臂:**未设障记录 → 无条件 Fatal**
(`:163-165`,无旋钮可豁免,理由 `:122-132`——值按构造是 torn 的);设障 + strict + 未被
静态表或 escalation 承认 → `StrictBarrierPullFatal`(`:182-184`,消息尾
`[BARRIER-PULLED, MOBILEGL_IPC_STRICT_ERRORS=1, retires in <phase>]`);设障 + admitted →
每进程每 (field,verb) 一条 `Admitted{...}` MGLOG_W(`AdmittedBarrierPullOnce` :96-117,
静态位图去重)。
- 参数窄化:`MGPipeInputArgumentRead`(`PipeInputs.cpp:347-370`),今天唯一行是
GetPixelStoreParameters 的 unpack 半 → FATAL(`PipeInputs.h:439-447`)。
- sticky 七字段无 `MGP_INPUT_CHECK`(声明的例外,`PipeInputs.h:683-688`),由
`MGPipeStickyForwardPull`(`PipeInputs.cpp:372-378`)在 server-stamped verb 内手工计入
`rsp`/strict。
### 3.3 MOBILEGL_PIPE_POISON 旋钮在哪解析
**它不是运行时环境变量**:`PipeInputs.h:30-35` 的编译期派生宏——
`MOBILEGL_PIPE_PUSH && (LOG<=DEBUG || MOBILEGL_BUILD_DISAGGREGATED || MOBILEGL_PIPE_VERIFY)`。
运行时旋钮只有毒化家族的**测试**旋钮:`MOBILEGL_PIPE_POISON_OMIT=<Verb>:<Field>`
(阴性对照 B)→ `Features.PipePoisonOmit`(`Config.h:373-378` 定义、`ConfigLoader.cpp:278`
解析)→ `PipeFill.cpp:518-543` `ParsePoisonOmissionKnob` 在每次 Validate 时查对,
未知名 `BadKnob` Fatal。
**今天为何能工作**:戳是每 verb 的代际号而非位图(`PipeFilled.inc:19-23`:位图看不见
"上一 draw 填的、这一 verb 没重填"),stamp/withdraw 双写者靠 verb barrier 串行化。
**P5f 处置建议**:双块下 server 块的 BARRIER_PULLED 戳**已经被 server stamp 清零**——freshness
语义原样成立。关键缺口在**值**:knob 开时 server 块的 15 个 BARRIER_PULLED 字段没人填,
O 类 SharedPtr 字段(GetBoundVertexArray/GetProgramForDraw/GetTransformFeedbackProgram)
**没有 null 检查**(对比有检查的 `GetTextureUnitObject`,`PipeInputs.h:669-676`),直接返回
空 SharedPtr 给后端解引用 → 是**无名崩溃而不是具名 marker**。所以 f1 必须把
`CountBarrierPull` 在双块臂下改成无条件 `StrictBarrierPullFatal`(why 串填
`MOBILEGL_IPC_ROLE_SPLIT_STATE=1`,marker 语法与 `split_log_paths.py:44-46` 的
`MARKER_RE` 天然兼容)——这是"红就是清单"成立的前提,否则 O 类字段的红是段错误。
---
## 4 MOBILEGL_IPC_* 旋钮与新旋钮的最小接线
### 4.1 现有机制
- 声明:`Config.h:468-547` `struct IpcTable`(`MOBILEGL_BUILD_DISAGGREGATED` 内);
实例 `MG_Config::Ipc`(`ConfigLoader.cpp:35`)。
- 解析:`MG_ConfigLoader::InitIpc()`(`ConfigLoader.cpp:356-416`),由 `Init()` 在
`InitTransport()` 后调(`:428-429`)。env 收集是前缀制
(`IsAcceptedPrefix`,`ConfigLoader.cpp:42-44`),**任何 MOBILEGL_ 前缀自动可见,
无需登记**(`:257-259` 注释明说)。
- 工具函数:`QueryEnvFlag`(truthy:非空、非 "0"、非 "false")、`QueryEnvUint32`(带
min/max 与非法值 WARN 回落)、`QueryEnvVariable`。
- 纪律:**新旋钮必须进 Config 由集成者落地,不得在调用点现造**
(`EmitTables.h:109` 原文:调用点发明的 MOBILEGL_IPC_ 形名字是反模式;
`Config.h:463-467`:P5 只落自己包读的旋钮,后续阶段的旋钮由集成者加在这里)。
### 4.2 `MOBILEGL_IPC_ROLE_SPLIT_STATE=1` 的最小接线
1. `Config.h` IpcTable 尾部加 `Bool RoleSplitState = false;` + 注释(照 `StrictErrors`
`Config.h:534-537` 的形状:一句话说从什么升成什么)。
2. `ConfigLoader.cpp` `InitIpc()` 加 `ipc.RoleSplitState = QueryEnvFlag("MOBILEGL_IPC_ROLE_SPLIT_STATE");`,
并进 `:400-406` 的那行汇总日志。
3. 两个交互要写死:
- **monolith 下无效**:`:397` 已有 `if (Transport == Monolith) return;`,选择函数处再判一次
`Transport != Monolith`(monolith 的 backend 与 fill 同线程,分块会立刻饿死所有读)。
- **与 PipeVerify 互斥**:verify 的入口比较比的是填侧块、compare-at-read hook 以
`&self == &gPipeInputs` 判活块(`PipeFill.cpp:663`),双块下 hook 会在 apply 线程重读
活 context。照 `:388`(`if (PipeVerify) ipc.RunAhead = 0;`)的形状强制
`RoleSplitState = 0` 并留一行 WARN。
4. 消费点:`PipeInputs.h` 的选择函数(§7)。`PipeInputs.cpp` 已 include `Config.h`
(`:20`),无新依赖方向问题。
**今天为何能工作**(对"加旋钮"这件事):前缀收集 + IpcTable + InitIpc 三点一线,StrictErrors
/ Audit 两个 Bool 旋钮是逐字可照抄的样例。
---
## 5 CONTRACT-P5E §3.2 的 per-role stamp 存储:内容与归属裁定
### 5.1 内容(承诺了什么)
`MG_Remote/CONTRACT-P5E.md:224-229`(§3.2):`MGPipeServerStampVerbBoundary` 应把
`m_filled` / `m_currentVerb` / `m_serverStampedVerb` 写进 **applier 私有存储而绝不写共享块**;
client 侧的 `MGPipeServerClearVerbBoundary()`(PipeFill 的两处调用)在 transport 下删除;
`SetIdentity` 移到 `ApplyOne`、每会话一次。
### 5.2 落地状态与编号归属(任务单说"ID-120",需更正)
- §3.2 **UNLANDED**,且契约自己在 ra2 修正里点名了它(`CONTRACT-P5E.md:266-272`):
"§3.2 above, which is UNLANDED and was never marked as such",stamp 今天仍写进
`gPipeInputs` 本体。拆 stamp 在契约里被记为 **P11 项**,并附关键告诫:**只有 per-role
stamp 而不给 BARRIER_PULLED 值做版本化,比今天更坏**——会把具名 Fatal 变成静默旧值读
(`:270-272`)。
- 编号:`CURRENT_STAGE_PROGRESS.md:232` 把这一行挂为 "ID-120 / ID-135"。逐条核对后:
**ID-120 是 §8 修正 8**(`GetBufferBindingPointCount` 的 forward → FATAL 子句,
`CONTRACT-P5E.md:606-617` 标 UNLANDED、Lands with P7/P13);**§3.2 的 per-role stamp
对应 ID-135**(ra2 元数据竞态的裁定,`notes/p5e/FACTS-P5E.md:178`、ROADMAP.md:39
P11 行:"当时那次竞态在元数据标量上,修法是让守卫测事实而非断言未来(ID-135)……
契约 §3.2 的 per-role stamp 存储仍未落地")。任务单的"ID-120"应读作"ID-135(§3.2)"。
### 5.3 双块机制应不应该顺手落它
**应该,而且是 f1 的必然子集而非可选项**,理由:
1. 双块一落地,server 块**就是** applier 私有存储(client 再也摸不到它)——§3.2 第一句在
knob 开的臂上自动成立;knob 关的臂保持共享块旧语义(A/B 所需)。
2. §3.2 的另两条在双块下**变成 moot 而非要删的代码**:client 侧的
`MGPipeServerClearVerbBoundary`(`PipeFill.cpp:3437, 2228`)清的是自己块的 flag
(无人读过它,无害),不需要"删除",只需要让它作用于 client 块(见 §7 的参数化)。
3. **唯一真正要做的搬运是 `SetIdentity`**:今天 client 每个 verb 都写
`m_live`/`m_contextIdentity`(`PipeFill.cpp:3377-3385`,这是 §3.1 的具名偏离,因为
"本进程有没有活 GL context"不属于任何字段的归属类)。双块后 server 块的
`MGB_CTX_LIVE`/`MGB_CTX_IDENTITY`(`PipeInputsSwitch.h:20-21`)**永远答 false/nullptr**,
后端所有 null-context 守卫会立刻全部翻车。f1 必须在 server 侧给 server 块置一次身份
——契约 §3.2 末句"SetIdentity moves to ApplyOne, once per session"正是答案,
落点在 `PipeApplier::Attach`(`PipeApplier.cpp:1140-1149`)或首个 verb boundary。
4. 契约的告诫(§3.2 不配版本化就更坏)在双块下由 §3.3 的"CountBarrierPull 改无条件
Fatal"兑现:BARRIER_PULLED 值在 server 块里**不存在**(不是旧值),读它具名死——
恰好是契约要求的方向。
---
## 6 integration-split 车道的声明方式与双块车道形状
### 6.1 现有车道形态(样例)
- **标签纪律(ID-131)**:`ctest -L` 是**正则**,所以"必须从 integration-split 里搬出去的
条目"的标签不能含子串 `integration-split`。样例:
- `integration-magma-split`(`MG_IntegrationTest/CMakeLists.txt:2422-2450`,理由
`:2428-2433`:曾实测 `integration-split-magma` 拼法会被 `-L integration-split` 匹配中);
对应预期红 CI 步 `test.yml:1360-1381`:红 + 私有日志里必须有具名 marker,绿也是错。
- `integration-clientarrays-split`(`CMakeLists.txt:2216-2225`);CI 步
`test.yml:1405-1440` 是**三臂**:run-ahead 未武装却红 = 真回归;武装却绿 = 具名拒绝没
打响;红 + 日志带 `Fatal{UnmigratedVerb, "...+CLIENT_ARRAYS"}` = 通过。
- **strict 车道**:主要形态是**环境变量车道而非 ctest 标签**(`f0-env.md:196`:
`MOBILEGL_IPC_STRICT_ERRORS=1 ctest -L integration-split` + marker 直方图);另有少量
自带旋钮的注册条目(`StrictProgramArm.*`,`CMakeLists.txt:2327-2352`,LABELS 故意只写
`integration-split`,理由 `:2321-2326`)。
- **预期红的双态门**:`test.yml:1207-1317`——同一车道在翻转常量
(`kMGPipeP5eRunAheadReady`,grep 自 `Init.cpp`)前是"红即设计、跑 census",后是"硬绿 +
两侧棘轮"。
- **私有日志**:每条 split 条目一个 `MOBILEGL_LOG_FILE_PATH`,
`SplitLogPaths.PrivateAndDistinct`(`CMakeLists.txt:2360-2364` +
`Harness/split_log_paths.py` 的 `check` 模式 :183-188)断言私有且互不相同;
markers 模式的日志集来自 `ctest --show-only=json-v1` 而非目录猜测(:49-70,ID-119)。
- **棘轮**:`Harness/strict-expected-markers.txt`(52 行,10 对活着的
Admitted `<field>@<verb>`)+ `split_log_paths.py` 的 `markers` 模式(:116-178)——
**两侧都咬人**:出现了表里没有的对 → 红;表里的对不再出现 → 红(防"烂绿",:122-126)。
Fatal 侧在 `no-fatal` 臂下任何一对即红。
### 6.2 双块车道的具体形状
1. **标签**:`integration-dualblock-split`(不含 `integration-split` 子串,正则安全;
同样不带 `integration-gpu`,因为该标签下的车道必须能绿,`:2210-2211` 同论证)。
2. **条目**:`gtest_discover_tests` 同一批 split scenario,`TEST_PREFIX
"DirectGLES.Split.DualBlock."`——前缀仍在 `DirectGLES.Split.` 下,
`split_log_paths.py` 的 `paths()`(:19 的前缀判定)与 markers 模式继续覆盖,无需改工具。
env = split env + `MOBILEGL_IPC_ROLE_SPLIT_STATE=1` + 每条目私有
`MOBILEGL_LOG_FILE_PATH`(照 F1./Ct. 块形态,`CMakeLists.txt:2367-2404`)。
3. **CI 步**(test.yml 新增,照 :1360-1381 的双态形状):f1 落地时**预期红**——
步断言 (a) 车道非绿,(b) 私有日志带 `Fatal{UnmigratedPipeInput, "..."} [BARRIER-PULLED,`
形 marker(语法已在 `MARKER_RE`,`split_log_paths.py:44-46`),(c) 把 census 对表提交为
新的预期文件(见 §7.4)。收口包翻转一个常量(照 `kMGPipeP5eRunAheadReady` 的
grep-源码判臂法,`test.yml:1215`)后同一批条目转硬绿。
4. **阴性对照(§6 出口门,ID-122 教训:对照要证伪机制本身)**:关掉双块必须让至少一条具名
用例由绿转红。单纯"共享块恢复旧行为"是全绿的,所以对照用例必须是**为双块专门写的确定性
断言**,建议:`DualBlockScenario.TheTwoRolesHaveDistinctBlocks`——经新增 Harness peek
(照 `SplitRuntimePeek.h`/`PipeApplyPeek.h` 形态)断言两块地址不同、且 client 填一个 verb
后 server 块的 `CurrentVerbSerial` 不动。knob 开 → 绿;knob 关(`ROLE_SPLIT_STATE=0`)→
同一块 → 断言失败 → 红。确定性、无时序、不在 pre-flight 里 skip(ID-62),形状可直接进
`scripts/ci/split_negative_controls.sh` 的 `run_control`(该脚本现成的合同:基线必须绿、
红必须带被选条目自己的断言文本,`split_negative_controls.sh:60-99, 118-168`)。
---
## 7 f1 落地方案
### 7.1 块的分区形态(最小改动面)
`PipeInputs.h:835` 一带(`MOBILEGL_BUILD_DISAGGREGATED` 内,保持 pull/verify 构建符号不动):
```cpp
// server 角色的块:后端经 MGB_CTX 读的、applier 写的、stamp 落的那一块。
// gPipeInputs 的拼写不变,379 个 MGB_CTX 读点与 PipeApply.cpp 的写点零改动。
inline PipeInputs& gPipeInputsServerBlock = *new PipeInputs();
// client 角色的块:MG_Impl 的残余填充写的那一块。
inline PipeInputs& gPipeInputsClientBlock = *new PipeInputs();
inline PipeInputs& gPipeInputs = gPipeInputsServerBlock; // 读侧拼写,向后兼容
inline Bool MGPipeRoleSplitActive() {
return MG_Config::Ipc.RoleSplitState &&
MG_Config::Transport != MG_Config::TransportMode::Monolith;
}
// 填侧唯一新拼写。knob 关或 monolith:同一块,行为逐字节不变。
inline PipeInputs& MGPipeClientInputs() {
return MGPipeRoleSplitActive() ? gPipeInputsClientBlock : gPipeInputs;
}
```
- 两块都 `*new`(leak-at-exit,`PipeInputs.h:818-834` 的论证原样适用,每条目多一块几 KB)。
- `MGPipeRoleSplitActive` 是进程寿命内常量;若要省热路径读,可在首次调用处 latch
(照 `ArmVerify` 的 re-arm 形态,`PipeFill.cpp:598-624`),但 Config 读本身只是两次
全局 load,填侧每 verb 一次,可接受。
### 7.2 拼写替换清单(client 侧,全在 `MG_Impl/Pipe/PipeFill.cpp`)
`gPipeInputs` → `MGPipeClientInputs()`:`:627`(ReportDivergence 的 serial/verb 取名)、
`:653`(SnapshotFromGLContext 的 SetVerb)、`:703`(NoteFrontendMutation)、`:1217`
(ReleaseResidualFillPins)、`:2205`(LeaveVerb)、`:3016`(VertexAttribDefaultsOf 读)、
`:3348`(ValidateForVerb)。
**例外留着不动**:`:663` 的 `&self == &gPipeInputs` 判等——hook 只该钉在**读侧块**上
(server 块),knob 开时它与 verify 互斥(§4.2),knob 关时两块同物,两种臂都正确。
### 7.3 server 侧需要的三处配合
1. **`MGPipeServerClearVerbBoundary` 参数化**(`PipeInputs.cpp:307`):今天写死 gPipeInputs。
拆成 `MGPipeServerClearVerbBoundaryFor(PipeInputs&)`(或直接让两个调用角色各调各的):
applier 的 `LeaveApplier`(`PipeApplier.cpp:1261`)清 server 块;client 的两处
(`PipeFill.cpp:3437, 2228`)清 client 块。knob 关时同一块,语义不变。
2. **server 块身份**:`PipeApplier::Attach` 或首个 `StampVerbBoundary` 处给 server 块
`SetIdentity`/置 `m_live`(§5.3.3),否则 `MGB_CTX_LIVE` 恒 false。
3. **`CountBarrierPull` 的双块臂**(`PipeInputs.cpp:162-187`):`MGPipeRoleSplitActive()` 时
无条件 `StrictBarrierPullFatal(field, verb, "MOBILEGL_IPC_ROLE_SPLIT_STATE=1")`——
这是把 §3.3 的"无名崩溃"变成"具名红"的一行,也是计划 §4 "立刻变成 Fatal" 的机制落点。
`rsp` 计数语义不变(knob 开时 BARRIER_PULLED 读都死了,rsp 恒 0,与出口门 3 的
"rsp 逐帧读零"自洽)。
### 7.4 "红就是清单":红怎么收成清单
1. f1 落地当天跑双块车道,每条目在自己的私有日志里留下
`Fatal{UnmigratedPipeInput, "<field>@<verb>"} [BARRIER-PULLED, MOBILEGL_IPC_ROLE_SPLIT_STATE=1, retires in <phase>]`。
2. `split_log_paths.py markers` 已能解析并按条目归类 Fatal 对(:83-113, :133-136)。
需要一个小扩展:一个 `expect-fatal` 臂,把 **Fatal 集合**与提交的预期文件做与
`strict-expected-markers.txt` 完全同构的双向棘轮(出现新对 → 红;旧对消失 → 红)。
新文件建议 `Harness/dualblock-expected-fatals.txt`,首版内容由 census 生成,
**不由手写**(strict 文件 `:15-20` 的刷新规程照抄)。
3. 之后每个 f 包(fm/fc/fs/fr/fv)退掉自己名下字段的载体,删对应行;文件空 + 车道绿 =
收口(对照 P5f §5 的包图与 §6 出口门 1/2)。strict 车道的
`strict-expected-markers.txt` 棘轮继续独立存在——双块车道管"值不在对面",
strict 车道管"读没被承认",两者是同一债务的两个探针。
### 7.5 守卫与测试的兼容
- `RefusePipeInputsTouchWhileApplierOwnsIt`(`ClientSession.cpp:1290-1380`)保持原样:
它守的是"GL 线程碰 server 拥有的块",knob 开时填侧不再碰 server 块,守卫自然不再触发;
knob 关时行为不变。RemoteClientTest 的死亡测试(:2071, :2295, :2347)不受影响。
- 单测/集成 GPU 车道 knob 默认关 → 单块,逐字节不变;FieldOwnershipTest/PipeInputsTest
直读 `gPipeInputs`(server 块拼写),monolith 下同物。
- G1:新增符号全部关在 `MOBILEGL_BUILD_DISAGGREGATED` 内(该头本就只在 PUSH 闭包,
`PipeInputs.h:39-43`),pull 构建符号集不动。
---
## 8 风险与待确认
1. **O 类 SharedPtr 字段无 null 检查**(§3.3)——f1 的第一批红若不走 §7.3.3 的 Fatal 化,
会以段错误形态出现,census 收集不到 marker。**这是 f1 落地顺序里必须先落的一行。**
2. **`m_live`/`m_contextIdentity` 不属于任何字段归属类**(`PipeFill.cpp:3377-3385` 的具名
偏离):双块后 server 块的身份由 §7.3.2 置一次,但**失语境**(context destroy)时谁把
server 块的 `m_live` 打回 false——契约 §3.2 没说,f1 设计时要点名(候选:applier_reset
控制记录,P5c ct 已让它过线)。
3. **Magma 臂**:Magma 不发布 `kCapRunAheadApply`、跑 lockstep,九个 BARRIER_PULLED 字段
全是它的读者。双块车道建议**双后端各注册一份**(照 `NamedBlit` 的双后端循环,
`CMakeLists.txt:2423-2449`),Magma 侧的红就是 fm 包的清单——这与 §6 出口门 4
"Magma 与 Espryt 跑同一套判据"直接对齐。
4. **verify 构建**:`MOBILEGL_PIPE_VERIFY` 强制 lockstep + 全填(`ConfigLoader.cpp:377, 388`),
与双块互斥的建议已写进 §4.2;若未来要 verify 双块臂,compare-at-read hook 的块归属要重做。
5. `MG_Test` 里直接调 `MGPipeServerStampVerbBoundary` 的用例(PipeWireCodecTest :1366-1380、
FieldOwnershipTest 约 15 处、RemoteClientTest :2393-2413)stamp 的都是 server 块拼写,
knob 关时不变;若有人想在单测里开 knob,需要新 peek——目前无此需求,标为**未知/待 f1 定**。
+228
View File
@@ -0,0 +1,228 @@
# f0-egl — P5f §2.3 EGL / surface 控制面普查(只读)
> 基线 `feat/disaggregated @ 8b68b92c`(代码头 `25fba0d5`)。路径在 `MobileGL/` 下。
> 本文件只读普查,不改任何代码。对应 P5c 审计 G4 行(`docs/Disaggregated/ROADMAP.md:71`),
> 原计划记给 P6(`MobileGL/MG_Remote/CONTRACT-P5C.md:537`),P5f 计划 §2.3
> (`docs/Disaggregated/P5F-WIRE-COMPLETENESS.md:181-186`)将其收回 P5f 的包 `fc`。
---
## 1. 单槽邮箱机制(现状)
**机制本体。** 十二个 forwarder 共享同一条过线通道:
- `ServerLoop.h:220`:`using ControlWork = MobileGLResult (*)(void* user);` —— 一个**裸函数指针**
加一个 `void*`。注释(`ServerLoop.h:217-219`、`ServerLoop.cpp:784-787`)说明为何不是
`std::function`:析构路径不得分配(ID-8)。
- `ServerLoop.cpp:788-793`:每个 forwarder 用同一个无捕获 trampoline
`+[](void* user) { return static_cast<Args*>(user)->Run(); }` 和**指向调用者栈上 `Args` 的
指针**调用 `RunOnApplyThread`。
- `ServerLoop.cpp:645-707`(`RunOnApplyThread`):`m_callerMutex` 串行化多个投递者(:653);
在 `m_controlMutex` 临界区内发布 `{m_controlWork, m_controlUser, m_controlPending}` 四元组,
影子位 `m_controlPosted` 最后发(:685-694);发布后再敲门铃(:702-704,先发布后敲门是
Doorbell 的硬规则);然后阻塞在 `m_controlDone.wait`(:705),返回 `m_controlResult`(:706)。
- `ServerLoop.cpp:533-568`(`PumpControlRequest`):apply 线程在 drain 批之间取走请求、
执行 `work(user)`(:560)、回填结果并 notify(:561-567)。
- 泵点:`ApplyThreadMain` 主循环 :397-398 与退出前 :453;park 谓词 `ready`(:391-395)把
`ControlIsPending()` 列为唤醒条件之一。
- 重入臂:`RunOnApplyThread:651`——apply 线程自己投递就内联执行(拆构路径
`~BackendObject_DirectGLES` → `ReleaseEGLResources` 走这里)。
- 无线程时的行为:backend 活着而线程不在 → `Fatal{ApplyThreadNotRunning}`(:670-676);
backend 已不在 → 返回 `MOBILEGL_ERR_NOT_INITIALIZED`(:678-683)。
**邮箱字段**在 `ServerLoop.h:367-389`:`m_callerMutex` / `m_controlMutex` /
`m_controlPosted`(一位影子)/ `m_controlDone` / `m_controlWork` / `m_controlUser` /
`m_controlResult` / `m_controlPending` / `m_controlFinished`。
**今天为何能工作**:两个角色同进程、同地址空间。函数指针是双方都能执行的代码地址;
`&args`、`major`/`minor`、`&handle` 指向的栈帧由阻塞握手(:705 的 wait)保证在整个执行期间存活;
单槽够用是因为"verb barrier 同一时刻只留一个 client 线程可运行"(`ServerLoop.h:367-368`
注释),加上 `m_callerMutex` 兜底。跨进程后这三样全部失效:代码地址、栈地址、以及"阻塞等待
同进程另一个线程"本身。
**P5f 处置建议**:邮箱机制在 inproc 下整体保留(它是 apply 线程归属语义的一部分),但在其上
叠一层"帧化"接缝:每个 forwarder 的参数先收敛成一个**纯值结构**(见 §4 草案),inproc 臂把该
结构放在栈上传指针(现状等价),spawn 臂把同一结构编码进 `SurfaceOp` 帧。这样 fc 包不动
线程模型,只动载荷的形状。
## 2. 十二个 forwarder 逐个点名
声明在 `ServerLoop.h:459-475`,定义在 `ServerLoop.cpp:802-1033`。下表"载荷"一列标出
**值**(可直接序列化)/ **栈上指针**(指向调用者存储)/ **句柄值**(client 进程的 EGL 句柄,
跨进程无意义)。
| # | forwarder(定义行) | 签名 | 语义 | 载荷分类 |
|---|---|---|---|---|
| 1 | `ServerInitializeEGLDisplay`(`ServerLoop.cpp:802-816`) | `Bool (EGLDisplay dpy, EGLint* major, EGLint* minor)` | 初始化 server 后端的 EGL display,回写主/次版本 | dpy 句柄值;**major/minor 是指向 client 栈的 out 指针**(:805-806) |
| 2 | `ServerCreateEGLWindowSurface`(:818-834) | `Bool (EGLSurface surface, const WindowHandle& handle)` | 建窗口 surface;成功后 `ForgetCurrentTuple()`(:829,N-3) | surface 句柄值;**`&handle` 是指向 client 存储的指针**(:821/:832),且 `WindowHandle::Handle` 本身是 `void*`(`BackendObject.h:561-566`) |
| 3 | `ServerResizeEGLWindowSurface`(:836-850) | `Bool (EGLSurface, Uint32 w, Uint32 h)` | 重建 swapchain | 全为值。**最干净的一个** |
| 4 | `ServerCreateEGLPbufferSurface`(:852-870) | `Bool (EGLSurface, EGLint w, EGLint h)` | 建 pbuffer;成功后 `ForgetCurrentTuple()`(:865) | 全为值 |
| 5 | `ServerMakeEGLCurrent`(:872-918) | `Bool (EGLDisplay, EGLSurface draw, EGLSurface read, EGLContext ctx)` | 经 `ApplyMakeCurrent`(:269-316)三分支:NativeBind / RepeatNoOp / ClientRelease(ID-54);真绑定后重发布 caps 快照(:899-913,R-12) | 四个全是句柄值 |
| 6 | `ServerSwapEGLBuffers`(:920-933) | `Bool (EGLDisplay, EGLSurface draw)` | 直接在 server 上 present | 句柄值。**无生产调用者**(见 §5 发现 F8) |
| 7 | `ServerSetEGLSwapInterval`(:935-946) | `void (Int interval)` | 设置交换间隔;返回值被丢弃(:945) | 值 |
| 8 | `ServerReleaseEGLSurface`(:948-965) | `void (EGLSurface)` | 释放 surface;`ForgetCurrentTupleIfItNames`(:960,N-3) | 句柄值 |
| 9 | `ServerReleaseEGLResources`(:967-989) | `void ()` | **按契约阻塞**(:967-973 注释:之后 `MobileGL::Destroy()` 立即走);`ForgetCurrentTuple()`(:984) | 无参数 |
| 10 | `ServerInitCapabilities`(:991-1007) | `Bool ()` | 跑 server 端 `InitCapabilities` 并 `PublishCapsSnapshot()`(:999-1002) | 无参数 |
| 11 | `ServerInitWindowSurface`(:1009-1020) | `Bool ()` | server 端 `InitWindowSurface` | 无参数。**无任何调用者**(见 §5 发现 F8) |
| 12 | `ServerSetWindowHandle`(:1022-1033) | `void (const WindowHandle& handle)` | 把窗口句柄交给 server 后端 | **`&handle` 是指向 client 存储的指针**(:1024/:1031),内含 `void*` |
参数里的**函数指针**:每一条都是同一个 trampoline(:790-791),它承载的唯一信息是"调哪个
`Args::Run`",即**操作的身份**。参数里的**栈上 `void*`**:`&args` 永远存在(:792),其内部再
含 client 栈指针的是 #1(major/minor)、#2 与 #12(handle)。
**今天为何能工作**:同进程;阻塞握手(`RunOnApplyThread:705`)使调用者栈帧在整个 RPC 期间
存活,所以 out 指针与引用参数安全。EGL 句柄值两边通用是因为同一个驱动在同一进程里认它们。
**P5f 处置建议(共性)**:
- 函数指针 → `SurfaceOp.kind` 枚举(操作身份显式化)。
- out 指针 → 帧的 reply 字段(#1 已被 `SurfaceReply.eglMajor/eglMinor` 覆盖)。
- `WindowHandle` → `windowKind` + `nativeToken` + `width`/`height` 值字段;`Handle` 指针在
Android 上是 `ANativeWindow*`(`P6-SPAWN-PLAN.md:38`),**子进程无意义,真窗口到达是 P12**,
P5f 只在 server 侧落具名拒绝 `Fatal{UnmigratedSurface, "AndroidNativeWindow@P12"}`
(`P6-CONTRACT-DRAFT.md:43` 已预写这个 Fatal 名)。
- EGL 句柄值 → client 铸造的 token(`DisplayToken/SurfaceToken/ContextToken`,
`P6-CONTRACT-DRAFT.md:41` 已裁定:client 铸造、从 1 起稠密、session 内不复用,server 持
token → native 映射,永远不见 client 的 EGL 值)。`protocol.fbs:189-190` 的
`display/surface: ulong` 已经就是 token 的宽度。
## 3. client 侧调用面(`BackendObject_Remote.cpp`)
九个 EGL 虚函数的路由(:196-310),核心纪律是"先转发,再跑基类"(:198-201 注释):
- `InitializeEGLDisplay`(:203-207)→ forwarder #1。
- `CreateEGLWindowSurface`(:209-225)→ 先 #12(:214,"唯一告诉 server 窗口是哪扇的途径"),
再 #2(:215),随后 `DrainPublishedEvents()`(:223)——surface-changed 事件走 SEG_EVENT。
- `ResizeEGLWindowSurface`(:227-234)→ #3 + drain(:232)。
- `CreateEGLPbufferSurface`(:236-243)→ #4 + drain(:241)。
- `MakeEGLCurrent`(:245-276)→ #5,成功后 `PumpControlPlane()` + drain + 刷新格式能力
(:265-274,codex 12:把 R-12 的"第二次到达即失效"闭合在造成它的那次 make-current 上)。
- `SwapEGLBuffers`(:278-287)→ **不转发**:present 走记录(class-B `Present` emitter),
注释明确 #6 "在 P5 没有调用者,这是刻意的"(:284-285)。
- `SetEGLSwapInterval`(:289-297)→ #7。覆写的理由:基类会调 class-C 的 `SetSwapInterval`
槽而 Fatal(:291-295 注释)。
- `ReleaseEGLSurface`(:299-302)→ #8。
- `ReleaseEGLResources`(:304-310)→ #9,按契约阻塞。
- 另有 `InitCapabilities`(:106-142)调 #10(:125);`InitWindowSurface`(:144-149)是
**纯 client no-op,不调 #11**。
**每个 forwarder 调用前的 fence**:`WaitForApplyBeforeEglForwarder`(:189-193),对除
#6 外的每一次转发先 `WaitForApplyToCatchUp`。理由(:176-187 注释、CONTRACT-P5E §2.5
`CONTRACT-P5E.md:177-180`):邮箱在 drain 批之间被泵,run-ahead 下控制请求会插进两条
在飞记录之间。client 入口侧:九个虚函数由 `MG_Impl/EGLImpl/EGLImpl.cpp` 的 EGL 入口调
(如 eglMakeCurrent → :284、eglSwapBuffers → :178、eglSwapInterval → :448、eglTerminate 路径
→ :328)。
**P5f 处置建议**:这个 fence 在 spawn 下**仍然是必要的**——socket 控制通道与 SEG_CMD 是两条
通道,控制帧一样可以超过在飞记录。fc 包的帧化必须保留"发帧前先等 `appliedSeq` 追上
`LastPublishedSeq`"这一步;它不属于 wire 格式而属于发送纪律,应写进 fc 的契约行。
## 4. schema 对照与 wire 帧设计草案
### 4.1 现有 schema(`Protocol/protocol.fbs`,已定但无人使用)
- `SurfaceOpKind`(:166-175):`None / InitializeDisplay / CreateWindowSurface /
CreatePbufferSurface / ResizeWindowSurface / ReleaseSurface / MakeCurrent / ReleaseCurrent`,
共 7 个有效枚举。
- `WindowKind`(:177-184):`None / AndroidNativeWindow / X11 / Win32Hwnd / Surfaceless /
Pbuffer`。
- `SurfaceOp`(:186-196):`seq, kind, display, surface, windowKind, nativeToken, width,
height, swapInterval`。`nativeToken` 注释自述"Android transfers the window out of band"。
- `SurfaceReply`(:198-204):`seq, ok, eglMajor, eglMinor, defaultFb`。
- 信封:`CtrlMsg` union(:273-284)已含 `SurfaceOp/SurfaceReply`;`CtrlEnvelope`(:286-288)。
### 4.2 映射表:12 forwarder → op
| forwarder | 映射 | 缺的枚举 / 字段 |
|---|---|---|
| #1 InitializeEGLDisplay | `InitializeDisplay`;reply 的 `eglMajor/eglMinor` 正是 major/minor out 参数的线形 | 无 |
| #2 CreateEGLWindowSurface | `CreateWindowSurface` + `windowKind`/`nativeToken`/`width`/`height` | 无(P12 前 server 具名拒绝 `AndroidNativeWindow`) |
| #3 ResizeEGLWindowSurface | `ResizeWindowSurface` + `width`/`height` | 无 |
| #4 CreateEGLPbufferSurface | `CreatePbufferSurface` + `width`/`height` | 无 |
| #5 MakeEGLCurrent | `MakeCurrent`;其 ClientRelease 臂(`ClassifyEglMakeCurrent`,:257-267)落 `ReleaseCurrent` | **`SurfaceOp` 缺 `readSurface` 与 `context` 两个字段**:MakeCurrent 的语义单元是 (dpy, draw, read, ctx) 四元组,schema 只有一个 `surface` 且没有 context 字段 |
| #6 SwapEGLBuffers | **不配帧**:present 走记录(`BackendObject_Remote.cpp:278-287`) | — |
| #7 SetEGLSwapInterval | 用 `swapInterval` 字段 | **缺 `SetSwapInterval` 枚举** |
| #8 ReleaseEGLSurface | `ReleaseSurface` | 无 |
| #9 ReleaseEGLResources | 无参数,阻塞 | **缺 `ReleaseResources` 枚举** |
| #10 InitCapabilities | **不配 SurfaceOp**:应答物是 `CapsSnapshot` 帧(server 已在 :999-1002 发布;`P6-CONTRACT-DRAFT.md:88-89` 同此裁定) | —(但 client 需要一个"等下一帧 CapsSnapshot"的同步点,见 4.4) |
| #11 InitWindowSurface | **不配帧**:client 侧 no-op(:144-149),无调用者 | — |
| #12 SetWindowHandle | 用 `windowKind`/`nativeToken`/`width`/`height` | **缺 `SetWindowHandle` 枚举** |
缺的三个枚举与 `P6-SPAWN-PLAN.md:76` 的预测("预期缺 `SetSwapInterval`/`ReleaseResources`/
`SetWindowHandle`")**逐字吻合,本普查确认**。9 个需映射的 forwarder = 7 个现有枚举 + 3 个新增
枚举 - 1 个复用(ReleaseCurrent 由 #5 的释放臂复用),与 `P6-CONTRACT-DRAFT.md:87-90` 的
"the remaining nine map onto the seven plus §1's additions" 一致。追加枚举必须 append-only
(schema 自述纪律在 :268-272 的 union 注释与 `CapsSnapshot` 的 deprecated 先例 :115-127)。
另外发现 **schema 缺的字段**(P6 计划未预写):
1. `SurfaceOp` 缺 `readSurface`(MakeCurrent 需要 draw≠read 的场景)。
2. `SurfaceOp` 缺 `context` token 字段(MakeCurrent/ReleaseCurrent 都要指名 ctx)。
3. `WindowKind` 与 `WindowBackend`(`BackendObject.h:551-559`:Android/X11/MetalLayer/Win32)
**不互洽**:`WindowKind` 缺 `MetalLayer`,多 `Surfaceless`/`Pbuffer`(那两个不是窗口后端)。
需要一张显式映射表,不能按整数值直译。
### 4.3 帧设计草案(逐 forwarder)
公共规则:`seq` 由 client 单调铸造,`SurfaceReply.seq` 回声;携带 `ok=false` 等价今天的
`Bool false` 或 void 丢弃结果;server 侧答不出来等价 `ServerBackendOrNull()` 为 null
(:798)时的 `MOBILEGL_ERR_NOT_INITIALIZED`。token 化按 `P6-CONTRACT-DRAFT.md:41`。
| op 帧 | 载荷 | reply | 阻塞性 |
|---|---|---|---|
| `InitializeDisplay` | `display`(token) | `ok` + `eglMajor/eglMinor` | 阻塞(今天返回 Bool) |
| `CreateWindowSurface` | `surface`(token) + `windowKind` + `nativeToken` + `width/height` | `ok` + `defaultFb`(见 4.4 的路线冲突) | 阻塞。可并入 #12(见下) |
| `ResizeWindowSurface` | `surface` + `width/height` | `ok` + `defaultFb` | 阻塞 |
| `CreatePbufferSurface` | `surface` + `width/height`(`windowKind=Pbuffer`) | `ok` | 阻塞 |
| `MakeCurrent` | `display` + `surface`(draw) + **新字段 `readSurface`** + **新字段 `context`** | `ok` | 阻塞 |
| `ReleaseCurrent` | `display`(其余 token 为 0 合法,`P6-CONTRACT-DRAFT.md:41` 已许) | `ok` | 阻塞(今天经同一个 Bool 通道) |
| `SetSwapInterval`(新枚举) | `surface` + `swapInterval` | 可无 reply | **可改 fire-and-forget**:今天虽经阻塞邮箱但结果被丢弃(:945) |
| `ReleaseSurface` | `surface` | 可无 reply | 可 fire-and-forget(:964 丢结果);但须保序 |
| `ReleaseResources`(新枚举) | 无 | `ok` | **必须阻塞**:`ServerLoop.cpp:967-973` 的契约,`Destroy()` 在它返回后立即走 |
| `SetWindowHandle`(新枚举) | `windowKind` + `nativeToken` + `width/height` | 可无 reply | 可 fire-and-forget,**但必须在后续 `CreateWindowSurface` 之前生效**——同一有序通道即保证 |
两个可合并项(供 fc 包定夺,本普查只摆出):① `CreateWindowSurface` 的 schema 字段已自带
`windowKind/nativeToken/width/height`,#12 可以并进 #2,`SetWindowHandle` 枚举只在"先给窗口
后建 surface"的时序必须拆开时才需要——今天的代码就是拆开的(:214-215),保守做法是两者都
落;② `ReleaseCurrent` 也可用 `MakeCurrent` + 全 0 token 表达,现有枚举分开更好,保留。
### 4.4 三个与 schema 相邻的副作用,必须在 fc 的契约里点名
1. **caps 重发布**:#5 的真绑定臂(:899-913)和 #10(:999-1002)都会让 server 主动推一帧
`CapsSnapshot`。跨进程后这是 server 自发帧;client 今天的吸收点(RPC 返回后
`PumpControlPlane()`,:266-272 与 :130)天然对应"reply 之后泵控制通道"。schema 无需加
字段,但 fc 应写明"MakeCurrent reply 到达后、下一帧 CapsSnapshot 到达前"的语义窗口。
2. **`SurfaceReply.defaultFb` 与 SEG_EVENT 是重复路线**:P5c 已把默认 FBO 形状做成
surface-changed 事件,client 在 create/resize reply 后 `DrainPublishedEvents()`
(:223/:232/:241)。`defaultFb` 字段(:154-160, :203)若启用是第二载体。建议 fc 二选一
并写明,不要两个都活(`CapsSnapshot` 的 deprecated 字段教训,:101-127,就是两种拼法
并存的代价)。
3. **server 死亡的具名化**:今天的 `Fatal{ApplyThreadNotRunning}`(:670-676)在 spawn 下
对应 `FatalCode::ServerCrashed`(:240 已分配,`P6-CONTRACT-DRAFT.md:44` 已点名 P6 是
第一个能产生它的阶段)。fc 的 client 侧发送路径要把"发不出去/等不到 reply"接到这个码上。
## 5. 其他发现
- **F8:两个 forwarder 没有生产调用者。** `ServerSwapEGLBuffers` 只有单测调用
(`MG_Test/Wire/ServerLoopTest.cpp:1549`、`:1568`);`ServerInitWindowSurface` 全树无调用者
(client 的 `InitWindowSurface` 是纯 no-op,`BackendObject_Remote.cpp:144-149`)。
处置建议:fc 不为它们配帧(§4.2 已按此映射);`ServerLoop.h:469`/`:474` 的声明与
实现在 spawn 世界只剩 inproc 测试价值,fc 可具名删除或标注 inproc-only。
- **F9:文档行号漂移。** `ROADMAP.md:71`(P5c 审计 G4 行)引 `ServerLoop.cpp:543-598`,
当前 HEAD 的邮箱是 `:533-568`(PumpControlRequest)+ `:645-707`(RunOnApplyThread);
`CONTRACT-P5C.md:537` 把控制面记给 P6,P5f 计划 §2.3(`P5F-WIRE-COMPLETENESS.md:181-186`)
已改记 P5f 的包 `fc`(`P5F-WIRE-COMPLETENESS.md:252`)。处置建议:fc 落地时顺手刷新
ROADMAP G4 行的行号与去向。
- **F10:`ServerLoop.h:436` 与 `ServerLoop.cpp:968` 引的 `EGLImpl.cpp` 行号**(:284/:326)
与当前 `MG_Impl/EGLImpl/EGLImpl.cpp` 基本相符(:284 是 eglMakeCurrent;ReleaseEGLResources
实际在 :328)。仅为记录,不构成缺陷。
## 6. 结论汇总
1. 十二个 forwarder 的过线载荷里,真正"不可序列化"的只有两类:**trampoline 函数指针**
(操作身份 → `SurfaceOp.kind`)和**三处 client 栈/堆指针**(#1 的 major/minor → reply 字段;
#2/#12 的 `WindowHandle*` → windowKind+nativeToken 值字段,Android 的 `ANativeWindow*`
归 P12,P5f 只落具名拒绝)。其余参数全是值或 client 句柄值(→ token)。
2. schema 缺口清点确认:**缺 3 个枚举**(SetSwapInterval / ReleaseResources /
SetWindowHandle,与 P6-SPAWN-PLAN 的预测逐字一致)+ **缺 2 个字段**(MakeCurrent 的
readSurface 与 context token)+ WindowKind/WindowBackend 需要显式映射表。
3. #6、#10、#11 不配 SurfaceOp 帧:present 走记录、InitCapabilities 走 CapsSnapshot、
InitWindowSurface 无调用者。需要帧化的是 9 个 forwarder、10 种 op(含 ReleaseCurrent)。
+309
View File
@@ -0,0 +1,309 @@
# P5f / f0 — 构建与门禁机制侦察(实现代理 cheatsheet)
> 只读普查产物。仓内引用以 `feat/disaggregated @ 8b68b92c`(代码头 `25fba0d5`)为准;
> WSL 侧文件不在仓内,引用给绝对路径。未发起任何构建。
---
## 1 WSL 侧布局:树在哪、是什么关系
所有 WSL 树都是**同一个仓的 git worktree**(不是拷贝)。主 gitdir 在 `/home/swung/mgl/MobileGL`,
`git worktree list` 在任何一棵树里都能看到全部(证据:在 `~/w7/p5e-int` 里执行
`git worktree list` 列出 pipe / p5-* / p5e-* / land 等 20 棵树)。
| 树 | 分支 @ HEAD | 角色 |
|---|---|---|
| `~/w7/pipe` | `feat/disaggregated @ 11ac3de6` | **集成树**。比 Windows HEAD 落后 105 个提交(`11ac3de6..HEAD`),P5c 开工时的位置。`docs/Disaggregated/notes/p0/BRIEF-P0.md:13`:"DO NOT edit `~/w7/pipe` or `~/w7/base` - they are read-only references" |
| `~/w7/base` | `dev @ 81b17c0b` | **性能锚点**,dev 分支,不动(`docs/Disaggregated/notes/p1/BRIEF-P1.md:3`) |
| `~/w7/land` | `dev @ 81b17c0b` | 与 base 同 commit,带 `build-android/` 目录。用途未见诸阶段文档——**未知**(从目录形态看是 dev 的 Android 构建树;P5f 用不到) |
| `~/w7/p5e-int` | `p5e-wave2-landed @ f23fbc1b` | P5e 集成树,**已过时**,见 §6.1 |
| `~/w7/p5e-<slug>` | `p5e/<slug>` | P5e 各包树(c0e/fb/fix1/gl/id/mv/pa/pg/ra/ra2/sb/tx2/vi),每棵一个包 |
| `~/w7/p5e-logs/` | — | p5e_gate.sh 的日志输出目录(每步一个 `<slug>-<step>.log`) |
每棵树的 remote 都有两个:`origin = /home/swung/mgl/MobileGL`(WSL 内部主仓),
`winrepo = /mnt/c/Users/geekerwan/AndroidStudioProjects/FoldCraftLauncher/MobileGL`(Windows 侧)。
**Windows 侧关系**:工作区 `MobileGL-disagg` 是 `FoldCraftLauncher` 仓里 `MobileGL` 子模块的
worktree(`MobileGL-disagg/.git` 文件指向
`C:/Users/geekerwan/AndroidStudioProjects/FoldCraftLauncher/.git/modules/MobileGL/worktrees/MobileGL-disagg`)。
Windows 侧(在该 worktree 执行 `git remote -v`)配了 **`wslpipe = //wsl.localhost/Arch/home/swung/w7/pipe`**,
以及 `origin = github.com/MobileGL-Dev/MobileGL.git`、`hitmoe`、`fu3`。
### 1.1 代码怎么同步(非对称,两个方向机制不同)
- **Windows → WSL**:按 SHA fetch。`~/w7/notes/tools/p5e_new.sh` 的核心三行:
```bash
cd ~/w7/pipe
git fetch -q /mnt/c/Users/geekerwan/AndroidStudioProjects/FoldCraftLauncher/.git/modules/MobileGL "$SHA"
git branch -f "p5e/$SLUG" "$SHA" && git worktree add ~/w7/p5e-$SLUG "p5e/$SLUG"
```
前提是**先在 Windows 侧 commit**——WSL 看到的是 gitdir 里的对象,工作区改动过不去。
p5e_new.sh 随后做 `git submodule update --init --recursive`、补拷
`3rdparty/glslang/External`(worktree 不带子模块的嵌套 External)、写
`.git/info/exclude` 加 `.p5e/`,然后直接调 `p5e_gate.sh $SLUG configure` + `build`。
- **WSL → Windows**:在 Windows worktree 里 `git fetch wslpipe <branch>`。
出处:`docs/Disaggregated/notes/p5e/FLIP-CHECKLIST.md:3-5`——"Integration tree
`~/w7/p5e-int`(branch `p5e-wave2-landed`, fetched to the Windows worktree
`MobileGL-disagg` via remote `wslpipe`, pushed to `origin/feat/disaggregated`)"。
- **LFS 纪律**(trace fixture):`git worktree add` 不 hydrate LFS,新树里 41 个 fixture 有 40 个是
130 字节指针。从 `~/w7/pipe/tools/trace_replay/fixtures` **拷贝**,并标 assume-unchanged;
**永远不在 WSL 里 `git lfs pull` / `git lfs checkout`**(额度是既有规矩,且 checkout 会把真文件
覆盖成指针)。出处:`~/w7/notes/tools/wsl_p5_gate.sh` Part 2 头注释("FIXTURES FIRST…"段)。
- `~/w7/notes/` 本身已搬家:`~/w7/notes/MOVED-TO-REPO.txt`——415 篇 .md 已入仓
`docs/Disaggregated/notes/<phase>/`(commit `2acea1b1`);留在 WSL 的只有脚本、日志、census
数据、patch、APK、nm dump(含绝对路径与设备序列号,不入仓)。
### 1.2 现成脚本(`~/w7/notes/tools/`)
| 脚本 | 作用 |
|---|---|
| `p5e_new.sh <slug> <sha>` | 按 SHA 建 `~/w7/p5e-<slug>` 包树并 configure+build(见 §1.1) |
| `p5e_gate.sh <slug> <step> [regex]` | **P5e 门禁本体**,step ∈ configure/build/unit/isplit/gpu/strict/flavours/gens/one,逐条见 §4 |
| `wsl_p5_gate.sh [quick]` | P5 时代的五段式大门(env `MGL_P5_TREE` 指定树),四 flavour 全建 + retrace 扫描;`flavours` 的 verify 臂只在它这里有(§3) |
| `wsl_p4a_gate.sh` / `wsl_p3a_gate.sh` / `wsl_p2_gate.sh` 等 | 各阶段同构老门,仅供考古 |
| `wsl_integrate.sh` / `p5_merge_*.sh` / `p5_land_*.sh` | 各阶段合并/落地脚本,阶段专用 |
WSL 工具链事实(`docs/Disaggregated/notes/p1/BRIEF-P1.md:3`):clang 22.1.6 在
`/usr/sbin/clang++`(没有 `clang++-20`);28 核;ccache 配 `CCACHE_BASEDIR=/home/swung/w7`。
---
## 2 仓内门脚本(`scripts/` 与 `scripts/ci/`)
全部入口都是 `python3 scripts/xxx.py` / `bash scripts/ci/xxx.sh`,在仓根跑。P5e gate 的 `gens`
步(`~/w7/notes/tools/p5e_gate.sh`)就是这套的最小全集:
```bash
python3 scripts/gen_pipe.py --check # G1..G7 七个生成器,产物已提交,重生成有 diff 即红
python3 scripts/gen_pipe.py --self-test # 生成器自己的阴性对照
python3 scripts/gen_pipe_field_ownership.py --check # 70 行归属表(63 字段 + 7 sticky)每行恰好一类,有洞即红
python3 scripts/gen_pipe_field_ownership.py --self-test
python3 scripts/gen_pipe_field_ownership.py --print-admitted # 打印"允许 admitted 的 <field>@<verb>",strict 棘轮的另一臂
python3 scripts/check_include_closure.py # 三个头的 include 闭包(value/artifacts/wire 三 probe)
python3 scripts/gen_pipe_dirty_surface.py --check # 脏面扫描:mutator→aggregate generation 映射
python3 scripts/gen_pipe_dirty_surface.py --self-test
python3 scripts/check_doc_citations.py --rev HEAD --strict docs/Disaggregated/*.md MobileGL/MG_Remote/CONTRACT-P5*.md
```
细节:
- `scripts/gen_pipe.py`(文件头 docstring):读 `PipeCalls.def / PipeFields.def / Coverage.def /
FillPoints.def` + `scripts/data/backend_read_inventory.md`,写 `MobileGL/MG_Pipe/generated/*.inc`,
产物是**提交的**,CI 重生成比对。无参 = 写文件;`--check` = 只校验;`--self-test` = 阴性对照。
- `scripts/gen_pipe_field_ownership.py`(文件头):RECORD_SUPPLIED 是**推导**出来的
(Coverage.def emitted − PipeFill.cpp 拒绝表),所以映射文件不可能与 emitter 漂移还保持绿。
- `scripts/check_include_closure.py`(文件头):`--mode text|clang|both`,ctest 里跑的是 text
(CI test job 的 runner 没子模块);`--require-all` 把 SKIP 变红(棘轮)。
- `scripts/gen_protocol.py`:flatc 解析顺序 `--flatc` / `MOBILEGL_FLATC_EXECUTABLE` → 从
`3rdparty/flatbuffers` 源码建到仓外 `<repo>/../flatc-build`(`MOBILEGL_FLATC_BUILD_DIR` 可改)。
- `scripts/check_doc_citations.py`:解析 md 里的 `path:line` 引用对 git rev 校验,只有
`--strict` 才非零退出。
- `scripts/ci/split_negative_controls.sh [--self-test]`:E1(verb barrier)与 E3(a)(persistent-map
push)的阴性对照,是 `.github/workflows/test.yml:1097` 那个 step 的本体。环境变量
`CTEST`(默认 ctest)等覆盖点在文件头 usage 段。两条规矩(文件头):基线必须绿(数 PASSED)、
红必须带被选条目自己的失败文本。
- `scripts/ci/control_smoke_test.sh`:用 stub ctest 跑上面真脚本,验证"该红时红"(R-16)。
- `scripts/ci/redcheck_control_smoke_test.sh`:smoke test 自己的 red-once(临时 revert 证据检查)。
- `scripts/ci/retrace_pull_library_control.sh` / `retrace_drop_draw_control.sh`:retrace-split
车道的两个阴性对照(pull 库必须红于 transport 断言;丢 draw 必须红于 SSIM)。retrace 本体是
WSL 侧 `~/w7/retrace_gate.py`(不在仓内)。
- `scripts/ci/census_junit.py` / `junit_tally.py`:JUnit XML 统计辅助。
- CI 接线点:`.github/workflows/test.yml:1097`(negative controls)、`:1249`
(`--print-admitted`)、`:2568-2576`(gen_pipe)、`:2616-2617`(dirty surface)、
`:2637-2638`(field ownership)、`:2736`(doc citations,`|| true` 非 strict)。
---
## 3 四个构建 flavour 与 CMake 强制规则
开关定义在仓根 `CMakeLists.txt`:
| 开关 | 行 | 含义 |
|---|---|---|
| `MOBILEGL_BUILD_DISAGGREGATED` | `CMakeLists.txt:23` | 编译 MG_Remote 传输层(两进程形态) |
| `MOBILEGL_BUILD_DISAGGREGATED_INPROC` | `CMakeLists.txt:30` | 编译 inproc 角色隔离 shim;蕴含上一项(`:460-463`) |
| `MOBILEGL_PIPE_PUSH` | `CMakeLists.txt:35` | 后端经 PipeInputs 块读前端状态 |
| `MOBILEGL_PIPE_VERIFY` | `CMakeLists.txt:36` | 编译 SnapshotFromGLContext + G4 逐 verb 影子比对器;蕴含 PUSH(`:506-508`),永不发布 |
**强制规则(全是普通变量遮蔽,不写 cache——所以 CMakeCache 不可信,见 ID-124)**:
- `DISAGGREGATED=ON` 缺 flatbuffers 子模块 → 静默降级为 OFF(`:471-486`)。
- **`DISAGGREGATED=ON` 强制 `PIPE_PUSH=ON`(`:496-500`)——不存在 "disaggregated pull"**。
同时传 `-DMOBILEGL_PIPE_PUSH=OFF` 会被静默覆盖,cache 里仍显示 OFF。
- `PIPE_PUSH=OFF` 强制 `PIPE_LEGACY_MEMOS=ON`(`:513-517`)——pull 构建里 legacy 臂是唯一臂。
- 生效宏落点:`:652-659`(`-DMOBILEGL_BUILD_DISAGGREGATED=1` / `-DMOBILEGL_PIPE_PUSH=1` /
`-DMOBILEGL_PIPE_VERIFY=1`)。
四个 flavour 的配法(`~/w7/notes/tools/wsl_p5_gate.sh:63-66` 与 `p5e_gate.sh` 的 flavours 步):
| flavour | 构建目录 | 开关 |
|---|---|---|
| pull | `build-linux`(老门)/ `build-pull`(p5e) | `DISAGGREGATED=OFF INPROC=OFF PIPE_PUSH=OFF` |
| push | `build-push` | `DISAGGREGATED=OFF INPROC=OFF PIPE_PUSH=ON` |
| verify | `build-verify` | `PIPE_VERIFY=ON` + `MOBILEGL_ITEST_REQUIRE_GPU=ON`(只在 wsl_p5_gate.sh 里有;p5e_gate.sh 不建它) |
| split | `build-split` | `PIPE_PUSH=ON DISAGGREGATED=ON DISAGGREGATED_INPROC=ON` |
**ID-124 教训(p5e_gate.sh flavours 步头注释原文)**:每个 flavour 配完后必须先从
`compile_commands.json` 里 grep 生效宏再放行构建——cache 条目会说谎:
```bash
got=$(grep -o 'MOBILEGL_PIPE_PUSH=1' "build-$fl/compile_commands.json" | head -1)
# pull 要 absent,push 要 1,不等就 ARM CHECK FAILED
```
公共 configure 串(p5e_gate.sh 的 `$COMMON`):`-G Ninja`、clang/clang++、ccache、
`-DCMAKE_BUILD_TYPE=Release`、`-DMOBILEGL_LOG_ACTIVE_LEVEL=MOBILEGL_LOG_LEVEL_INFO`、
`-DMOBILEGL_BUILD_TEST=ON -DMOBILEGL_BUILD_INTEGRATION_TEST=ON -DMOBILEGL_BUILD_BENCHMARK=OFF`、
`-DMOBILEGL_ITEST_EGL_VENDOR=/usr/share/glvnd/egl_vendor.d/50_mesa.json`、
`-DMOBILEGL_ITEST_VK_ICD=/usr/share/vulkan/icd.d/lvp_icd.json`、
`-DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_POLICY_VERSION_MINIMUM=3.5`。
**C-10 教训**(wsl_p5_gate.sh:8-11 头注释):构建结果要用产物的存在来证明——`cmake --build`
拿错目录时 `$?` 也是 0(cmake 打 usage),所以每个 build 目录先查 `CTestTestfile.cmake`
再采信(`wsl_p5_gate.sh:74`)。
**`~/w7/p5e-int` 实测**(只读查 compile_commands.json):`build-pull` 无任何宏、`build-push`
有 `MOBILEGL_PIPE_PUSH=1`、`build-split` 有 `PUSH=1 + DISAGGREGATED=1`、`build-nodisagg` 无宏;
**没有 build-verify**。`verify` flavour 在 P5e 只在 retrace 扫描里以
`MOBILEGL_PIPE_VERIFY=1` 环境变量的形式出现(wsl_p5_gate.sh:270)。
---
## 4 车道与 P5e gate 脚本
### 4.1 ctest 标签
| 标签 | 注册处 | 说明 |
|---|---|---|
| `unit` | `MobileGL/MG_Test/**/CMakeLists.txt`(gtest_discover_tests … LABELS unit,如 `MobileGL/MG_Test/Pipe/CMakeLists.txt:215`) | 单测 |
| `integration-split` | `MobileGL/MG_IntegrationTest/CMakeLists.txt:1917-2364` | 拆分车道。大多数条目同时带 `integration-gpu`(`:1917` 等 `LABELS "integration-gpu\;integration-split"`);**`integration-split` 不等于 "split transport"**——`:1944` 注释明说 monolith 臂也带这个标签。strict 专用条目只带 `integration-split`(`:2339, :2349`)。`integration-split-clientarrays` 会被 `-L integration-split` 匹配(子串,`:2206-2209`) |
| `integration-gpu` | 同上 | GPU 车道。`MOBILEGL_ITEST_REQUIRE_GPU` 把"无 GPU 全 skip"从绿变红,否则该标签不可证伪(`MobileGL/MG_IntegrationTest/CMakeLists.txt:280-285`) |
| `integration-verify` | `:1695-1726` | verify comparator 车道(`-DMOBILEGL_PIPE_VERIFY=ON` 构建里跑) |
### 4.2 p5e_gate.sh 各 step(`~/w7/notes/tools/p5e_gate.sh`,逐字摘录的命令)
用法:`bash ~/w7/notes/tools/p5e_gate.sh <slug> <step> [regex]`,在 `~/w7/p5e-<slug>` 里跑,
日志落 `~/w7/p5e-logs/<slug>-<step>.log`。集成树就是 slug=int(FLIP-CHECKLIST.md:5:
"`G` = `bash /home/swung/w7/notes/tools/p5e_gate.sh int <step>`")。
| step | 命令本体 |
|---|---|
| `configure` | `cmake -S . -B build-split $COMMON -DMOBILEGL_BUILD_DISAGGREGATED=ON -DMOBILEGL_BUILD_DISAGGREGATED_INPROC=ON -DMOBILEGL_PIPE_PUSH=ON` |
| `build` | 无 cache 先 configure;`cmake --build build-split -j $(nproc)` |
| `unit` | `GLIBC_TUNABLES=glibc.malloc.tcache_count=0 ctest --test-dir build-split -L unit -j $(nproc) --output-on-failure`(GLIBC_TUNABLES 是 ID-18/21:让 exit-order UAF 可复现) |
| `isplit` | `ctest --test-dir build-split -L integration-split --no-tests=error -j 4 --output-on-failure` |
| `gpu` | `ctest --test-dir build-split -L integration-gpu --no-tests=error -j 4 --output-on-failure`。**不是可选**:它是 push 构建的 monolith 运行时臂(ID-109 的洞——137 个 SEGFAULT 在 38 个 scenario 上无门通过,fix1/ID-107);-j4 约 10 分钟,定为集成分支步骤而非每包步骤 |
| `strict` | `MOBILEGL_IPC_STRICT_ERRORS=1 ctest --test-dir build-split -L integration-split --no-tests=error -j 4 --output-on-failure`,然后 `grep -ho 'Fatal{UnmigratedPipeInput, "[^"]*"}'` 做首错直方图。**strict 是环境变量车道,不是独立 ctest 标签** |
| `flavours` | rm -rf 重建 build-pull / build-push,每个先过 compile_commands.json 宏断言再构建(§3 ID-124) |
| `gens` | §2 列的那串 + `check_doc_citations.py --rev HEAD --strict` |
| `one <regex>` | `ctest --test-dir build-split -R <regex> --output-on-failure`,附 Fatal 上下文摘录 |
关键运行时环境变量:
| 变量 | 取值/出处 |
|---|---|
| `MOBILEGL_TRANSPORT` | `monolith \| inproc \| spawn \| unix:<path> \| pipe:<name>`(`MobileGL/Config.h:425`);pull 库里 `inproc` 被静默忽略(`Config.h:436`)——这就是 retrace pull 阴性对照存在的理由 |
| `MOBILEGL_IPC_STRICT_ERRORS` | `MobileGL/ConfigLoader.cpp:393` 读取;BARRIER-PULLED 读由计数升为 Fatal(`MobileGL/Config.h:534`、`MobileGL/MG_Backend/MGPipe/PipeInputs.cpp:183`) |
| `MOBILEGL_IPC_RUN_AHEAD` | `MobileGL/Config.h:508`(P5e,`MG_Remote/CONTRACT-P5E.md` §1) |
| `MOBILEGL_IPC_AUDIT` | `=1` 时读 `0xDD` 毒化即红(BRIEF-P5E.md §3.7) |
| `MOBILEGL_IPC_VERB_BARRIER=0` | **不要拿它当对照**(ID-114,FLIP-CHECKLIST.md Phase E):它是 `RunAheadArmed()` 的第一合取项,副作用是关掉 run-ahead,且秒死于 `Fatal{UnmigratedPipeInput, "IsCapabilityEnabled@ClientWaitSync"}` |
| `MOBILEGL_ITEST_REQUIRE_GPU` | 见 §4.1;configure 期 option 会注入公共 ENVIRONMENT(`MobileGL/MG_IntegrationTest/CMakeLists.txt:303-306`) |
| `MOBILEGL_LOG_FILE_PATH` | 每个 split 条目一条私有库日志(split_log_paths.py 的职责就是校验私有且互不重名);库的 Fatal 只在私有日志里——**ctest 控制台 transcript 对库输出是假零**(split_log_paths.py evidence 模式错误信息原文) |
### 4.3 P5e 的落地流程(FLIP-CHECKLIST 摘要)
`docs/Disaggregated/notes/p5e/FLIP-CHECKLIST.md`:Phase A 按 gl→pa→mv 序合并,每次合并后
`G build && G unit && G isplit && G gpu && G gens`;Phase B 翻转前记录四条基线
(`RUN_AHEAD=0` / `IPC_AUDIT=1` 各 116/116、`STRICT_ERRORS=1 ctest -L unit` 2250/2250、
默认臂日志含 "run-ahead requested … running lockstep");Phase D 翻转是一个 commit 同时落
`kMGPipeP5eRunAheadReady`(`MG_Backend/Init.cpp:98`)与
`kMGPipeP5eClientWaitRuleLanded`(`MG_Pipe/PipeApply.h:969`)——分开落会死。
---
## 5 strict-expected-markers.txt 刷新流程
文件:`MobileGL/MG_IntegrationTest/Harness/strict-expected-markers.txt`。当前 HEAD 上活着
**10 对** `<field>@<verb>`(`:34-52`:8 对表 admission + 2 对 escalation-only 的
client-vertex-array 条目,P8 的)。
它是双向棘轮(`:11-13`):表里有的对子若不再出现 → 在退役它的那个 commit 里删行;
出现新对子 → 加行并注明归哪个阶段,或直接退役它。
**刷新流程(`:15-20` 原文,禁止手猜)**:
```bash
ctest -L integration-split --show-only=json-v1 > lane.json
MOBILEGL_IPC_STRICT_ERRORS=1 ctest -L integration-split -j 4
python3 MobileGL/MG_IntegrationTest/Harness/split_log_paths.py markers lane.json . \
<(python3 scripts/gen_pipe_field_ownership.py --print-admitted) strict-expected-markers.txt
# 把它打印的 census 贴回文件
```
配套事实:
- marker 语法在写出处定义(`split_log_paths.py` 的 `MARKER_RE`):
`Fatal{UnmigratedPipeInput, "<F>@<V>"}` 与 `Admitted{UnmigratedPipeInput, "<F>@<V>"}
[BARRIER-PULLED, ADMITTED[-ESCALATED], retires in <phase>]` 两种形态。
- 日志集来自 `ctest --show-only=json-v1` 而不是目录扫描(ID-119:目录是猜测,F1. readback
块、NamedBlit、Ct.、PersistentMapArm、DirectVulkan 条目都不在 split-logs/ 目录里)。
- census 是**首错直方图不是清单**(FLIP-CHECKLIST.md Phase B.2):退役一行后那 62 个条目不会
变绿,会推进到各自的下一个 pull。
- 重测 census 要按 `ctest -L integration-split -N -V` 逐条驱动环境——`PersistentMapArm.` /
`SmallRing.` / `NamedBlit.` 前缀带额外 ENVIRONMENT,固定环境的 census 对 14/109 是错的
(FLIP-CHECKLIST.md Phase B.1)。
---
## 6 P5f 开工前必须知道的三件事
### 6.1 `~/w7/p5e-int` 不能直接用
p5e-int 停在 `f23fbc1b`(branch `p5e-wave2-landed`),它**不是** Windows HEAD `8b68b92c` 的
祖先(`git merge-base --is-ancestor` 判定否)——P5e 收官后 Windows 侧分支被重述过
(同一批提交、中英文两版 message、不同 SHA;`f23fbc1b` 对象本身在 Windows 仓里存在,
`git cat-file -t f23fbc1b` = commit)。P5f 的正确姿势是从当前代码头 `25fba0d5`(或 HEAD
`8b68b92c`,其后的提交只动文档)按 §1.1 新建树:`p5e_new.sh` 的形态照抄,slug 换 `p5f-<x>`。
### 6.2 gate 脚本要复制改造,不要直接复用
`p5e_gate.sh` 硬编码 `~/w7/p5e-$SLUG` 与 `~/w7/p5e-logs`。P5f 应复制为 `p5f_gate.sh`
(树改 `~/w7/p5f-$SLUG`)。P5f 新增的双块车道(P5F-WIRE-COMPLETENESS.md §4,旋钮建议名
`MOBILEGL_IPC_ROLE_SPLIT_STATE=1`)应加成新 step,形态照 `strict` 步(环境变量 + 同一标签 +
marker 直方图)。**阴性对照要写进脚本**:关掉双块必须让至少一条具名用例由绿转红
(P5F §6,ID-122 的教训)——参照 `scripts/ci/split_negative_controls.sh` 的"红必须带被选条目
自己的失败文本"规矩。
### 6.3 门禁的已知盲点都是"未被构建/未被运行的臂"
ID-107/109(运行时臂无门:push 构建的 monolith 臂漏跑 → 137 SEGFAULT)、ID-123(gate 只配
build-split,pull flavour 根本没建)、ID-124(cache 与生效宏不符的伪 pull 构建)、ID-122
(对照要证伪机制本身)。P5f 加任何新车道时按这个清单自查:**配了吗、建了吗、跑了吗、宏对吗、
红过一次吗**。
---
## 7 常用命令速查(Windows 侧发起,WSL 执行)
```bash
# 建 P5f 包树(先在 Windows worktree commit,拿到 SHA)
wsl.exe -e bash -lc 'bash ~/w7/notes/tools/p5e_new.sh <slug> <sha>' # 脚本内路径写死 p5e-,P5f 需先复制改造
# 集成树门禁(P5e 形态,P5f 复制后替换 slug 前缀)
wsl.exe -e bash -lc 'bash ~/w7/notes/tools/p5e_gate.sh int build'
wsl.exe -e bash -lc 'bash ~/w7/notes/tools/p5e_gate.sh int unit'
wsl.exe -e bash -lc 'bash ~/w7/notes/tools/p5e_gate.sh int isplit'
wsl.exe -e bash -lc 'bash ~/w7/notes/tools/p5e_gate.sh int gpu' # 集成分支步骤,非每包
wsl.exe -e bash -lc 'bash ~/w7/notes/tools/p5e_gate.sh int strict'
wsl.exe -e bash -lc 'bash ~/w7/notes/tools/p5e_gate.sh int flavours'
wsl.exe -e bash -lc 'bash ~/w7/notes/tools/p5e_gate.sh int gens'
wsl.exe -e bash -lc 'bash ~/w7/notes/tools/p5e_gate.sh int one <regex>'
# 仓内门(Windows 侧 Git Bash 也能跑,与 WSL 等价)
python3 scripts/gen_pipe.py --check && python3 scripts/gen_pipe.py --self-test
python3 scripts/gen_pipe_field_ownership.py --check && python3 scripts/gen_pipe_field_ownership.py --self-test
python3 scripts/gen_pipe_dirty_surface.py --check && python3 scripts/gen_pipe_dirty_surface.py --self-test
python3 scripts/check_include_closure.py
python3 scripts/check_doc_citations.py --rev HEAD --strict docs/Disaggregated/*.md MobileGL/MG_Remote/CONTRACT-P5*.md
bash scripts/ci/split_negative_controls.sh # 需要 build-split 与 bin 目录环境,一般在 WSL 跑
```
+408
View File
@@ -0,0 +1,408 @@
# f0 普查 · §2.1 BARRIER_PULLED 15 字段逐字段载体判定
> 基线:`feat/disaggregated @ 8b68b92c`(代码头 25fba0d5 之后的提交只动文档)。行号均以该 HEAD 为准。
> 范围:`MobileGL/MG_Pipe/FieldOwnership.def` 的 21 行 / 15 个 BARRIER_PULLED 字段,逐字段回答
> (a) 存储形态 (b) 后端读者与 verb (c) 现有记录载体 (d) P5f 处置 (e) 依赖 / 工作量 / 包归属。
> 只读普查:本文件是唯一产物,未改任何代码、未构建、未跑测试。
> 姊妹篇:`f0-magma.md`(Magma 侧逐站点清单,本报告与之交叉引用而不重复)、`f0-reverse-channel.md`。
## 0. 总判断
1. **15 个字段全部涉及 client 地址空间,无一例外**。9 个非 sticky 行的存储全部是前端堆引用——
4 个 `SharedPtr`(`m_boundVertexArray` / `m_programForDraw` / `m_programForDispatch` /
`m_transformFeedbackProgram`,PipeInputs.h:807、:812-814)+ 5 个裸指针基址/槽
(`m_bufferBindingSlot[15]` :808、`m_bufferBindingPointBase[15]` :809、`m_framebufferBindingSlot[2]`
:810、`m_imageTextureBindingBase` :811、`m_textureUnitBase` :815);6 个 sticky forward 里
3 个直接交出前端对象或写前端(GetProgramObject / GetTextureObject / RecordError),
3 个是值类查找(GetBufferBindingPointCount / HasOpenTransformFeedbackSpan / ValidateProgramName)。
21 行 = 15 字段行 + 6 行 forward 行(FieldOwnership.def:53-165 与 :178-192)。
2. **P5e 的教训("数据已在线上,读者没跟上")在 15 个里命中 11 个**。已有记录供给或线上已带等价
句柄的:GetBoundVertexArray(`bind_vertex_elements`→`BoundVertexElements`)、GetBufferBindingPoint
(`set_shader_buffers`→`BoundShaderBuffers`,**XFB 目标除外**)、GetFramebufferBindingSlot
(`set_framebuffer_state`→`BoundFramebuffer`)、GetImageTextureBinding(`set_shader_images`)、
GetProgramForDraw / GetProgramForDispatch(`set_draw_program` / `set_dispatch_program`→
`DrawProgram` / `DispatchProgram`)、GetTextureUnitObject(`set_sampler_views`→`BoundSamplerViews`)、
GetTextureObject(`MGPCopyRegion.Src/Dst` 句柄就在 GL 名旁边,MGPipeTypes.h:1468-1476)、
GetProgramObject + ValidateProgramName(`MGPStorageBlockBinding.ShaderCso` 就在 GlName 旁边,
MGPipeTypes.h:1791-1792)、RecordError(`kEventGlError` 已接线,PipeFill.cpp:2166-2178)。
**需要扩记录或新载体的只有 4 个**:GetTransformFeedbackProgram(`begin_stream_output` 只带
PrimitiveMode,CONTRACT-P5B.md:215)、GetBufferBindingSlot 的 7 个无载体 target
(Coverage.def:47-57)、HasOpenTransformFeedbackSpan(需 applier 自推)、GetBufferBindingPointCount
(需 applier 自推或 constexpr 表)。
3. **包归属有一个真实的缺口**:计划 §5 的 fm 字面只覆盖"Magma 的 9 个字段",而 15 个里
GetBufferBindingPointCount / HasOpenTransformFeedbackSpan / GetProgramObject / ValidateProgramName /
RecordError / GetBufferBindingSlot 六个不在其字面范围;fm 9 字段的 **Espryt 残余**(strict 车道
活着的 8 对非 escalation 标记里的 6 对,见 §2 各字段)也无家。建议 fm 改写为"对象类字段
(双后端)",或新增一个字段包;RecordError 归 fv 是计划 §2.6 文本直接支持的唯一年配。
4. **顺序约束(ID-112 的绊线仍然有效)**:`PipeFill.cpp:2789-2809` 的两个 `static_assert`
(`NoPointerBackedRowIsWhollySupplied` 等)把 7 个指针残余行钉在"仍被拉"状态;退役任一行的
`EmittedCallSuppliesTheWholeField` FALSE 臂(PipeFill.cpp:2582-2602)必须与**该字段最后一批
后端读者的迁移同提交落地**,否则 Magma 第一帧 draw 就解引用空镜像——注释 :2773-2781 明说
"This residual fill is MAGMA'S ONLY SOURCE"。这不是建议,是构建期强制。
5. **strict 车道活标记 10 对与字段的映射**(strict-expected-markers.txt:34-52):8 对表驱动
(disjunct 1/2)+ 2 对仅 escalation(disjunct 3)。出口门要求该文件清空,而
`GetBoundVertexArray@DrawArrays` / `GetBufferBindingPoint@DrawArrays` 两对的退役题材是 P8 的
client vertex arrays(P5F 计划 §2.1 自注),**P8 不在 P5f 的六个包里**——要么 P5f 把这两对的
载体(client VA staging)拉进来,要么出口门 2 需要为 escalation 对留一个具名豁免。这是
计划文本内部的张力,f0 只记账不裁决。
## 1. 方法与口径
- **三重证据**:(i) `MG_IntegrationTest/Harness/strict-expected-markers.txt` 的 10 对活标记
(车道实测,含 admitted 判据);(ii) `rsp` 计数路径——非 sticky 读经 `MGP_INPUT_CHECK` →
`MGPipeInputUnfreshRead` → `CountBarrierPull`(PipeInputs.cpp:344),sticky forward 经
`MGPipeStickyForwardPull`(PipeInputs.cpp:372-378,七个本体在 PipeFill.cpp:2119-2186 各自
第一行调 `MGP_STICKY_FORWARD_PULL`);(iii) 全树 grep `MGB_CTX-><Field>` / sink 侧
`gPipeInputs.<Field>`。
- **推导规则**(scripts/gen_pipe_field_ownership.py):RECORD_SUPPLIED 是推导值 =
Coverage.def 的 `MGP_COVERAGE_EMITTED_LIST`(48 行,Coverage.def:256-304)减去
`EmittedCallSuppliesTheWholeField` 的 8 个拒绝(PipeFill.cpp:2582-2602,解析见
gen 脚本 `parse_supplies_whole_field` :157-175;self-test 钉住"恰为 8 个",:972-974)。
BARRIER_PULLED 手维护且每行必须有退役相(gen 脚本 :460-462 无相即构建失败)。
admitted 表是 ID-116 推导:BARRIER_PULLED ∧ 在 verb 类 may-read 罩内 ∧(verb 的 op 静态设障
∨ 退役相不含本阶段)(gen 脚本 `build_admitted` :312-375),再加运行时的 disjunct 3
(escalation,PipeInputs.cpp:170-174 起)。
- **"今天为何能工作"的公共答案**(下文各字段只写增量):inproc 下两角色共享一份
`gPipeInputs`(PipeInputs.h:835),client 的第 4 步残余填充(PipeFill.cpp:3712-3762,
:3759 的 `CopyField`)写入、server 在同一块上读,verb barrier 保证同一时刻只有一个写者
(PipeInputs.h:902-908 的裁定)。strict 下这类读要么具名 admitted 要么 Fatal。
- **行号漂移记录**(内容判断不受影响,但引用者须知):FieldOwnership.def:68-71 引的
`PipeFill.cpp:1902-1905` 对应现为 `CopyField` 的 GetBoundVertexArray 臂 :128-130;
FieldOwnership.def:82-84 引的 `SyncCurrentFBO (:2995)` 现为 DirectGLES.cpp:4465,
`BindCurrentFBO (:4303-4353)` 现为 :5860 起;计划 §1.1 引的 PipeFill.cpp:245/:274 现为
:244-245/:272-274,:2591-2592 现为 :2591-2597(均只差一两行)。P5F 计划 §2.2 引的
T5 站点 `VulkanRenderer.cpp:1562-1590` 据 f0-magma.md §2 已漂移到 :1590-1637。
## 2. 逐字段判定
### 2.1 GetBoundVertexArray
- **(a) 形态**:`SharedPtr<VertexArrayObject> m_boundVertexArray`(PipeInputs.h:807;
accessor :597-601)。O 类,`ReleaseObjectPins` 四行之一(PipeFill.cpp:95-100)。
- **(b) 读者**:Espryt 普通 draw 已走记录——`fromRecords` 三元 DirectGLES.cpp:2275、:2442、
:6185,`VertexInputReadsRecords()` 门 :2195;**残余读点**全在 escalation 路径:
`SyncClientSideVertexArraysForDrawArrays` :2207/:2213(client VA,P8)、:8539、
MultiDraw.cpp:223。Magma 6 站:DirectVulkan.cpp:805、:929,VulkanRenderer.cpp:6446、:6852、
:12550、:12651(逐站分析见 f0-magma.md §4.1;:805 的 LINE_LOOP 臂还叠加
`buffer-legacy-arm` Fatal)。**strict 标记**:`GetBoundVertexArray@DrawArrays`
(markers:51,仅 disjunct 3 escalation;普通 draw 对已在 P5e mv 退役,markers 头注 :29-30
与 ROADMAP P5e 行 item 5 的 red-once 证明:"倒掉 mv 的臂得 GetBoundVertexArray@DrawArrays")。
- **(c) 载体**:`bind_vertex_elements` → applier `BoundVertexElements`(PipeApply.h:662;
写入 PipeApply.cpp:2348)+ `VertexElementsCsos` 记录表。Espryt 读者已跟上;Magma 的
fast-path 句柄臂存在但句柄仍由前端对象推出(f0-magma.md §4.1,VulkanRenderer.cpp:6452-6458)。
- **(d) 处置**:Magma 六站改读 `BoundVertexElements` → 升 RECORD_SUPPLIED(Coverage.def:36、
:262 的 emitted 行早已在;删 PipeFill.cpp:2585 的 FALSE 臂,与 ID-112 绊线同提交)。
Espryt 残余的 client-VA 对是 P8 题材——见 §0.5 的门张力。
- **(e)** 依赖:Magma vertex-input 句柄化(与 fm 的 GetBufferBindingPoint 同源)。
工作量:中。包:fm;escalation 对无包(缺口)。
### 2.2 GetBufferBindingPoint
- **(a) 形态**:裸指针基址 `BindingSlotRange1D<BufferObject>* m_bufferBindingPointBase[15]`
(PipeInputs.h:809;accessor :615-627,`base[index]` 即前端活槽 :624-626)。填充
PipeFill.cpp:141-147(只填 `BufferBindPointTargets`)。
- **(b) 读者**:Espryt 的记录臂已落——`SyncBufferBindingPointsByRecord` 读
`st.BoundShaderBuffers`(DirectGLES.cpp:670-713,:684)、`SyncAtomicCounterBuffers` 记录臂
:873-926、UBO 循环读 `BoundShaderBuffers[Uniform]`(:7295;CONTRACT-P5E.md:476)。
legacy 臂仍在:SyncBufferBindingPoints :724-761(:737)、:928-936(:935)。
**XFB 目标无载体**:SyncTransformFeedbackBindingPoints :796、StartPendingTransformFeedback
:1891(kXfbSpan 罩住这两个字段,FillPoints.def:315-316)。Magma 3 站:
UniformManager.cpp:1205、:2035,VulkanRenderer.cpp:11764(XFB)。**strict 标记**:
`GetBufferBindingPoint@DrawArrays`(markers:52,仅 disjunct 3)。该对的具体读点本普查
不能从静态证据唯一确定——候选是 XFB-span draw 的 :1891(escalation (i),open span)或
client-VA draw;计划 §2.1 把两对都记为 client-VA(P8)。双块演习会直接报名字,f0 不裁决。
- **(c) 载体**:`set_shader_buffers` → `BoundShaderBuffers[3][84]`(PipeApply.h:776-779;
写入 PipeApply.cpp:2918)。**XFB 目标明确不搭这条记录**(CONTRACT-P5E.md:770:
"XFB does NOT ride this state");`set_stream_output_targets` 今天"has no applier and no
producer"(CONTRACT-P5B.md:215)。
- **(d) 处置**:Magma 三站改读 `BoundShaderBuffers`;XFB 目标的载体是 `set_stream_output_targets`
的实体化(P9 题材,落入 P5f 范围)。之后删 PipeFill.cpp:2597 的 FALSE 臂、字段翻
RECORD_SUPPLIED(Coverage.def:71、:263 已在)。
- **(e)** 依赖:同 2.1 + XFB 记录实体化。工作量:中。包:fm + XFB 半无包(缺口)。
### 2.3 GetFramebufferBindingSlot
- **(a) 形态**:裸指针 `BindingSlot<FramebufferObject>* m_framebufferBindingSlot[2]`
(PipeInputs.h:810;accessor :628-637,空槽即 poison Fatal)。填充 PipeFill.cpp:190-195。
- **(b) 读者**:Espryt——记录臂 `SyncCurrentFBOByRecord`(DirectGLES.cpp:4479)+ 强制臂具名
abort `RefuseFramebufferBindingSlotRead`(:4490-4492,P5e fb);pre-handle 回落臂仍在
SyncCurrentFBO(:4465 起,:4507 的 `GetFramebufferBindingSlotChecked`,helper 在 :184-202),
直接站点 :3261、:3491、:4212、:4426、:4507、:5625、:5923、:6096、:8349、:10696-10697,
Managers.cpp:9903、:10299。FieldOwnership.def:82-84 的"8 Espryt + 13 Magma"与本次 grep
量级一致。**strict 标记**:`GetFramebufferBindingSlot@ReadPixels`(markers:40,disjunct 1——
`read_pixels` 是 kWaitReply);读点是 ReadPixels 内的 `FramebufferImpl::SyncCurrentFBO()`
(DirectGLES.cpp:14275)回落臂。Magma 13 站:UniformManager.cpp:560;VulkanRenderer.cpp:3158、
:5510、:5730、:6360、:6465、:6845、:7648、:8016、:9024-9025、:9660、:10371。
- **(c) 载体**:`set_framebuffer_state` → `BoundFramebuffer[2]` + `FramebufferRecords`
(PipeApply.h:714;写入 PipeApply.cpp:2558-2562),P5e fb 已给 Espryt 记录臂。
- **(d) 处置**:Espryt 的 ReadPixels 回落为何仍命中(记录臂 decline 的路径)需 f1 双块演习
定位——静态看 :4479 应先试记录臂,标记存活说明 ReadPixels 场景走了回落;Magma 13 站改读
`BoundFramebuffer`/`FramebufferRecordFor`(PipeApply.cpp:2609-2613)。之后删
PipeFill.cpp:2586 FALSE 臂、翻 RECORD_SUPPLIED(Coverage.def:84、:274 已在)。
- **(e)** 依赖:fm 的 FBO 记录消费是 Espryt 已铺好的路。工作量:中(Magma 站点多但形状单一)。
包:fm。
### 2.4 GetImageTextureBinding
- **(a) 形态**:裸指针 `ImageTextureBinding* m_imageTextureBindingBase`(PipeInputs.h:811;
两个 const 重载 :638-653,null 基址即 poison Fatal)。填充 PipeFill.cpp:196-199。
- **(b) 读者**:Espryt——pre-handle 形式 SyncImageTextureBinding :3842(注释 :3831-3837 自明
"what the pull build compiles and what a push-monolith build runs");transport 下已删的
MarkWritableImageBufferTexturesGpuWritten :3891(门 :3885-3887);Managers.cpp:11963(.Format)。
Magma 4 站:UniformManager.cpp:1021、:1312、:1867、:1955。**strict 标记:无**。
- **(c) 载体**:`set_shader_images` → `BoundShaderImages`(PipeApply.h:751;写入
PipeApply.cpp:2857);Espryt 的记录重载已在(DirectGLES.cpp:3810-3829,`ResolveShaderImageRecord`
+ `SyncTextureToBackendByHandle`)。`bind_shader_image` verb 记录的参数全景也在线上
(PipeApplier.cpp:889-900 的注释)。
- **(d) 处置**:Magma 四站改读 `BoundShaderImages`;Espryt 残余是 monolith 臂,不动。
删 PipeFill.cpp:2587 FALSE 臂、翻 RECORD_SUPPLIED(Coverage.def:85、:275 已在)。
- **(e)** 依赖:无超出 fm 的。工作量:小-中。包:fm。
### 2.5 GetProgramForDraw
- **(a) 形态**:`SharedPtr<ProgramObject> m_programForDraw`(PipeInputs.h:813;accessor
:659-663)。填充 PipeFill.cpp:244-245(计划 §1.1 的 :245 引文)。O 类 pin 四行之一。
- **(b) 读者**:Espryt——PrepareForDraw 的提升读 :6215(`programFromRecords` 三元;
:6132-6134 的注释记了这条提升本身的历史);记录臂:`GetCurrentBackendProgram` 读
`MGPipeApplier().DrawProgram`(:7659-7670),legacy 臂 :7672/:7744 只在
`ProgramHandleArm()==false` 时跑;:7029 同样带三元。Magma 3 站:VulkanRenderer.cpp:6384、
:6815、:6853。**strict 标记:无**——P5e pa 退役,markers 头注 :25-27 记了棘轮曾指名它消失,
ROADMAP P5e 行 item 5 的 red-once 即此对。
- **(c) 载体**:`set_draw_program` → `DrawProgram`(PipeApply.h:759)+ `bind_shader_state` →
`BoundShaderCso`(:761;写入 PipeApply.cpp:3208-3214);ShaderCso 记录带逐 link 的
ProgramArchive(ROADMAP P5e 行:"最大的那次迁移没有改动任何线上结构:记录早就带着逐 link
的 ProgramArchive,缺的是仍去问前端对象的读者"——本字段就是那句话的原主)。
- **(d) 处置**:Magma 三站改读记录即毕。删 PipeFill.cpp:2589 FALSE 臂、翻 RECORD_SUPPLIED
(Coverage.def:100、:289 已在)。
- **(e)** 依赖:无。工作量:小-中。包:fm。
### 2.6 GetProgramForDispatch
- **(a) 形态**:`SharedPtr<ProgramObject> m_programForDispatch`(PipeInputs.h:812;accessor
:654-658)。填充 PipeFill.cpp:241-243。O 类 pin 四行之一。
- **(b) 读者**:Espryt——PrepareForCompute :8142(记录三元)+ :8154-8157 的
`DispatchProgram` 句柄臂。Magma 2 站:VulkanRenderer.cpp:7424、:7476。**strict 标记:无**
(markers 头注 :28:pa 在它被写进表之前就退役了它)。
- **(c) 载体**:`set_dispatch_program` → `DispatchProgram`(PipeApply.h:760)。
- **(d) 处置**:与 2.5 同形。删 PipeFill.cpp:2590 FALSE 臂、翻 RECORD_SUPPLIED
(Coverage.def:99、:288 已在)。
- **(e)** 依赖:无。工作量:小。包:fm。
### 2.7 GetTextureUnitObject
- **(a) 形态**:裸指针 `TextureUnit* m_textureUnitBase`(PipeInputs.h:815;accessor :669-676,
null 基址即 poison Fatal——计划 §1.1 的 :669 引文)。填充 PipeFill.cpp:272-274(计划的 :274)。
- **(b) 读者**:FieldOwnership.def:89-90 记"13 Espryt + 8 Magma",与 grep 一致。Espryt 13 站:
DirectGLES.cpp:2679、:2707、:2742、:2755、:3451、:6425、:6754、:7535、:10760、:11771、
:11887、:12120、:14451。Magma 8 站:UniformManager.cpp:511、:787、:826、:852、:1679;
VulkanRenderer.cpp:9652、:11157、:11401。**strict 标记**:`GetTextureUnitObject@CopyTexImage2D`
(markers:43,disjunct 1——`copy_framebuffer_to_texture` 记为 verb CopyTexImage2D,
FieldOwnership.def:285)。读点值得点名:`UpdateTextureBindingAtTarget` 的
`MGB_CTX->GetTextureUnitObject(unit)`(DirectGLES.cpp:10760)**在 transport 分流检查
(:10769-10774 的 `VerbCopyTexDst` 句柄臂)之前无条件执行**——句柄臂已经在了,读却先发生;
这正是"数据已在线上,读者顺序没跟上"的最小样本,也是双块演习下第一批会红的站点之一。
- **(c) 载体**:`set_sampler_views` → `BoundSamplerViews`(PipeApply.h:741;写入
PipeApply.cpp:2828)+ `BoundSamplerStates`(:746)。
- **(d) 处置**:Espryt 13 站 + Magma 8 站逐个改读记录(:10760 这类"读在分流前"的站点要
把读取移进各自臂内)。删 PipeFill.cpp:2588 FALSE 臂、翻 RECORD_SUPPLIED(Coverage.def:115、
:295 已在)。
- **(e)** 依赖:无超出 fm 的;站点数量是 fm 里最大的一批。工作量:中-大。包:fm。
### 2.8 GetTextureObject
- **(a) 形态**:sticky forward,无存储;按 GL 名返回 `const SharedPtr<ITextureObject>&`
(PipeInputs.h:691;本体 PipeFill.cpp:2131-2135,null context 时返回 `NullShared`)。
- **(b) 读者**:Espryt 后端本体**无站点**(DirectGLES 全树 grep 无 `MGB_CTX->GetTextureObject`);
读者在 **server sink**:`ServerVerbSink::OnResourceCopyRegion` 用 GL 名重建两端点
(PipeApplier.cpp:853-859,注释明说"`rsp` counts every one of these and P7 is what retires
them")。Magma:VkTextureManager.cpp:810。**strict 标记**:`GetTextureObject@CopyImageSubData`
(markers:42,disjunct 2 退役相 P7;gen 脚本 self-test :998-999 与 :1039-1041 钉住它同时被
disjunct 1/2 覆盖)。
- **(c) 载体**:`MGPCopyRegion.Src/Dst` 句柄与 GL 名**并排在线**(MGPipeTypes.h:1468-1476;
注释 :1455-1464 自明"A GL name is NEVER an identity; it is the lookup key of a pull the
handle beside it will replace")。
- **(d) 处置**:sink 改按 `Src/Dst` 句柄经 server 纹理 twin 表解析(FieldOwnership.def:183-184
的 forward 机制"a server-side texture handle table"),forward 删除、字段行出表。
Magma 的 :810 同批。无法升 RECORD_SUPPLIED——sticky forward 没有存储可供"供给",退役形态
是 accessor 死亡(仿 InvalidateCompileEnv 的 P5c ev 处置,FieldOwnership.def:157-163:
字段行改 FATAL + forward 删除)。
- **(e)** 依赖:server 端纹理句柄表(fm 的公共底座,与 2.7 共用)。工作量:小-中。
包:fm 边缘——读者在"后端无关的 sink"而非 Magma 本体,fm 的字面范围需要为此扩写(§0.3)。
### 2.9 GetBufferBindingPointCount
- **(a) 形态**:sticky forward,值类 `SizeT`,按 target 查前端绑定点的**容量**(不是绑定状态)。
Coverage.def:145 的 sticky 理由原文:"keyed by target: a constexpr capacity table, not verb
state"。本体 PipeFill.cpp:2119-2123。
- **(b) 读者**:Espryt 1 站:SyncAtomicCounterBuffers 的 legacy 臂 :928——它的记录臂
(:873-877)已改读 applier 窗口,注释 :871-872 自明"the bound is the applier's window
instead of GetBufferBindingPointCount's sticky forward, which is the row this site was the
Espryt reader of"(即 Espryt 侧读者已退役,legacy 臂只在非记录配置跑)。Magma 2 站:
UniformManager.cpp:1200、:2030。**strict 标记:无**。
- **(c) 载体**:`set_shader_buffers` 的窗口(`ShaderBufferStart/Count`,PipeApply.h:778-779)
回答"用到哪";容量本身是常量(线上 84,`kMGPipeMaxBufferBindingPoints`;CONTRACT-P5E.md:650)。
- **(d) 处置**:升 **APPLIER_DERIVED**——applier 从 `BoundShaderBuffers` 窗口/容量表回答,
读者改读之(FieldOwnership.def:179-180 的 forward 机制就是"a server-side binding-point
table")。注意它与 2.2 同源:Magma 的 UniformManager 两站把 count 与 point 成对读
(:1200/:1205、:2030/:2035),应同批迁移。
- **(e)** 依赖:同 2.2。工作量:小。包:fm(字面外,缺口)。退役相标 P7/P13——P13 的半边
(transfer target 的容量)本普查未见读者,未见不等于没有,标**未知**。
### 2.10 HasOpenTransformFeedbackSpan
- **(a) 形态**:sticky forward,值类 `Bool`,按 lifetime id 查前端 XFB span 开闭
(PipeInputs.h:692;本体 PipeFill.cpp:2137-2141;前端实现 Core.cpp:1299)。
- **(b) 读者**:仅 Magma 1 站:VulkanRenderer.cpp:11684(`m_xfbCounterSlotOwner` 的归并检查)。
Espryt 无后端读者。**strict 标记:无**。
- **(c) 载体**:无现成字段级载体,但 applier 已具备自推的全部输入:`begin/end/pause/resume
_stream_output` 四个 verb 记录(FieldOwnership.def:267-270 的 stamp 行)+ `bind_stream_output`
(带 `LifetimeId`,MGPipeTypes.h:1773-1778)+ 已有的 `MGPipeApplierState::IsTransformFeedbackActive`
镜像(PipeApply.h:805,P5e §2.1 escalation (i) 的两侧同值论证是先例)。注意
CONTRACT-P5B.md:215 记 `begin_stream_output` 的 sink 今天是 stub——自推依赖 t2 sink 实体化。
- **(d) 处置**:升 **APPLIER_DERIVED**(FieldOwnership.def:185-186 的机制"server-side XFB span
state"):applier 从 stream-output 记录序列维护 per-lifetime-id 的 span 开闭集。
- **(e)** 依赖:t2 sink 实体化(P9 题材的边缘)。工作量:小-中。包:无明确归属(缺口;
读者在 Magma,可挂 fm)。
### 2.11 GetTransformFeedbackProgram
- **(a) 形态**:`SharedPtr<ProgramObject> m_transformFeedbackProgram`(PipeInputs.h:814;
accessor :664-668)。填充 PipeFill.cpp:285-287。O 类 pin 四行之一。
- **(b) 读者**:Espryt 1 站:StartPendingTransformFeedback(DirectGLES.cpp:1871,PrepareForDraw
尾部,kDraw 罩住——FieldOwnership.def:102-105 的"XFB itself is off the reduced path, but
kDraw's may-read mask carries it"即此);同一函数 :1891 还读 GetBufferBindingPoint(2.2 的
XFB 半)。Magma 2 站:VulkanRenderer.cpp:11725、:11824。**strict 标记**:
`GetTransformFeedbackProgram@DrawArrays`(markers:44;gen 脚本 self-test :996-997 钉住它由
disjunct 2 承载,CONTRACT-P5E §5.7 把 XFB 整体划出 P5e)。
- **(c) 载体**:**今天没有**。`begin_stream_output` 只带 `PrimitiveMode`(CONTRACT-P5B.md:215
原文,且同文明说 capture program 靠的就是 kXfbSpan/kDraw 的 BARRIER-PULLED 读);
`set_stream_output_targets` 无 producer 无 applier。这是 15 个里"线上没数据"的代表。
- **(d) 处置**:升 RECORD_SUPPLIED 需要先造数据:给 `begin_stream_output` 增加 capture
program 的 ShaderCso handle(或实体化 `set_stream_output_targets` 并让它带上),两端读者
(Espryt :1871、Magma 两站)改读 applier 状态。**不能降 FATAL**:kDraw 罩内有活读者,
缩减路径(OpenRA 的 XFB 用例)会读。
- **(e)** 依赖:记录 schema 扩展(线上行,须与 gen 管线同步)+ 双后端读者。工作量:中。
包:fm(Magma 半);Espryt 半的退役相标的是 P3b/P4b(与 fr 的 registry 重键同源不同事,
归属需在 §5 定包时裁决)。
### 2.12 GetProgramObject
- **(a) 形态**:sticky forward,按 GL 名返回 `const SharedPtr<ProgramObject>&`
(PipeInputs.h:690;本体 PipeFill.cpp:2125-2129)。
- **(b) 读者**:Espryt 2 站,成对出现在 ValidateProgramName 之后:GetBackendProgramId :8204
(+:8199)、ShaderStorageBlockBinding :12600(+:12599;:12603-12606 还背着 G6 的
`MGPipeFrontendKeyedRegistryScope`)。Magma 1 站:DirectVulkan.cpp:278(+:275)。
sink 侧注释 PipeApplier.cpp:921-923 自明"Both backends resolve the PROGRAM through the
barrier-pulled GetProgramObject(GlName) … retired by P9"。**strict 标记**:
`GetProgramObject@ShaderStorageBlockBinding`(markers:41;`SetStorageBlockBinding` 是
kWaitApplied,PipeCalls.def:297,disjunct 1/2 皆覆盖)。
- **(c) 载体**:`MGPStorageBlockBinding.ShaderCso` 已在记录里(MGPipeTypes.h:1791-1792:
"the identity, and what P7 dispatches on"),名字 blob 走 SEG_STAGE。数据已在线上。
- **(d) 处置**:两端 backend 的 `ShaderStorageBlockBinding` slot 改按 ShaderCso 句柄解析
(esp. Espryt :12597-12620 的"只推给已建成 program"优化路径,其 frontend-keyed `Find` 一并
随 fr 的 registry 重键消失);forward 删除,字段行参照 2.8 的 ev 形态出表。无法升
RECORD_SUPPLIED(无存储),处置形态是 accessor 死亡。
- **(e)** 依赖:fr 的 program registry 句柄化(:12603 的 scope 是 P5c G6 债,两包有交集)。
工作量:小-中。包:无明确归属(缺口;可挂 fm 或并入 fr 的 program 半边)。
### 2.13 ValidateProgramName
- **(a) 形态**:sticky forward,值类 `Bool`,前端名表探测(PipeInputs.h:694;本体
PipeFill.cpp:2158-2162;Coverage.def:127 记 kClientResolved——"the server is never asked"
是设计答案,今天的实现恰恰相反)。
- **(b) 读者**:与 GetProgramObject 完全同点成对(2.12 的四处;另 DirectGLES.cpp:8199)。
**strict 标记**:`ValidateProgramName@ShaderStorageBlockBinding`(markers:45)。
- **(c) 载体**:不需要载体——发射端 client 在发 `set_storage_block_binding` 时名字必然已过
前端 validator;server 按 ShaderCso 解析到记录即隐含合法(与 2.12 是同一笔迁移)。
- **(d) 处置**:随 2.12 一起退役;字段行出表(机制"a client-resolved program name probe",
FieldOwnership.def:187-188)。
- **(e)** 依赖:同 2.12。工作量:小(与 2.12 同提交)。包:同 2.12。
### 2.14 RecordError
- **(a) 形态**:sticky forward,**写前端**(错误队列)(PipeInputs.h:695-697;本体
PipeFill.cpp:2164-2186)。15 个里唯一的写方向。
- **(b) 读者(写者)**:Espryt:Managers.cpp:14858、DirectGLES.cpp:11124(另有
Managers.cpp:14949-14951 自明"NO RecordError HERE"的反向先例)。Magma:DirectVulkan.cpp:735、
VulkanRenderer.cpp:1367、:1371、:1427。**strict 标记:无**(车道不制造 GL 错误)。
**rsp 口径注意**:`MGPipeStickyForwardPull(RecordError)` 在分流**之前**(PipeFill.cpp:2165),
所以即使 transport 臂根本不碰前端(:2166-2178 直接 `PostGlError` 后 return),server-stamped
verb 内的每次调用仍被记一次 pull——这是机制的保守,不是残余的债。
- **(c) 载体**:**已存在且已接线**:P5c ev 把 transport 臂改成了 `kEventGlError` 事件
(CONTRACT-P5C §4.2;`ServerSessionInstance().PostGlError`,PipeFill.cpp:2174-2177),
错误消息经 `info->toString()` 过线。剩在 P9 的只是**有序化**(:2170-2173 的注释:
"preserves per-thread program order of error-then-read but not cross-verb interleaving")。
- **(d) 处置**:这是 15 个里唯一"载体已通、剩记账口径"的字段。建议仿 InvalidateCompileEnv 的
P5c ev 处置(FieldOwnership.def:157-163 的先例与 :160-161 的"FieldOwnership 只描述 split
server 的读"论证):把 `MGP_STICKY_FORWARD_PULL` 移到分流之后(或 transport 臂豁免计数),
字段行降 FATAL——论据是"transport 下分流臂已是完整答案,server 侧再落到 monolith 臂即真
缺陷"。需先逐写者核 `OnGlError` 覆盖(消息保真已由 :2174 保证,有序化仍是 P9 的)。
若 f1 双块演习显示monolith 臂在 split 下仍被合法触达,则退而维持 BARRIER_PULLED 到 P9——
双块的红就是判据。
- **(e)** 依赖:fv 的反向通道有序化口径(P9 的边界划分)。工作量:小。包:**fv**——计划
§2.6 明列"OnGlError 有序化",其中触碰 client 内存的部分归 P5f,而本字段 transport 下已不
触碰,剩余正好是有序化与计数口径。
### 2.15 GetBufferBindingSlot
- **(a) 形态**:裸指针 `BindingSlot<BufferObject>* m_bufferBindingSlot[15]`(PipeInputs.h:808;
accessor :605-614,空槽/越界即 poison Fatal)。填充 PipeFill.cpp:131-140——只填
`GlobalBufferTargets`,**Index 恒 null**(:132-136 的注释:GLContext 经绑定 VAO 的
element-buffer 槽推导,"a derivation no FillPoints.def row can copy")。
- **(b) 读者**:按 target 分片(Coverage.def:37-70 的权威拆分:8 个 target 有记录载体,7 个
没有——CopyRead/CopyWrite/PixelPack/PixelUnpack/Texture/DispatchIndirect/Query)。
Espryt:PixelPack 读回 6 站(DirectGLES.cpp:12809、:13791、:14028、:14338、:14769,
Utils.cpp:2353);DrawIndirect/Parameter 族 :440、:976、:1422、:8921、:8999-9000、:9078、
:9151-9152、:9332、:9381,MultiDraw.cpp:308。Magma:DirectVulkan.cpp:283、:407、:470、:538、
:591;VulkanRenderer.cpp:7520(DispatchIndirect)、:11126、:12560-12561、:12661-12662、:12731。
**strict 标记两对**:`GetBufferBindingSlot@ReadPixels`(markers:34,disjunct 1——读点是
ReadPixels 的 PBO 槽 :14337-14338 一带)与 `GetBufferBindingSlot@DrawArrays`(markers:36-39,
wave-3 新:multi-draw 五档被强制后 indirect 档浮出,注释 :35-38 记了它"was named before it
could fire")。
- **(c) 载体**:`set_indirect_buffers` 只带 DrawIndirect+Parameter 对(Coverage.def:44-45,
MGPIndirectBuffers 的自明范围);`resource_readback`(MGPReadback)带目标 buffer 句柄
(MGPipeTypes.h:1439-1443)但 PixelPack 槽的读在 verb 内、不在记录解析点。PixelPack 等
7 target **无任何 call**(Coverage.def:47-57 逐 target 点名)。
- **(d) 处置**:本字段不能一次翻类,只能按 target 渐进——而字段按 Coverage.def:61-69 的裁定
必须保持一行,所以 P5f 的工具是 **`MGP_FIELD_OWNERSHIP_ARG_LIST` 的按参数例外行**
(GetPixelStoreParameters,1 已是先例,FieldOwnership.def:214-216):有载体的 target 逐批窄出
BARRIER_PULLED,Query target 两端都无读者(Coverage.def:56-57)可率先窄为 FATAL,
DispatchIndirect(Coverage.def:50-55 点名"两端都读且无 call")需要扩 `set_indirect_buffers`
或新记录(P13 题材),PixelPack 随 readback 记录改造(P9 题材)。全部窄完后字段行出表。
- **(e)** 依赖:readback 记录化(P9)+ indirect 扩 target(P8/P13)——**三个退役相分属三个
后续阶段,是 15 个里唯一需要 P5f 主动把外阶段题材拉进来的字段**。工作量:大
(15 target × 双后端 × 三类载体)。包:无归属(缺口最大的一行)。
## 3. 包归属汇总与缺口
| 字段 | 处置方向 | 载体状态 | 包(计划 §5 字面) | 建议包 |
|---|---|---|---|---|
| GetBoundVertexArray | 升 RECORD_SUPPLIED | bind_vertex_elements 已在 | fm(Magma 半);escalation 对无包 | fm + P8 议题 |
| GetBufferBindingPoint | 升 RECORD_SUPPLIED | set_shader_buffers 已在(XFB 除外) | fm;XFB 半无包 | fm |
| GetFramebufferBindingSlot | 升 RECORD_SUPPLIED | set_framebuffer_state 已在 | fm | fm |
| GetImageTextureBinding | 升 RECORD_SUPPLIED | set_shader_images 已在 | fm | fm |
| GetProgramForDraw | 升 RECORD_SUPPLIED | set_draw_program 已在 | fm | fm |
| GetProgramForDispatch | 升 RECORD_SUPPLIED | set_dispatch_program 已在 | fm | fm |
| GetTextureUnitObject | 升 RECORD_SUPPLIED | set_sampler_views 已在 | fm | fm |
| GetTextureObject | accessor 死亡(FATAL 形态) | MGPCopyRegion 句柄已在 | fm 边缘(读者在 sink) | fm |
| GetBufferBindingPointCount | 升 APPLIER_DERIVED | applier 窗口可推 | 无 | fm |
| HasOpenTransformFeedbackSpan | 升 APPLIER_DERIVED | 需 applier 自推(依赖 t2 sink) | 无 | fm 或 P9 边界 |
| GetTransformFeedbackProgram | 升 RECORD_SUPPLIED(**须先造数据**) | 无——begin_stream_output 需扩 | fm(Magma 半);Espryt 半标 P3b/P4b | fm + fr 裁决 |
| GetProgramObject | accessor 死亡 | MGPStorageBlockBinding.ShaderCso 已在 | 无 | fm 或 fr |
| ValidateProgramName | accessor 死亡 | 随 2.12,无需载体 | 无 | 同 2.12 |
| RecordError | 降 FATAL(计数口径修正后) | kEventGlError 已接线 | fv(唯一字面匹配的) | fv |
| GetBufferBindingSlot | 按 target 渐进(ARG 例外行) | 8/15 有载体,7/15 无 | 无(P8/P9/P13 混合) | 缺口最大 |
**三个给 §5 定包的输入**:
1. fm 的字面"Magma 的 9 个字段"应扩写为"对象类字段的双后端退役"——否则 6 个字段无家可归,
且 fm 内部还混着 sink 侧读者(GetTextureObject)与 Espryt 残余读者(GetTextureUnitObject@
CopyTexImage2D、GetFramebufferBindingSlot@ReadPixels、GetTransformFeedbackProgram@DrawArrays)。
2. 两个 escalation 对(client VA,P8 题材)与 GetBufferBindingSlot 的 P8/P9/P13 混合退役,
是出口门 2(markers 清空)与范围表 §3(不取 P8 staging)之间唯一的正面冲突,需要计划
层面裁决:拉进来,或为 escalation 对留具名豁免。
3. 顺序约束:7 个指针行的 `EmittedCallSuppliesTheWholeField` FALSE 臂删除(PipeFill.cpp
:2582-2602)与对应最后一批改者必须同提交,ID-112 的两个 `static_assert`
(PipeFill.cpp:2789-2809)是构建期强制执行者;`FieldOwnershipTest` 钉住非 sticky
BARRIER_PULLED 清单(FieldOwnership.def:66-67),gen 脚本 self-test 钉住拒绝集恰为 8
(scripts/gen_pipe_field_ownership.py:972-974)——每退役一行,这三处与
strict-expected-markers.txt 的同提交更新是机械义务。
+175
View File
@@ -0,0 +1,175 @@
# f0 普查 · §2.2 Magma(DirectVulkan)跨角色读写
> 基线:`feat/disaggregated @ 8b68b92c`(代码头 25fba0d5 之后的提交只动文档)。行号均以该 HEAD 为准。
> 范围:`MobileGL/MG_Backend/DirectVulkan/**` 一侧所有直接读前端对象 / 读 client 镜像 / 写 client 存储的站点。
> 只读普查:本文件是唯一产物,未改任何代码、未构建、未跑测试。
## 0. 总判断
1. **Magma 在 transport 下的 draw/dispatch 路径今天根本跑不通**,这不是推断而是守卫的直接后果:顶点/索引/UBO/SSBO/indirect 缓冲的同步都汇到 `VkBufferManager::AcquireResidentSlice` / `AcquireStreamedSlice`,两者第一动作就是 `bufferObject->SyncPersistentMappedRange()`(VkBufferManager.cpp:657、:708),而该方法在 transport + apply 线程下无条件 `Fatal{RoleViolation, "buffer-legacy-arm"}`(MG_State/GLState/BufferState/BufferObject.cpp:415-440,守卫条件 `PushIsArmed() && OnServerRole()`,PersistentMapTracker.cpp:526-535)。CI 侧与之一致:`integration-magma-split` 只有两条 `DirectVulkan.Split.NamedBlit.*`,且**预期红**(在 Clear 的 `GetFramebufferBindingSlot` 读处就 abort,MobileGL/MG_IntegrationTest/CMakeLists.txt:2411-2437,.github/workflows/test.yml:1353-1381)。所以"今天为何能工作"对本目录绝大多数站点的诚实回答是:**monolith / pull 臂下同线程直接成立;inproc split 下只有不设缓冲的 verb(Clear/Blit/GenerateMipmap 等)能走到,凡是 draw 带缓冲即具名 Fatal**。lockstep(Magma 永不发布 `kCapRunAheadApply`,CONTRACT-P5E.md:68、§6.1)保证每条记录设障,使未加守卫的 BARRIER_PULLED 读在非 strict 下作为 admitted pull 计数(`rsp`)而非 Fatal——但 guard 类站点不吃这一套,任何 strictness 下都 abort。
2. **T5 属实且已被 P5c tx 处理**:transport 下生成 mip 改写 server 的 staged shadow,不再写 client 的 level 存储;但留了两处具名残余(见 §2)。
3. **C1 四处 caps 读属实已改走 server backend**(见 §3)。
4. 对象类 BARRIER_PULLED 字段的 Magma 读点全部在 draw/dispatch/blit/readback/mipmap/XFB 路径上,逐字段清单见 §4。其中 8 行的退役标签是 "P5e (Espryt unbarriered), P7 (Magma)",第 9 个 `GetTextureObject` 标的是裸 "P7"(Espryt 半边已在 P5c tx 退役),合计 9 个 Magma 相关行——与任务书的"9 个"一致。
5. 除字段读外,Magma 还有三类结构性跨角色耦合:前端地址键控的 twin registry / memo(§5)、server 在 apply 线程上创建与销毁前端类型对象(§6)、以及对前端 BufferObject 的直接方法调用(§7)。
## 1. 术语与机制前提(本次普查用到的)
- `MGB_CTX` 在 push 构建下 = `&MG_Pipe::gPipeInputs`(MG_Pipe/PipeInputsSwitch.h:17-21);在 pull 构建下 = `MG_State::pGLContext`。Magma 全树的对象访问器读都经此宏。
- lockstep:Magma 臂的 `CallMask` 不含 `kCapRunAheadApply`,每条记录都设障,apply 时 client 停在 `WaitForApplied`。
- 双层守卫(均在 `MOBILEGL_BUILD_DISAGGREGATED` 下):`Fatal{RoleViolation, "MGPipeSlots"}`(MG_Impl/Pipe/SlotAllocator.cpp:32-70,挂在 Acquire/FindByLifetimeId/Free,:330/:317/:339);`Fatal{RoleViolation, "buffer-legacy-arm"}`(BufferObject.cpp:47-66,挂在 MappedData :992 / ShadowAllocationBytes :1002 / GetChangeSerial :1025 / HasDefinedContent :1034 / IsMapped :1049,以及 SyncPersistentMappedRange :434-437);`Fatal{RoleViolation, "texture-legacy-arm"}`(MipmapStorage.cpp:30-60,被 `MGPipeTextureLegacyArmScope` 豁免)。
- Magma 的具名豁免 scope:`MagmaP7AllocatorDebtScope`(MG_Impl/Pipe/SlotAllocator.h:223-248,P5e ruling 12 改名后专指 Magma 的四笔 apply 线程分配器债,且按后端种类 keyed——Espryt 借用即 Fatal,SlotAllocator.cpp:47-55)。
## 2. T5(P5c 审计行,ROADMAP.md:57)核验:属实,已迁移,但有残余
**原状**(ROADMAP 记的行号已漂移):`EnsureGenerateMipmapStorageAllocated` 现在位于 `Renderer/VulkanRenderer.cpp:1590-1637`(非 :1562-1590),其中 `texture.AllocateStorage(...)` :1632、`texture.MarkStorageDirty(...)` :1633 直接写前端 `TextureObjectMipmap` 的 level 存储。调用点在 `GenerateMipmap`(def :11378,非 :11317)。
**现状(P5c tx 已落地)**:`GenerateMipmap` 在 transport 下改走 `EnsureGenerateMipmapShadowAllocated`(:1655-1682),把生成的链定义在 server 的 `StagedTextureStore` 上、以 twin 地址为键(`KeyForTwinAddress`,:1670);monolith 臂保持原样(:11464-11474 的三元)。**跨进程:成立。**
**残余两处,均已被代码注释自认**:
- 形状读:`EnsureGenerateMipmapShadowAllocated(*resource, baseMipLevel, texture->GetUploadTargets())`(:11470)——upload-target 列表仍读前端对象。注释 :1653-1654 明说:"The upload-target list still comes from the frontend object - a shape READ, the P7 registry's residual"。
- `GenerateMipmap` 头部仍经 `MGB_CTX->GetTextureUnitObject(...)`(:11401,BARRIER_PULLED)取得前端纹理,并把它传给 `m_textureManager->NeedsMipChainGrowth(*texture)`(:11420)与 `SyncTextureAndGetDescriptor(*texture)`(:11442、:11477)——后者进入 §5.1 的前端地址键控同步,读 client mip shadow(见 §5.2 的 texture-legacy-arm)。
**P5f 处置建议**:T5 本体无需再做;残余随 §4 的 `GetTextureUnitObject` / §5.1 的纹理 twin 迁移一起消失(upload-target 列表可随纹理描述符/记录供给)。
## 3. C1(ROADMAP.md:67)核验:四处全部属实,已改走 server backend
四处均在 `MG_Config::Transport != Monolith` 时读 `MG_Remote::Server::ServerLoopInstance().Backend()->GetDynamicParameters()`(server 自己的 backend),monolith 臂保持 `pActiveBackendObject`:
| # | 站点(当前 HEAD) | 函数 |
|---|---|---|
| 1 | `DirectVulkan.cpp:714-733`(split 臂 :723-728) | `ShaderStorageBlockBinding`,`MaxShaderStorageBufferBindings` 越界检查 |
| 2 | `Renderer/VulkanRenderer.cpp:676-712`(split 臂 :682-693) | `ApplyLineWidthState`,aliased line-width clamp |
| 3 | `Renderer/VertexInputStateFactory.cpp:252-264` | `narrowFloat64Arrays` 判定(`SupportsFloat64VertexAttributes`) |
| 4 | `Renderer/VertexInputStateFactory.cpp:515-527` | `ToVkVertexFormat` 的 Long 臂同一 flag 判定 |
(ROADMAP 记的 :713-715 / :667-676 / :249-250 / :502-503 均略有漂移,指向相同代码。)`DirectVulkan.cpp:20` 起的 `#if MOBILEGL_BUILD_DISAGGREGATED` include 即为此。**跨进程:成立**(server 读自己的 backend 对象)。Espryt 回落臂(`DirectGLES/Utils.cpp:50`)不在本普查范围。
## 4. 九个 "P7 (Magma)" BARRIER_PULLED 字段的 Magma 读点
字段归属以 `MG_Pipe/FieldOwnership.def:53-107`(非 sticky 行)与 :178-192(sticky forward 行)为准。"draw 路径"= 经 `SetupDraw`(:6801) / `TrySetupDrawFastPath`(:6375) / `GetOrCreatePipeline`(:5250) 到达;"dispatch 路径"= 经 `DispatchCompute`(:7419) / `DispatchComputeIndirect`(:7472) 到达。
### 4.1 `GetBoundVertexArray` — 6 站,全部在 draw 路径
- `DirectVulkan.cpp:805`(`BuildClosedLineLoopIndices`,LINE_LOOP 重写):读出 VAO 的索引缓冲绑定后 **`indexBufferShared->SyncPersistentMappedRange()` + `MappedData()`**(:814-815)——后者在 transport 下是 `Fatal{buffer-legacy-arm}`。即 Magma 的 LINE_LOOP indexed draw 在 split 下今天是具名 Fatal,不是静默错。
- `DirectVulkan.cpp:929`(`MultiDrawElementsImpl` :913):只读 EBO 绑定存在性以决定逐条回放。
- `VulkanRenderer.cpp:6446`(`TrySetupDrawFastPath`)、`:6852`(`SetupDraw`):每次 draw 的对象读;fast path 还有 handle 臂(`ResolveVaoHandle`,:6452-6458,`MagmaPipeTrackHArmIsHandles`),但 handle 由 `vao.GetLifetimeId()` 推出——仍以前端对象为源。
- `VulkanRenderer.cpp:12550`(`MultiDrawElementsIndirectCount` :12528)、`:12651`(`MultiDrawElementsIndirect` :12629)。
**今天为何能工作**:同地址空间 + 每条记录设障;值是 client 残余填充的 `SharedPtr<VertexArrayObject>`(PipeFill.cpp:1902-1905 一带,见 FieldOwnership.def:68-71 的引文)。**跨进程:不成立**(前端堆 SharedPtr)。
### 4.2 `GetBufferBindingPoint` / `GetBufferBindingPointCount` — 3 + 2 站,draw 与 dispatch 都到
- `UniformManager.cpp:1205` + `:1200`(`ResolveStorageBufferDescriptor` :1157,SSBO/原子计数器绑定解析,draw/dispatch 共享)。
- `UniformManager.cpp:2035` + `:2030`(`ResolveUniformBufferPayload` :1979,UBO 绑定解析,draw/dispatch 共享)。
- `VulkanRenderer.cpp:11764`(`BeginXfbCaptureForDraw` :11714,`BufferTarget::TransformFeedback`,XFB 捕获,draw 路径)。
三处取到绑定点后都继续 `bindingPoint.GetBoundObject()` 拿前端 `BufferObject`,再走 §7 的 buffer legacy arm。**跨进程:不成立**(`BindingSlotRange1D` 前端基址指针,PipeFill.cpp:2591-2592 的 "four raw bases" 同类)。`GetBufferBindingPointCount` 是 sticky forward(FieldOwnership.def:147-148),退役标签 "P7/P13"。
### 4.3 `GetFramebufferBindingSlot` — 13 站
- draw 路径:`VulkanRenderer.cpp:3158`(`GetShaderTransformFlags`,判 default FBO 决定 Y-flip 编译位)、`:5510`、`:5730`(`GetOrCreatePipeline`,深度/模板附件门控与 render-pass 相容性)、`:6360`(`GetBaseTransformFlagsRaw` 的 MOBILEGL_ASSERT——**注意:INFO 级别下断言被编译掉,这站不总是执行**)、`:6465`(fast path)、`:6845`(`SetupDraw`)、`UniformManager.cpp:560`(`ResolveSamplerDescriptor` 的 feedback-loop 诊断)。
- 其余 verb:`VulkanRenderer.cpp:7648`(`Clear`——**这就是 integration-magma-split 预期红的那一对 `GetFramebufferBindingSlot@Clear`,CMakeLists.txt:2411**)、`:8016`(`QueueClearBufferPayload`)、`:9024`/`:9025`(`BlitFramebuffer` 的 bound 臂;具名臂见 §5.4)、`:9660`(`CopyTexSubImage2D`,Read 靶)、`:10371`(`ReadPixels`,Read 靶)。
读到的都是前端 `BindingSlot<FramebufferObject>` 指针再 `GetBoundObject()`。**跨进程:不成立**。
### 4.4 `GetImageTextureBinding` — 4 站,draw 与 dispatch 都到
- `UniformManager.cpp:1021`(`ResolveStorageTexelBufferDescriptor` :991)、`:1312`(`ResolveStorageImageDescriptor` :1276)、`:1867`(`CollectStorageImageTextures` :1818)、`:1955`(`CollectSamplerImageFeedback` :1900,sampler/image 子资源重叠危害探测)。
返回前端 `ImageTextureBinding` 基址后的元素。**跨进程:不成立**。
### 4.5 `GetTextureUnitObject` — 8 站(与 FieldOwnership.def:90 的 "8 Magma sites" 吻合)
- `UniformManager.cpp:511`(`ResolveSamplerDescriptor`,随后 `textureUnit.GetSamplerObject()` :512 取前端 SamplerObject)、`:787`(`ProgramSamplesOnlySingleLevelTextures`)、`:826`(`ResolveSamplerTexture`)、`:852`(`ResolveSamplerTextureRaw`)、`:1679`(`ResolveSampledBinding`)。
- `VulkanRenderer.cpp:9652`(`CopyTexSubImage2D`)、`:11157`(`GetTexImage`——class C,split 下 client 侧已具名拒绝,EmitTables.cpp:1673-1675)、`:11401`(`GenerateMipmap`)。
指针指进 client 的纹理单元数组(PipeInputs.h:669 的解引用 + PipeFill.cpp:274 的裸指针填充)。**跨进程:不成立**。
### 4.6 `GetProgramForDraw` / `GetProgramForDispatch` — 3 + 2 站
- draw:`VulkanRenderer.cpp:6384`(`TrySetupDrawFastPath`)、`:6815`、`:6853`(`SetupDraw`)。
- dispatch:`VulkanRenderer.cpp:7424`(`DispatchCompute`)、`:7476`(`DispatchComputeIndirect`)。(FieldOwnership.def:97 注里写的 :7327 已漂移。)
拿到前端 `SharedPtr<ProgramObject>` 后整个 program 内容都从前端对象读:`ProgramFactory::ComputeHash`/`GetOrCreateProgram` 读 `program.GetGeneratedSpirv()`(ProgramFactory.cpp:2469-2473、:3472);`ResolveUniformBufferPayload` 读 `program.GetUBOData()/GetUBOSize()`(UniformManager.cpp:1992-1993,具名 UBO host payload,ROADMAP.md:142 D-B8 的已知形状)、`GetUniformBlockBinding`/`GetUniformBlockName`/`GetUBOSizeAt`(:2028/:2033/:2063)。**跨进程:不成立**。Espryt 在 P5e pa 的证明("记录早就带着逐 link 的 ProgramArchive",ROADMAP.md:31)对 Magma 尚未接线——Magma 的 program 记录载体是否存在,本次未核实到(**未知**,fm 包第一天要回答)。
### 4.7 `GetTransformFeedbackProgram` — 2 站,draw 路径
- `VulkanRenderer.cpp:11725`(`BeginXfbCaptureForDraw`)、`:11824`(`EndXfbCaptureForDraw`)。前端 `SharedPtr<ProgramObject>`。**跨进程:不成立**。配套读还有 `IsTransformFeedbackActive/Paused`(:11716/:11722,值类,记录供给,成立)、`GetBoundTransformFeedbackLifetimeId`(:11667,值类)、`GetTransformFeedbackGeneration`(:11801,值类)、`HasOpenTransformFeedbackSpan`(:11684,sticky forward,"P7/P9"——前端 XFB span 表查询,**不成立**)。
### 4.8 `GetTextureObject` — 1 站
- `VkTextureManager.cpp:810`(`SyncTextureAndGetDescriptor` 内):按 GL name 查前端纹理对象表以注册 alive 追踪;查不到就 `texture.weak_from_this()`(:821)——把前端对象的 control block 存进 server 侧 map。sticky forward,退役标签裸 "P7"。**跨进程:不成立**。
### 4.9 相邻但非 "P7 (Magma)" 的字段读(列出以免漏网)
- `GetBufferBindingSlot`("P8/P9/P13",15 靶合一数组)13 站:`DirectVulkan.cpp:283`(`ResolveIndirectCommandBytes`,DrawIndirect)、`:407`(`MultiDrawArraysIndirect`)、`:470`(`MultiDrawArraysIndirectCount`,Parameter)、`:538`(`DrawElementsIndirect`)、`:591`(`DrawArraysIndirect`);`VulkanRenderer.cpp:7520`(`DispatchComputeIndirect`,DispatchIndirect)、`:11126`(`GetTexImage`,PixelPack)、`:12560`/`:12566`、`:12661`、`:12731`(multi-draw indirect 各站);`UniformManager.cpp:910`(`ResolveTexelBufferDescriptor`)、`:1053`(`ResolveStorageTexelBufferDescriptor`——这两站是 `textureBuffer->GetBufferBindingSlot()`,前端 TextureBuffer 对象自身的方法)。indirect 路径取到前端 buffer 后普遍跟 `SyncPersistentMappedRange()`(如 DirectVulkan.cpp:285、VR:7525)——transport 下具名 Fatal。
- `GetTransformFeedbackPausedPrimitiveCounter`(FATAL 行):`DirectVulkan.cpp:1256`(`GetQueryResult64` :1228)、`:1303`(`BeginXfbPrimitivesQuery` :1294)。两个入口都是 class C(EmitTables.cpp:1690-1693),split 下 client 侧先拒绝,**今天不可达**;行为一致,归 §2.7,不归 P5f。
- `GetPixelStoreParameters(false)`(pack 半,APPLIER_DERIVED):`VulkanRenderer.cpp:11127`。**跨进程成立**。注意 FieldOwnership.def:208 注里写的 ":10980" 已漂移(该行现在是 MOBILEGL_ASSERT),真身在 :11127——文档漂移,供 fm 顺手修注。
## 5. 前端地址 / 前端身份键控的 twin registry 与 memo
### 5.1 `VkTextureManager`(纹理 twin)
- `TextureIdentity{ ITextureObject* texture, Uint64 lifetimeId }`(VkTextureManager.h:126-145),`m_textureResources` / `m_aliveObjects` 均以此为主键;hash 混入前端对象地址(:144)。`m_syncedTextureMemo[8]` 直接以 `const ITextureObject*` 比较(:708-715,"A dead-then-reused texture address cannot false-hit: the new object carries a new lifetime id")。
- `SyncTexture`(VkTextureManager.cpp:1745-1796+)整体裹在 `MGPipeTextureLegacyArmScope`(:1755)里——注释 :1748-1754 自认:"Magma's texture sync still reads - and clears - the CLIENT's mip shadow: the dirty scan below, and UploadDirtyMipLevels' texel reads / region reads / MarkStorageDirty(false) clears"。**这是 §2.2 意义上最大的一块:读 client 纹素字节 + 写(清脏)client 存储**,guard 是 texture-legacy-arm,scope 内豁免。
- `ToStorageMipLevel/ToStorageArrayLayer(ITextureObject*)`(VkTextureManager.h:113-126)全树散布,读前端 view 父链。
**跨进程:不成立**。P5c 只迁了 Espryt 的 sync(走 StagedTextureStore 句柄键),Magma 的 server 侧 sync 是 P7 的活。
### 5.2 `VkBufferManager`(缓冲 twin)
- twin 指针直接**写进前端对象**:`bufferObject->SetBackendResource(resource)`(VkBufferManager.cpp:305、:601),读出对称(:291、:299)。`GetBackendResource/SetBackendResource` 是前端 BufferObject 上的 mutable 槽——server 写 client 内存。
- `AcquirePersistentMap`(:598-646)seed 时读 `bufferObject.MappedData()`(:631)。
- `AcquireResidentSlice`(:649-699)/ `AcquireStreamedSlice`(:701-):每 draw 调用,含 `SyncPersistentMappedRange()`(:657/:708)、`GetSize()`、`GetChangeSerial()`(:726)、`MappedData()` 整缓冲上传(:682/:768)。transport 下第一行即 `Fatal{buffer-legacy-arm}`(见 §0.1)。
**跨进程:不成立**;且今天是 guarded Fatal,不是静默读。
### 5.3 draw 路径上的地址键控小缓存
- `ConvertedVertexStreamKey.buffer = sourceBufferShared.get()`(VulkanRenderer.cpp:4106-4116)+ `GetChangeSerial()`(:4107)+ `MappedData()` 转换读(:4127)——`UploadAndBindVertexStreams` 内,前端 buffer 地址做 memo 键 + 读 client 字节。
- `UploadAndBindIndexBuffer` 的 restart-index 替换臂:`indexBufferShared->SyncGpuWrites()` + `MappedData()` + `GetSize()`(:4421-4423)——`SyncGpuWrites` 在 transport 下有反向通道臂(BufferObject.cpp:571-590 起),但那是 client 线程语义;apply 线程调它的行为本次未逐行走通(**未知**,大概率在 `MappedData()` 的 guard 处先 Fatal)。
- `SetupDrawSnapshot`(VR:6388-6470 一带)以 `program.GetLifetimeId()`、前端 VAO/FBO 的地址与 lifetime id 做键(:6446-6468)。
- `UniformManager.h` 的 memo 族(`SamplerResolveMemo` :418 起、`FastRebindMemo` :363、`m_globalUboMemo` :392、`m_descriptorReuseMemo` :341)以 binding + program lifetime id / 版本号做键——键本身是值,但值全部来自前端对象读出。
- `ProgramFactory::ProgramLookupCache.program` 存前端 `ProgramObject*`(ProgramFactory.h:582-587)。
- `g_programResourceCaches`(DirectVulkan.cpp:103-108)以 **GL name** 为键、lifetime id 校验(:166-189)——`GetShaderStorageBlockIndex/Binding`(:313/:332,client 侧查询路径)与 `ShaderStorageBlockBinding`(:714,P5b 的 `set_storage_block_binding` 记录会经 sink 在 apply 线程到达)都会进 `TryGetDirectVulkanProgram`(:274-280),后者调 sticky forward `ValidateProgramName` + `GetProgramObject`("P9" 行)——**server 按名字探前端名字表,跨进程不成立**;GL-name 键控的 cache 本身是 server 内存,成立。
### 5.4 具名 blit 端点解析(P5c G6 / P5e ruling 12)
- `VulkanRenderer.cpp:8974-9022`:split 臂从 applier 的 verb 句柄工作区取 `ReadFbo/DrawFbo` 句柄(:8989-8991),随后 `resolveEndpoint` lambda 里**直接拼写 `MG_State::pGLContext`**(:8997、:9004、:9005)与 `MG_Pipe::MGPipeSlots()`(:8999、:9003),全程裹 `MagmaP7AllocatorDebtScope`(:8995)。这是 DirectVulkan 全树仅有的 `pGLContext` 与 `MGPipeSlots()` 直接拼写。**跨进程:不成立**(前端 FBO 池 + client 分配器)。P7 的退役方式注释已写明(:8983-8984:"P7 retires it by carrying the object identity in the record")。
- 附带发现:**ARCHITECTURE.md:460 的 C 门原文是 `grep -c 'pGLContext' MG_Backend/ == 0`,当前 HEAD 实测非零**——`VulkanRenderer.cpp` 3 处代码命中(:8997/:9004/:9005)+ `MGPipe/PipeInputs.h:822` 一处注释。该门是否仍在 CI 以 ==0 执行、还是已改为白名单,本次未核实(**未知**);若仍按字面执行则门已破,值得在 f1 之前确认。
### 5.5 `MagmaPipeIdentityTables`(MagmaPipeArms.h:370-529)
Magma 自己的 {slot, gen} mint,按 lifetime id 把前端 VAO/Buffer 映到 server 侧 slot 表(`HandleOf` :515-518);`VertexInputStateFactory::VaoBackendMemos` 以该 handle 为键(VertexInputStateFactory.h:149-171)。表本身是 server 私有内存,**成立**;但 lifetime id 的获取仍靠读前端对象(`vao.GetLifetimeId()`),身份源是 §4.1 的字段读—— mint 干净、水源脏。P5f 无需动表,动的是喂它的字段。
## 6. server 在 apply 线程上创建 / 销毁前端类型对象
- 隐藏 blit 资源:`VulkanRenderer.cpp:4475-4491`(`ShaderObject`/`ProgramObject`)、`:4527-4540`(两个 `SamplerObject`);隐藏 depth-mipmap 资源:`:4567-4617`。销毁走 `ShutdownBlitResources`/`ShutdownDepthMipmapResources`(:4544-4562、:4634-4643),已裹 `MagmaP7AllocatorDebtScope`(:4559、:4640)——注释自认析构会触发 client death helper 的 lifetime-id 探测。注释 :4552-4553 明说:"P7 gives these resources storage that is not a frontend object"。
- UniformManager 占位纹理:`MakePlaceholderTextureObject`(UniformManager.cpp:167-189,`GetFallbackTexture` :1410/:1435、`GetFallbackMultisampleTexture` :1451/:1497-1499 调用),以及 `m_unboundStorageImageTextures`(UniformManager.h:317)。**每构造一个纹理对象都会 `MGPipeMintTextureHandle` + `MGPipeEmitTextureResourceCreate`**(TextureObject.cpp:143-170,push 构建下无条件 mint)——apply 线程上的 `MGPipeSlots().Acquire` 无 scope 即 `Fatal{RoleViolation, "MGPipeSlots"}`(SlotAllocator.cpp:330、:47-59)。也就是说 **Magma 的占位纹理在 split 下首次需要时即具名 Fatal**(与 ROADMAP.md:127 "占位纹理原生化 → P7" 互证)。ProgramObject/ShaderObject/SamplerObject 的构造不 mint(grep 无命中),故隐藏 program/sampler 的创建本身今天不触发守卫,只有析构的探测被 scope 兜住。
**跨进程:不成立**(server 进程里没有 MG_Impl/MG_State 的 client 语义,构造出的对象也不该存在)。P5f 处置:随 P7 的"内部 shader 烘焙 / 占位纹理原生化"换成 server 原生资源;f1 双块演习时这些点会以 Fatal 形式自己报出来。
## 7. 对前端 BufferObject 的直接方法调用(写 client 存储的边)
- `bufferObject->MarkGpuWritten()` 直写臂已按 P5c ev 改掉:三处都是 `#if MOBILEGL_PIPE_PUSH → MGPipeAnnounceBufferGpuWritten(...) / #else 直写` 双臂(UniformManager.cpp:1077-1085、:1241-1247;VulkanRenderer.cpp:11774-11781)。announce 内部经 `MagmaP7AllocatorDebtScope` 做 client 分配器的 lifetime-id 反查(ResourceTracker.h:710-743,:728 是"第四笔债"),找到句柄则走 `OnGpuWritten` → SEG_EVENT;找不到句柄则**回退直写 client 对象**(:738)。**跨进程:announce 主臂成立;回退臂不成立;scope 内的分配器探测不成立**。
- `bufferObject->EnsureGpuResidentStorage()`(UniformManager.cpp:1077、:1239;VulkanRenderer.cpp:11774):transport 下早退 `return false`(BufferObject.cpp:877-880,R-6 的第二道门),但早退之前已读 `m_resource.IsGpuResident()` / `m_isMapped`(:856、:866)——**无守卫的 client 内存读**,今天靠同地址空间成立,跨进程不成立。
- `indexBufferShared->SyncGpuWrites()`(VR:4421):见 §5.3。
## 8. 写 client 存储 / 读 client 镜像的其他站点
- `RecordError`(写前端错误队列):`VulkanRenderer.cpp:1367`、`:1371`(`RecordClearBufferError`/`RecordTextureCopyError` 帮手)、`:1427`(`RecordUnsupportedFramebufferError`)、`DirectVulkan.cpp:735`(`ShaderStorageBlockBinding`)。transport 下 `PipeInputs::RecordError` 改走 `ServerSessionInstance().PostGlError` → SEG_EVENT `kEventGlError`(PipeFill.cpp:2164-2178),client 在 drain 点入账。**跨进程:成立**(排序是 P9 的已知债)。
- `InvalidateCompileEnv`(写前端编译环境):`BackendObject_DirectVulkan.cpp:390`(`InitCapabilities`)、`:788`(`ApplyVulkanCapabilitiesForTesting`)。transport 下 `PipeInputs::InvalidateCompileEnv` 已删除为空操作(PipeFill.cpp:2143-2156,失效改由 caps 重发布完成)。**跨进程:成立**。
- `SwapchainObject` 默认 FBO 附件写:transport 下走 `OnSurfaceChanged` → SEG_EVENT(SwapchainObject.cpp:323-339),monolith 臂仍直写 `pDefaultFramebufferInfo` 的 `AllocateStorage/SetInternalFormat`(:342-358)。**跨进程:成立**(P5c ev / R3 已处理,ROADMAP.md:64)。
- `GetTextureImage`(VR:11162-11209+):入口签名直接吃前端 `SharedPtr<ITextureObject>`(DirectVulkan.h:101 声明、DirectVulkan.cpp:768 入口),内部 `SyncTextureAndGetDescriptor(*textureObject)`(:11175)+ 无 GPU 存储时回退 `MG_Impl::GLImpl::CopyTextureImageToClientOrPBO_State`(:11205)——直接调 MG_Impl 函数读 client shadow 写 client 目标缓冲。但两个 GL 入口都是 class C(EmitTables.cpp:1673-1675),split 下 client 先拒绝,**今天不可达**;若 P9 要放开,这是整条臂的跨进程形状问题,先记着。
## 9. 值类读取(非债,列出备查)
以下 accessor 在 DirectVulkan 下被读、但属 RECORD_SUPPLIED / APPLIER_DERIVED,跨进程成立,不需 P5f 动作:`IsCapabilityEnabled(Indexed)`、`GetRenderStateParameters(Version)`、`GetPipelineStateVersion`、`GetStencilState`、`GetColorMaskIndexed`、`GetDepthMask`、`GetBlendColor/Func/Equation`、`GetScissorBox`、`GetViewportIndexed`、`GetDepthRangeIndexed`、`GetClearColor/Depth/Stencil`、`GetActiveTextureUnit`、`GetCurrentVertexAttribute`、`GetPatch*`、`GetPolygon*`、`GetLineWidth`、`GetLogicOp`、`GetCullFaceMode`、`GetDepthFunc`、`GetMinSampleShadingValue`、`GetClampReadColor`、`GetProvokingVertexMode`(VR:13229)、`IsTransformFeedbackActive/Paused`、`GetTransformFeedbackGeneration`、`GetBoundTransformFeedbackLifetimeId`,以及三 shutter `GetTextureBindGeneration`/`GetSamplingResolutionGeneration`(VR:6477/:6659/:6907/:6913/:7031/:7050/:7361/:7387 等,P5c rv 起 APPLIER_DERIVED,server 自答)。`g_dynamicStateShadow`(VR:290-409)是纯 server 侧 memo,成立。
## 10. 未知 / 留给 fm 的问题
1. Magma 的 program 内容(SPIR-V、UBO 初值)是否已有记录载体(类似 Espryt 的 ProgramArchive)——本普查未在 wire schema 侧核实;若没有,4.6 是 fm 最大的一块。
2. `SyncGpuWrites` 从 apply 线程在 transport 下的实际行为(BufferObject.cpp:590 起的臂是否假设 GL 线程)。
3. ARCHITECTURE.md:460 的 C 门是否仍以 ==0 执行(当前实测非零,见 §5.4)。
4. indirect draw 无绑定缓冲(client 指针)时,记录在 wire 上如何携带命令字节、server 端 `ResolveIndirectCommandBytes` 的 client 指针解引用在严格双块下的归类(指针随记录过来,值无意义——大概率走 client-memory 升级的具名拒绝,待 f1 的红来确认)。
5. `GetTexImage`/`GetTextureImage` 若 P9 放开,VR:11162 起的整条前端对象签名链需要重新设计(§8)。
+225
View File
@@ -0,0 +1,225 @@
# f0 普查子项:§2.5 registry 重键普查(`MGPipeFrontendKeyedRegistryScope`)
> 基线 `feat/disaggregated @ 8b68b92c`(代码头 `25fba0d5`,其后仅文档提交)。只读普查,未改动任何代码。
> 路径省略前缀 `MobileGL/`。行号均在当前 HEAD 实测。
## 0. 范围与实际 grep 结果
计划 §2.5 写"约 12 个活跃站点(:2542、:4505、:5540、:5659、:5940、:6490、:6576、:7092、:7682、:8213、:11231 …)"。
当前 HEAD 实测(`rg MGPipeFrontendKeyedRegistryScope`,全树):
- **`MG_Backend/DirectGLES/DirectGLES.cpp`:13 处构造点**(比计划列举多 `:12606`、`:14461`),另有 `:2090` 一处注释记录 vi 家族已删除的 VAO 站点(非构造点)。
- `MG_Backend/DirectGLES/Managers.cpp`:**11 处**(`:3063`、`:4689`、`:6101`、`:8934`、`:9762`、`:9816`、`:10953`、`:10974`、`:14102`、`:14463`、`:14760`)。
- `MG_Test/Wire/RemoteClientTest.cpp:1930`、`:1948`:测试夹具,非生产路径。
本报告主体是 DirectGLES.cpp 的 13 处;Managers.cpp 的 11 处在 §4 作附注(同一豁免家族,超出本子项口径但处置同类)。
## 1. 机制回顾:scope 保护的是什么,P5e id 已经重键了什么
**scope 的语义**(`MG_Impl/Pipe/SlotAllocator.h:250-282`、`:272-282`;实现 `SlotAllocator.cpp:146-157`):
P5c G6 的具名豁免——豁免的探测是"server 私有、但以**前端身份**键控的 twin registry 查询"。
P5e(id,CONTRACT-P5E §4.4)把豁免条件收窄为**仅当前记录设障**(`MGPipeApplierCurrentRecordIsBarriered()`):
设障时 client 停在 `WaitForApplied` 里,其分配器与 lifetimeId→slot 映射静止,只读探测无撕裂;
未设障记录下 scope 不豁免任何东西,探测即 `Fatal{RoleViolation, "MGPipeSlots"}`(`SlotAllocator.cpp:32-70`)。
monolith 下守卫首行即返回(`SlotAllocator.cpp:33`),scope 只是标记。
**被保护的"键"是什么**。七张 twin 表全部是 `BackendSlotTable`/`TwinRegistry`(`Managers.h:1579` VAO、`:2118` 纹理、`:2297` FBO、`:3110` 程序、`:3298` 采样器、`:3383` sampler-view、`:3449` renderbuffer)。
P5e(id)之后,**每张表都已按 {slot,gen} 键控**:`FindByHandle` / `GetOrCreate(MGPipeHandle)` / `ReleaseByHandle` 全部存在
(`SlotTables.h:351`、`:461`、`:486`),Gen 检查、composite band、ABA 语义齐备(CONTRACT-P5E §4.2/§4.3)。
scope 站点走的是**前端身份半边**:
- `Find(StateObject*)` ≡ `FindByHandle(HandleOf(stateObj))`(`SlotTables.h:477-480`),
`HandleOf` = `stateObj->GetLifetimeId()` → `MGPipeSlots().FindByLifetimeId(kind, lifetimeId)`(`SlotTables.h:501-517`)——
即"前端对象指针 → lifetime-id → client 分配器探测"。这是 **lifetime-id 键**,不是裸地址键;
- `GetOrCreate(const StatePtr&)` 在 miss 时经 `Acquire` **铸造**句柄(`SlotTables.h:263-298` 一带,守卫在 `:298`);
- legacy-memos 臂(`MOBILEGL_PIPE_LEGACY_MEMOS`)才是裸前端地址键 + weak_ptr owner-equality(`DirectGLES.cpp:75-153`)。
所以每张表"按句柄重键缺什么"的答案**不是缺表的句柄能力**——表早就有了——缺的是**句柄到达该站点**:
要么记录已带句柄但 sink/后端没用它(:2542、:12606),要么该站点整个是 monolith glue,transport 下根本不该到达(其余 11 处)。
**P5e id 已删的**:draw path 上约 20 处 scope 构造点连同其包裹的前端探测(CONTRACT-P5E §4.4 列旧行号;
当前 HEAD 的 `DirectGLES.cpp:2086-2093` 注释记录了 VAO 站点是"删除而非收窄",删除使回退变响)。
**存活的口径**(CONTRACT-P5E §4.4 末段):设障行站点(CopyTex / GetTexImage / mipmap-shape /
set_storage_block_binding / detach-walk)、两个 verify 臂、`BufferImpl::HandleOfBuffer`。
注意该列举写于 P5e 基线,当前 HEAD 已有漂移:CopyTex 与 mipmap 已改走句柄(见下),GetTexImage 在 wire 上已是 class-C 具名拒绝(见 :14461 条)。
## 2. 总结论
13 个站点分两类:
- **A 类(P5f 跨进程必需,2 处)**:transport 下真实活着、被设障行保护的前端键探测——
**`:2542`(resource_copy_region 的 CopyImage 端点同步)** 与 **`:12606`(set_storage_block_binding)**。
这两处的记录**早已携带句柄**(`MGPCopyRegion::Src/Dst`,`MGPipeTypes.h:1469`;`MGPStorageBlockBinding::ShaderCso`,`:1792`),
sink/后端没用而已。
- **B 类(P3b/P4b 债 / monolith glue,11 处)**:在受支持的 transport 配置下不可达——或前面已有 transport 具名拒绝/abort
(:6576、:7682),或臂选择器先行分流到 by-handle 臂(:4505、:5540、:5659、:5940、:6490、:7092),
或 wire 槽位本身是 class-C 拒绝(:14461),或仅 monolith 路径调用(:11231),或**全树无调用者**(:8213)。
这些在"拆进程后还成立吗"的判据下**不成立也无妨**,因为它们到达不了 server 进程;
它们退役的正确归属是 P3b/P4b 的 monolith-glue 清理,而不是 P5f 的 wire 完备性。
## 3. DirectGLES.cpp 逐站点
### A 类:transport 下活着的设障行站点
#### :2542 — `TextureImpl::SyncTextureObjectToBackend(textureObject, imageBindable)`
- **保护的 registry**:`TextureImpl::g_backendTextureObjects`(纹理 twin 表)。
- **今天的键**:`Find(textureObject.get())` / `GetOrCreate(textureObject)`(`:2544-2546`),slot 臂上经 lifetime-id 探测;
注释自己写明(`:2538-2541`)。
- **对象是否已有 {slot,gen}**:有。纹理的句柄由 `resource_create/respecify` 先行(CONTRACT-P5E §4.2 纹理行)。
- **transport 下谁到达这里**:`DirectGLES::CopyImageSubData` → `MakeGLESCopyImageEndpoint`(`:12301`),
其端点由 sink `ServerVerbSink::OnResourceCopyRegion`(`MG_Remote/Server/PipeApplier.cpp:856-859`)
用 **BARRIER_PULLED 的 `gPipeInputs.GetTextureObject(GlName)`** 重建出前端对象再传入。
`resource_copy_region` 是 `kWaitApplied`(`PipeCalls.def:254`),client 停车,故探测合法。
(视图嵌套同步 `SyncTextureViewToBackend` 也调它,但 transport 臂已改为 `SyncTextureViewToBackendByRecord` 走 `Desc.ViewOf` 句柄,`Managers.cpp:7178-7195`。)
- **按句柄重键缺什么**:不缺载体——`MGPCopyRegion` 已同时携带 `Src/Dst` 句柄与 `SrcGlName/DstGlName`(`MGPipeTypes.h:1468-1476`)。
缺:(1) sink 用 `Src/Dst` 句柄而非 `GetTextureObject` 重建端点(顺带退役 FieldOwnership 的 `GetTextureObject` P7 行);
(2) `CopyImageEndpoint` 增加句柄形态或后端函数表加 by-handle 入口;(3) `MakeGLESCopyImageEndpoint` 改 `SyncTextureToBackendByHandle`。
- **今天为何能工作**:设障(kWaitApplied)+ scope 豁免,client 停着,lifetime-id 探测读的是静止的 client 分配器。
- **P5f 处置建议**:归 fr 包。这是 §2.1 `GetTextureObject`(P7 行)在 Espryt 侧的**实际消费点**,句柄已在记录里,属纯接线;
做完后 `:2542` 的 scope 在 transport 下失去最后一个到达者,可随 P3b/P4b 的 monolith-glue 清理一起删。
#### :12606 — `ShaderStorageBlockBinding(program, storageBlockName, binding)`
- **保护的 registry**:`PrgramImpl::g_backendProgramObjects`(程序 twin 表,kind ShaderCso)。
- **今天的键**:sink `OnSetStorageBlockBinding`(`PipeApplier.cpp:910-928`)按 GL 名调后端表项,
后端先 `MGB_CTX->ValidateProgramName` / `GetProgramObject(program)`(两个 BARRIER_PULLED 行,P9),
再 `Find(programObject.get())`(`:12608`)→ lifetime-id 探测。
- **对象是否已有 {slot,gen}**:有;且**记录已带**——`MGPStorageBlockBinding::ShaderCso`(`MGPipeTypes.h:1791-1796`)。
CONTRACT-P5E §2.2 本就写着"trailing: pg resolves through `MGPStorageBlockBinding::ShaderCso` and flips it",未落。
- **按句柄重键缺什么**:sink/后端按 `ShaderCso` 解析 twin(`ResolveProgramTwin`/`FindShaderCsoRecord` 已在),
跳过 `GetProgramObject` 全程;该行 `kWaitApplied`(`PipeCalls.def:297`)即可翻 `kWaitNone`。
注意当前实现的"不同步即返回"语义(`:12614-12617`,link version 落后则留给 reseed)在 by-handle 臂需用
`m_syncedShaderCsoSerial` vs `record->Serial` 重述。
- **今天为何能工作**:同上——设障 + scope。
- **P5f 处置建议**:归 fr 包(或与 §2.1 的 `GetProgramObject`/`ValidateProgramName` P9 行一起:这两行的 Espryt 消费点主要就是这里)。
契约已预定、记录已带句柄,是 13 处里**收益最直接**的一处。
### B 类:monolith glue / transport 下不可达(P3b/P4b 债)
#### :4505 — `SyncCurrentFBO()` 的 legacy 循环
- registry:`FramebufferImpl::g_backendFramebufferObjects`;键:前端 FBO 指针(经 `HandleOf`)。
- transport 下:`SyncCurrentFBOByRecord()` 先行(`:4479`),decline 且 fb 位开启时直接
`RefuseFramebufferBindingSlotRead()` abort(`:4490-4492`)。fb 位关 + transport 的组合里,
环绕它的 `GetFramebufferBindingSlot` 读本身已是 BARRIER_PULLED 具名红——**非受支持配置**。
- 处置:P3b/P4b 删 monolith glue 时连同 `GetOrCreate(currentFBO)` 臂一起删;P5f 不需要动它。
#### :5540 — `ResolveGlobalConstantsRecord(program)`(monolith-glue 半边)
- registry:`g_backendProgramObjects`;键:`HandleOf(program)`(`:5546`)。
- 注释自带结论(`:5530-5533`):"Reached only when `Transport == Monolith`";transport 的唯一调用点
走 `ResolveGlobalConstantsRecordForHandle`(`:7139`)。
- 处置:P3b/P4b。P5f 无需动。
#### :5659 — `SyncCurrentProgram(SharedPtr<ProgramObject>)`
- registry:`g_backendProgramObjects`(另含两张表的 `CollectGarbageIfNeeded`,`:5661-5662`);键:前端程序指针(`:5679-5680`)。
- transport 下:调用点全部按 `ProgramHandleArm()`(`Managers.h:714-716`)分流到
`SyncCurrentProgramByHandle`(draw `:6260-6265`,dispatch `:8156-8161`)。
- 处置:P3b/P4b。
#### :5940 — `BindCurrentFBO(target)` 的 legacy 臂
- registry:`g_backendFramebufferObjects`;键:前端 FBO 指针 `Find(currentFBO.get())`(`:5947`)。
- transport + fb 位:记录臂 `FindByHandle(record.Fbo)`(`:5889`)先行返回;decline 则 abort(`:5917-5919`)。
- 处置:P3b/P4b。
#### :6490 — `ResolveAndBindUnitTextures()` 的 legacy 单元绑定 pass
- registry:`g_backendTextureObjects`;键:前端纹理指针 `Find(textureObject.get())`(`:6492`)。
- transport + 纹理位:`UnitTexturesByHandle()` 的记录臂在 `:6397` 返回,走不到这里(`:6341-6398`)。
- 处置:P3b/P4b。该 legacy pass 的外层读 `MGB_CTX->GetTextureUnitObject(unit)`(`:6425`)本身是 §2.1 的
BARRIER_PULLED 行(Magma 的那半归 fm),scope 只是其中 registry 探测的标记。
#### :6576 — `ResolveUnitSamplerBackend(unit, samplerObject)`
- registry:`SamplerImpl::g_backendSamplerObjects`;键:`HandleOf(samplerObject)`(`:6582`)。
- transport 下:**scope 之前就已 abort**——`Fatal{ProtocolCorruption, "BindSamplerStates.Count"}`(`:6565-6573`),
P5e(tx2)按 CONTRACT-P5E §4.2 把 identity sampler 家族在 transport 下整个删除。
- 处置:scope 已形同虚设(只为 monolith 编译期保留),随 P3b/P4b 删。
#### :7092 — `BindCurrentProgramWithResources` 的 else 臂
- registry:`g_backendProgramObjects`;键:前端程序指针 + stash 比较(`:7096-7104`)。
- transport 下:`handleArm` 走句柄 stash / `ResolveProgramTwin`(`:7080-7083`)。注释自标"monolith glue only"(`:7088-7091`)。
- 处置:P3b/P4b。
#### :7682 — `GetCurrentBackendProgram()`
- registry:`g_backendProgramObjects`;键:前端程序指针 `Find(currentProgram.get())`(`:7684`)。
- transport 下:`ProgramHandleArm()` 臂(`:7659-7670`)在 scope 之前返回,scope 不可达(注释 `:7680-7681` 自明)。
- 处置:P3b/P4b。
#### :8213 — `GetBackendProgramId(GLuint program)`
- registry:`g_backendProgramObjects`;键:前端程序指针(`:8215-8217`,Find-or-create + 按需 `SyncToBackend`)。
- **特殊发现:当前 HEAD 全树无任何调用者。** 该函数无头文件声明(`DirectGLES.h`、`Managers.h` 均无),
不在后端函数表(`BackendObject.h` 无此槽),MG_Impl/MG_Remote/MG_Pipe 无引用;唯一同名物是
`BackendProgramObjectImpl::GetBackendProgramId()` 成员(`Managers.h:2894`)。CONTRACT-P5E §5.5 称它
"is a monolith entry",但至少在当前 HEAD 它是**死代码**(唯一旁证:`MG_Test/Program/ProgramInterfaceTest.cpp:1411`
的注释提到这个名字描述一种既有危害)。
- 处置:先确认删除(或恢复声明与调用者),与 P5f 无关;若保留则归 P3b/P4b。**建议 fr 包顺手删掉它连带这处 scope**——
这是普查发现的唯一"scope 保护着没人调的函数"。
#### :11231 — `ScopedDetachedTextureFramebufferAttachments(SharedPtr<ITextureObject>)`(detach-walk 前端构造)
- registry:`g_backendTextureObjects`(`Find(texture.get())`,`:11233`)+ `g_backendFramebufferObjects.ForEachLive`
内经 `StateForHandle` 取回前端 FBO 对象(注释 `:11243-11255`)。
- transport 下:唯一 transport 调用者是 `GenerateMipmapByRecord` 的**句柄构造**(`:12076`,走 `:11162` 的
`MGPipeHandle` 重载,纯记录走查);前端构造只被 monolith 的 `GenerateMipmap` 调用(`:12151`),
而 transport 的 `GenerateMipmap` 在 `:12105-12117` 已整臂分流到 `VerbMipRes`。
- 处置:P3b/P4b(fb 包的 reverse index 已是句柄臂的替代)。注意 `StateForHandle` 这半边由
`MGPipeRefuseFrontendKeyedRegistryFromUnbarrieredApply` 单独把守(`SlotAllocator.cpp:76-86`),
scope 删后该守卫仍在。
#### :14461 — `GetTexImage(target, level, format, type, pixels)`
- registry:`g_backendTextureObjects`;键:前端纹理指针(`:14463`),其前端对象来自
`GetActiveTextureUnit`/`GetTextureUnitObject`/`GetBindingSlot` 三连 BARRIER_PULLED 读(`:14448-14453`)。
- transport 下:**不可达**——wire 槽 `GetTexImage` 在 `MGR_UNMIGRATED_TAIL_SLOTS`(`EmitTables.cpp:1673`),
即 class-C 具名拒绝 `Fatal{UnmigratedVerb, "GetTexImage"}`;DSA 的 `GetTextureImage` 由前端自己的 CPU 读回
应答(`SlotCaps.h:57`),其后端槽同样在拒绝名单(`EmitTables.cpp:1674-1676`)。
即 CONTRACT-P5E §4.4 当年列举的"GetTexImage 设障行站点"在当前 HEAD 已漂移成 class-C。
- 处置:本分两个阶段看——P9 若把 GetTexImage 接上 wire,`MGPReadbackInfo::Res`(`MGPipeTypes.h:1555`)已带句柄,
届时按 :2542 同款模式重键;在那之前此 scope 仅 monolith 可达,归 P3b/P4b。**当前不属于 P5f 跨进程必需。**
## 4. 附注:Managers.cpp 的 11 处(同一豁免家族,本子项口径外)
均为 G6 注释标记的同类探测,除注明外均为 monolith-glue 性质:
| 行 | 函数 | registry / 键 |
|---|---|---|
| `:3063` | `BufferImpl::HandleOfBuffer` | buffer twin 表;lifetime-id。CONTRACT-P5E §4.4 点名的残留("until vi/sb carry the handle");当前调用者在 monolith 臂(`DirectGLES.cpp:1076`、`:1366`) |
| `:4689` | `SamplerViewImpl::HandleOfSamplerViewForTexture` | sampler-view 表;lifetime-id |
| `:6101` | 纹理 remint-pull 的 rearm(`RequireImageBindableStorage` 族) | 纹理表 `HandleOf` |
| `:8934` | `BackendTextureObject::ResolveOwnRecord` | 纹理表 `HandleOf`;by-handle 臂靠 `m_pushedSyncHandle` 不探测 |
| `:9762` / `:9816` | `SyncAttachmentObject` | 纹理 / renderbuffer 表 Find-or-Create;legacy FBO 附件走查 |
| `:10953` / `:10974` | FBO verify 臂(`glGetFramebufferAttachmentParameteriv` 断言走查) | 纹理 / renderbuffer 表 Find;debug 断言代码 |
| `:14102` | 程序 `SyncToBackend` 的 serial 盖章 | 程序表 `HandleOf`;注释自标 "MONOLITH GLUE ONLY" |
| `:14463` | 采样器参数同步的"未注册"判别 | 采样器表 `HandleOf`;后端自产采样器(raw-depth-fetch)靠它区分 |
| `:14760` | renderbuffer `SyncToBackend` 的记录解析 | renderbuffer 表 `HandleOf`;注释自标 monolith glue |
建议 fr 包把 Managers.cpp 这 11 处与 DirectGLES.cpp 的 B 类一起列入"随 P3b/P4b 删除"清单,避免 P5f 范围漂移。
## 5. 对 P5f(fr 包)的处置清单(汇总)
1. **fr 的真工作只有两处接线**:`:2542`(resource_copy_region 改吃 `MGPCopyRegion::Src/Dst` 句柄,
顺带退役 `GetTextureObject` 拉取)与 `:12606`(set_storage_block_binding 改吃 `MGPStorageBlockBinding::ShaderCso`,
顺带退役 `GetProgramObject`/`ValidateProgramName` 拉取,WaitClass 可翻 `kWaitNone`)。
两者记录都已带句柄,registry 都已是句柄键——**是接线,不是重键**。
2. `:8213`(`GetBackendProgramId`)疑似死代码,建议确认后随 fr 删除。
3. 其余 11 处(DirectGLES.cpp)+ 11 处(Managers.cpp)是 monolith glue / P3b/P4b 债,
**不应计入 P5f 的跨进程判据**;双块演练(§4)不会让它们变红,因为它们根本不被 transport 到达。
计划的 fr 包若按"删全部 scope"来写会虚胖;按本普查,fr 的 red-once 判据应落在 A 类两处。
4. 口径修正建议:P5F-WIRE-COMPLETENESS.md §2.5 写"registry 仍按前端地址 / lifetime-id 键控"——
实测 **registry 本体已全部按 {slot,gen} 键控**(P5e id 完成),残存的是"调用点仍用前端身份解析",
且 13 处中 11 处在 transport 下不可达。建议把 §2.5 措辞改为"两个设障行调用点仍经前端身份解析"。
## 6. 未知项(如实记录)
- `:2542` 的 `SyncTextureObjectToBackend` 在 transport 下是否还有 CopyImageSubData 之外的到达者,
本普查核对了其全部 8 个调用点(`DirectGLES.cpp:3323`、`:3458`、`:3543`、`:3852`、`:10363-10364`、
`:12131`、`:12134`、`:12301`,加 `Managers.cpp:7104`):其余均在 monolith/legacy 臂或被
`FramebufferRecordArmIsMandatory` 之类的分流挡住;若臂选择器被操作员改出非默认组合,可达性会变化——未逐组合穷举。
- `:8213` "无调用者"的结论基于全树文本检索;若存在经函数指针表以外的动态到达(如 dlopen 符号),未能覆盖——未发现任何迹象。
@@ -0,0 +1,259 @@
# f0-reverse-channel — P5f §2.6 反向通道逐站点普查(只读)
> 基线 `feat/disaggregated @ 8b68b92c`(代码头 `25fba0d5`)。路径在 `MobileGL/` 下。
> 本文件为只读普查,未改任何代码、未发起构建、未跑测试。对应 P5f 计划 §2.6
> (`docs/Disaggregated/P5F-WIRE-COMPLETENESS.md:200-204`)与 P5c 审计表 R1–R5 / B4 行
> (`docs/Disaggregated/ROADMAP.md:61-66`)。
>
> **行号漂移提醒**:任务与 `ROADMAP.md:61`(B4 行)引用的 XFB scatter 旧行号
> (`DirectGLES.cpp:950/1060/1077/1081/1172/1185`)在当前 HEAD 已落在
> `SyncVaoAttributeBuffersByHandle/ByRecord`(VBO memo)区域,与 XFB 无关。XFB 机制现位于
> `DirectGLES.cpp:1508-2072`(`XfbImpl` 命名空间),scatter 本体在 `:1726-1839`,
> 非 scatter 回读臂在 `:1602-1684`。下文一律以当前 HEAD 行号为准。
---
## 0 总览:十个回调,四类有接线
`MGPipeCallbacks` 共 10 个成员(`MG_Pipe/MGPipeCallbacks.h:27-51`,个数有 static_assert 把守)。
逐个数 producer / consumer / 事件种类:
| 回调 | EventKind | server producer | client consumer | 状态 |
|---|---|---|---|---|
| `OnBufferWriteback` | `kEventBufferWriteback`(`EventRing.h:49`) | `ServerSession.cpp:264-292` | `ClientSession.cpp:266-291` → `ResourceTracker.h:575-638` | **已接线** |
| `OnGpuWritten` | `kEventGpuWritten`(`EventRing.h:50`) | `ServerSession.cpp:294-312` | `ClientSession.cpp:292-314` → `ResourceTracker.h:645-667` | **已接线** |
| `OnSurfaceChanged` | `kEventSurfaceChanged`(`EventRing.h:51`) | `ServerSession.cpp:314-330` | `ClientSession.cpp:315-329`(→ `:211-252`) | **已接线** |
| (`OnGlError`) | `kEventGlError`(`EventRing.h:52`,P5c 新增) | **不经回调表**:`PipeInputs::RecordError` 直调 `ServerSession::PostGlError` | `ClientSession.cpp:330-365` | **已接线,但绕过回调表**(见 §5) |
| `OnTextureWriteback` | 无 | 无 | 无 | 零接线 |
| `OnTexturePullRequest` | 无 | 无 | 无 | 零接线(终止符见 §7) |
| `OnMipLevelsGenerated` | 无 | 无 | 无 | 零接线(见 §6) |
| `OnXfbScatterReady` | 无 | 无 | 无 | 零接线(见 §3) |
| `OnCapsInvalidated` | 无 | 无 | 无 | 零接线,由 R-12 caps 重发布取代(`CapsMirror.cpp:78-80`) |
| `OnLog` | 无 | 无 | 无 | 零接线 |
安装/卸载:`ServerSession::Accept` 只装三个(`ServerSession.cpp:538-542`),`Close` 对称卸载
(`:622-632`);双重安装是 `Fatal{RoleViolation,"callback-double-install"}`(`:337-347`)。
consumer 侧按名直调、绝不回走 `gMGPipeCallbacks`(`ClientSession.cpp:203-206` 注释,防
layer-2 反调)。这套所有制关系本身**没有跨进程问题**,P5f 无需动。
---
## 1 XFB scatter(Espryt)——字节路径已迁移,对象身份仍指回 client
这是 B4 行的本体。当前 HEAD 的传输臂形状(P5c 已落):
- **非 scatter 臂** `ReadbackCapturedRanges`(`DirectGLES.cpp:1602-1684`):transport 下
(`:1616-1656`)按 handle 解析 server 资源(`:1622-1623`)、map 的是 **ES 驱动 buffer**
(`:1626-1629`)、字节经 `OnBufferWriteback` 事件回传(`:1638-1643`),serial/epoch 的
序按 Ops_H_Readback 同款规则(`:1650-1654`)。monolith 臂(`:1658-1680`)仍直接
`target.buffer->WritebackFromBackend`(`:1675`),被 transport 分支的 `continue` 隔开。
- **scatter 臂** `ScatterCapturedRecords`(`:1726-1839`):transport 下预捕获字节读的是
**server 自己的 staged shadow**(`:1776-1794`,含 `RequireStagedCoverage` 覆盖断言
`:1789-1790`),拼好的范围同样经 `OnBufferWriteback` 回传(`:1807-1819`),不再读改写
client shadow。monolith 臂 `target.buffer->MappedData()` / `WritebackFromBackend`
(`:1794`/`:1826`)保留。
**仍触碰 / 依赖 client 内存的残余**(都在 transport 臂上,逐条列):
1. **`scatterProgram` 是 client `ProgramObject` 的 `SharedPtr`,并在 apply 线程上直接调它的
方法。** 来源:`MGB_CTX->GetTransformFeedbackProgram()`(`:1871`,BARRIER_PULLED 字段,
`FieldOwnership.def:106` 记 "P3b/P4b (Espryt), P7 (Magma)"),存进
`XfbObjectState::scatterProgram`(`:1538`、`:1925`)。scatter 时读
`GetTransformFeedbackPackedStride()`(`:1731`)、`GetTransformFeedbackStride()`(`:1766`)、
`GetTransformFeedbackVaryings()`(`:1796`)——**这些都是对 client 对象体的读**,
字节不走 client shadow 了,但 layout 元数据仍从 client 对象上现取。
- 今天为何能工作:同地址空间 + barrier/run-ahead 窗口内对象存活(P5e 的 `ReleaseFillPins`
机制钉住 O 类 SharedPtr,`ClientSession.cpp:1073-1082`)。
- P5f 处置:这是 §2.1 `GetTransformFeedbackProgram` 字段退役(P3b/P4b 债)与 fv 的交集——
scatter 所需的三个 layout 答案应随 XFB span 记录上 wire(值类,可推导),server 侧只留
快照。**分类:P5f(fv,依赖 §2.1 字段的载体判定先行)。**
2. **`XfbCaptureTarget::buffer` 持有 client `BufferObject` 的 `SharedPtr` 跨整个 span**
(`:1511`,填充于 `StartPendingTransformFeedback` 的 `:1890-1901`,后者同时读
BARRIER_PULLED 的 `GetBufferBindingPoint`,`:1891`)。transport 臂只取
`HandleOfBuffer(target.buffer.get())`(`:1622`/`:1779`)——**用 client 裸地址当 registry
键**,落在具名豁免 `MGPipeFrontendKeyedRegistryScope` 内(`Managers.cpp:3063`)。
- 今天为何能工作:同地址空间下地址即身份;scope 把债记名。
- P5f 处置:targets 快照应改持 `{handle, range}` 纯值,地址键探针随 §2.5 registry 重键
(包 `fr`)一起退。**分类:P5f(fr ∩ fv;本身不是字节读写,但跨进程后"client 地址"无意义)。**
3. **`MGB_CTX->GetTransformFeedbackCapturedVertices()`(`:1733`)是 RECORD_SUPPLIED**
(`PipeFieldOwnership.inc:85`,emitter `SetContextValues`,`PipeFill.cpp:3064`),
**不是债**,列出以免后人重复普查。
另外 XFB 整条机制读 `GetBufferBindingPoint`(BARRIER_PULLED,`FieldOwnership.def:80`)的退役
属 §2.1 字段包,fv 不应重复记账,只登记依赖关系。
## 2 `OnBufferWriteback` —— 已接线,blobref 约定闭环(无 P5f 债)
**producer(后端侧,3 处)**,全部以 `Seg = kMGHostSpanSegNone` + host 地址形态交出:
`Managers.cpp:2451-2455`(`Ops_H_Readback`,readback verb 的字节)、
`DirectGLES.cpp:1638-1643`(XFB 非 scatter 臂)、`DirectGLES.cpp:1809-1814`(XFB scatter 臂)。
三处都带"无通道则 MGLOG_E_ONCE 丢弃"的显式降级(如 `:1644-1648`),不是静默。
**producer(会话侧)** `ServerOnBufferWriteback`(`ServerSession.cpp:264-292`):
入参 `Seg != kMGHostSpanSegNone` 即 `Fatal{ProtocolCorruption,"OnBufferWriteback.Seg"}`
(`:266-276`)——**后端边界只接受 host span,段拷贝是这个函数自己的活**;字节 memcpy 进
SEG_EVENT 记录内联尾(`:285-290`)。满环经 `ReserveEventOrBlock`(`:211-262`):
run-ahead 服务器park 等 client 排空(CONTRACT-P5E §2.6 流控),lockstep 服务器
`Fatal{EventRingOverflow}`。整 buffer 大于半环的切片在 client 侧发起处完成
(`BufferObject.cpp:593-612`,`BufferWritebackSliceBytes`)。
**consumer** `DrainEventRing`(`ClientSession.cpp:266-291`):在此构造
`Seg = kSegEvent` + `OffsetInSegment` 的 blobref(`:282-285`),交给
`MGPipeClientOnBufferWriteback`(`ResourceTracker.h:575-638`)——三臂校验齐备:
kSegEvent 经 client 自己的 SegmentTable 界检解析(`:596-617`)、transport 下 host span 即
Fatal(`:584-593`)、其他 Seg 即 Fatal(`:618-624`)。写 client shadow 的是 GL 线程上的
`WritebackFromBackend`(`:636-637`),归属正确。
- 今天为何能工作:约定是**双向 Fatal 执法**的,不只是文档;wire 形态(`Seg=kSegEvent`)
在跨越点被强制。
- P5f 处置:**无**。剩余课题(批处理、epoch 排序、`eventRingFull`/`eventDropped` 的丢弃
策略)都是 P9 的,`EventRing.h:14-16` 与 `CONTRACT-P5C.md §4.4` 已记名。
## 3 `OnXfbScatterReady` —— 声明存在,全仓零接线
仅有声明(`MGPipeCallbacks.h:50`,注释写明设计意图:server 交回 packed scratch、
**client 自己 scatter**,`:48-49`)。grep 全仓无 producer、无 consumer、无对应 EventKind;
`CONTRACT-P5C.md:536` 把它与 `OnTexturePullRequest` 并列记给 P9。
- 今天为何能工作:P5c 选的是另一条路——scatter 留在 server,读 server staged shadow、
结果走 `OnBufferWriteback`(§1)。两条路在语义上互斥地覆盖同一个需求。
- P5f 处置:**无**。是否改走"client scatter"是纯设计/异步化选择(P9 的题材,
`ROADMAP.md:34` P3b/P4b 行也记了"XFB scatter 搬到 client")。若 P9 采纳,§1 的
残余 1/2 自然消解(layout 与 targets 都回到 client 侧)。**分类:P9。**
## 4 `OnGpuWritten` —— Espryt 已净,Magma 有一处响亮但真实的直捅兜底
**Espryt**:`MarkBufferGpuWritten`(`Managers.cpp:3072-3103`)在资源族臂上只发事件
(`:3101-3102`,单条 `kMGPipeWholeBuffer` 全量 range——收窄是 P8/P9 的,
`ResourceTracker.h:646-656` 有 assert 把守形状)。它在 transport 下的三个原调用点已被
P5e 删除或门控:`MarkShaderStorageBuffersGpuWritten` 整体早退(`DirectGLES.cpp:845`,
注释 `:828-844` 说明 client 的 `MarkShaderStorageBindings` 已覆盖同集);
`SyncAtomicCounterBuffers` 的记录臂不标(`:918-924`);
`MarkWritableImageBufferTexturesGpuWritten` transport 下整函数 return(`:3884-3887`)。
client 侧保守集在 `MG_Remote/Client/GpuWritePending.{h,cpp}`(GL 线程自标,窄化通道反向
运行)。**Espryt 无 P5f 债。**
**Magma**:三个站点经 `MGPipeAnnounceBufferGpuWritten` 走回调——
`UniformManager.cpp:1082`(storage texel buffer,Access != READ_ONLY)、
`UniformManager.cpp:1244`(storage block)、`VulkanRenderer.cpp:11778`(XFB capture)。
但 helper 本体(`ResourceTracker.h:710-743`)有两个跨进程不成立的点:
1. handle 来自 **`MGPipeSlots().FindByLifetimeId`(client 分配器探针)**,套在
`MagmaP7AllocatorDebtScope` 具名豁免里(`:717-730`)——P7 债,记名在册。
2. **handle 缺失时的兜底是直捅 client 对象**(`:732-739`:MGLOG_E_ONCE 之后
`bufferObject->MarkGpuWritten()`——apply 线程写 client 内存)。注释说这是"响亮而非
静默"的故意选择;在 P5f 双块演练下这一支会成为真实违规。
- 今天为何能工作:同地址空间;Magma 跑 lockstep(不发布 `kCapRunAheadApply`),
client 停在 barrier 后,直捅恰好安全——ID-132 的那类掩盖。
- P5f 处置:**分类 P5f(fm/fv)**。把兜底从"直捅"改成具名 Fatal 或携带性降级
(例如记 pending 由 client 侧保守集兜底——反正 GpuWritePending 已按绑定走查标过同集,
这个兜底在语义上是冗余保险而非正确性来源);lifetime-id 探针随 Magma 的 §2.2/fm 一并退。
## 5 `OnGlError` —— 已接线,但绕过了回调表;顺序保证是"下一个 drain 点"
**路径不经 `gMGPipeCallbacks.OnGlError`**:该成员声明于 `MGPipeCallbacks.h:29`,
**全仓零安装、零调用**。实际路径是 `PipeInputs::RecordError`(`PipeFill.cpp:2164-2186`)
在 transport 下直接调 `ServerSessionInstance().PostGlError`(`:2175`),后者产
`kEventGlError`(`ServerSession.cpp:709-739`,消息内联、NUL 随带、producer 侧截断到
1024,`EventRing.h:108-115`)。consumer `ClientSession.cpp:330-365` 校验
`MessageBytes != 0` 且 NUL 在位(否则 `Fatal{ProtocolCorruption,"kEventGlError"}`),
在 GL 线程写 client 自己的 `pGLContext->RecordError`(`:353-357`)。
**顺序保证的现状**(任务点名项):所有 producer 都在 apply 线程上、共用同一个 SEG_EVENT
环,所以 **错误事件与 writeback/gpu-written/surface 事件之间保 FIFO**;client 侧的
保证是"**下一个 drain 点观测到**"——保住的是同线程的 error-then-read 程序序,
不保跨 verb 交错。这是写明并接受的局面,不是漏洞:`PipeFill.cpp:2168-2173`、
`ClientSession.cpp:350-352`、`CONTRACT-P5C.md §4.2`(表格第 4 行,`:281`)、
run-ahead 下的松弛在 `CONTRACT-P5E.md:181`。`FieldOwnership.def:164` 的 `RecordError`
行仍挂 BARRIER_PULLED "P9"(`MGP_STICKY_FORWARD_PULL` 宏仍执行、计数仍走 `rsp`),
有序化退役排在 P9。
- 今天为何能工作:错误队列是 client 状态,写它发生在 GL 线程 drain 时(归属正确);
序的保证靠 drain 点分布(§8)而非锁。
- P5f 处置:**本体分类 P9**(有序化、`OnGlError` 回调成员的正式接线)。P5f 只需登记一个
不对称事实:**错误事件不走回调表,因此 §4.1 的双重安装守卫与"十个成员"的记账方式
盖不住它**;若 fv 收口时顺手把 `gMGPipeCallbacks.OnGlError` 也接到
`ServerSession::PostGlError`(或显式标注该成员永不经表),可消除"将来有人调
`OnGlError` 而静默空转"的坑。这是可选的整洁项,不是跨进程缺陷。
## 6 `OnTextureWriteback` / `OnMipLevelsGenerated` —— 零接线,且今天的 Espryt 不需要它们
全仓零 producer / consumer / EventKind。核查它们"本该服务"的路径在 transport 下的现状:
- `glGenerateMipmap`(Espryt):transport 下走记录臂(`DirectGLES.cpp:12093-12117` →
`GenerateMipmapByRecord :12037-12081`),纹理由 `VerbMipRes` 句柄解析,存储形状由
**前端自己分配**、server 侧只做描述符核验(`EnsureGenerateMipmapStorageDescribed`,
`:11040`起)——这正是 `OnMipLevelsGenerated` 注释里"SHAPE ONLY, client owns the CPU
shadow"(`MGPipeCallbacks.h:39-41`)想要的形态,只是由"前端先行分配"实现而非事件通知。
- 唯一真正需要 texel 回流的是 RGB16F/RGB32F 的 CPU filter
(`GenerateThreeChannelFloatMipmapOnCpu` 读改写 client level shadow):transport 下已被
具名拒绝 `MGPipeUnmigratedEmulation("generate-mipmap-cpu-filter")`(`:12051-12056`),
记录保持 barriered(`:12030-12036` 注释)。**它就是 `OnTexturePullRequest` /
`OnTextureWriteback` 的未来用户**,`CONTRACT-P5B.md:255/:379` 也这么记。
- Magma 侧 mip 直写 client level 存储是 T5(`ROADMAP` §2.2 引用
`VulkanRenderer.cpp:1562-1590` 一带),属包 `fm`,此处只登记交叉。
- P5f 处置:**无**。**分类:P9**(纹理拉取与 texel 回写通道的建设);T5 归 fm。
## 7 `OnTexturePullRequest` 与终止符 `ResourceSubDataComplete` —— 整条未建
零 producer。终止符 `ResourceSubDataComplete` 有 wire 位(opcode 50,
`PipeCalls.def:229`、`PipeWire.inc:122`)但 **applier 是显式空 stub**:
`PipeWireCodec.cpp:2070-2073`("There is no client producer and no applier; the
reverse channel is P7/P9",`return false`)。`PipeCatalogueTest.cpp:1425` 注释同样记为
later phase。
- 今天为何能工作:缩减路径上没有纹理重铸(recast)场景;唯一会需要的 CPU filter 已被
具名拒绝(§6)。
- P5f 处置:**无**。**分类:P9**(`ROADMAP.md:37` P9 行"纹理拉取四条缓解 + 终止符")。
## 8 排空点清单(顺序保证的现实基础,P5f 不需要动)
`kEventGlError` 与所有事件的"下一个 drain 点"具体是(全部在 GL 线程):
`ClientSession.cpp:170`(事件积压唤醒的二级退出)、`:908`(SEG_CMD 空间等待出口)、
`:1071`(`EmitAndWait` barrier 之后——主排空点,注释 `:1066-1070`)、`:1206`
(`WaitForApplyToCatchUp`,run-ahead 强制对齐)、`:1256`/`:1269`(present credit 等待)、
`:1456`(公共 `DrainEvents`);另有第二类:阻塞式 EGL 生命周期 RPC 返回处
(`CONTRACT-P5C.md §4.1`,`:263-272`)。每个等待出口都排空是 P5e 流控死锁论证的支柱
(`:1202-1206`)。**这些是全值的拆分机语义,跨进程成立,P5f 无处置。**
## 9 SEG_EVENT blobref 约定核验结论(任务点名项)
约定(`CONTRACT-P5C.md:54`):wire 上的 `OnBufferWriteback` blobref 必须
`Seg = kSegEvent` + 段内偏移,**永不**是 host 地址;monolith 下保持 `kMGHostSpanSegNone`。
逐环核验:**约定被所有 producer 遵守,且每一环都有执法**——
1. 后端 → 会话:3 处 producer 全部交 `kMGHostSpanSegNone` host span(§2);
2. 会话入口:`Seg` 检查是 Fatal(`ServerSession.cpp:266-276`);
3. wire 形态构造:只有 `DrainEventRing` 一处造 `kSegEvent` blobref(`ClientSession.cpp:282-285`);
4. consumer 三臂:kSegEvent 界检解析 / host span 在 transport 下 Fatal / 其他 Fatal
(`ResourceTracker.h:583-624`)。
**无违规、无缺口。**
## 10 汇总
| # | 站点 | 触碰 client 内存? | 分类 |
|---|---|---|---|
| 1 | XFB scatter 字节路径(Espryt) | 否(P5c 已改走 server shadow + writeback 事件) | 无债 |
| 2 | XFB `scatterProgram`(client ProgramObject 的 SharedPtr,apply 线程直读 layout) | **是(读)** | **P5f(fv,依赖 §2.1 `GetTransformFeedbackProgram` 载体判定)** |
| 3 | XFB `targets` 持 client BufferObject SharedPtr + `HandleOfBuffer` 地址键探针 | 身份依赖(不读字节) | **P5f(fr ∩ fv)** |
| 4 | `OnBufferWriteback` 全链 | 否 | 无债(批处理/排序归 P9) |
| 5 | `OnXfbScatterReady` | —(零接线) | P9 |
| 6 | `OnGpuWritten` Espryt 臂 | 否 | 无债(收窄归 P9) |
| 7 | `OnGpuWritten` Magma 兜底(handle 缺失时直捅 `MarkGpuWritten`) | **是(写,响亮兜底)** | **P5f(fm/fv)** |
| 8 | `OnGlError`(`RecordError` → `kEventGlError`) | 否(GL 线程写 client 队列) | 有序化归 P9;回调表不对称是可登记的小项 |
| 9 | `OnTextureWriteback` / `OnMipLevelsGenerated` | —(零接线;唯一用户被具名拒绝) | P9 |
| 10 | `OnTexturePullRequest` + 终止符 | —(整条未建) | P9 |
| 11 | `OnSurfaceChanged` 全链(Espryt `:14959-14970` / Magma `SwapchainObject.cpp:324-339` → `ClientSession.cpp:211-252`) | 否(GL 线程写 client `pDefaultFramebufferInfo`,R3 归属正确) | 无债 |
| 12 | `OnCapsInvalidated` / `OnLog` | —(零接线;前者由 R-12 重发布取代) | P9/无需 |
**P5f 实收三条**(#2、#3、#7),全部集中在 XFB 对象身份与 Magma 兜底;反向通道的
**字节面在 P5c 之后已经干净**。monolith 臂上的直写点(`DirectGLES.cpp:1675/:1826/:12820/
:14391/:14806`、`Utils.cpp:2398`、`Managers.cpp:2025`)逐一核过:transport 下或被
`#else` 臂隔开,或被 client 侧具名拒绝把门(`EmitTables.cpp:976-980` 的
`UnmigratedVerbFatal("ReadPixels+PACK_BUFFER")`、`PipeWireCodec.cpp:2105-2108` 的
`GetTextureImage` class-C 拒绝),均不可达,不构成 P5f 项(其中 `ReadPixels` 服务器臂对
`GetBufferBindingSlot(PixelPack)` 的残余读,`DirectGLES.cpp:14337`,属 §2.1
`GetBufferBindingSlot` 行 "P9 (readback)",不在本清单重复记账)。
+305
View File
@@ -0,0 +1,305 @@
# P5f f0 普查(只读):进程级静态量中语义属于 per-context / per-session 的成员
> 基线:`feat/disaggregated @ 8b68b92c`(代码头 `25fba0d5`,其后提交仅动文档)。
> 范围:`MobileGL/` 下 `MG_Backend`(DirectGLES / DirectVulkan / MGPipe)、`MG_Impl`、`MG_Pipe`、
> `MG_Remote`、`MG_State`。方法:`g_`/`s_` 前缀可变全局、函数级 `static`、`inline X& = *new X()`
> 单例、命名空间级非常量变量的全面 grep,再逐族读代码确认键控方式与重置时机。
> 本报告只读产生;未修改任何代码、未构建、未跑测试。
## 0. 判定框架
P5f 关心的是「换一个地址空间还成立吗」的一个变体:**这个静态量的语义寿命跟谁走**。
| 分类 | 含义 |
|---|---|
| **【A】P5f 必须按角色+世代分区** | 语义属于某个 GL context / session,且当前的重置时机挂在错误的钟上(或不挂任何钟),f1 双块演练下必须暴露 |
| **【B】进程级即可** | 拆进程后每个进程自然各有一份,且持有者在 spawn 后唯一(server 独有 / client 独有),或纯诊断/配置 |
| **【C】已是 per-context / per-session** | 已有世代键控自失效或已有 per-session 重置机制,只需 f1 确认 |
| **【D】未知** | 只读普查不足以判定,标出待 f1/后续包回答的问题 |
一条贯穿全报告的事实先记住:**拆进程后 Espryt/Magma 后端代码只在 server 进程运行,MG_Impl 只在
client 进程运行**(P5F-WIRE-COMPLETENESS.md §1.4:「MG_Impl 根本不在 server 进程里」)。所以
`MG_Backend` 下的静态量天然只需 server 一份、`MG_Impl` 下的天然只需 client 一份——**单看拆进程,
绝大多数成员是安全的**。真正的缺陷集中在两类:(1) 重置时机挂错钟(挂 server 自己的钟,而语义属于
client context 世代);(2) 静态量里存着 client 对象的指针/SharedPtr。
## 1. 已知成员的核实与重置时机
### S1 `g_syncedRenderStateParameters` 家族 —— 【A】
- 证据:`MG_Backend/DirectGLES/DirectGLES.cpp:4584-4617`,同族 `g_syncedRenderStateVersion`、
`g_hasSyncedRenderState`、`g_syncedBackendViewport`、`g_syncedBackendScissorBox`、
`g_syncedSrgbFramebufferWrites`、`g_forceFullRenderStateResync`、`g_syncedColorMaskAlphaWidenMask`、
`g_dualSourceDeclinedBlendStates`。
- 语义:「后端 ES context 上当前已推下去的渲染状态」的影子,diff 对象是**前端**
`RenderStateParameters` 的版本与字节(`DirectGLES.cpp:4629-4660`)。即 per-(client context ×
server ES context) 的乘积状态。
- **重置时机**:`RenderStateImpl::InvalidateSyncedRenderState()`(`DirectGLES.cpp:4618-4623`,置
`g_forceFullRenderStateResync=true` 并清空四个影子)。调用点两个:
(a) `DirectGLES::MakeCurrent()` 尾部(`DirectGLES.cpp:15375`)——每次 backend make-current;
(b) viewport-routing 回放收尾(`DirectGLES.cpp:7930`)。注意 `DestroyEGLContext()`
(`DirectGLES.cpp:15896-15912`)的清理清单**不含**它——靠「新 context 必经 MakeCurrent」兜底。
- 今天为何能工作:inproc 单进程,ES context 与 client context 同在;ID-67 裁定「相同 tuple 的
make-current 跳过 native bind」,但 `BackendObject_DirectGLES.cpp:40-42` 的注释写明不同 virtual
context 仍进 `MakeCurrent`,七个缓存在那里统一失效。
- P5f 处置建议:拆进程后只有 server 持有、重置挂在 server 自己的 MakeCurrent 上,跨进程方向成立;
但 (1) f1 双块下必须把它归入 server 角色的块,使 push-monolith 臂与 server 臂不共享;(2) 待验证点:
server ES context 换代(`g_backendContextGeneration` 在 `DirectGLES.cpp:15912` 自增)而 client
tuple 不变时,`MakeCurrent` 是否仍被调用——若是则靠 :15375 兜住,若否则此家族缺一条挂
`g_backendContextGeneration` 的失效线。**该点只读无法定论,标为待 f1 双块回答。**
### S2 `ScopedDefaultUnpackState::s_synced` 家族 —— 【A】(全清单里最弱的一个)
- 证据:`MG_Backend/DirectGLES/Managers.cpp:6258-6325`。类内 `static inline` 成员:
`s_synced`(:6319)、`s_alignment/s_rowLength/s_skipRows/s_skipPixels/s_imageHeight/s_skipImages`
(:6320-6325)。
- 语义:后端 ES context 的 GL_UNPACK_* 像素存储状态影子(纹理上传路径的 save/restore)。
- **重置时机:没有。** `s_synced` 在 `EnsureShadowSynced()`(:6283-6300)里一次性置 true 后**永不
清除**;`grep` 确认它不在 `DestroyEGLContext()`(`DirectGLES.cpp:15896-15912`)的清理清单里,
也不在任何 `Invalidate*` 里(`PixelStoreImpl::InvalidatePackStateCache`
(`Managers.cpp:11565-11567`)只动 PACK 侧的 `g_packState`)。
- 今天为何能工作:两层巧合——(a) 本类是唯一写者且析构恒恢复到 resting default (4,0,0,0,0,0)
(类注释 :6250-6257);(b) 新 ES context 的 GL 默认值恰好等于该 resting default,故 ES context
销毁重建后影子「恰好仍对」。CONTRACT-P5C.md:538-539 已把它与 S1 一起记为 P6 的债,P5f §2.4 收回。
- P5f 处置建议:把 `s_synced=false` 挂进 `DestroyEGLContext` 的清理清单(或挂
`g_backendContextGeneration` 比较),这是「进程级静态无世代重置」的最小确定样本;f1 双块下归入
server 块。
## 2. 新发现
### S3 后端 memo/影子大家族:键控 (client 上下文 id/serial, `g_backendContextGeneration`),自失效 —— 【C】
Espryt 的 per-draw memo 几乎全部自带双键:前端侧键(`ContextId`/`ContextSerial`/内容哈希)加
`g_backendContextGeneration`(`DirectGLES.cpp:15912` 处自增)。全部成员(grep 命中的完整枚举):
| 成员 | 位置 | 键 / 重置 |
|---|---|---|
| `g_observedUnitBindings` 等 5 个 | DirectGLES.cpp:2767-2771 | (contextId, bind generation, maxUnit) 三重门,见 :2773-2782 注释 |
| `g_unitTextureSyncListByHandle*` 7 个 | DirectGLES.cpp:3002-3008 | 记录臂:(ContextSerial, ViewsSerial, g_backendContextGeneration),:3372/:3404 |
| `g_unitTextureSyncList*` 7 个 | DirectGLES.cpp:3010-3016 | 前端臂:(ContextId, epoch, generation),:3420/:3464 |
| `g_fboTextureSyncList*` 8 个 | DirectGLES.cpp:3046-3066 | {Fbo, ContentHash, ContextSerial, g_backendContextGeneration},:3522/:3550 |
| `g_fboAttachmentSyncList*` 6 个 | DirectGLES.cpp:3073-3078 | 同上,:3231/:3236 |
| `g_readFboAttachmentSyncList*` 6 个 | DirectGLES.cpp:3082-3087 | :3249/:3254 |
| `g_readFboTextureSyncList*` 8 个 | DirectGLES.cpp:3182-3189 | :3299/:3330 |
| `g_imageSweep*` 7 个 | DirectGLES.cpp:4013-4024 | 记录臂三 serial + generation,:4074-4094;前端臂 :4088 |
| `g_unitSamplerWalk*` 5 个 | DirectGLES.cpp:6627-6631 | (contextId, epoch, maxUnit, generation) + 行 memcmp,:6640/:6770 |
| `g_resolvedTextureBindingMemos` + cursor | DirectGLES.cpp:6859-6860 | 每 program 4 槽 round-robin memo,键含 lifetime id(:6921-6940) |
| `g_fboSyncedSerials` / `g_fboRecordsTrusted` | DirectGLES.cpp:4137 / :4146 | `InvalidateFramebufferHandleArmMemos()`(:4161-4164),挂 `InvalidateFramebufferBindingCache`(Managers.cpp:9726)→ MakeCurrent(:15367)与 DestroyEGLContext(:15903-15905) |
| broadcast memo 7 个 | DirectGLES.cpp:5324-5350 | `PrgramImpl::InvalidateBroadcastMemo()`(:5358),挂 MakeCurrent(:15364)与 DestroyEGLContext(:15909) |
| `g_currentDrawFrontendProgram`/`g_currentDrawBackendProgram`/`g_currentDrawProgramHandle` | DirectGLES.cpp:5300-5313 | 每次 PrepareForDraw/Compute 顶部重写(:5291-5298 注释) |
| `g_passes`/`g_passCount`/`g_routedProgram` | DirectGLES.cpp:7779-7780 | 每次 replay 收尾清零(:7915-7924) |
- 今天为何能工作:双键俱备且失效方向保守(键不符即重建);`MGPipeApplierReset()` 在 context 切换
时清空 applier 的记录表,令 `ContextSerial`/记录哈希侧的键同时移动(DirectGLES.cpp:1022-1029
的注释即此论证)。
- P5f 处置建议:**进程级即可,不新增机制**。spawn 后只有 server 跑 Espryt;记录臂的键全部来自
applier 自己的 serial(APPLIER_DERIVED),不依赖 client 内存。f1 双块只需验证 client 角色下无人
读写它们(双块会把这种访问变成具名红)。
### S4 纯 server-ES-context 状态(绑定影子 / scratch / 池 / 环 / EGL 句柄)—— 【B】
描述的是 server 自己的 ES context 或 renderer,不携带任何 client 身份。重置统一挂在
`DestroyEGLContext()`(`DirectGLES.cpp:15896-15912`,依次调 `BufferImpl::OnBackendContextDestroyed`
(Managers.cpp:3146)、`XfbImpl::OnBackendContextDestroyed`(DirectGLES.cpp:2067-2074)、
`MultiDrawImpl::OnBackendContextDestroyed`(MultiDraw.cpp:1086)、`OnRestartSubstitutionContextDestroyed`、
`ScratchFBOImpl::OnBackendContextDestroyed`(Managers.cpp:11509)、`ReleasePackedWordScratchTexture`
(DirectGLES.cpp:14150-14155))与 `MakeCurrent()` 的 Invalidate 序列(:15363-15375):
- DirectGLES.cpp:`g_Display/g_Context/g_Surface/g_Config`(:14834-14837,后端唯一 ES context
句柄)、`g_requestedSwapInterval`(:15229,per-surface,surface 重建时重放)、
`g_backendContextOwnerThread`(:15289)、`g_syncContextGeneration`(:15295)、frame fence 环
(:15304-15312)、`g_eglVerifiedFrameSerial/g_eglVerifiedContextGeneration`(:15415-15416)、
resolve scratch(:9462-9467,自含世代守卫 :9488)、`ReplicateBlitImpl`(:9777-9789,守卫 :9851)、
`DepthStencilSamplingReadImpl`(:12876-12911,守卫 :12941)、packed-word scratch
(:14101-14103)、restart scratch(:8395-8396)、`g_writableImageBufferUnits/g_writableImageBufferUnitCount`
(:3605-3607)与 `g_imageUnitHighWaterMark`(:3633,自恢复语义见 :3600-3604 注释)。
- Managers.cpp:`g_backendContextGeneration`(:68)、绑定影子(:811-822、:3777-3791、
:4790-4791、:9578-9582 `g_activeTextureUnit`/`g_boundTexturesCache`、:11520-11521 pack 影子)、
`g_bufferContextGeneration`(:826)、deferred releases(:852-857)、buffer pool(:873-875)、
三条 persistent ring(:1017-1039)、`g_backendBufferResources`(:2873)、`g_bufferBackendIdGeneration`
(:3108)、`g_backendSamplerViews`(:4649)、`g_pendingFetchBaseInstance`(:4850)、alpha/integer
mask(:9929-9930)、`g_attachmentBackendIdGeneration`(:11277)、scratch FBO(:11283-11287)、
program 影子(:11571-11574)。
- MultiDraw.cpp:scratch 组(:329-344)、tier 解析(:464-466)、`g_announcedTiers`(:483)。
- BackendObject_DirectGLES.cpp:54-58:native bind 影子,注释自述「Process-wide like the native
state it mirrors; under split exactly one DirectGLES object exists (the server's)」。
- 处置建议:进程级即可;唯一待办是 f1 双块下确认 client 角色不触碰(EsprytSlotTablesEnabled 等
latch 已在拆分臂下拒绝)。
### S5 `TwinLookupMemo` 三件套 + `g_fbSlotCache*`(legacy 臂)—— 【B】,含一条 D
- 证据:DirectGLES.cpp:143-152(`g_vaoTwinLookupMemo`/`g_programTwinLookupMemo`/`g_fboTwinLookupMemo`,
仅 `MOBILEGL_PIPE_LEGACY_MEMOS` 编译)、:167-168(`g_fbSlotCacheContext`/`g_fbSlotCache`,pull 或
legacy 臂编译)。
- 语义:以前端对象地址为键的 memo——**per-client-context 语义**,因为键是 client 堆地址。
- 今天为何能工作:memo 注释(:88-102)论证 registry 条目跨 ES context 存活、弱指针防地址复用;
`g_fbSlotCache` 以 context 裸指针为键、指针比较即失效(:155-163)。
- P5f 处置建议:拆进程后 server 进程没有 client 对象,这两条臂在 server 上根本不编译/不被选中
(句柄臂取代);进程级即可。但留一条【D】:push-monolith 构建下它们仍在运行,若 f1 双块让
monolith 臂与 server 臂同进程共存,这两个 memo 属于 client 角色块——f1 的归属判定要覆盖它们。
### S6 XfbImpl 家族:map 里存 client 对象的 SharedPtr —— 【A】
- 证据:`g_xfbObjects`(`DirectGLES.cpp:1548`)、`g_currentXfbName`/`g_currentXfbState`
(:1549/:1558)、`g_scatterBufferId/g_scatterBufferSize`(:1545-1546)。`XfbObjectState` 持有
`SharedPtr<MG_State::GLState::BufferObject> buffer`(:1511)与
`SharedPtr<MG_State::GLState::ProgramObject> scatterProgram`(:1538)。
- 语义:按前端 XFB 对象名键控的捕获状态——per-client-context 语义,且**值里嵌着 client 对象指针**。
- 重置时机:`XfbImpl::OnBackendContextDestroyed()`(:2067-2074)清表——只随 server ES context
销毁走,**不随 client context 世代走**。
- 今天为何能工作:同地址空间 + lockstep;P5c 已把 XFB scatter 的读改到 server staged shadow,但
这个 map 的 SharedPtr 成员本身仍在。
- P5f 处置建议:此项同时落在 §2.6(反向通道触碰 client 内存)的 fv 包里;从静态量角度它必须
按角色+世代分区,且成员里的 `SharedPtr` 要在 spawn 前换成句柄或 server 侧对象——与 T5 同类的
跨角色持指针。
### S7 `g_rawDepthFetchSamplerState`/`g_rawDepthFetchSamplerBackend` —— 【D】
- 证据:DirectGLES.cpp:72-73;惰性构造于 `GetRawDepthFetchSampler()`(:301-313),**无重置点**。
- 语义:raw-depth-fetch 替代的 server 自建 frontend SamplerObject 及其 backend twin(P4a D-F3 具名
保留,:284-300 注释)。
- 今天为何能工作:内容是不可变常量(构造即定型),`SyncToBackend` 每次调用重同步。
- P5f 处置建议:跨进程后 server 自建自持有,方向成立;但 `BackendSamplerObject` 内部是否持有
driver sampler id(若是,则 ES context 换代后失效无人清)只读未确认——**未知**,留给 fs 包顺手
回答(一行 grep `BackendSamplerObject` 的成员即可)。
### S8 `g_anyProgramRoutesViewportIndex` —— 【B】,附注
- 证据:Managers.cpp:87;置位点 :14028(program link),**只升不降,无重置**。
- 语义:「本进程编译过的 program 里是否有任何一个路由 viewport index」的 latch。
- 今天为何能工作:方向保守——latch 卡在 true 只会多做 viewport routing 检查,不会错画面。
- P5f 处置建议:进程级即可(per-server-进程的程序集合属性);不需修,仅记录它是「无重置 latch」
家族的一员。
### S9 `g_bufferMutationEpoch` —— 【C】(已被角色守卫钉在 server 侧)
- 证据:Managers.cpp:834;bump 点全在 `Ops_*Tracked` 与 DirectGLES 的 6 处
(DirectGLES.cpp:1654/:1679/:1828/:12828/:14393/:14808);P5e 已加
`Fatal{RoleViolation, "CurrentBufferMutationEpoch"}` 守卫(Managers.cpp:2853)把 GL 线程 bump
钉死(仅 bring-up 例外,:2811-2830 注释),并有 `g_bufferMutationEpochBumpsOffTheApplyThread`
(:2803)计数供测试断言为零。
- 语义:memo 干净探针的跳过时钟;语义上「谁的 buffer 变了」是 client 事件,但 P5e 已裁定 bump 只
发生在 apply 线程(server 角色)。
- P5f 处置建议:已是角色正确;进程级即可。f1 双块下它归入 server 块。
### S10 Magma(DirectVulkan)—— 【B】
- `g_rendererGeneration`(DirectVulkan.cpp:44):per-renderer 世代,renderer 重建时
`BumpRendererGeneration()`(:51-53);server 独有。
- `g_activeBufferManager`(Renderer/VkBufferManager.cpp:56):当前 renderer 的 manager 指针;
server 独有。
- `g_dynamicStateShadow`(Renderer/VulkanRenderer.cpp:409):Vulkan 动态状态影子,per-renderer。
- `s_warnedHalfTessellatedPipeline`(PipelineFactory.cpp:528)、`s_warnedInstanceIndexUnsupported`
(ProgramFactory.cpp:2635):log-once,进程级。
- 注:VulkanRenderer.h:718-730 的 `s_vkResetQueryPool` 等是**类成员**(无 `static`),不在普查范围。
- 处置建议:进程级即可。Magma 臂的 lockstep 掩盖问题属 §2.2(fm 包),静态量本身无跨角色语义。
### S11 MG_Impl/Pipe 的 client 侧单例群(16 个 Instance() 泄漏单例 + PipeFill 静态)—— 【B】
- 证据:`MG_Impl/Pipe/` 下 `CompositeResolver.h:266`、`CsoCache.h:202`、`FramebufferEmit.h:656`、
`ImageEmit.h:194`、`PipeFill.cpp:1711`(publication latch)、`ProgramEmit.h:725`、
`ResourceTracker.h:550`、`SamplerEmit.h:522`(cso cache)/`:679`(opaque units)/`:1082`、
`SetHashSuppressor.h:130`、`ShaderBufferEmit.h:273`、`SlotAllocator.cpp:433`、`TextureEmit.h:1344`、
`Tracker.h:932`、`VertexInputEmit.h:441`;`CsoCache.h:129` `s_hashForTest`(测试钩子)。
- PipeFill.cpp 的命名空间静态:`g_lastFillWasBarriered`(:486)、`g_omission` 三件套(:509-511,
verify 旋钮)、`g_snapshot`/`g_readScratch`(:565-566,verify 双臂)、`g_verify`(:591)、
`g_deferredDestroy*`(:1166-1168)、`g_fillPlan`(:2822)、`g_attribDefaultRepairs`(:2942)、
`g_attribDefaultLastHeader`(:2949)、`g_residualDue`(:3152)、verify 探针 `probe`(:2664)。
- 语义:per-client-context/session 的发射与追踪状态。
- 重置时机:make-current 边沿(`tracker.FreshlyPrimed()`,`PipeFill.cpp:2654-2667`;该处同时是
`applier_reset` 记录的 producer,并做 client 侧的 CsoCache / hash suppressor / vertex-input
emitter 重置,CONTRACT-P5C §5.1)。
- 今天为何能工作:单 client、单 context/session(P5c 裁定每 session 恰一个 context)。
- P5f 处置建议:进程级即可——spawn 后它们只存在于 client 进程;f1 双块时归入 client 块。多
context 是 P6+ 的形状,`MGPApplierReset::ContextSerial` 的注释(CONTRACT-P5C §1)已写明。
### S12 `MG_Impl/GLImpl` 的 query/sync 注册表 —— 【B】,含一条多 context 语义债
- 证据:`GL_Query.cpp:55-66`(`g_queryObjectsMutex`/`g_liveQueryObjects`/`g_nextQueryId` 与四个
active-query id + pipeline-statistics map)、`GL_Sync.cpp:34-37`(`g_syncObjectsMutex`/
`g_liveSyncObjects`)。
- 语义:GL 对象(query/sync)按规范是 per-context 的,这里存成进程级注册表。
- 今天为何能工作:单 context/单 session;mutex 防多 JVM 线程迁移(:50-54 注释)。
- P5f 处置建议:拆进程后天然在 client 进程,进程级即可;但「语义 per-context、存储 per-process」
这一事实记入 P6+ 多 context 债(与 S11 同一形状)。
### S13 MG_Remote 会话单例与跨角色标量 —— 混合
- `ClientSession::g_active`(Client/ClientSession.cpp:48)、`ServerSession::g_active`
(Server/ServerSession.cpp:349)、`ServerLoop` 单例(Server/ServerLoop.cpp:774):每进程一个
session 是设计本身——【B】。
- `g_applyThreadInsideApplier`(Client/ClientSession.cpp:118):**inproc 下 server 写、client 读的
跨角色共享原子**,语义 per-session。CONTRACT-P5C §6(A1)已具名其为 barrier 簿记。拆进程后
client 那份恒 false,但它是 wait-rule 机制的一部分而非状态内容——【A】:f1 双块/角色分区时必须
按角色拆开,否则会漏掉「client 读自己那份永远 false」的假绿。同址的 `thread_local
g_inBarrierWait`(:117)是 client 线程本地,【B】。
- `WireTables.cpp:91-104`(`g_emitted`/`g_declined`/`g_clientTablesUninstalled`)、
`WireTables.cpp:642`(`g_applierResetContextSerial`,per-session 计数器,client 侧)、
`EmitTables.cpp:91-96`(drop 旋钮与 `g_presentOrdinal`/`g_publishedMaxRecordBytes`)、
`EmitTables.cpp:1543`(`g_fenceMutex`)、`EmitTables.cpp:711`(发射 scratch)、
`CapsMirror.cpp:34-40`(hook + 计数器)、`CapsMirror.cpp:169`(单例)、
`GpuWritePending.cpp:171`(producer marks)、`PersistentMapTracker.cpp:85-136`(SIGSEGV 追踪):
全部 client 侧,【B】。
- `PipeWireCodec.cpp:347` `g_processResolverTable`:本进程段表指针,每进程各一份即正确,【B】;
同文件 :355 的 `t_activeDecoder` 是 thread_local,已是 per-thread。
- `ServerLoop.h:126` `g_applyThreadKey`:server 线程身份戳,【B】。
- `StagedShadowStore` 单例(Managers.cpp:1160-1165):server 侧暂存影子,注释自述「ONE PER
PROCESS」,【B】。
- Transport 的 `g_spinItersPerUs`(Doorbell.cpp:37)、`g_shmCounter`(ShmSegmentPosix.cpp:47)、
`g_sectionCounter`(ShmSegmentWin32.cpp:36):进程级校准/命名计数器,【B】。
### S14 MG_Pipe 核心 —— 已知项定位
- `gPipeInputs`(MG_Backend/MGPipe/PipeInputs.h:835):P5f §1 的主对象,双块机制(§4)就是为它造
的;不重述。
- `g_applier`(MG_Pipe/PipeApply.cpp:433):server-private(CONTRACT-P5C §5.1 裁定),重置经
`applier_reset` 记录(opcode 77,`MGPipeApplierReset()`,`PipeApply.cpp:1202-1300`)——【C】
已是 per-session。
- `PipeRoute.cpp:63-69`(`g_arm`/`g_monolithScreen`/`g_monolithContext`/`g_monolithEscapes`):
路由表与配置,【B】。
- `PipeInputs.cpp:55` `g_residualPulls`:诊断计数器(rsp),server 侧读,【B】。
### S15 MG_State —— 【B】
- 七个 lifetime-id 分配器(BufferObject.cpp:31、RenderbufferObject.cpp:25、
FramebufferObject.cpp:20、ProgramObject.cpp:27、SamplerObject.cpp:20、TextureObject.cpp:26、
VertexArrayObject.cpp:18)与 `s_nextTextureStateContextId`(TextureState.cpp:24):client 侧单调
分配器;spawn 后只存在于 client 进程,句柄经记录过线,进程级即可。
- `g_stateObjectDeathOps`(StateObjectDeathNotice.h:52)、`g_bufferBackendOps`
(BufferObject.cpp:79):进程级函数表,【B】。
- `g_textureLegacyArmScopeDepth`(MipmapStorage.cpp:112)、`g_magmaP7AllocatorDebtScopeDepth`
(SlotAllocator.cpp:118)、`g_frontendKeyedRegistryScopeDepth`(SlotAllocator.cpp:143):P5c 具名
豁免 scope 的深度计数,守卫簿记而非状态,【B】。
- `ProgramSpirvTask.cpp:35-36`:log-once atomic_flag,【B】。
- `MG_Impl/NSOpenGLImpl/NSOpenGLImpl.cpp:32-33`:macOS IMP 缓存,与拆分无关,【B】。
## 3. 汇总
| 分类 | 条目 |
|---|---|
| 【A】P5f 必须按角色+世代分区 | S1(g_syncedRenderStateParameters 家族)、S2(s_synced 家族)、S6(XfbImpl)、S13 中的 `g_applyThreadInsideApplier` |
| 【B】进程级即可 | S4、S5(附一条 D)、S8、S10、S11、S12(附多 context 债)、S13 大部、S14 的 PipeRoute/rsp、S15 |
| 【C】已是 per-context/per-session | S3(自失效双键)、S9(角色守卫已钉)、S14 的 `g_applier` |
| 【D】未知 | S7(BackendSamplerObject 是否持 driver id);S1 的「ES context 换代且 tuple 不变时 MakeCurrent 是否仍被调用」 |
**最重要的三条结论**:
1. **两个已知成员里,`ScopedDefaultUnpackState::s_synced` 比 `g_syncedRenderStateParameters` 弱得多**:
前者没有任何重置点(`Managers.cpp:6319` 一次置位永不清,不在 `DestroyEGLContext` 清单里),正确性
靠「新 ES context 的 GL 默认值恰好等于影子值」的巧合;后者有 `MakeCurrent()`(DirectGLES.cpp:15375)
的每次强制全量重推兜底,但兜底链条上「tuple 相同而 ES context 换代」一格只读无法确认(D 项)。
2. **Espryt 的 per-draw memo 大家族(S3)已经自带 (client 键, `g_backendContextGeneration`) 双键
自失效,是本普查中最大的一类,且全部不需要新机制**——f1 双块对它们只需证明 client 角色不触碰。
P5f §2.4 的「完整清单未知」可以收口为:真正缺世代钟的只有 S2、S6、S7 三个小点。
3. **S6(`g_xfbObjects` 持有 client 对象 `SharedPtr`,DirectGLES.cpp:1511/:1538/:1548)是本次普查
新发现的、唯一一个「进程级 map 的值里嵌 client 指针」的成员**,重置只挂 server ES context 销毁
(:2067-2074),同时属于 §2.6 fv 包的范畴——两个包的清单里都应有它。
### 附:普查方法的可复现性
```
grep -rn -E '^\s*(inline\s+)?(static\s+)?[A-Za-z_][A-Za-z0-9_:<>,\s\*&]*[ \*&](g_|s_)[A-Za-z_0-9]+\s*(=[^=]|\[|\{|;)' \
MG_Backend MG_Impl MG_Pipe MG_Remote MG_State --include='*.cpp' --include='*.h'
# 加上 '= *new ' / 'Instance()' 单例模式的第二轮 grep;全部命中均已人工过目并归入上表。
# 3rdparty/ 子模块不在范围内(其 git 报错为既有噪音)。
```
+186
View File
@@ -0,0 +1,186 @@
# P5f / f1 — 双块演练机制:落地报告
> 落地于 `feat/disaggregated`,代码提交 `cfcc12f7`(机制 + 测试 + 车道 + 脚本),
> 棘轮初版与本报告随文档提交。WSL 门树 `~/w7/p5f-f1`(branch `p5f/f1`),
> 对照基线树 `~/w7/p5f-base` @ `e75e00cb`。设计输入:`f0-dualblock-recon.md`。
> 旋钮 `MOBILEGL_IPC_ROLE_SPLIT_STATE` 默认关;关时两臂折成同一块,行为逐字节不变(G1 实测见下)。
---
## 1 落地内容
| 文件 | 内容 |
|---|---|
| `MobileGL/Config.h` | `IpcTable::RoleSplitState`(`MOBILEGL_IPC_ROLE_SPLIT_STATE`),只在 `MOBILEGL_BUILD_DISAGGREGATED` 闭包里 |
| `MobileGL/ConfigLoader.cpp` | `InitIpc()` 解析该旋钮;与 `MOBILEGL_PIPE_VERIFY` 互斥(强制关 + 一行 WARN,照 `RunAhead` 的形状);进 IPC 汇总日志行 |
| `MobileGL/MG_Backend/MGPipe/PipeInputs.h` | `gPipeInputsClientBlock`(leak-at-exit,同 `gPipeInputs` 的论证);`MGPipeRoleSplitActive()` / `MGPipeClientInputs()` / `MGPipeClientClearVerbBoundary()` / `MGPipeServerBlockNoteIdentity()` 声明;非 disagg 的 push 构建里 `MGPipeClientInputs()` 是折回 `gPipeInputs` 的 inline |
| `MobileGL/MG_Backend/MGPipe/PipeInputs.cpp` | 四个函数的定义;**机关**:`CountBarrierPull` 在 `MGPipeRoleSplitActive()` 时无条件 `StrictBarrierPullFatal(field, verb, "MOBILEGL_IPC_ROLE_SPLIT_STATE=1")`——先于设障判定、先于 strict 旋钮、先于计数器;`MGPipeServerStampVerbBoundary` 末尾调 `MGPipeServerBlockNoteIdentity()` |
| `MobileGL/MG_Impl/Pipe/PipeFill.cpp` | 填侧 9 处拼写 `gPipeInputs` → `MGPipeClientInputs()`(:627/:629/:653/:703/:1217/:2205/:3016/:3027/:3348),两处 `MGPipeServerClearVerbBoundary()` → `MGPipeClientClearVerbBoundary()`(:2228/:3437)。`MGPipeVerifyReadHook` 的 `&self == &gPipeInputs` 判等(:663)**故意不动**:hook 钉在读侧块上,且 verify 与双块互斥 |
| `MobileGL/MG_Remote/Server/PipeApplier.cpp` | `Attach()` 调 `MGPipeServerBlockNoteIdentity()`(CONTRACT-P5E §3.2 的 "SetIdentity moves to ApplyOne") |
| `MobileGL/MG_Test/Pipe/FieldOwnershipTest.cpp` | 6 个新用例(见 §3) |
| `MobileGL/MG_IntegrationTest/Scenarios/DualBlockScenario.cpp` + `Harness/DualBlockPeek.{h,cpp}` | 确定性 distinctness 对照用例(§6) |
| `MobileGL/MG_IntegrationTest/CMakeLists.txt` | `integration-dualblock-split` 车道注册(§5) |
| `MobileGL/MG_IntegrationTest/Harness/split_log_paths.py` | 新 `expect-fatal` 模式:Fatal 对的双向棘轮 + 每条红条目必须带具名 marker + 旋钮下一处 Admitted 即红 |
| `MobileGL/MG_IntegrationTest/Harness/dualblock-expected-fatals.txt` | 红清单棘轮初版(census 生成,非手写;§4) |
| `scripts/ci/dualblock_negative_control.sh` | 阴性对照脚本(`split_negative_controls.sh` 的合同:基线必须绿、红必须带被选条目自己的失败文本) |
| `.github/workflows/test.yml` | 两个新 CI 步:双块 census(预期红 + 棘轮核对 + 棘轮非空时全绿即红)与阴性对照 |
| `MobileGL/MG_Remote/CONTRACT-P5E.md` | §3.2 标 LANDED(落地形式写明);ra2 修正段的 UNLANDED 注记同步关闭(§7) |
后端与 applier 的 379 处 `MGB_CTX` 读点、`PipeApply.cpp` 的写点零改动——`gPipeInputs` 拼写保留为 server 块。
## 2 设计决策与对侦察报告的偏差
1. **`MGB_CTX_LIVE` 不会恒 false——侦察报告这里错了**。`PipeInputs::IsLive()`(PipeFill.cpp:2100)
不读 `m_live`,而是 forward 到 `LiveContext()`(读 `MG_State::pGLContext`)。inproc 下它仍答对——
但这是一次 inproc 结构性看不见的跨角色读(P6 时 MG_Impl 不在 server 进程里)。
**真正恒 nullptr 的是 `m_contextIdentity`**,而 DirectGLES 的 fb-slot memo 缓存(DirectGLES.cpp:191)
先比 identity 再决定是否走带检查的访问器:nullptr 对零初始化缓存是**命中**,会发空槽指针——
无名崩溃,恰是演练要消灭的形态。所以 f1 落了 `MGPipeServerBlockNoteIdentity()`。
(附带:`m_live` 目前没有任何读者,见 §8。)
2. **SetIdentity 不是"Attach 一次"而是随 stamp 按 `MGPipeApplierContextSerial()` 刷新**。契约 §3.2 原文是
"moves to ApplyOne, once per session";identity 的 consumers 是 per-context 的 memo key
(fb-slot 缓存、以及 `GetTextureContextId` 已经用同一串行号回答),context 切换(applier reset)
时它必须动。实现:stamp 里比较即存,knob 关时整个函数早退——零行为变化。
3. **车道形态用 env 车道而非整批重注册**。侦察 §6.2 建议 `gtest_discover_tests` 以
`DirectGLES.Split.DualBlock.` 前缀重注册同一批 scenario。实际采用 strict 车道的同构形态
(`MOBILEGL_IPC_ROLE_SPLIT_STATE=1 MOBILEGL_IPC_STRICT_ERRORS=1 ctest -L 'integration-split|integration-magma-split'`),
只新注册 1 条对照条目。理由:重注册会让 179 条条目集合成为第二份需要手工保持同步的清单
(各块的 TEST_FILTER 排除项各不相同,逐块复制必然漂移),而 env 车道的红条目集合与
`integration-split` **恒等由构造保证**。发现数不翻倍(G14 只增不删仍满足:净增 3 条注册名,
见 §5)。Magma 由 `integration-magma-split` 并入同一 census 覆盖(2 条 NamedBlit)。
4. **对照条目不把旋钮钉进自己的 ENVIRONMENT**——这是对 N-6 钉死惯例的一次有理由偏离:
ctest 的 ENVIRONMENT 属性覆盖进程环境,钉死 `ROLE_SPLIT_STATE=1` 会让 knob=0 形态(即阴性对照本身)
经 ctest 不可达。失败方向安全:不带旋钮裸跑 `-L integration-dualblock-split` 是**红**(具名断言),
不是静默绿。条目钉了 `MOBILEGL_IPC_RUN_AHEAD=0`:串行分离断言要求每个 verb 边界都填,
run-ahead 下未设障 verb 不填,断言会变成时序相关。
5. **`VertexAttribDefaultsOf` 的镜像自查改读 client 块**(PipeFill.cpp:3016)。knob 开时它退化为
对同 verb 自家填充的恒真自检——applier 镜像比对本身是 lockstep 时代的跨角色读,正是双块要消的
形状;knob 关时两块同物,语义逐字节不变。
6. **`MGPipeClientClearVerbBoundary` 而非"删除 client 侧 clear"**(契约 §3.2 的字面是 DELETED):
调用点保留、重指到 client 块。knob 关时同一块同语义;knob 开时 client 块的 flag 从不举起,
clear 是无操作——"client 不再能撤 server 的 stamp"由块分区结构性成立,不靠删代码。
## 3 单元测试(6 个新用例,FieldOwnershipTest)
- `RoleSplitOffFoldsTheFillSideOntoTheSharedBlock`:旋钮关 → `MGPipeClientInputs()` 就是 `gPipeInputs`。
- `RoleSplitUnderMonolithTransportIsStillOneBlock`:旋钮开 + monolith → 仍折成一块(monolith 折叠)。
- `RoleSplitGivesTheFillSideADistinctBlockTheStampNeverTouches`:两块是不同对象;server stamp 只动
server 块(serial +1、flag 举起),client 块纹丝不动;`MGPipeClientClearVerbBoundary` 不撤 server 的
stamp;stamp 后 server 块 identity 非空。
- `TheClientVerbLeaveWritesTheClientBlockAlone`:`MGPipeLeaveVerb` 只推 client 块 serial。
- `DualBlockMakesABarrierPulledReadANamedAbortWithoutStrict`(fork):旋钮开、**strict 关**,
server stamp 后读 `GetBoundVertexArray` → SIGABRT 且日志带
`Fatal{UnmigratedPipeInput, "GetBoundVertexArray@DrawArrays"} [BARRIER-PULLED, MOBILEGL_IPC_ROLE_SPLIT_STATE=1, ...]`。
这是机关的 R-16:O 类 SharedPtr 字段没有 null 检查,没有这一臂它就是无名段错误。
- `DualBlockDoesNotArmUnderMonolithTransport`(fork):旋钮开 + monolith → 同一读被计数而非 Fatal。
## 4 红清单(census 实测,`~/w7/p5f-f1`,两次独立运行同一对集)
车道:`MOBILEGL_IPC_ROLE_SPLIT_STATE=1 MOBILEGL_IPC_STRICT_ERRORS=1 ctest -L 'integration-split|integration-magma-split'`。
181 条目:**155 红,红条目 155/155 带具名 Fatal,零无名崩溃**;22 绿(3 条 PushMonolithArm 单块臂 +
17 条路径上本就不读 BARRIER_PULLED 字段的 scenario + Ct 角色守卫死亡用例 + SplitLogPaths 元检查),
4 skip(两条 PersistentMapArm 专属、两条 StrictArming 专属,在自己的车道外 by design 跳过)。
**6 对首阻塞 `<字段>@<verb>`**(每条目死于自己的第一处 pull,退掉一对就推进到下一对——清单会随
fm/fs/fr/fv 缩短):
| 对 | 条目数 | FieldOwnership.def 退役归属 | f1 包归属建议 |
|---|---|---|---|
| `GetFramebufferBindingSlot@ReadPixels` | 132 | P5e (Espryt unbarriered), P7 (Magma) | Espryt readback 路径的载体(最大一块,决定 fv/收尾工作量) |
| `GetTransformFeedbackProgram@DrawArrays` | 11 | P3b/P4b (Espryt), P7 (Magma) | XFB 程序随 draw 的载体 |
| `GetTextureObject@CopyImageSubData` | 6 | P7 | sticky forward 的 handle 化 |
| `GetFramebufferBindingSlot@Clear` | 2 | P5e (Espryt), P7 (Magma) | **fm 的前两行**(两条 DirectVulkan NamedBlit) |
| `GetTextureUnitObject@CopyTexImage2D` | 2 | P5e (Espryt unbarriered), P7 (Magma) | 纹理单元指针的载体 |
| `ValidateProgramName@ShaderStorageBlockBinding` | 2 | P9 | sticky forward |
注意与 strict 车道的分工:strict 管"设障 pull 有没有被承认"(值还在共享块里),双块管"值根本不在
对面"。同一笔债的两个探针,两份棘轮独立。旋钮下 `Admitted{` 实测为零(机关先于承认臂打响)。
## 5 车道与标签(ID-131 的证据)
`ctest -N` 实测(build-split @ cfcc12f7):
- `-L integration-split` = **179**(不含新条目——`integration-dualblock-split` 里隔着 `dualblock`,
子串匹配不上);
- `-L integration-dualblock-split` = **1**(`DirectGLES.Split.DualBlock.DualBlockScenario.TheTwoRolesHaveDistinctBlocks`);
- `-L integration-magma-split` = 2(未变);
- `-L integration-gpu` = **1359**(基线 1357 + 2 条 ambient 注册 `DirectGLES./DirectVulkan.DualBlockScenario.*`——
与 F1WireScenario 的 19 条 ambient 条目同形态,运行时 monolith 臂 GTEST_SKIP)。
G14:名集合只增不删(新增 6 个单测名 + 3 条 itest 注册名)。
`SplitLogPaths.PrivateAndDistinct` 通过:新条目恰好一条私有日志且不与他人重名。
## 6 阴性对照(P5F §6,两种形态都真跑过)
`scripts/ci/dualblock_negative_control.sh`(p5f_gate.sh 的 `negctl` 步)实测:
- **旋钮=1**:`DirectGLES.Split.DualBlock.DualBlockScenario.TheTwoRolesHaveDistinctBlocks` **Passed**
(0.68s;三块断言全过:roleSplitActive、两块地址不同、client verb 边界推 client 块 serial 而
server 块 serial 不动)。
- **旋钮=0**:同一条目 **Failed**,失败文本正是该用例自己的断言:
`dual-block control: MGPipeRoleSplitActive() is false - MOBILEGL_IPC_ROLE_SPLIT_STATE is not armed ...`。
- 脚本同时坚持:基线绿(0 failed、0 skip——skip 不算绿,ID-62)、对照红且红带案文。
## 7 CONTRACT-P5E §3.2(ID-135)的核实结论
侦察的判断成立:双块落地后 §3.2 的语义**在旋钮开的臂上自动成立**——server 块就是 applier 私有存储,
stamp 写的 `m_filled/m_currentVerb/m_serverStampedVerb` 都在 server 块,client 的两处 clear 已重指到
自己块(无人读过它的 flag),`SetIdentity` 落到了 applier 侧(Attach + stamp 刷新)。ra2 的告诫
("不配版本化就更坏")由机关兑现:BARRIER_PULLED 值在 server 块里**不存在**,读它具名死,不存在
"静默旧值"。契约文本已从 UNLANDED 改为 LANDED 并写明落地形式。旋钮关的臂保持共享块旧语义,
是 A/B 与阴性对照所需,不是第二份契约。
## 8 附带发现(与本包无关,未修)
1. **`strict-expected-markers.txt` 有两行 stale**(`GetBoundVertexArray@DrawArrays`、
`GetBufferBindingSlot@DrawArrays`):strict 车道实测观测 8 对(7 admitted + 1 escalated),
双向棘轮因这两行不再出现而红。**归因:基线树 `~/w7/p5f-base` @ e75e00cb 逐字复现同一失败**
(同一观测集、同一 vanished 对),与 f1 无关——前者随 client-arrays 条目迁出
`integration-split`(ID-134 的标签搬家)而失效,后者是 MultiDrawTier 车道不再产生它。
修复是删掉这两行(属 strict 车道维护,留给下一轮车道养护,本包不顺手改别人的棘轮)。
f1 的 strict 门按任务口径判读:179/179 绿、`Fatal{` 为零、观测 Admitted 恰为既有 8 对——满足。
2. **`check_doc_citations.py --strict` 在基线即红**:CONTRACT-P5.md:349(`Init.cpp:44`)与 :524
(`Core.cpp:39`)两处 basename 歧义,base 树同 rc=1;CI 本就以 `|| true` 非 strict 跑它。
f1 新增文档没有引入新歧义(见 §9 的对照数字)。
3. **`m_live` 无读者**:`PipeInputs::IsLive()` forward 到 `LiveContext()`,从不读 `m_live`;
`SetIdentity` 写它纯属记录。inproc 下 `MGB_CTX_LIVE` 经此跨角色读到 client 的 `pGLContext`——
答得对但正是 P6 要消灭的形状。建议 fm/fs 或收尾包把 server 块的 liveness 改读自己的 `m_live`
(f1 已会在 stamp/Attach 时置它),并决定 context destroy 时谁把它打回 false
(侦察 §8.2 的开放问题,候选:applier_reset 控制记录)。
4. **census 车道与 strict/gpu 车道共享私有日志文件,绝不能并发跑**。本报告撰写期间我曾在后台并发
发起 `dualblock` 与 `gpu` 两步,gpu 车道(knob 关)覆写了 census 正在读的 18 份日志,表现为
"红而无 marker + 对子计数漂移"。单独重跑后两套数字稳定一致。p5f_gate.sh 的步序是串行的;
教训写在这里防后来者重蹈。
## 9 逐门数字汇总
| 门 | 结果 |
|---|---|
| build(split flavour) | rc=0,984 TU |
| unit(旋钮关) | **2262/2262**(基线 2256 + 新增 6) |
| integration-split(旋钮关) | **179/179**,零回归 |
| integration-split+magma(旋钮开) | 181 条目,155 红**全部具名**、零无名崩溃;6 对首阻塞落盘为 `dualblock-expected-fatals.txt` 初版 |
| flavours | pull rc=0(`MOBILEGL_PIPE_PUSH=1` absent ✓)、push rc=0(=1 ✓),compile_commands.json 断言过 |
| **G1** | pull flavour 对基线 e75e00cb:`.text` 10806051 → 10806051(+0),defined symbols 27815 → 27815,**0 added / 0 removed / 0 resized / 0 renamed**——零认定 |
| integration-gpu(旋钮关) | **1359/1359**(1357 + 2 条 ambient DualBlock skip 条目) |
| 生成器 --check/--self-test、include 闭包、dirty-surface | 全绿(gen_pipe 12 控制、field-ownership 13 控制、dirty-surface 27 控制均打响) |
| doc 引用 --strict | 基线既有 2 处 ambiguous(CONTRACT-P5.md:349/:524),f1 新增 0 处 |
| strict(旋钮关) | 179/179 绿、`Fatal{`=0、观测 8 对 admitted(=任务口径的既有八行);棘轮文件的 2 行 stale 见 §8.1 |
| 阴性对照 | 旋钮=1 绿 / 旋钮=0 红且带案文,两种形态各跑过(§6) |
## 10 复现
```bash
# WSL 侧(树 ~/w7/p5f-f1,branch p5f/f1)
bash ~/w7/notes/tools/p5f_gate.sh f1 build # configure + build-split
bash ~/w7/notes/tools/p5f_gate.sh f1 unit
bash ~/w7/notes/tools/p5f_gate.sh f1 isplit
bash ~/w7/notes/tools/p5f_gate.sh f1 strict
bash ~/w7/notes/tools/p5f_gate.sh f1 dualblock # census + 棘轮核对
bash ~/w7/notes/tools/p5f_gate.sh f1 negctl # 阴性对照两种形态
bash ~/w7/notes/tools/p5f_gate.sh f1 gpu
bash ~/w7/notes/tools/p5f_gate.sh f1 flavours
bash ~/w7/notes/tools/p5f_gate.sh f1 gens
# G1:python3 scripts/symbol_report.py --before ~/w7/p5f-base/build-pull/libMobileGL.so \
# --after build-pull/libMobileGL.so --threshold 0
```
+104
View File
@@ -0,0 +1,104 @@
# fc — 控制面帧契约草稿(P5f 包 fc;CONTRACT-P5F.md 本体留给集成收口)
> Status: DRAFT, landed in code by package `fc` on branch `p5f/fc`. Authority once integrated: this
> feeds CONTRACT-P5F.md. Until then it supplements CONTRACT-P5C (audit row G4, discharged here) and
> CONTRACT-P5E §2.5 (the wait-before-forwarder discipline, unchanged), and it answers the
> control-plane rows of `docs/Disaggregated/P6-CONTRACT-DRAFT.md` §4 ahead of schedule.
> Code anchors: `MobileGL/MG_Remote/Server/SurfaceControlFrame.h` (the frame),
> `MobileGL/MG_Remote/Protocol/SurfaceOpCodec.{h,cpp}` (the wire codec and the named refusals),
> `MobileGL/MG_Remote/Server/ServerLoop.cpp` (`RunSurfaceControlFrame` /
> `ApplySurfaceControlFrame`).
---
## 1. Ownership
1. A **SurfaceControlFrame is a value**. The poster fills the request fields; ownership of the
slot's content passes to the channel at publish; the dispatch on the apply thread fills the
reply half (`ok`, `eglMajor`, `eglMinor`) into the same value; the poster's copy-out happens
after the blocking handshake returns. No field is a pointer and none may become one — the
exhaustive constexpr structured binding in `SurfaceControlFrame.h` checks every member
as an integer or enum. Adding a member without extending the binding fails compilation;
changing a checked member to a pointer fails its static assertion. Trivially-copyable /
standard-layout remain separate copyability checks: neither trait rejects pointers.
2. An unnumbered local request (`seq == 0`) is numbered by `RunSurfaceControlFrame`, from 1
per session. An already numbered wire request retains its client-minted sequence through
dispatch and reply (P6-CONTRACT-DRAFT table 0); the server never renumbers it.
3. `display` / `surface` / `readSurface` / `context` are Uint64 **tokens**. Inproc they are the
client's EGL handle values bit-cast — legal only because both roles share a process and a
driver, and the N-3 tuple bookkeeping compares them by value. Under spawn they are
client-minted dense tokens (P6-CONTRACT-DRAFT table 0, unchanged). No code may dereference a
token as a pointer on a path a non-inproc transport can reach.
4. `windowBackend` + `nativeToken` + `width`/`height` carry a `WindowHandle` as values. The frame
names the **backend** enum, never the wire's `WindowKind`; the two enums meet only inside
`SurfaceOpCodec.cpp`'s explicit tables (`Surfaceless`/`Pbuffer` are surface shapes and answer
"no backend" there). A `nativeToken` whose backend is Android is an `ANativeWindow*` — an
address in the client's process — and may never cross (§3.5). MetalLayer carries a
`CAMetalLayer*` and has the same restriction.
## 2. Ordering
1. The channel keeps its P5 semantics: one blocking slot, `m_callerMutex` serialising posters,
pumped by the apply thread **between drain batches**, publish-then-ring. Frames are FIFO
against each other; they are NOT ordered against SEG_CMD records by the channel itself.
2. The client-side discipline that orders frames against records is unchanged and remains
mandatory under spawn: `WaitForApplyBeforeEglForwarder` waits `appliedSeq` to
`LastPublishedSeq` before every forwarder (CONTRACT-P5E §2.5), because the channel is pumped
between drain batches and a control frame would otherwise overtake in-flight records.
3. **All twelve ops stay blocking in fc**, including the three f0-egl §4.3 marked relaxable
(`SetSwapInterval`, `ReleaseSurface`, `SetWindowHandle`). Relaxing them to fire-and-forget is
a P6 decision and must preserve: a `SetWindowHandle` is in effect before any later
`CreateWindowSurface` (one ordered channel suffices), and `ReleaseResources` NEVER relaxes —
`MobileGL::Destroy()` walks on the moment it answers (ServerLoop.h's header note).
4. Re-entrancy is unchanged: a post from the apply thread dispatches inline (the
`~BackendObject_DirectGLES` → `ReleaseEGLResources` path). This is thread semantics, not wire
semantics; under spawn the destructor path runs server-side natively and never posts.
## 3. Error semantics
1. Loop down, backend alive → `Fatal{ApplyThreadNotRunning}` (M-7, unchanged).
2. Loop down, no backend → `MOBILEGL_ERR_NOT_INITIALIZED`, nothing runs on the caller (C2,
unchanged).
3. Backend null at dispatch → `MOBILEGL_ERR_NOT_INITIALIZED` with `ok=false`; the forwarder's
answer is the old `false`/void-drop, unchanged.
4. Successful void operations (`SetSwapInterval`, `ReleaseSurface`, `ReleaseResources`,
`SetWindowHandle`) reply `ok=true` after completing on the apply thread; a null backend
replies `ok=false`. The wire therefore preserves the success/failure distinction even
though the inproc forwarder returns void.
5. Wire entry (`ServerApplyWireSurfaceOp`, the future P6 control pump's entry point; P5f drives
it from tests only): a decode failure is **`Fatal{ProtocolCorruption, "SurfaceOp"}`**, never a
dropped frame (a dropped control frame is a client waiting on a reply that never comes); a
decoded `WindowKind::AndroidNativeWindow` is
**`Fatal{UnmigratedSurface, "AndroidNativeWindow@P12"}`** — the window kind is legal schema,
the token is the part that means nothing in the server's process, and real window arrival is
P12. A decoded `MetalLayer` is similarly **`Fatal{UnmigratedSurface, "MetalLayer@P12"}`**,
because its `CAMetalLayer*` also belongs to the client process. Inproc-only kinds
(`InitCapabilitiesInprocOnly`, `SwapBuffersInprocOnly`,
`InitWindowSurfaceInprocOnly`, `ProbeForTesting`) cannot arrive: the encoder refuses them
(`SurfaceWireError::InprocOnlyOpOnTheWire`).
6. A frame that reaches the inproc dispatch with `kind == None` or a kind the switch does not know
is `Fatal{ProtocolCorruption, "SurfaceOp.kind"}`; a `windowBackend` tag outside the enum is
`Fatal{ProtocolCorruption, "SurfaceOp.windowBackend"}`. Inproc these are corruption shapes, not
bad input — same discipline as the ring's header check.
## 4. Reply carriers — and the deliberate non-use of `SurfaceReply.defaultFb`
1. The default framebuffer's shape already crosses as `kEventSurfaceChanged` on SEG_EVENT (P5c
ev), and the client drains it at the RPC return (`BackendObject_Remote.cpp`'s create/resize
arms). fc rules that `SurfaceReply.defaultFb` **stays unset**: two spellings of one fact is how
the two sides come to disagree about it (the `CapsSnapshot` deprecated-fields lesson,
`protocol.fbs`). Enabling it later is a schema amendment, not a silent flip.
2. The caps republish side effects are unchanged and are server-spontaneous frames on the wire:
a real bind under `MakeCurrent` republishes (R-12 arm (a)); `InitCapabilities` publishes. The
client's absorption point — pump the control plane after the RPC returns — is the same in both
worlds: "after this op's reply, before the next op" is a total order the client can rely on.
## 5. What fc deliberately did NOT do
- No transport: no socket, no spawn pump, no client-minted token table (the frame fields are
token-width already, so P6 is transport-only here).
- The two dead forwarders (`ServerSwapEGLBuffers`, `ServerInitWindowSurface`) and
`ServerInitCapabilities` were NOT given wire ops (f0-egl F8/§4.2): they ride the inproc channel
as inproc-only kinds because the function-pointer mailbox is gone entirely, and G14 forbids
deleting their pinning tests.
- Blocking semantics, the shadow, the doorbell order and the C2 exit block: unchanged.
+161
View File
@@ -0,0 +1,161 @@
# P5f / fc — EGL/surface 控制面帧化:落地报告
> 落地于 `p5f/fc`。设计输入:`f0-egl.md`(逐 forwarder 点名表、schema 缺口清单、帧设计草案);
> 契约草稿 [`fc-contract-draft.md`](fc-contract-draft.md)(CONTRACT-P5F.md 本体留给集成收口)。
> 范围:P5F-WIRE-COMPLETENESS.md §2.3(P5c 审计 G4 行,原记 P6,P5f 收回)。
---
## 1 落地内容
| 文件 | 内容 |
|---|---|
| `MobileGL/MG_Remote/Protocol/protocol.fbs` | **append-only**:`SurfaceOpKind` 补 `SetSwapInterval=8` / `ReleaseResources=9` / `SetWindowHandle=10`(与 P6-SPAWN-PLAN 的预测逐字一致);`WindowKind` 补 `MetalLayer=6`(f0-egl schema 缺口 3:两枚举不互洽的另一半);`SurfaceOp` 补 `readSurface`、`context` 两字段(MakeCurrent 的语义单元是四元组) |
| `.../Protocol/generated/protocol_generated.h` | 用 pinned flatc(`~/w7/p5-s1-flatc-build/flatc`,25.12.19)重新生成;diff 仅 +58/−6 行,全部落在追加的枚举值与字段上 |
| `.../Server/SurfaceControlFrame.{h,cpp}` | 纯值帧:`SurfaceControlOp`(10 个 wire op + 4 个 inproc-only kind)+ `SurfaceControlFrame`(constexpr 穷举结构化绑定 + 每成员 integer/enum 断言禁止指针;trivially-copyable / standard-layout 单独约束复制形态(§8 修正初版断言)) |
| `.../Protocol/SurfaceOpCodec.{h,cpp}` | 帧 ↔ `Wire::SurfaceOp`/`SurfaceReply` 编解码;`WindowBackend` ↔ `WindowKind` 显式映射表(Surfaceless/Pbuffer 具名无后端);wire 入口 `ServerApplyWireSurfaceOp` 的两个具名 Fatal(见 §3);枚举对齐用 static_assert 钉死而非强转 |
| `.../Server/ServerLoop.{h,cpp}` | **单槽邮箱的载荷从"函数指针 + 栈上 void\*"换成按值携带的一个帧**。`RunOnApplyThread(ControlWork, void*)` → `RunSurfaceControlFrame(SurfaceControlFrame&)`;十二个 forwarder 的 Args::Run 本体逐字搬进成员分发 `ApplySurfaceControlFrame`(C7/ID-54 分类、N-3 遗忘、R-12 重发布全部原位保留);阻塞握手、影子位、publish-then-ring、C2 出口块全部不动。测试缝:`RunProbeOnApplyThreadForTesting`(hook 是成员变量,**不进槽位**) |
| `MG_Test/Wire/SurfaceControlFrameTest.cpp` | 新套件 9 用例(见 §3) |
| `MG_Test/Wire/ServerLoopTest.cpp` | 既有用例 5 处迁移到 probe 缝;新增 2 用例(见 §3) |
| `MG_Test/Wire/RemoteClientTest.cpp` + `RemoteClientControls.inc` | 18 + 11 处 `RunOnApplyThread` 调用点机械迁移到 probe 缝(lambda 签名逐字兼容) |
| 根 `CMakeLists.txt` / `MG_Test/Wire/CMakeLists.txt` | 两个新源文件进 disagg 闭包;新套件按既有"加一个 NAME"约定注册 |
| 文档 | ROADMAP.md G4 行(f0-egl F9 的行号修正 + 去向改为"已由 P5f fc 帧化");P5F 计划进度行与 §2.3 标注;P6-CONTRACT-DRAFT §1/§4 与 P6-SPAWN-PLAN 第 4 条改为"fc 已落,P6 只剩传输";CONTRACT-P5E 两处 ServerLoop.cpp 行号随动 |
**grep 证明**(验收项):`grep -rn "ControlWork\|m_controlWork\|m_controlUser\|RunOnApplyThread"
MobileGL/ --include="*.h" --include="*.cpp" --include="*.inc"` → **0 命中**;邮箱槽位类型是
`SurfaceControlFrame m_controlFrame;`(按值,`ServerLoop.h:412`),其无指针约束由
`SurfaceControlFrame.h` 的穷举成员检查钉死;仅 trivially-copyable 并不能拒绝指针(§8)。披露:测试缝的 `m_controlProbeHook` /
`m_controlProbeUser` 是 ServerLoop 的**成员**而非槽位内容(同 `m_beforeRetireHook` 的既有先例),
只在 `ProbeForTesting` kind 的分发臂被读。
### 与 f0-egl 的逐条核对
- **9 个 forwarder / 10 种 op 帧化** ✔(含 `ReleaseCurrent` 复用:`ServerMakeEGLCurrent` 在打包侧按
三 NO\_\* 形状拆出 `ReleaseCurrent` kind,分发到达同一个 `ApplyMakeCurrent` ClientRelease 臂)。
- **死代码不帧化** ✔(按 F8 的"标注 inproc-only"臂):`ServerSwapEGLBuffers` / `ServerInitWindowSurface`
与 `ServerInitCapabilities` 拿的是 **inproc-only kind,codec 拒绝编码它们**
(`InprocOnlyOpOnTheWire`)。它们仍走帧通道是因为函数指针邮箱已整体拆除,而 G14 禁止删它们的
钉住用例。这是与 f0-egl 字面建议的唯一偏差,理由是它自己的 F8 给的第二条路。
- **`ANativeWindow*` 具名拒绝** ✔:wire 解码入口 `Fatal{UnmigratedSurface, "AndroidNativeWindow@P12"}`
(P6-CONTRACT-DRAFT 预写的名字);inproc 路径不受影响(Android 同进程照常)。
- **`SurfaceReply.defaultFb` 不启用** ✔(f0-egl §4.4 路线冲突的二选一):默认 FBO 形状已由
SEG_EVENT `kEventSurfaceChanged` 承载,回复帧不回写它。契约草稿 §4。
- **发送纪律**(f0-egl §3):`WaitForApplyBeforeEglForwarder` 原样保留;契约草稿 §2.2 写明它在
spawn 下仍是硬要求。
## 2 双块车道:fc 名下的红
**零。** `dualblock-expected-fatals.txt` 的 6 对首阻塞全部是 `PipeInputs` 字段的 BARRIER_PULLED
读(GetFramebufferBindingSlot@ReadPixels 等),与 EGL 控制面无交集——双块机关探的是
`gPipeInputs` 的读侧,邮箱/帧通道不经过它。fc 的对应义务是**普查不变**:旋钮开的车道在 fc 前后
产生同一对集(逐门数字见 §5),棘轮文件未动。fc 自己的红一次对照见 §4。
## 3 新增测试(G14:只增不删)
`SurfaceControlFrameTest`(9):帧是纯值聚合(trivially-copyable);十个帧化 op 恰好有 wire
kind 且数值钉死(8/9/10 与 MetalLayer=6 是 wire ABI);WindowBackend↔WindowKind 双向显式表
(含"两枚举整数值错位"的防强转断言);十 op 逐个过真 `CtrlEnvelope{SurfaceOp}` 字节往返
(readSurface/context 在内);SurfaceReply 往返(seq 回声 + 版本号);inproc-only 与畸形帧的
编码拒绝;无后端 windowKind 的解码拒绝;**两个 fork 死亡用例**钉住 wire 入口的具名 Fatal。
`ServerLoopTest` +2:`AVoidForwarderCrossesAsOneDispatchedFrame`(无 backend 时
`ServerSetEGLSwapInterval` 仍恰好分发一帧——帧通道自己的 R-16 扳机);
`ServerLoopEglTest.TheInitializeDisplayReplyArrivesThroughTheFrame`(major/minor 以**回复字段**
而非栈指针回到调用方,mesa 真实版本号佐证)。
既有钉住用例全部保留并经帧路径驱动:C7 的 native bind 计数(`readSurface`/`context` 字段若丢,
0x1 句柄会变 0 → ClientRelease 误分类 → NativeBindCount 不动 → 红)、N-3 的 destroy-recreate、
ID-67 的重发布计数、M-7/C2 的两个 !m_running 臂、影子位双清用例。
## 4 R-16 阴性对照(真跑过一次)
在 WSL 门树(未提交)把 `ServerSetEGLSwapInterval` 的投递行改成 `(void)frame;`(forwarder 不再
过帧通道),重链 ServerLoopTest:
- **红**:`ServerLoopTest.AVoidForwarderCrossesAsOneDispatchedFrame` Failed,失败文本正是该用例
自己的断言——`loop.ControlFramesDispatched()` Which is: **0**,expected 1
("the forwarder reached the backend (or did nothing) without crossing the frame channel")。
- 还原后同一条目转绿(`100% tests passed, 0 tests failed out of 1`)。
## 5 逐门数字(WSL 门树 `~/w7/p5f-fc`,split flavour,逐条实跑)
| 门 | 结果 |
|---|---|
| build(split flavour) | rc=0(全量 915+ TU;增量修订后最终全绿) |
| unit(旋钮关) | **2273/2273**(f1 基线 2262 + 本包新增 11:SurfaceControlFrameTest 9 + ServerLoopTest 2;G14 只增不删,无标签前缀误伤——未新增任何标签,`SurfaceControlFrameTest` 名集合与既有名无前缀关系) |
| integration-split(旋钮关) | **179/179**,零回归 |
| strict(旋钮关) | 179/179 绿、`Fatal{` 为 0、观测 Admitted 恰为既有 8 对(7 admitted + 1 escalated)。双向棘轮仍报 f1 §8.1 记录的**基线既有** 2 行 stale(`GetBoundVertexArray@DrawArrays`、`GetBufferBindingSlot@DrawArrays`)——与 fc 无关,f1 已归因基线树逐字复现,修复属 strict 车道养护 |
| 双块 census(旋钮开) | 181 条目:**155 红 / 22 绿 / 4 skip,与 f1 初版逐对逐数相同**(132/11/6/2/2/2 六对),`expect-fatal: ratchet OK - 6 fatal pair(s), zero admitted, every red entry named`。**棘轮文件零改动**——fc 名下无红(§2) |
| R-16 阴性对照 | 见 §4(改回即红、还原即绿,各真跑一次) |
| flavours | pull rc=0(915 TU,`MOBILEGL_PIPE_PUSH=1` absent ✓)、push rc=0(929 TU,=1 ✓),compile_commands.json 断言过 |
| **G1**(pull 对基线 `~/w7/p5f-base` @ e75e00cb) | `.text` 10806051 → 10806051(+0);defined symbols 27815 → 27815,**0 added / 0 removed / 0 resized / 0 renamed**——零认定 |
| gens | gen_pipe --check/--self-test、field-ownership(fc 未动 FieldOwnership.def,仍跑)--check/--self-test、dirty-surface --check/--self-test、include 闭包 4 probes 全绿;**protocol 重生成对提交头零 diff**(pinned flatc 25.12.19);doc 引用 --strict 恰为基线既有 2 处 ambiguous(CONTRACT-P5.md:349/:524,f1 §8.2 同此),fc 新增 0 处 |
| integration-gpu | 按任务分工由集成者跑,本包未跑 |
注:f1 §8.4 的教训已遵守——census 与其他车道串行跑,无私有日志覆写。
## 6 附带发现(未修)
1. `p5f_new.sh` 按 SHA fetch 在源仓未开 `uploadpack.allowAnySHA1InWant` 时失败
("couldn't find remote ref");fc 改用按分支名 fetch(`git fetch <gitdir> p5f/fc`)。
建议脚本照改或源仓开 `allowTipSHA1InWant`。
2. `git submodule update --init --recursive` 在新建 worktree 上反复超时(嵌套子模块走网络);
fc 从同父提交的 `~/w7/p5f-f1` 树整体拷贝 submodule 工作区并改写 gitdir 指针解决。
脚本那行 `cp -a .../glslang/External` 掩盖了这一点(它只补了 glslang 一家)。
3. `p5f_gate.sh` 的 build 步以 `[ $rc -ne 0 ] && grep ...` 收尾,成功时脚本退出码是 1
(日志行 `build rc=0` 才是真相)。既有噪音,未动。
## 7 预期合并冲突点
- `MobileGL/MG_Test/Wire/CMakeLists.txt` 的套件清单(文件自述为"本阶段反复冲突点",按
"加一个 NAME" 约定解)。
- `ServerLoop.{h,cpp}` 与 `RemoteClient{Test,Controls}`:若有并发包碰 apply 线程或角色守卫
测试(fm 的 Clear 臂不改这里;fv 若动 `RunOnApplyThread` 调用点则须平移到 probe 缝)。
- `protocol.fbs` 与 `protocol_generated.h`:若并发包也动 schema,枚举/字段追加序须人工保
append-only 后重生成。
- `docs/Disaggregated/ROADMAP.md` G4 行、`P5F-WIRE-COMPLETENESS.md` 进度行、`P6-CONTRACT-DRAFT.md`
§4:文档同点编辑。
## 8 集成前局部复审修复(2026-09-19)
本节追加独立修复,§5 的全门数字保留为初版历史;本次只重跑受影响测试,集成全门由集成者负责。
这次局部复审不代替 P5f 不同模型族终审。
| 缺陷 | 修复与回归用例 |
|---|---|
| wire `seq` 在真实 dispatch 入口被重新 mint,codec-only 往返漏检 | 仅 `seq==0` 的本地帧 mint;wire 序号保留。`WireSequenceSurvivesRealDispatchAndFailureReply` 驱动 wire → apply → reply 编码,要求无 backend 的失败回复仍回声 4242;成功臂亦断言原序号。 |
| 4 个 void 成功臂未填 `ok`,编码成 `false` | `SetSwapInterval` / `ReleaseSurface` / `ReleaseResources` / `SetWindowHandle` 完成后写 `ok=true`。`SuccessfulVoidWireOperationsReplyWithSuccessAndOriginalSequence` 用真实 EGL backend 驱动四种 op 并检查实际编码回复。 |
| MetalLayer 与 Android 一样携带客户端对象地址,却未拒绝 | `DecodeWireSurfaceOp` 对两种 window op 都返回 `MetalLayerArrived`,入口具名 Fatal `MetalLayer@P12`;新增纯解码检查与死亡用例。 |
| trivially-copyable + standard-layout 不能排除指针;初版的机械证明错误 | constexpr 结构化绑定穷举 14 个字段,每项只准 integral/enum。添加任何成员而不更新绑定会编译失败;将既有字段改为指针会触发 static_assert。保留旧两个 trait,并加入 object/function pointer 的 constexpr 反例和新用例。 |
| probe hook/user 在 `m_callerMutex` 外写,可被并发或重入 probe 覆盖 | 发布移入 caller 临界区,锁覆盖整个握手;apply 线程重入用调用栈上的 hook/user 参数,不写共享 pair。8 个并发投递者各 128 次,每次再嵌套一个 probe,逐投递者计数并校验总分发数。 |
真实 dispatch 测试还暴露 `SurfaceOpCodec.h` 的 include 顺序问题:`Wire::` 会被既有
`MG_Remote::Wire` 命名空间遮蔽;已将公开声明限定为 `::MobileGL::Wire::`。
**G14**:原测试全部保留,新增 5 条(SurfaceControlFrameTest +2、ServerLoopTest +2、
ServerLoopEglTest +1)。两目标 `cmake --build build-split --target SurfaceControlFrameTest ServerLoopTest -j8`
通过;`MOBILEGL_ITEST_REQUIRE_GPU=1 ctest --test-dir build-split -R
'^(SurfaceControlFrameTest|ServerLoopTest|ServerLoopEglTest)[.]' --output-on-failure -j8`
**42/42 通过,零 skip**。probe 的另外两组调用者也已覆盖:重建 `RemoteClientTest`,
`RemoteClientControls` **26/26** 与该可执行文件的其余 8 套件 **116/116** 全绿,
合计本次相关 unit **184/184**。
**真实 red-once,全部在 WSL 验证副本修改并还原,没有提交故障代码:**
| 单独回退 | 红证据 |
|---|---|
| seq 恢复无条件 mint | `WireSequenceSurvivesRealDispatchAndFailureReply` 失败:回复 1,预期 4242;ctest rc=8。 |
| 删除四处 `frame.ok=true` | 四种操作均报 `successful void operation encoded failure`;ctest rc=8。 |
| 删除 MetalLayer 解码拒绝 | 解码错误码不符,死亡测试 `failed to die`;ctest rc=8。 |
| probe 恢复锁外共享 pair 发布,并让重入读共享 pair | 并发+nested 用例逐投递者计数不符,报 `another poster or nested probe replaced this hook/user pair`;ctest rc=8。 |
| 额外新增第 15 个指针成员但不更新检查 | 用真实 SurfaceControlFrame.cpp TU 的 compile_commands 编译参数执行 `-fsyntax-only`,编译失败:`binds to 15 elements, but only 14 names were provided`,rc=1。 |
| 将既有 nativeToken 改为 void* | 同样的真实 TU 编译失败,正是 `every surface control frame member must be an integer or enum` 断言,rc=1。 |
还原后两目标重建通过,相关测试再次 **42/42 绿**。日志在 WSL
`/tmp/p5f-fc-fix-{red-seq,red-ok,red-metal,red-probe,red-added-member,red-pointer-type,restored-green}.log`。
第一次编译负例的检查脚本预期了另一种编译器措辞,实际已按正确原因编译失败;修正日志匹配词后
单独重跑两个编译负例并恢复验证,没有重跑无关门。
WSL 旧门树 HEAD `7257a372` 与 Windows `d5ed139c` 为兄弟提交,仅报告不同,不能 ff-only。
本次仅覆盖已确认无本地修改的 7 个相关源/测试文件验证,未 reset WSL 树,未改动其既有子模块状态。
+95
View File
@@ -0,0 +1,95 @@
# P5f FCL / Minecraft 端到端补测
> 本文是 `aa78f102` 的历史失败记录。后续 `38919d45` 已修复应用 buffer 消费及 Android
> 90° window blit,Magma inproc 已能正常进入同一世界;见 [magma-inproc-fix.md](magma-inproc-fix.md)。
2026-09-20,Redmi `2f7cbe2e`,FCL `com.tungsten.fcl.mgdebug.debug`,Minecraft
`26.3-rc-3`,现有单人世界 `test`。此前 [device-report.md](device-report.md) 是公开 GL
像素 runner,不是 FCL E2E;本文是用户要求后新增的真实游戏测试。
**两个后端均已实际启动测试;Magma inproc 失败,不能表述为两后端 split 均可玩。**
GLES inproc、GLES monolith 与 Magma monolith 进入世界并完成至少 60 秒连续运行,截图人工复核。
Magma inproc 在加载阶段触发明确的 P7 buffer-consumer 拒绝,未到进世界阶段。
## 被测制品与安装
- MobileGL 源头:`aa78f102ff8ecbe32be34b79d1d654c039867d19`,已推至
`origin/feat/disaggregated`。相对上一份验证库源头 `cfca93c7` 没有 C++ 行为变化。
- 正常 Gradle 构建 `:FCL:assembleFordebug`,`-Darch=arm64` 与
`mobilegl.pipePush=ON`、`mobilegl.buildDisaggregated=ON`、
`mobilegl.buildDisaggregatedInproc=ON`;**BUILD SUCCESSFUL in 52s**。
- `settings.gradle.kts` 的已有测试接线指向 `MobileGL-disagg`;NDK 27.3.13750724、
arm64、RelWithDebInfo。FCL 原有 Java / Kotlin 任务复用有效增量产物;未修改其源代码。
- APK:`FCL/build/outputs/apk/fordebug/FCL-fordebug-1.3.3.2-arm64-v8a.apk`,326039983 bytes,
applicationId 精确为 `com.tungsten.fcl.mgdebug.debug`,versionCode 1332。
- APK SHA256:`864fb685893abd346ac62aef1921dddddb6cd49c616ff0812ba9225cc90d11d7`。
- `libMobileGL.so` SHA256:`76c61d5990f52e5ffcad9741532ea2dec443d6677f97b55585df886df0f1a1e7`。
- APK 与设备实际 nativeLibraryDir 的 MobileGL / libc++ hash 逐项一致;libc++ 为
`46b51d661454b9cfaf42c1dc90893b5ad601b7a7ffc2e09d44bb3cc9d20e7ae2`。
这是本轮 Windows/Gradle 的实际产物,不混用先前 WSL pixel runner 的库 hash。
- 签名沿用已有 FCL debug key,证书 SHA256
`b8f82162dbfd193d2c8383bda495d5d5cdbabcd00c4e9064bc59483422a8b765`;`adb install -r`
成功,设备 lastUpdateTime `2026-09-20 13:49:19`。配置、options 与 55 MiB 的 test 世界已备份,
没有清应用数据或改其他 FCL 包。
## 实际运行结果
| 后端 / transport | 入世界 | 稳定窗口 | 窗口内帧增量 | 轮询近似 FPS(仅记录) | 判定 |
|---|---:|---:|---:|---:|---|
| GLES / inproc,strict=1、role-split=1 | 32.029 s | 64.005 s | 14280 | 223.109 | PASS,真实 apply verbs、所有128个统计窗口 rsp=0 |
| Magma / inproc,strict=1、role-split=1 | 未进入 | — | — | — | FAIL,21.454 s 内退出,P7 buffer consumer |
| Magma / monolith | 28.435 s | 62.251 s | 10560 | 169.636 | PASS,90个统计窗口 rsp=0、vbs=0 |
| GLES / monolith | 38.864 s | 60.696 s | 6840 | 112.692 | PASS,64个统计窗口 rsp=0、vbs=0 |
成功项同时核对:实际 backend 日志、inproc 的 capability/strict/role 配置、fresh 游戏日志
中的玩家进入世界、持续递增的 frames、进程存活与截图。GLES inproc 已 ARMED;Magma inproc
明确运行 lockstep,没有以界面选项或环境文件代替运行臂证明。每组前重启;GLES inproc
首次启动失败后的重试在同一次 boot 内完成。
画面人工检查范围是地形、树木、天空、手部、快捷栏与正常菜单;未见黑屏或明显纹理破坏。
场景时间/视角在运行中有变化,未定频,也不是固定帧像素比对;表中 FPS 不能用于后端性能
比较或回归判定。只验证这个版本、这个世界及数分钟内的游戏流程,不宣称完整功能覆盖。
### Magma inproc 的真实失败
```text
[13:58:45] [Android mgl-srv-apply/FATAL]: MGPipe: Fatal{RoleViolation, "buffer-legacy-arm"} (Magma P7 buffer consumer)
```
同次日志先报告 subsystem `0x80` 没有 server consumer,随后在 apply 线程拒绝 legacy buffer
路径。该文案对应 Magma draw / indirect buffer 的 P7 守卫,区别于 UniformManager 的另一条
`buffer descriptors remain P7` 文案。现有抓取没有 native PC / tombstone,不能进一步指定
是哪一个 GL draw 或 VBO/EBO 触发;FCL 自身的 SIGABRT hook 会接管退出。
这不是测试跳过,也没有通过关闭 strict / dualblock 绕过拒绝。Magma monolith 成功仅说明
该库的单体路径能跑此游戏,不能代替 split 支持。P5f 的已完成范围仍以 wire ownership 门
为准,完整 Magma 应用缓冲消费继续属于 P7。
### 其余诊断没有隐去
GLES 首次启动 PID 12166 在 MobileGL 初始化前被 signal 34 结束,没有生成 library log;
根因未定位。原始日志保留在 `GLES-inproc/`,同配置重试保留在 `GLES-inproc-retry/`。
两次都有 `ClassNotFoundException: sun/java2d/SurfaceManagerFactory`,成功重试证明不能
把这条被处理的 CTC agent 警告认作首轮退出原因。
成功运行仍有初始化诊断:GLES 的 `eglSwapBuffersWithDamageEXT` 动态入口缺失带历史 FATAL
日志级别,但没有导致 abort;还有 `glShaderStorageBlockBinding` 入口缺失、两后端的
`GL_STENCIL_INDEX8` 归一化诊断,Magma 的 separate depth/stencil 不支持提示。
因此本文不宣称“日志零错误”;通过项是本场景实际进世界、运行与画面检查,且无 wire
`Fatal{...}` / 进程退出。Magma 的具名 P7 拒绝单列为失败。
## 复现与证据
证据根:`C:/Users/geekerwan/.codex/tmp/p5f-fcl-e2e-aa78f102/`。其中有 Gradle 日志、
`artifact-identity.json`、设备库 hash、构建接线快照、备份,以及每臂的 library/latest/logcat、
boot-id、逐次 pid/统计采样、summary 和截图。`run_fcl_arm.py` 只负责测试采样,未清 logcat、
未 pin 时钟;机器成功状态需经过人工截图检查再判 PASS。
FCL 当前的 `mg_transport.txt` / `mg_env.txt` 接线只在内置 Espryt renderer 分支执行;因此四臂
保持该入口,通过 `MOBILEGL_BACKEND_TYPE` 明确覆盖后端,并核运行日志。直接点内置 Magma
选项默认走 monolith,不能把这种操作误记成 Magma inproc。两后端加载同一个 `libMobileGL.so`。
所有 inproc 组使用 stage=256 MiB、strict=1、role-split-state=1、run-ahead=1、stats period=120;
monolith 对照明确设 transport=monolith、role-split-state=0。
测试结束已从游戏菜单保存退出,恢复原 `mg_transport.txt=inproc` 与空 `mg_env.txt`,
核对文件 hash 一致。新 APK 保留安装;未改系统时钟/定频设置,未回滚运行中发生的世界变更。
完整 test 世界备份仍在证据根的 `backup/test/`。父仓原有冲突索引和未提交构建配置未改动。
+164
View File
@@ -0,0 +1,164 @@
# P5f / fe — Espryt 字段退役报告
> 分支 `p5f/fe`,基线 `418c765c`。本次恢复时已有四个提交:`85f31047`、
> `07bf8d7c`、`881e050e`、`a0004db9`;并非 handoff 所说的未开工。
> 本次保留这些提交,补单测/strict 棘轮,发现并修复 XFB make-current 生命周期缺陷,
> 完成门禁。最终行为代码 `19a4400a`,注释整理 `63c2a331` / `31e95b07`。
> Windows 树 `../MobileGL-p5f-fe`;WSL 独立树 `/home/swung/w7/p5f-fe`。
## 1. 结果与范围
Espryt `integration-split` 的 179 条目在普通、strict、双块形态均无失败;strict 实测
零 Fatal / 零 Admitted / 零 ESCALATED,允许标记文件清空。双块总车道 181 条目中只余
Magma 两条 NamedBlit 的 `GetFramebufferBindingSlot@Clear`,本包未声称 P5f 已收官。
退役的方法是改读者:readback 读 framebuffer surface 记录、copy 端点读 texture handle、
storage-block binding 读 program handle。XFB 需要新数据,故扩 `MGPStreamOutputBegin`
为 120 字节 POD,携带 capture-program handle、XFB lifetime id、四组 buffer handle/range。
没有增加 call/opcode,没有用指针或整个 PipeInputs 块充当载体。
`GetBufferBindingPointCount`、`HasOpenTransformFeedbackSpan` 的字段与 forward 行翻为
APPLIER_DERIVED;全表仍有 13 个 BARRIER_PULLED 字段,原因是 Magma、P8 client arrays、
RecordError 以及尚未删除的不可达 legacy accessor。fe 只完成 Espryt 本包范围;不能在
Magma 最后一批读者迁移前删除 `EmittedCallSuppliesTheWholeField` 的拒绝臂和 ID-112 绊线。
## 2. 十五字段逐项交账
| 字段 | Espryt 的来源 / 本包改动 | 剩余边界 |
|---|---|---|
| GetBoundVertexArray | 普通 draw 已由 `BoundVertexElements` / vertex records 回答,本包核对原记录臂 | client-VA escalation 属 P8,Magma 属 fm |
| GetBufferBindingPoint | 普通 UBO/SSBO/atomic 读 `BoundShaderBuffers`;XFB capture 目标本包改读 Begin snapshot | Magma 属 fm,legacy monolith 仍读前端 |
| GetFramebufferBindingSlot | `IsAlphaWidenedFallbackReadAttachment` / `IsFixedPointFallbackReadAttachment` 改读 `ReadFramebuffer()->ReadSurface`;其它 transport FBO 路线已有记录臂 | Magma Clear 是本包双块唯一剩余首阻塞 |
| GetImageTextureBinding | 既有 `BoundShaderImages` / record overload;剩余 frontend overload 是 monolith 臂 | Magma 属 fm |
| GetProgramForDraw | 既有 `DrawProgram` / shader-CSO archive / handle twin | Magma 属 fm |
| GetProgramForDispatch | 既有 `DispatchProgram` / shader-CSO archive / handle twin | Magma 属 fm |
| GetTextureUnitObject | `UpdateTextureBindingAtTarget` 把 frontend 读移到 transport 早退之后;copy destination 直接消费 `VerbCopyTexDst` | 其它 transport sampler readers 已有记录臂;Magma 属 fm |
| GetTextureObject | `OnResourceCopyRegion` 用记录已有 `Src/Dst`;`CopyImageEndpoint.TextureHandle` 送入 Espryt server texture twin/format record | Magma 共用 endpoint seam 由 fm 接;renderbuffer copy 维持原 class-C 拒绝 |
| GetBufferBindingPointCount | transport 返回四种 indexed target 的 `kMGPipeMaxBufferBindingPoints`(84);与 frontend 数组容量相同,无 context 查找 | 这是存储容量,不是设备公布的较小 XFB/SSBO limit;非法 target 返回 0 |
| HasOpenTransformFeedbackSpan | transport 查 server `StreamOutputSpans`,Begin/End 维护 | reset 保留 snapshot,object release 清空;见 §3 |
| GetTransformFeedbackProgram | deferred Begin 读 snapshot 的 `CaptureProgram`,由 server shader-CSO record 取得不可变 ProgramArchive;scatter pin 的也是该 archive | Magma 属 fm;monolith 保留 SharedPtr 路线 |
| GetProgramObject | storage-block verb 改读 `VerbStorageBlockProgram` 对应 server twin | `GetBackendProgramId` 的 legacy helper 属 fr 死代码核查;Magma 属 fm |
| ValidateProgramName | storage-block transport 不再按 GL name 探 frontend 表 | 同上一行;frontend GL 验证仍在 client |
| RecordError | 本包未改 | fv 的 reverse-channel 包明确拥有 |
| GetBufferBindingSlot | 六个 pack-readback 站点在 transport 选 server reply scratch,不读 PixelPack slot;其它 target 见下表 | Magma、P8 与 legacy 读点不能被 Espryt census 代为认证 |
### f0 所称七个“无载体” target 的复核
f0 把 `set_indirect_buffers` 的覆盖面当成整个 verb 的覆盖面,因此“必须扩七种 target”
并非最终结论。按当前 executable 路线逐项核实后,fe 无须为它们新增记录:
| target | 实际路线与证据 |
|---|---|
| CopyRead | Espryt backend 无 `MGB_CTX` 的此 target 槽读取;client buffer 操作解析为 resource 身份 / 数据后发射 |
| CopyWrite | 同 CopyRead;不是 server 必须恢复的 context binding |
| PixelPack | `EmitReadPixels` 在任何 emission 前已具名拒绝 `ReadPixels+PACK_BUFFER`。server 接受的是 reply scratch 地址,因此其 pack buffer 必须为空。本包六个站点都选空 server binding;没有声称实现 PBO readback。GetTex* 仍受原 class-C / shadow-emulation 拒绝 |
| PixelUnpack | client `GL_Texture` 解析 offset 和 unpack 状态为上传数据;texture/resource 记录供 server 消费,Espryt backend 不读 client PixelUnpack 槽 |
| Texture | Espryt 无 context `BufferTarget::Texture` 槽读者;纹理 buffer 的对象内绑定与 server texture/resource records 是另外一层身份,不能混同为 context 槽 |
| DispatchIndirect | 已有 `MGPGridInfo.IndirectBuffer` → sink `VerbDispatchIndirectBuffer` → `SyncComputeBuffers` 的 `EnsureBufferResourceForHandle`,P5c hd 已实现;`SyncBoundBuffer(DispatchIndirect)` 仅 monolith else 臂 |
| Query | 两后端都没有此 context 槽的 backend reader,Coverage.def 也明确点名无读者 |
DrawIndirect / Parameter 则早已有 verb handles(含 count buffer),`MultiDraw` 的
`BoundDrawIndirectBufferId` 在 P5e ra2 已改读记录;这是旧 strict `GetBufferBindingSlot@DrawArrays`
早在 f1 基线就 stale 的原因。P8 client arrays 没有在本包被假称完成。
## 3. XFB snapshot、身份与生命周期
Begin emitter 在 `BeforeReadOnlyVerb` 后取得 capture program 的 CSO handle,并把四组
buffer range 按存储大小裁剪。resource records 与 shader-CSO archive 先到,Begin snapshot
随后到。server sink 以 lifetime id 保存 snapshot;Espryt deferred Begin 用 archive 回答
stride/varying/layout,按 buffer handles 建 capture targets。End readback/scatter 同样按
handle 找 server buffer resource,保留现有事件字节写回路径。
这同时消掉 f0-reverse-channel 中 XFB 的两条身份债:transport 的 `scatterProgram`
不再 pin client ProgramObject,`targets` 不再从 client buffer 裸地址反查 handle。它们
随 capture source 一起迁移,不能让后续 fv 再重复造一套。monolith 的旧字段仍留在结构内。
`g_xfbObjects` 按 GL name 的静态对象命名空间/世代分区仍归 fs;RecordError 与
`ResourceTracker` 的 client 直写仍归 fv;这些没有被本包绿门证明已解决。
恢复后的审查还发现初稿把 `StreamOutputSpans` 放进 `MGPipeApplierReset()` 清空。
reset 会在 make-current 返回活 context 时发生,而 client 不会重发 Begin,所以首次
capture draw 会丢 archive/targets。本包修为:
- reset 只撤当前 bound lifetime id,保留所有活 span snapshot。
- 已存在的 `MGPContextValues.BoundTransformFeedbackLifetimeId` 在 apply 时恢复当前绑定。
- End 删除当前 span;`MGPipeApplierReleaseObjectRecords()` 清空全部 snapshot 和绑定。
此处没有新 context 值记录。单测模拟“Begin 的对象快照已到 → make-current reset →
返回 context 的值记录 → 查 capture → object release”,校验 64 位 identity、program
handle 和 buffer range 跨 reset 保留,并校验 release 后消失。静态 XFB backend 的全套
context 世代问题仍属 fs,这个测试只证明新 snapshot 的生命周期。
## 4. 双向棘轮,逐对解释
双块从 f1 的 **155 红 / 6 对**变成 **2 红 / 1 对**,剩下 fm 的
`GetFramebufferBindingSlot@Clear`(两个 NamedBlit)。没有新增预期对,也没有无名崩溃。
| 被删除的双块首阻塞 | f1 条目数 | 退役改动 |
|---|---:|---|
| GetFramebufferBindingSlot@ReadPixels | 132 | read attachment 分类用 server framebuffer surface;其后 PixelPack 用 reply scratch |
| GetTransformFeedbackProgram@DrawArrays | 11 | Begin snapshot 的 capture-program archive;后续 binding-point pull 也由 range snapshot 替代 |
| GetTextureObject@CopyImageSubData | 6 | copy 两端使用记录已有 texture handles |
| GetTextureUnitObject@CopyTexImage2D | 2 | copy destination handle 分流先于任何 frontend texture-unit 读取 |
| ValidateProgramName@ShaderStorageBlockBinding | 2 | storage-block program handle 分流;其后 GetProgramObject pull 同时消失 |
strict 从文件原有 10 对到空表,每一行的出处如下:
| strict 消失对 | 归因 |
|---|---|
| GetFramebufferBindingSlot@ReadPixels | 上表 read surface 路线 |
| GetBufferBindingSlot@ReadPixels | server reply scratch 路线 |
| GetTextureObject@CopyImageSubData | 上表 copy handles |
| GetTextureUnitObject@CopyTexImage2D | 上表分流顺序 |
| ValidateProgramName@ShaderStorageBlockBinding | 上表 program handle |
| GetProgramObject@ShaderStorageBlockBinding | 同一 handle 臂的下游读取 |
| GetTransformFeedbackProgram@DrawArrays | capture archive |
| GetBufferBindingPoint@DrawArrays | capture target ranges;旧表虽列在 ESCALATED 区,活来源是 XFB,不能仅凭旧注释当作 P8 client arrays |
| GetBoundVertexArray@DrawArrays | f1-report §8.1 已在独立基线树证明 stale(client-array 条目移出 integration-split);本包不领取这笔实现功劳 |
| GetBufferBindingSlot@DrawArrays | f1-report §8.1 同样证明基线已 stale;multi-draw 记录路线已在 P5e ra2 |
因此这个车道的空表不要求拉入 P8 staging,也不代表所有 backend/所有 lane 的字段表已归零。
## 5. Red-once 与最终门禁
恢复时旧 `fe-red-once.log` 有 22 个 Espryt 具名场景红,但没有足够完整的独立 revert
操作记录,不单凭这份旧日志领取 R-16。本次另做可复现、确实执行的 red-once:
- `81d20554` 加 `FieldOwnershipTest.SplitCaptureSnapshotSurvivesMakeCurrentUntilObjectRelease`,
实际 rc=8;bound lifetime id 被清成 0、HasOpen=false、snapshot 查找失败三项断言红。
- `19a4400a` 修 reset/restore 后,同条目 rc=0。红/绿日志分别是
`/home/swung/w7/p5f-logs/fe-xfb-reset-red.log`、`fe-xfb-reset-green.log`。
- f1 机关阴性对照也重跑:旋钮 1 绿,旋钮 0 红且为 distinct-block 用例自己的断言。
| 门 | 本包实测 |
|---|---|
| split build | rc=0 |
| unit | **2265/2265**(f1 2262 + 本包 3 条) |
| integration-split,旋钮关 | **179/179** |
| strict,旋钮关 | **179/179**;零 Fatal / Admitted / ESCALATED;空棘轮核对绿 |
| 双块 split + magma | 181 条:**175 green / 4 skip / 2 red**;一对 fm Fatal、零 Admitted、每条红都具名;棘轮绿 |
| integration-gpu | **1359/1359**,零失败(包含车道设计的 skip) |
| pull / push flavours | 两者实际完成构建 rc=0;compile_commands 验证 pull 无 PUSH、push 有 PUSH=1 |
| G1,对 e75e00cb 基线 | `.text` **10806051 → 10806051**;defined symbols **27815 → 27815**;**0 added / 0 removed / 0 resized / 0 renamed**;data/bss/rodata 也零差 |
| G2 | pull 与 push 都 **3008** 个 ctest 名,集合差为 0 |
| G14 | split 名集合 **3646 → 3649**,删 0、只加本包三条 FieldOwnershipTest |
| 生成器 / include closure | gen_pipe check+12 控制、ownership check+13 控制、dirty check+27 控制全绿;include 4 probes、0 skipped/0 problems |
| doc citations --strict | 与基线相同的 2 处 basename 歧义:CONTRACT-P5 的 Init.cpp / Core.cpp;无新问题 |
| 设备门 | 未跑;未取得 Redmi 设备,本包不声称通过 |
恢复时发现并修好的旧失败是 `TheStickyExemptionIsCancelledByTheServerStamp`:它以前
要求所有 sticky forward 都不 fresh;两个 scalar forward 改为 server-derived 后,测试应
按 ownership 区分,其他 client forward 的撤销断言仍保留。旧 strict gate 也会因为全部
10 对消失而红;按实际 census 删除上述行后,两侧棘轮都绿。
日志在 `/home/swung/w7/p5f-logs/`:`fe-unit.log`、`fe-isplit.log`、`fe-gpu.log`、
`fe-final-strict-gate.log`、`fe-final-dualblock-gate.log`、`fe-final-{pull,push}-build.log`、
`fe-g1.log`、`fe-name-gates.log`、`fe-final-gens.log`、`fe-final-doc-citations.log`。
strict / dualblock / gpu 必须串行,因为它们复用条目私有日志;最后重跑 strict → dualblock
保存最终摘要和 census,避免 GPU 车道覆盖双块 marker 后再拿它核棘轮。
## 6. 集成注意
按 fc → fe → fm 集成。fm 需要共同的 `CopyImageEndpoint.TextureHandle`、
`VerbStorageBlockProgram` 与 sink 赋值;两包已交换相同命名和代码边界。
`FieldOwnership.def` 与生成文件按最后存活读者统一重生成,不能盲目保留两边文本。
全局零 BARRIER_PULLED、fs 静态分区、fr 死代码/registry、fv 反向通道和设备门仍待后续。
+161
View File
@@ -0,0 +1,161 @@
# P5f fm — Magma 跨角色读写退役
> 分支 `p5f/fm`;Windows worktree `MobileGL-p5f-fm`;WSL gate tree `~/w7/p5f-fm`。
> 已验证代码头:`552ade5b`;最后一轮运行与棘轮结果见 §5。后续本报告与注释提交不改变执行路径。
> 本报告只裁定 fm;不宣布 P5f 总出口完成。
## 1. 真实可达性修正
f0 的“带 buffer 的 draw 最终到 buffer-legacy-arm”不能推出整个 draw 子树不可达。
`ClipDistanceScenario.AnEnabledClipDistanceRemovesTheNegativeHalf` 使用 `gl_VertexID`,没有 VBO;在 f1 基线
`~/w7/p5f-f1` 的真实 Magma/inproc、role-split=0、strict=0 下像素测试通过(`/tmp/p5f-fm-baseline-clip.log`)。
因此本包保留无 buffer draw/dispatch,新增 server program source、descriptor 和 render-pass 路径;没有把所有 draw 拒绝。
迁移后同一 case 在 role-split=1、strict=1 下通过(`fm-clip.log`;集成者独立复核 `int-wire-clip.log`)。
记录能被消费也必须能被发射。client 的 P4a family gate 和 server 的 `NoP4aConsumer`
原来都绑在 buffer resource-ops 上,而 Magma 没有该 ops。本包改为 client 查询该 family
的已发布 consumer bit、server 接受其 object records;残余 fill memo 加 caps generation。
Magma 仍不发布 buffer resources bit 7;发布 indexed-binding bit 13,用记录辨别未绑定与 P7 buffer 债。
texture staged bytes 原本也只由 GLES 的 resource-ops hook 采纳,本包补无 hook 时的 server-owned
adoption、respecify/defined-ness、destroy/release,保留有 hook 的 Espryt 路径避免双采纳。
## 2. 九字段与邻接字段
| 字段 | Magma transport 的现在来源 / 边界 |
|---|---|
| GetBoundVertexArray | `SetupWireDraw` 读 `BoundVertexElements` / `VertexElementsCsos`;无数组与 current generic attribute 正常画;实际读取 enabled array 时在 client 读前具名 `buffer-legacy-arm`(P7)。|
| GetBufferBindingPoint | UniformManager 读 `BoundShaderBuffers` 判断绑定;已存在的无绑定 native buffer placeholder 保留,有真实 SSBO/UBO buffer 时具名 `buffer-legacy-arm`。XFB capture 同样在读取前端绑定前拒绝。|
| GetFramebufferBindingSlot | `WireFramebuffer.inc` 的 clear/blit/read/copy 与 `WireDraw.inc` / pipeline builder 全读 framebuffer record / `MGPSurface`。|
| GetImageTextureBinding | UniformManager 读 `BoundShaderImages`;native image view 与 sampler 使用 server resource record。|
| GetTextureUnitObject | sampler 读 `BoundSamplerViews` / `BoundSamplerStates`;mipmap 与 framebuffer-copy 读各 verb handle。|
| GetProgramForDraw | `MagmaProgramSource(handle, ShaderCsoRecord)`;SPIR-V / reflection 来自 `Archive`,可变绑定和 global UBO 来自记录尾部。|
| GetProgramForDispatch | 同一 source,以 `DispatchProgram` 句柄选择 compute program。|
| GetTransformFeedbackProgram | 无 XFB draw 不进该读点;active XFB capture 在 wire setup 的 P7 buffer 边界具名拒绝。本包没有宣称 Magma 的 XFB capture 已可用。|
| GetTextureObject | handle-keyed VkTextureManager 完成 sync,无 GL-name / client weak_ptr 查询。|
邻接项:`GetBufferBindingPointCount` 不再被 wire uniform 路径读取;`HasOpenTransformFeedbackSpan`
只留在 class-C query / P7 capture 子树。`GetBufferBindingSlot` 的 indirect wrappers 在第一处前端读取前
保持具名 P7 拒绝;server 生成的 LINE_LOOP indices 用 transient server bytes,普通无 buffer draw 不受影响。
`ShaderStorageBlockBinding` 用 `VerbStorageBlockProgram` 更新 server `StorageOverrides`,不再经
`TryGetDirectVulkanProgram` / `ValidateProgramName` / `GetProgramObject` 探 client 名表。
独立 fm 的全局 FieldOwnership 分类仍保留 15 个 BARRIER_PULLED 字段;fe 集成后两个 scalar sticky
改为 APPLIER_DERIVED,仍余 **13 个字段**。其余对象行需在收口时与 residual-fill /
generator 的静态不变量一起归零,不是本包门绿后自动翻成 RECORD_SUPPLIED。
这里没有把“没有调用旧对象 getter”冒充“旧 SharedPtr 字段已由记录填充”。`FieldOwnership.def` 已加该说明。
`RecordError` 的反向通道归 fv;`PipeInputs::IsLive()` 仍 forward 到 `LiveContext()`,也是
未退役的 client liveness 读取,留给 fv / 阶段收口核对;均未在本包领取完成。
### Program source、descriptor 与发射约束
`MagmaProgramSource` 是仅在 disaggregated 构建存在的只读视图:monolith/internal-program
构造接 `const ProgramObject&`,wire 构造接 handle 和 server `MGPipeShaderCsoRecord`。
非 disaggregated 构建是原 `ProgramObject` 的类型别名,保持 pull 代码形态。
SPIR-V、linked stages、uniform/block/XFB reflection 来自 ProgramArchive;`BlockBindings`、
`SamplerUnits`、`StorageOverrides`、`GlobalConstants` 来自当前记录,后者覆盖 archive 的旧值。
全局 UBO 字节与版本不再问 client,SSBO 索引沿用旧 SPIR-V reflection 的排序规则。
server 视图不使用或写回 `ProgramObject` 的 hash memo:每次按当前 archive/绑定尾部算 hash,
编译产物仍由 ProgramFactory 的 server cache 复用。按内容进一步缓存 hash 属性能工作,
本包没有以共享 client memo 换取“快”。draw 和 dispatch 各自从记录选 program;普通
无 buffer draw 支持 current generic attributes,`gl_InstanceID` 的既有 SPIR-V rebase 保留。
sampler/image descriptor 消费 `BoundSamplerViews` / `BoundSamplerStates` / `BoundShaderImages`,
以 server texture record 创建原生 image view、按 record sampler 参数创建 sampler;view 的
mip/layer window、format alias、swizzle 与隐式 alpha 按记录恢复。真实 buffer/texel-buffer
消费者仍在前端解引用前具名拒绝。无绑定 image 所需的 frontend placeholder 则明确报
`Fatal{UnmigratedVerb, "Magma:unbound-image-placeholder@P7"}`,不是构造 client 对象来兜底。
vertex-input 的发射不受 Magma 缺 bit 7 的牵连:`NewVertexElements` 属 bit 8,P4a 的
consumer/dependency gate 只管该阶段的四个 object families。server 因而能区分 enabled array
与 current attributes;wire 缺少 vertex-elements record 会具名拒绝,不能静默当空 VAO。
`CapsMirrorTest.ObjectFamilyEmissionTracksIndependentConsumerCapsWithoutBufferOps` 在同一
子进程中采用 Texture-only → Framebuffer-only → Texture-only 三个
snapshot;buffer bit 始终为 0,逐次断言真实 `MGPipeP4aFamilyEmits` 的正反变化。
当前对象行仍被 BARRIER_PULLED 分类支配,测试没有假造 `SuppliedFieldMask` 的值变化;
caps generation 是该环境缓存的失效键,也是后续归属表收口必须保留的条件。
## 3. T5 与三类结构耦合
- T5:mipmap 使用 `VerbMipRes/BaseLevel/LevelCount`,只改 server image / staged shadow;upload-target 集合由 resource descriptor 推导,view window 从 `ViewOf` / sampler-view record 解析。无 client texture unit、upload-target vector 或 mip-level storage 写入。
- texture twin / memo:独立 `std::unordered_map` 以 `{slot, gen}` 为键;dead-generation prune、shutdown 清理;shape 重建保留旧 GPU 内容。pending-upload 只上传指定 regions,避免 CPU 旧影子覆盖 GPU clear/blit/mipmap 后未改区域。失败上传不推进 synced serial。
- program twin:`MagmaProgramSource` 在非 disaggregated 编译下是 `ProgramObject` 别名,在 split 下按值引用 server archive/record;`GetBackendHashMemo/SetBackendHashMemo` 不再写 client 对象。
- server 构造 client 类型:wire clear/blit/mipmap/draw 使用 native image/view/framebuffer/render-pass,sampler 从 `SamplerParameters` 构造;不走隐藏 ShaderObject/ProgramObject/SamplerObject 或前端 texture placeholder 构造。原 frontend placeholder 的 allocator 边界显式改写为上节的具名 P7 拒绝,未装成新可用功能。
- buffer twin / 直写:真实前端 BufferObject 的 backing resource、mapped bytes、EnsureGpuResident 等仅留 monolith 或既有 P7 拒绝之后;`ResourceTracker.h` 的 GPU-written fallback 归 fv,没有改。
`CopyImageEndpoint.TextureHandle` / `VerbStorageBlockProgram` 与 fe 采用相同 seam。
为独立 fm 门可运行,同时带入 fe 的 GLES CopyImage endpoint 接线和 shared readback helper 的 server reply-scratch
分支;集成保留同一份,不重复计算为两份迁移。
新 draw render-pass 仍沿用既有正确性规则:sRGB attachment 随 `GL_FRAMEBUFFER_SRGB`
选择 sRGB/UNORM 写 view;1D/1D-array storage 保留相应 view 类型;各 attachment 使用
GENERAL layout 与 descriptor 一致。旧 pass/framebuffer/view 退休前等待已提交 GPU 工作完成。
每次 command buffer 重开均经 FrameContext observer 重置 dynamic-state shadow,viewport、
scissor、blend/stencil 等不会因连续 draw 的相同值而漏发。此处选择正确性优先的提交/等待,
不声称完成 P7 的批处理性能设计。
staged store 的 hookless 路径与 GLES hook 二选一,绝不双 Adopt。named respecify 定义对应
mip(包含 null-data),whole immutable respecify 重定义完整链,destroy 删除 handle key,
object-record release 清空;make-current reset 保留仍活对象的数据。
## 4. 出口门 4 的回答
**Magma 不发布 `kCapRunAheadApply`。** 无 buffer draw / compute、framebuffer、texture 诸实际可达路径
以与 Espryt 相同的 role-split + strict 机制验证;分块时旧 client pointers 根本不在 server 块里,lockstep 不能
掩盖这些读取。真实 buffer consumers、host-texel placeholders 和少量 native format/function shapes 仍是 P7 功能债。
新 wire render-pass 为保证对象退休正确,提交后等待 queue 完成才销毁,尚未建立 run-ahead 的资源版本和性能契约。
此外 `IsLive` forward、fv 剩余反向写入与完整字段归属收口仍未完成,不能把当前已测工作集
扩大成“全 server apply 路径已满足 run-ahead”的能力承诺。保留 lockstep 是能力声明;
不把它当跨角色读写的豁免。`MagmaPipeIdentityTest.AMagmaServerNeverPublishesTheRunAheadCapBit`
分别对 ready=false/true 固定 Magma 的回答为不发布,避免随 Espryt readiness 翻转而误开启。
R11F_G11F_B10F 的 mip blit 是已实测的原有功能债:f1 基线真实 inproc 下
`F1WireScenario.GenerateMipmapPackedFloatPixels` 像素失败,RGB 都为 0(`fm-base-packed.log`)。
本包对应失败为 `Fatal{UnmigratedVerb, "Magma:mipmap-native-format@P7"}`;新增 Magma 同名测试留在
`integration-magma-p7-known-red`,CI 强制恰一条实际执行、failure 非 skip、私有日志精确含该 marker。
它不加入双块 field-fatal 棘轮;原 Espryt case 与所有既有测试名保留。
## 5. 门与 red-once
独立包的验证在 `~/w7/p5f-fm @ 552ade5b` 完成,日志在 `~/w7/p5f-logs/`。两份 red-once 证据均为真实执行:
- 无 buffer ClipDistance:baseline 共享块绿 / fm 双块 strict 绿。
- Program source 单测 3/3;临时退回 archive 旧 binding 值,`MagmaProgramSourceTest.ServerBindingTailsReplaceLinkTimeDefaults` 真红(旧值 9 分别不等于记录值 3/6);健康源码 3/3 绿(`fm-program-source-tests.log` / `fm-program-source-red-once.log`)。这份证据为独立临时 object/executable 执行;最终集成 unit 门仍单列核对。
- `StagedTextureProductionTest.HooklessTextureConsumerOwnsBytesAndScopedStorageLifetime`:旧 metadata-only 条件吞 named null-data mip,level-1 extent 为 0 导致真红;修复后 1/1 绿(集成者 `int-fm-staging-red-once.log` / `int-fm-staging-green.log`)。
最终门记录:
| 门 | 最终结果 |
|---|---|
| 代码 / build | `552ade5b`,split build rc=0。|
| unit | **2267/2267,0 failed**;10 个基线平台/宏 skip(`fm-unit-final.log`)。|
| integration-split,旋钮关 | **179/179,0 failed**;4 个既有专属车道 skip(`fm-isplit.log`)。|
| strict,旋钮关 | **179/179,Fatal=0**,6 ordinary + 1 escalated = 7 对;双向棘轮通过(`fm-strict-final.log`)。|
| Magma 双块 + strict | **31 条,29 PASS + 2 既有 driver-capability skip,0 failed**。无 buffer sampler/uniform、compute imageStore(含 ignored Layer=7)、view-only STORAGE 升级、sRGB/1D、VBO 具名拒绝都实际执行通过(`fm-magma-final.log`)。|
| 双块 Fatal 棘轮,独立 fm | **210 条:51 PASS + 6 skip + 153 具名红**;四对首阻塞,zero Admitted、零无名崩溃,双向棘轮通过(`fm-dualblock-final.log`)。这是尚未合 fe 的包树,不是集成树全绿结论。|
| packed-format known-red | 实际 1 条 failure、0 skip,私有日志精确 `Magma:mipmap-native-format@P7`;同 CI 的 JUnit + marker 核对通过(`fm-known-red.xml` / `fm-known-red.log`)。|
| pull / push / G1 | 最终头两 flavour 生效宏正确且构建成功;G1 带两项 fail-on 硬门 rc=0。`.text` 10806051 → 10806051,defined symbols 27815 → 27815,0 added / removed / resized / renamed(`fm-g1-final.log`)。|
| generators / include closure | 全部 check/self-test 通过(12/13/27 个生成器阴性控制),include closure 4 probes、0 skipped、0 problems。doc citations 仍只有 f1 已记的两处 basename 歧义(`fm-gens.log`)。|
| G2 / G14 | 公共入口 catalogue 未改;旧注册名保留。新增 Magma 专属主车道、known-red 和 5 个 unit cases;完整集成名集合核对由集成者执行。|
| integration-gpu / f1 negative control | 不在独立 fm 重复跑整阶段门;集成者在 fc + fe + fm 树执行并记录。|
双块棘轮只减两对:`GetFramebufferBindingSlot@Clear` 随 Magma framebuffer 路径退役;
`GetTextureObject@CopyImageSubData` 随 shared fe/fm endpoint-handle seam 退役,那 6 个 Espryt
case 前进到仍有的 `GetFramebufferBindingSlot@ReadPixels`,该对条目数 132 → 138。
其余三对是 `GetTransformFeedbackProgram@DrawArrays`(11)、
`GetTextureUnitObject@CopyTexImage2D`(2)、`ValidateProgramName@ShaderStorageBlockBinding`(2)。
没有增加预期对。strict 删 shared CopyImage 对,并清理 f1 已独立复现的两条 baseline-stale
`GetBoundVertexArray@DrawArrays` / `GetBufferBindingSlot@DrawArrays`;实测只剩上述七对。
sampler-view 请求 STORAGE usage 时会在 native root 上保留用途、升级并复制已有 GPU 内容,
不伪造 client root descriptor 的 BindMask。descriptor 先于 framebuffer view 解析,避免
同一 draw 的两种用途引用升级前后的不同 image。`ComputeImageStoreThroughViewPreservesOtherRootLayer`
先建立无 STORAGE 的 root image,再只绑定 layer-1 view,验证新层绿、原 layer-0 红,真实通过。
strict、双块与 gpu 会覆盖同一测试的私有日志,串行运行并保存各自摘要;后跑车道的日志
不能拿来替前一车道补证。新增 scenario 名集合保留既有测试,known-red 专门车道也必须实际
执行并验证自己的失败原因,避免通过移标签隐藏回归。
设备门未执行:没有已授权的 Redmi `2f7cbe2e`;集成者枚举只见另一台 unauthorized 设备。
该项由阶段收口记录,不能由 host lavapipe 结果代替。
+90
View File
@@ -0,0 +1,90 @@
# P5f / fr — registry 身份边收口
> 分支 `codex/p5f-fr`,基线 `4667e13b`。工作树 `MobileGL-p5f-fr`;
> 独立 Linux 验证树 `/home/swung/w7/p5f-fr`。这是波次 3 的 fr 包,
> fe/fm 已迁移的 CopyImage 和 storage-block 接线不重复计数。
## 1. 结果与边界
所有 transport apply 对 client allocator 的访问都具名拒绝,设障、后端种类和历史
scope 均不再豁免。`MGPipeSlots()` 本身新增守卫,覆盖旧三方法守卫之外的
`Allocate`、`IsLive`、`HighWater` 等入口;backend 私有 allocator 不经这个 singleton。
`BackendSlotTable` 的 `GetOrCreate(StatePtr)`、`HandleOf`、`NoteStateForHandle`、
`StateForHandle` 在所有 apply 上拒绝 frontend 身份;`Find(StateObject*)` 经 `HandleOf`。
上层 `StateBackendObjectRegistry` 的 frontend lookup/mint/iterator 在臂选择之前检查,
不能靠关闭 slot-table 位退回裸地址 map。按 handle 的查找、创建、遍历、释放仍正常工作。
拒绝为 `Fatal{RoleViolation, "MGPipeSlots"}`,日志还包含具体成员名。
两种历史 scope 现在是无状态标记,不持有深度、不产生豁免。P3b/P4b 可随 monolith
glue 一起删除这些标记;P5f 不删掉对应的 monolith 功能来消除 grep 结果。
自由函数 `DirectGLES::GetBackendProgramId(GLuint)` 全树无声明、调用者或 dispatch 槽。
本包以 `!MOBILEGL_BUILD_DISAGGREGATED` 隔离,D-P 中不再存在;保留非 D-P 函数体,
避免仅为删除死代码改变 pull 的 `.text` 与符号。它不等于仍被大量使用的
`BackendProgramObjectImpl::GetBackendProgramId() const` 成员。
## 2. 原 13 个 DirectGLES scope 的重新核对
这里按函数名定位,不沿用 f0 的旧行号。家族位关闭导致的 legacy 回退不视为安全的 wire
功能;新的无条件身份守卫和字段收口会拒绝它,不能用“client 已停在 barrier”解释放行。
| 原 scope 所在函数 | 当前 transport 路线 / 阻断点 |
|---|---|
| `SyncTextureObjectToBackend` | `OnResourceCopyRegion` 已由 fe/fm 将 `Src/Dst` 放入 `CopyImageEndpoint.TextureHandle`,GLES endpoint 走 `SyncTextureToBackendByHandle`;旧对象 overload 留 monolith。 |
| `SyncCurrentFBO` | 先走 `SyncCurrentFBOByRecord`;开启 family 后的 decline 经 `RefuseFramebufferBindingSlotRead`,不会落入对象 lookup。 |
| `ResolveGlobalConstantsRecord(program)` | transport 的调用点用 `ResolveGlobalConstantsRecordForHandle`;旧对象 overload 留 monolith。 |
| `SyncCurrentProgram(program)` | draw/dispatch 经 `ProgramHandleArm()` 选 `SyncCurrentProgramByHandle`。 |
| `BindCurrentFBO` | record 的 `Fbo` 经 `FindByHandle`;mandatory record 臂 decline 即拒绝。 |
| `ResolveAndBindUnitTextures` | `UnitTexturesByHandle()` 的 record 分支先行返回;legacy unit pass 留 monolith。 |
| `ResolveUnitSamplerBackend` | transport 在 scope 前以 `BindSamplerStates.Count` 拒绝 identity sampler 家族。 |
| `BindCurrentProgramWithResources` | `handleArm` 经句柄 stash / `ResolveProgramTwin`,对象 registry 在另一臂。 |
| `GetCurrentBackendProgram` | `ProgramHandleArm` 在旧 scope 前返回。 |
| 自由函数 `GetBackendProgramId(GLuint)` | 无调用者;本包从 D-P 编译中排除。 |
| `ScopedDetachedTextureFramebufferAttachments(texture)` | transport mipmap 用 handle 构造与 record reverse-index;对象构造及 `StateForHandle` 留 monolith。 |
| `ShaderStorageBlockBinding` | fe 已用 `VerbStorageBlockProgram` → `FindByHandle` → native program id,并先行返回;旧 GL-name 查对象路径留 monolith。 |
| `GetTexImage` | wire 槽仍在 `MGR_UNMIGRATED_TAIL_SLOTS`,`Fatal{UnmigratedVerb, "GetTexImage"}`;不能因为本包关闭 scope 就宣称 P9 功能已实现。 |
## 3. Managers 的 11 个 scope 与普查遗漏
`HandleOfBuffer` 的 frontend overload 在 legacy buffer path;transport buffer consumers
用 handle 入口。`HandleOfSamplerViewForTexture` 全树没有调用者,仍是 monolith glue。
`RequireImageBindableStorage` 的 object overload 在 legacy texture path;transport 使用
`RequireImageBindableStorageByHandle`。`ResolveOwnRecord` 在 transport twin 已带
`m_pushedSyncHandle`,不进入对象 lookup。
`SyncAttachmentObject` 的 texture/renderbuffer 两站和 FBO verify 的两站位于 object
`BackendFramebufferObject::SyncToBackend`;transport 使用 `SyncToBackendByHandle`。
program serial 盖章和 renderbuffer record 解析位于各自 object `SyncToBackend`;
transport 的 by-handle overload 不问 frontend identity。
**第 11 项 sampler registration probe 不能照 f0 写成不可达。** transport 的
`BindCurrentProgramWithResources` 在 depth-texture、普通 `sampler2D`、需要强制 nearest
的组合下实际调用 `GetRawDepthFetchSampler()`;该 helper 原来创建 `SamplerObject`,
setter 还会读 client context,随后 `BackendSamplerObject::SyncToBackend` 的无 CSO 分支
进入这个 registration probe。此遗漏已交 fs 包改为 server native sampler,并补世代测试。
fr 关闭所有 registry 豁免后,这个遗漏不会再静默放行。
同时发现 `VulkanRenderer::Initialize()` 仍无条件创建 blit/depth-mipmap 隐藏
frontend program;相应两个 shutdown scope 不能当作不可达依据。已交 fv 包将 transport
初始化改道。原有 host Magma 用例通过不能代替完整 surface 初始化证据;本报告不声称
另有已经核实的 headless 初始化豁免。fr 仍无条件关闭 Magma allocator 豁免。
## 4. 验证
- 行为代码 `8377e6cf` 的独立 split `RemoteClientTest` 构建成功,新增四个测试;
`RemoteGuards` 44/44 通过,完整 executable 147/147 通过(`fr-remoteclient-full.log`)。
- `BarrieredLegacyScopesCannotExemptAllocator` 在 GLES / Vulkan 两 backend 都打开两种旧
scope,然后实际调用 client singleton 的 `HighWater`,必须在访问前具名 abort。
- `BarrieredFrontendRegistryMembersRefuseBothLegacyScopes` 对四个身份入口逐项检查;对象
和表在 client 创建,只有被测操作运行在 apply,日志核对具体成员名,避免在无关构造处死掉。
- wrapper 测试覆盖 frontend `Find`、mint 和 iterator,核对 wrapper 自己的 marker。
- handle 正对照在 barriered / unbarriered 两种记录下验证创建、查找、遍历、释放。
- **真实 red-once**:临时在两个 production guard 恢复“当前记录 barriered 就放行”的旧
条件,构建并执行两条 barriered 测试,**2/2 真红**,失败为预期 abort 没有发生;恢复健康
源码并重建后守卫测试全绿。日志为 `fr-red-once.log`、`fr-restored-green.log`,临时修改未提交。
- 非 D-P 行为改动全部由预处理隔离。pull / push、G1/G2/G14、完整 unit/GPU、strict 与
dualblock 在 fs/fr/fv 合并树由集成者执行;本包不拿单测结果冒充整阶段门。
Linux 新树的子模块递归初始化遇到本地缺少 apitrace nested commit,随后复用了现有
`p5f-int` 的依赖与 fixture 文件;未运行 `git lfs pull/checkout`,未修改参考树。
+135
View File
@@ -0,0 +1,135 @@
# P5f fs — 静态状态世代与 server liveness
> 基线 `4667e13b`,分支 `codex/p5f-fs`;行为代码 `35ad51d8`;默认 XFB 身份测试补强 `1b701020`。
> Windows 树 `MobileGL-p5f-fs`;独立 WSL 树 `/home/swung/w7/p5f-fs`。
> 不改 FieldOwnership 分类,不重复 fe 的 XFB archive/handle 迁移,RecordError 由 fv 完成。
## 1. 实现
**unpack 与 render-state shadow 的有效期成为显式键。** `ContextEpoch` 由 native ES
context generation、served-context serial 与执行臂(monolith / transport server)组成。
`ScopedDefaultUnpackState` 每次进入先核键;新世代或另一臂必须重发六个默认 pixel-store 值,
随后再设 tight alignment 并恢复。render-state 在版本号快速命中之前核键;键变动先调用
`InvalidateSyncedRenderState()`,相同参数字节和相同 version 也不能跳过重推。
这里的角色是 backend 执行臂:transport 下后端只由 server 调用,client 使用 remote table;
它不依赖读取 client 的 GLContext 地址。pull 编译不包含新键和分支。
**XFB 的 server 命名空间与 monolith 分开。** transport map 用既有记录携带的、不会复用的
`BoundStreamOutputLifetimeId` 作 key,GL name 不再是跨 context 身份;monolith 保留原 GL-name
语义。每个执行臂持有自己的 map、current/cached entry 与 scratch 状态。native generation
变化即丢弃旧 driver ids / spans;角色切换撤销 driver-binding 快速命中。
served-context serial 变化不清空仍活着的 XFB map:fe 已证明返回 context 不会重发 Begin。
`set_context_values` 恢复的 lifetime id 选择原来的 paused/pending span,并重新绑定其 native XFB
object。包括 virtual name 0 在内,不同 server lifetime 都有自己的 native object。server
scattered capture 的 scratch buffer 也按 capture object 分开,不能让另一暂停 span 的后续捕获
覆盖先前数据。native context 销毁统一清除;未实现的 DeleteTransformFeedback 仍由既有 class-C
边界拒绝,不把 GL name 偷换成 lifetime id。
本包验证的是同名不同身份和世代的隔离,不将它扩大为 P6 的多 client/session 功能承诺。
fe 已把 server map 的 program/target 值改成 Archive / buffer handles,fs 保持该方向。
**raw-depth sampler 的 transport 路线完全原生化。** 重核发现原来的 static frontend
SamplerObject 不只是缓存问题:setter 可读 client context,`SyncToBackend` 的 identity lookup
还会进入 client registry。transport 现在只构造 BackendSamplerObject,直接设置 native sampler
的 NEAREST min/mag、NONE compare mode、ALWAYS compare func;不构造、查询或同步前端
SamplerObject。native generation 变化重建 driver id;旧世代析构不会删除新世代复用的名字。
monolith 原路线不改,pull G1 保持恒等。此接缝与 fr 的 registry guard 收紧配套。
**IsLive 的答案由 server control 生命周期持有。** transport 的 `PipeInputs::IsLive()` 读取
server-owned liveness,完全不看 client `LiveContext()`:成功 make-current(包括 held tuple 的
重复绑定)设 live,client release-current 清 live,release-resources、backend/context 销毁与
loop stop 清 live。native context 可以按 ID-54 继续绑定在 apply thread 上;逻辑上的 client
release 仍必须答 false。surface 创建本身不构成 served current context。verb stamp 只刷新身份
token,不能把 teardown 后的 stale command 当作重建而复活 liveness。
**S13 的诊断位也不跨角色读。** 双块开启时,applier 入栈诊断使用 thread-local observer:
server 看到自己是否正在 apply,client 只看到自己的 false。共享块控制臂继续使用原 shared
atomic,原 R-1 诊断与 negative-control 不变。真正的跨角色等待从来都是 wire 的 `appliedSeq` /
`retiredSeq`,本包没有用 TLS 替换这些同步,也不从“client 观察不到 server”推导队列已排空。
## 2. f0-statics 全清单复核
| f0 项 | fs 结论 |
|---|---|
| S1 render-state shadow | 已补 native/served/role epoch。原 MakeCurrent invalidation 保留;新门覆盖相同 version / bytes 时的世代更换。 |
| S2 unpack shadow | 已补同一 epoch。每世代重新发布已知默认状态,不再依赖新 context 的 GL 默认值碰巧匹配旧 shadow。 |
| S3 Espryt per-draw memo 家族 | 保留现有 context identity/serial + native generation 或 record-content key。server 路线的身份源已是 applier;没有另造一套 memo。 |
| S4 native bindings / scratch / pools / EGL handles | 仍为 backend/server 私有;既有 MakeCurrent/DestroyEGLContext reset 链保留。native tuple 的 ForgetCurrentTuple / NoteNativeContextGone 已在波次 2 接线并有实际 destroy/recreate 测试。 |
| S5 legacy TwinLookupMemo / fb-slot memo | transport 可达读者由 fe/fm/fr 的 record arm 处理;monolith legacy memo 不被当作 server 值来源。地址键的 legacy 存在不等于 server 还可调用。 |
| S6 XFB | 已分执行臂,server 以 lifetime id 重键,native generation 清理,返回 served context 保留其 span;server capture scratch 按对象隔离。 |
| S7 raw-depth sampler | D 项已查明:BackendSamplerObject 析构有 generation gate,但旧 SyncToBackend 不重建死 driver id。transport 已改纯 native、按世代重建。 |
| S8 viewport-index 单向 latch | 仍是保守的 server process 属性;历史 true 只增加检查,不会略过必须的工作,无需按 context 清零。 |
| S9 buffer mutation epoch | 既有 server role guard 与单调 clock 保留;不是 client 共享状态内容。 |
| S10 Magma | renderer generation / manager 成员仍按 renderer 生命周期;动态影子在每次 BeginCommandRecording 的 observer 中 reset,包含中途 Flush 后的新 command buffer。fm 新增 wire resources 由 renderer/manager 持有。 |
| S11 MG_Impl/Pipe 单例 | client-only emit/tracker/publication 状态;原 FreshlyPrimed reset 保留。它们不提供 server fallback。 |
| S12 client query/sync registry | client-only;多 client/context 扩展仍属原范围,不为 P5f 在 server 镜像前端表。 |
| S13 Remote 单例及诊断 | session/scratch/hook 各有既有角色所有权;`g_applyThreadInsideApplier` 的双块跨角色观察已取消,共享控制臂保持。watermark 同步不变。 |
| S14 Pipe 核心 | gPipeInputs 双块由 f1 持有;g_applier 仍经控制记录 reset。fs 增加 server-owned liveness,route/diagnostic 计数不变。 |
| S15 MG_State lifetime allocators / scopes | client allocator 与诊断 scope 保持各自角色;transport raw-depth 不再构造会触发这些 client 语义的 SamplerObject。 |
f0 的“相同 tuple 且 native context 换代”不是另造一次 native bind 的理由:已有控制层在资源
销毁时忘记 tuple,新 surface 创建实际绑定并执行 invalidation。fs 另给消费端 shadow 独立
epoch 防线,避免 correctness 仅依赖这条调用链。原真实 EGL destroy/recreate 测试仍通过。
## 3. 有意义的 red-once
新增五个 `ContextEpochTest` 和两个 `ServerLoopEglTest`。前者调用生产 unpack/sampler/XFB/
liveness/诊断函数,用可观测的 driver-call / native-id / span 状态断言;后者在真实 headless EGL
context 的 apply thread 上验证 driver blend 状态与控制帧生命周期。
健康代码先 **7/7 PASS**。随后只在本包 WSL 树临时回退对应生产逻辑,构建成功后运行同一组
七条测试,**7/7 FAILED,rc=8**,每一条都红于自身断言;恢复原文件、重新完整构建后同组
**7/7 PASS**。没有提交测试旋钮,也没有把编译失败当 red-once。
| 测试 | 临时回退与确实失败的意义 |
|---|---|
| UnpackDefaultIsRepublishedForANewNativeContextOrRole | 关闭 unpack epoch 比较,新 context / 另一臂只产生 2 次 alignment 写而不是六默认值加 save/restore 的 8 次。 |
| RawDepthSamplerOwnsANativeIdForEachContextGeneration | 关闭 native generation 比较,第二世代沿用同一 sampler id、参数只发布一次。 |
| SameXfbNameInTwoServedContextsDoesNotAliasThePausedSpan | server key 改回 GL name,同名不同 lifetime 共享 native id / paused span。 |
| ServerLivenessDoesNotFollowTheClientContextOrAVerbStamp | 改回 client LiveContext:client 存在却 server dead 时误报 true,client 不存在却 server live 时误报 false。 |
| DualBlockApplierDiagnosticIsRoleLocalWhileSharedControlRemainsArmed | 改回 shared atomic,双块时 client 又能看到另一线程的 server 入栈;健康版同时验证 knob=0 的共享控制仍可见。 |
| RenderShadowCannotSkipAnUnchangedVersionAfterContextEpochChanges | 关闭 render epoch 比较;先建立 shadow,再改变真实 driver blend 状态并移动 native/served epoch,相同 version 导致错误跳过重推。 |
| ServerLivenessFollowsControlFramesAcrossReleaseAndRecreation | client LiveContext 不能回答 surface-only、release-current、重复绑定、release-resources、同 handle 重建、stop 的 server 状态。 |
日志:`fs-red-once-build.log`、`fs-red-once.log/xml`、`fs-restored-build.log`、
`fs-restored-green.log/xml`。回退完成后的 WSL `git diff` 为空。另重跑 f1 机关阴性对照:
旋钮开真绿、关真红,失败是 distinct-block 用例自身断言。
默认对象另做了更窄的对照:上述 XFB case 使用两个真实 GLContext 构造得到各自 name-0
lifetime id,断言非零且不同,再在 server 侧都调用 `BindTransformFeedback(0)`,要求 native
ids 非零且不同。临时把 native 创建条件从 `(server || name != 0)` 回退成 `name != 0`,
该 case 真红 rc=8,明确报出 0 对 0 的错误别名;恢复后 1/1 PASS。
证据 `fs-default-xfb-{green,red-once,restored-green}.log`。因此分开的不只是 CPU map key,
还有 driver 对象。该补强不新增测试名,也不改变前述生产代码或门禁数量。
## 4. 门禁
| 门 | 结果 |
|---|---|
| split build | rc=0 |
| unit | **2293:2283 PASS / 10 既有 skip / 0 failed** |
| integration-split | **179:175 PASS / 4 既有 skip / 0 failed** |
| strict | 同一 179 条零失败;Fatal / Admitted / ESCALATED 均为 0,空 marker 棘轮通过 |
| 双块 split + magma | **210:204 PASS / 6 既有 skip / 0 failed**;零字段 Fatal、零 Admitted,空棘轮通过 |
| integration-gpu | **1375:1118 PASS / 257 既有功能/驱动/专属车道 skip / 0 failed** |
| pull / push | 实际构建 rc=0;生效宏分别 absent / PUSH=1 |
| G1 硬门 | 对 e75e00cb:`.text` **10806051 → 10806051**;defined symbols **27815 → 27815**;**0 added / removed / resized / renamed**;data/bss/rodata 也零差 |
| G2 | pull / push 各 **3016** 个 CTest 名,集合差 0 |
| G14 | f1 **3646 → fs 3723**,累计新增77、删除0;其中波次2新增70,本包新增7 |
| generators / include closure | check 全绿,self-test 12 / 13 / 27 控制通过;4 probes,0 skipped / 0 problems |
| doc citations --strict | 两处 f1 已确认的 basename 歧义未变,未报告成绿门 |
全部日志位于 `/home/swung/w7/p5f-logs/`:`fs-{unit,isplit,gpu}.log`、
`fs-strict-gate.log`、`fs-dualblock-gate.log`、`fs-negctl-gate.log`、`fs-flavours-gate.log`、
`fs-g1.log`、`fs-name-gates.log`、`fs-gens.log`。strict / dualblock / GPU 串行运行,
各自 marker 摘要在被后续车道覆盖前已保存。flavour 构建和生成器不占用这些运行日志。
## 5. 集成边界
FieldOwnership 的13字段/17行分类由 root 收口,本包未修改;RecordError / GPU-written fallback
由 fv;registry guard 由 fr。fs 与 fr 的 raw-depth 接缝是纯 native helper,集成时应保留其
generation 重建,不恢复 frontend sampler identity lookup。
本包新键和 server 分支均被 `MOBILEGL_BUILD_DISAGGREGATED` 隔离;传统 pull 编译的行为与
符号门保持原样。设备门、阶段异模型族终审和 P5f 总出口由集成者执行,本包不代为宣告完成。
+86
View File
@@ -0,0 +1,86 @@
# P5f fv — 反向通道归属与遗留对象边界
> 包树 `MobileGL-p5f-fv`,分支 `codex/p5f-fv`,基线 `4667e13b`。
> 已验证代码头 `1153c561`。WSL `~/w7/p5f-fv`,日志 `~/w7/p5f-logs/fv-*`。最终门结果见 §4。
## 1. 改动
`PipeInputs::RecordError` 的 transport 臂现在调用 `gMGPipeCallbacks.OnGlError(code, message)`。
回调补上借用文本参数,且仅在同步调用期间借用:server producer 在返回前调用既有
`PostGlError`,复制 code、截断后的 message 和 NUL 进同一个 SEG_EVENT。
`kEventGlError` 的 wire 形状、1024 字节上限、FIFO 发布与 client drain 时机均未改变。
没有建设 P9 的异步槽池、跨 verb 排序或 texel 拉取。
transport 错误发布不再先执行 `MGP_STICKY_FORWARD_PULL(RecordError)`,因此它不会被误计为
残余 frontend pull,也不因双块 poison 阻止合法的反向错误事件。该计数宏只留在原 monolith 臂。
本包不修改 `FieldOwnership.def` / generated 表;阶段集成者负责把 legacy accessor 分类收口。
缺少回调是 `Fatal{RoleViolation, "OnGlError.callback-missing"}`,不静默丢错。
`ServerSession::Accept` 安装第四个 producer,沿用不同函数重复安装的
`callback-double-install` 检查。`Close` 在 apply join 之后只卸载仍属于自己的函数,不覆盖
其他 owner。新 `ServerOnGlError` 使用当前 active session;active 指针在 callbacks 安装完成后
release 发布。Accept 的 owner claim 用 CAS,连握手进行中的 session 也占有唯一的进程 callback /
segment-resolver 名额;同一对象重复 Accept 仍返回 invalid-argument,另一个对象则具名拒绝。
失败握手与 Close 对称释放 claim,没有加入多 session 支持。
`MGPipeAnnounceBufferGpuWritten(SharedPtr<BufferObject>)` 明确成为 monolith-only 对象入口。
transport 在第一次对象解引用之前 `Fatal{RoleViolation, "gpu-written-legacy-object"}`;
删除原 Magma allocator scope 豁免,无法再通过 lifetime-id 探 client allocator 或落到
`MarkGpuWritten` 直写。纯 monolith 的原 lookup / callback / fallback 语义保留。
已带 record handle 的 `OnGpuWritten` 事件路径保持不变。
## 2. 复核与附带补漏
fe 已迁走 XFB 身份:`XfbProgramSource` 的 transport 侧持 server `ProgramArchive`,targets 持
`handle/start/end`,scatter 读 server staged shadow,结果走 `OnBufferWriteback`。
源码中的 `target.buffer` / `scatterProgram` 留作 monolith 成员;transport 的赋值、循环与写回
均走 handle/archive 臂。本包没有重做 fe 的快照载体,也没有改变 scatter 字节格式。
fr 复核还发现 Magma 的 `VulkanRenderer::Initialize` 会调用两个 hidden-resource 初始化方法,
构造前端 ShaderObject/ProgramObject。先前“headless 另有跳过初始化分支”的快速推断不成立:
仓内没有该分支,约 682 行实际是 line-width caps 读取。fv 在
`InitializeBlitResources` / `InitializeDepthMipmapResources` 自身入口统一排除 transport,
不论调用者使用什么 surface。wire blit/mipmap/draw 已有 native server 路径,无需这两个前端
program;monolith 方法体保持原样。无设备测试直接调用这两个生产方法,要求 transport 不触碰
前端编译器、program factory 或 Vulkan device。真实窗口 / P12 设备行为没有被此测试冒充。
## 3. 测试与 red-once
新增 `P5fReverseChannel` 共 9 个测试(Linux):
- RecordError 必须经过已安装 callback,保留 error code / prefix / message,残余计数为 0。
- Accept / 重复 Accept / Close / 再 Accept 的 callback 所有权;Close 不擦掉外部替换的函数。
- 不同 callback 的重复安装、第二个 session 的 ownership 冲突、缺 callback 的 RecordError 均具名 abort。
- 不可读地址 0x1 作为伪造 BufferObject,分别覆盖 callback 缺失和存在两臂;必须 SIGABRT,
不可因先解引用而 SIGSEGV,不可进入直写 fallback。
- 真实 apply thread 产生 error → gpu-written → buffer-writeback → 长 error → 空 error,
client-side ring consumer 验证 FIFO、code、完整短文本、1024 字节截断含 NUL、空字符串及
producer 临时字节在被覆盖后仍已复制;没有手造这些事件头。
- 两个 hidden frontend program 的生产初始化方法,在无 device / factory / client context 时
都直接跳过 transport 构造。
R-16 实际执行:WSL 临时删除 RecordError 的 callback 投递,
`GlErrorsUseTheOwnedCallbackWithoutAResidualPull` 因 callback 次数 0 而非 1 及消息缺失真红;
恢复原源码后当时全部 8 项通过,工作区 diff 为空。
日志:`fv-red-once.log` / `fv-green-after-red.log`。第 9 项随后补用于双 session owner 拒绝。
## 4. 门
| 门 | 结果 |
|---|---|
| split build | `1153c561`,rc=0(`fv-build-final.log`) |
| unit | **2295 条,2285 PASS、10 基线 skip、0 failed**;包含新增 9 项(`fv-unit-final.log`) |
| 普通 integration-split | **179 条,175 PASS、4 基线专属车道 skip、0 failed**(`fv-isplit.log`) |
| strict integration-split | **179 条零失败**;空表棘轮、零 Fatal / ordinary Admitted / ESCALATED(`fv-strict-gate.log`) |
| 双块 split + magma | **210 条,204 PASS、6 基线 skip、0 failed**;空表棘轮通过、零字段 Fatal / Admitted(`fv-dualblock-final.log`) |
| pull / push | 构建 rc=0,生效宏分别 absent / `MOBILEGL_PIPE_PUSH=1` |
| G1 | 两项 fail-on 硬门 rc=0:`.text` 10806051 → 10806051,defined symbols 27815 → 27815;0 added / removed / resized / renamed;data/bss/rodata section size 也零差(`fv-g1.log`) |
| generators / closure | 全 check/self-test 通过(12/13/27 个阴性控制),include closure 4 probes、0 skipped、0 problems(`fv-gens.log`) |
| doc citations | 与 f1 / wave2 相同的两处 baseline basename 歧义;不报成 strict 全绿 |
| integration-gpu / G2 / G14 | 整阶段集成者在 fs + fr + fv + 字段分类树执行;本包未删既有测试、未改公共入口 catalogue |
R16 扰动只在独立 WSL 树临时执行并恢复,未提交失败版本。
同一目录的 strict / 双块 / GPU 日志不并行覆盖;各车道结论在其运行后立即保存。
G1 的最后一个源码差异只位于 split-only 的测试宏声明,不影响已构建的 pull / push 库。
设备门没有可用的指定 Redmi `2f7cbe2e`;不申请或操作其他 unauthorized 设备。
+108
View File
@@ -0,0 +1,108 @@
# Magma inproc 实际游戏修复
> 历史行为头 `38919d45`,分支 `codex/magma-inproc`;本报告记录 P5f 后的实际游戏补修。
> 后续 `194382c9` 已完成 [Magma run-ahead](magma-runahead.md),本报告保留当时 lockstep 数据。
> Redmi Magma inproc 已通过运行与人工图像检查;同 APK 的 GLES inproc 与 Magma monolith 复跑、最终 G1/G2/G14 均已通过。
> 功能修复、主机门与真机验证完成;保留以下性能和功能边界,未宣称 P7 全阶段收官。
## 1. 问题与修复范围
P5f 原设备门验证的是公开像素子集,Magma 的应用 buffer 路径仍具名拒绝。
Minecraft 26.3-rc-3 真正需要 VBO/EBO、UBO range、persistent writes 和 indirect draws;
因此“原像素门通过”不能推出游戏可用。本轮按用户要求补上这些 server record 消费路径。
`VkBufferManager` 新增按完整 `{slot,gen}` 管理的 server buffer storage 和 resource ops,
实际发布 buffer consumer bit。SubData 原位更新;busy store 使用 staging copy 或等待后精确
写入,不拿 client 旧影子覆盖 GPU 结果。GPU-written / readback 走已有反向事件,persistent
map 保持 client-owned T2 emulation,不把 server 映射地址交给 client。
vertex/index 绑定从 wire VAO、逐属性 buffer records 和 server slices 解析,支持现有
格式转换、offset/stride、base vertex/instance;indirect 与 line-loop 消费 server buffer 字节。
UBO/SSBO/atomic/texel descriptors 从记录的 handle、range 和 program reflection 解析;
短 UBO 先零填完整反射块,再只复制绑定 range 内的 GPU 字节,避免 range 外毒值进入 shader。
Magma 继续不发布 `kCapRunAheadApply`,仍按 lockstep 生命周期运行。真实 bootstrap 单测同时
检查 resource ops 与 consumer bits,不能把“支持 buffer”误写成“支持 run-ahead”。
## 2. 保留中间失败证据
最初将 17 条新 buffer 用例接到旧实现,**构建成功、17 条实际全红**,主要在旧 buffer 守卫
abort。日志 `magma-buffer-baseline-red.log/xml` 保留;没有先改成弱断言来获得绿灯。
`31dc1a73` 修好 buffer 后,17 条门、unit/GPU 都绿,手机也能进世界,**但设备结果 NOT PASS**:
画面左半黑、右侧约 90° 旋转,并有条纹和彩噪。该阶段证据保存在
`C:/Users/geekerwan/.codex/tmp/magma-inproc-fix/Magma-inproc-31dc1a73-run/`,不能由后续成功覆盖。
根因是 wire color blit 将 logical `2620×1280` 矩形直接写入 native `1280×2620`、
`ROTATE_90` swapchain。monolith 的旧 shader 路线曾处理该转换,wire 路线没有继承。
`38919d45` 加入纯 native Vulkan shader blit,使用 server-owned shader/pipeline/descriptors,
覆盖 identity/90/180/270,按 native viewport 绘制,并正确处理 GL scissor 和反向矩形;
没有恢复前端 ShaderObject/ProgramObject,也没有添加 test-only transform 开关。
## 3. 主机门与阴性对照
| 门 | 已取得结果 / 适用代码 |
|---|---|
| buffer + default-blit 严格车道 | **19 PASS / 0 skip / 0 failed**;role-split=1、strict=1;原17条全部保留。 |
| unit,`31dc1a73` | **2311:2301 PASS / 10 既有 skip / 0 failed**。 |
| 最终 integration-gpu | **1387:1119 PASS / 268 skip / 0 failed**(`magma-final-gpu.xml`)。 |
| 最终双块 split + Magma | **231:225 PASS / 6 既有 skip / 0 failed**;空字段 Fatal 棘轮(`magma-final-dualblock.xml`)。 |
| strict / 每帧 RSP,`31dc1a73` | strict **180 条零失败**;RSP 两后端 **2 PASS / 0 skip**。 |
| G1,`38919d45` | `.text` **10806051 → 10806051**;symbols **27815 → 27815**,增/删/变长/改名 **0/0/0/0**。 |
| G2,`38919d45` | pull / push 各 **3016** 名,集合相同。 |
| G14,`38919d45` | 审计基线 **3744 → 3774**,新增30、删除0;其中3768→3774是完整JSON机比,历史证据限制见下。 |
G14 的历史机读集合由旧 XML/lane JSON 重建出3741名,另3名由 `aa78f102` 注册与未变测试
源码补证;**不是对一份完整保存的3744名历史 CTest JSON 直接比较**。明细在
`~/w7/p5f-logs/magma-final-summary.log`、`magma-g14.json` 和 `magma-final-names.log`。
最终 pull/push 构建、生成器检查及字段 self-test 通过;include closure 4项、0skip/0problem。
新增 UBO 用例逐次核 offset、range rebind、handle rebind、SubData 与 block binding;
GPU SSBO 用例先直接消费 GPU 写出的 VBO/EBO 绘制,再精确回读并重画;persistent-map
复用同帧/跨帧变色场景。旧 `EnabledVertexBufferDrawKeepsNamedP7Fatal` 保留注册名,内容已
改成64个真实绿色像素正例。两条 default-blit case 使用非方形四色源,核 viewport 无关、
方向、反向目标矩形以及 scissor 内外像素;host identity 路线确实执行新 native blit。
真实 carrier 阴控:`MOBILEGL_IPC_PERSISTENT_BLOCK_KB=0` 让同一 persistent-map 变色用例
实际失败(rc=8),随后恢复默认旋钮再跑为绿;保留 `magma-persistent-{green,red,restored}.log`,
以及 red XML / 私有日志。CI 固定核19名完整执行,未放宽六项 skip。PackedFloat known-red
也实跑1失败/0skip、rc8,保留其native-format边界(`magma-final-known-red.xml`)。
## 4. Redmi 实际游戏结果
设备 `2f7cbe2e`,既有 FCL 包 `com.tungsten.fcl.mgdebug.debug`,版本 `26.3-rc-3`、世界 `test`。
最终 Magma inproc:**32.083 s 进世界,稳定65.109 s、1320帧,约20.274 fps**;PID `9993`
仍存活,所有记录的 `rsp=0`。约20fps 明显偏慢;本轮是功能修复,不能据此宣称性能合格。
主任务人工检查完整景物、方向、雨效及暂停菜单,原半黑/旋转错位/彩噪消失。
runner 自动 summary 仍保留 `PASS_PENDING_SCREENSHOT_REVIEW`,人工结论单列于此,不篡改原证据。
证据目录:`C:/Users/geekerwan/.codex/tmp/magma-inproc-fix/Magma-inproc-38919d45/`,含
`final.png`、`pause.png`、游戏/library/logcat日志、boot-id、PID生命周期与 `summary.json`。
- 最终设备 `libMobileGL.so` SHA256:`5a264098f8916e811cd76ce82c3727d4f9a4a426a7b68b2fa812221e2ea41383`。
- APK SHA256:`4b42b0f85b8f83e6648cc24665a8b5fbe83e7420b04459abe7507e32e2e8aba6`。
- 同 APK GLES inproc:32.835秒进世界、60.287秒稳定窗口、10920帧,约181.134 FPS,人工验图通过。
- 同 APK Magma monolith:32.795秒进世界、61.574秒稳定窗口、7080帧,约114.984 FPS,人工验图通过。
- 三组均无定频,天气/时段在变化;FPS仅记录,不能据此建立严格性能倍率。三组rsp窗口均为零。
- 分工独立复核覆盖了buffer同步/生命周期、binding布局、native blit资源销毁、push constants/SPIR-V及状态失效;没有放宽角色守卫。
- 额外CLI只读审查扫描未返回最终结论,已停止,**不计为通过的审查门**。工具元数据实际模型为gpt-5.6-sol,未冒称异模型族;状态保存在证据根`review/status.json`。本轮不是P7阶段收官,未替换原P5f已完成的阶段终审。
## 5. 仍保留的边界
XFB buffer capture 仍在 `buffer-legacy-arm` 边界;client vertex arrays 仍属 P8。需要 UBO
重打包但起点/复制尾部不能满足4字节对齐时,仍为 `uniform-buffer-byte-tail@P7`;不满足
native alignment 的 SSBO/atomic/texel range,以及超出 native range/format 的形状仍具名拒绝,
未实现 writable range 的额外 copyback 方案。PackedFloat mipmap 与其他已登记格式债继续保留。
这次游戏可用不等于 P7 全部完成,也没有改变 P6/P12 的跨进程真窗口边界。
## 6. 交付与设备状态
修复已合入`feat/disaggregated`;被测APK保存在
`C:/Users/geekerwan/.codex/tmp/magma-inproc-fix/FCL-magma-inproc-38919d45.apk`,已安装到指定FCL包。
每组有不同boot-id,设备实际库hash与APK一致;三组共173个stats窗口全部rsp=0,只有inproc组
有真实vbs。人工验图汇总`final-device-summary.json`保留机器原始summary,不篡改其待验图标记。
测试结束从菜单保存退出,恢复原`mg_transport.txt=inproc`和空`mg_env.txt`并核hash。
现有FCL测试接线只有Espryt选项读这两个文件,Magma inproc测试通过该入口覆盖BACKEND_TYPE;
直接选择旧内置Magma选项仍默认monolith,不能只凭UI名称判断transport。父仓原冲突索引、
用户Gradle修改和游戏数据未清理;本轮没有修改FCL源代码或推进P6。
@@ -0,0 +1,163 @@
{
"production_head": "70fb6689",
"source_artifact": {
"source": "70fb6689",
"apk": "C:\\Users\\geekerwan\\.codex\\tmp\\magma-perf-fix\\FCL-magma-perf-70fb6689.apk",
"apk_sha256": "bfa352bcb3402d9a31252503bacf6fcdc21e28ffaaa929fd8c80e6f2e2781e4e",
"library_sha256": "11f26ca1f1d6c9a3d89134c31b2348306e669b1d9ebcc2fc77c7f5def2b4f818"
},
"baseline_fps": {
"Magma-inproc": 86.85293459363007,
"Magma-monolith": 116.07722925432384
},
"clock_control": "stock-dvfs",
"render_distance": 32,
"simulation_distance": 12,
"fan_target": 2,
"after": [
{
"name": "Magma-inproc",
"backend": "DirectVulkan",
"transport": "inproc",
"performance": {
"fps": 116.73138991101129,
"fps_median": 117.0,
"fps_p10": 115.0,
"fps_min": 106.0,
"fps_max": 119.0,
"fps_stdev": 1.8717476401816064,
"seconds": 61.02900004386902,
"intervals": 61,
"frames": 7124,
"method": "sum(reset-counter frames) / sum(actual adjacent-log seconds)"
},
"hardware": {
"clock_control": "stock-dvfs",
"samples": 11,
"temperature_c_min": 57.0,
"temperature_c_max": 58.1,
"fan": {
"fan_rpm": [
"14487",
"14591",
"14676",
"14697",
"14804"
],
"fan_target": [
"2"
]
},
"frequencies": {
"policy0_cur": {
"min": 1555200,
"max": 1555200
},
"policy6_cur": {
"min": 1209600,
"max": 1689600
},
"gpu": {
"min": 832000000,
"max": 900000000
},
"busy": {
"min": 82,
"max": 84
}
}
},
"boot_id": "e69d0329-2264-4a2d-9b00-e1a4ffb6154d",
"actual_runtime": {
"backend_names": [
"Direct (Vulkan)"
],
"ipc_lines": [
"Config: IPC ring=8MiB stage=256MiB 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'"
],
"run_ahead_armed": true,
"caps_call_masks": [
"0x0",
"0x3fff00000400"
],
"run_ahead_cap_bit_seen": true,
"stats_rows": 237,
"residual_pulls_max": 0.0
}
},
{
"name": "Magma-monolith",
"backend": "DirectVulkan",
"transport": "monolith",
"performance": {
"fps": 115.00581747506094,
"fps_median": 115.0,
"fps_p10": 113.0,
"fps_min": 112.0,
"fps_max": 118.0,
"fps_stdev": 1.310503381393822,
"seconds": 61.02300000190735,
"intervals": 61,
"frames": 7018,
"method": "sum(reset-counter frames) / sum(actual adjacent-log seconds)"
},
"hardware": {
"clock_control": "stock-dvfs",
"samples": 11,
"temperature_c_min": 55.4,
"temperature_c_max": 58.9,
"fan": {
"fan_rpm": [
"14282",
"14363",
"14384",
"14487"
],
"fan_target": [
"2"
]
},
"frequencies": {
"policy0_cur": {
"min": 1363200,
"max": 1555200
},
"policy6_cur": {
"min": 1689600,
"max": 1689600
},
"gpu": {
"min": 734000000,
"max": 900000000
},
"busy": {
"min": 73,
"max": 76
}
}
},
"boot_id": "b52edced-93b3-416e-890b-5d9a2ea4e8d2",
"actual_runtime": {
"backend_names": [
"Direct (Vulkan)"
],
"ipc_lines": [],
"run_ahead_armed": false,
"caps_call_masks": [],
"run_ahead_cap_bit_seen": false,
"stats_rows": 250,
"residual_pulls_max": 0.0
}
}
],
"restoration": {
"original_world_files_unchanged": 61,
"config": {
"mg_env.txt": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"mg_transport.txt": "1d80cf637af2284a1763196d824b41f6f12bea849aa81f95ab8db0e5ce043c95",
"options.txt": "4d1cd0cb595819d924f8d5823910b643c865f12b3f59b6900abd54b04e2ee646"
},
"fan_restored": true,
"installed_library_sha256": "11f26ca1f1d6c9a3d89134c31b2348306e669b1d9ebcc2fc77c7f5def2b4f818"
}
}
@@ -0,0 +1,105 @@
# Magma RD32 inproc 性能修复
**已完成,2026-09-20**。生产行为头 `70fb6689`,之后仅追加 CI 脚本、契约与报告。
原 [RD32 四组合记录](rd32-fourway.md) 的 Magma inproc 86.85 FPS / monolith 116.08 FPS
是本次基线,保留原数据。修复后的同包对照已回到约115–117 FPS,同一场景的25%差距消失。
## 结果
| 模式 | 修复前平均 FPS | 修复后平均 FPS | 修复后区间中位数 | 修复后区间 P10 |
|---|---:|---:|---:|---:|
| Magma-monolith | 116.08 | 115.01 | 115.00 | 113.00 |
| Magma-inproc | 86.85 | 116.73 | 117.00 | 115.00 |
inproc 相比旧实现平均提升 **34.4%**;同包 inproc 比 monolith 高约1.5%。只有单轮,
不能据此认定稳定领先;本场景已不再呈现原先约25%的差距,两者均接近120 FPS量级。
不宣称无上限吞吐或零架构开销。
P10为约一秒计数区间的FPS分位,不是逐帧1% low。
## 原因与改动
实机30秒 `simpleperf cpu-clock` 采样中,服务端仍反复
构造和销毁 native GPU 对象:`vkCreateFramebuffer` inclusive占7.91%,
`vkDestroyFramebuffer` 6.21%,`SetupWireDraw` 21.15%。这些是各自采样份额,存在调用层级,
不能把父子项全部相加。客户端与服务端都存在工作/等待交替,不能把两个线程CPU时间相加当帧延迟。
本次修复:
1. **采样/storage image view复用**:UniformManager按帧槽缓存完整创建参数,包括root handle/gen、
native image与allocation epoch、format/type、swizzle、aspect及mip/layer窗口。逐字段比较,
不把相同hash当相同视图。句柄稳定后,原descriptor内容缓存可以复用。
2. **draw framebuffer对象复用**:每个frame slot最多缓存32个inactive pass/view/framebuffer组合,
精确匹配附件身份、窗口、格式、samples、draw-buffer映射和交换链信息。命中仍执行原有
End/Begin、image transition及memory dependency;溢出走原submit-index退休。
清理依赖真实slot fence或完整idle证明,发生在texture manager释放旧image之前。
3. **pipeline兼容性身份修复**:原PipelineFactory把临时 `VkRenderPass` 句柄放进缓存key,
跨帧重建容易重复创建pipeline,句柄回收也存在旧key别名风险。现在用精确formats/samples、
有序color refs/holes与depth ref分配非零身份,renderer生命周期内不复用ID,
与native句柄域分离。原句柄只供Vulkan创建调用;wire pipeline不再按creator pass的销毁
事件回收,继续沿program/age/整体销毁生命周期,避免误删另一个兼容pass在途使用的pipeline。
4. **其余热路径**:缓存物理设备不变的vertex-format支持结果;退休队列由逐项erase的二次搬移
改为一次稳定压缩。没有移除GPU同步、reply等待、present credit或角色守卫。
修复后独立post-window profile中,framebuffer创建采样份额降到3.56%;旧pipeline创建/
`inflate`热点不再出现在0.1%阈值以上的服务端采样项。仍有每帧必要对象工作,未声称零创建。
服务端样本18,017→13,106,但两份profile处于动态频率、不同运行时刻,不能读成精确同频周期倍率。
计时窗口与profile分开,profile开销没有混入上表的FPS。
## 验证
| 门 | PASS / skip / failed |
|---|---:|
| unit | 2304 / 10 / 0 |
| GPU | 1119 / 296 / 0 |
| strict split | 176 / 4 / 0 |
| 双块 split + Magma | 246 / 6 / 0 |
| cache专项(含Vulkan同步验证) | 7 / 0 / 0 |
| run-ahead专项(含Vulkan同步验证) | 14 / 0 / 0 |
| buffer专项 | 19 / 0 / 0 |
- 新7项公开GL场景覆盖sampler swizzle A→B→A、respec、mip/layer/view type、
FBO A→B→A、重挂附件、sRGB切换及attachment respec。所有draw先排队,之后才统一读像素。
- 新2项unit覆盖兼容性身份稳定、raw句柄换代与wire/native分域。临时禁止生产ComputeHash的
wire key分支时,same-ID/different-native-RP断言实际rc1;逐字节恢复后完整构建和该case rc0。
- cache7与run-ahead14均证明Khronos layer实际插入,零VUID/SYNC-HAZARD/validation error。
既有caps枚举 `GL_STENCIL_INDEX8` 应用诊断仍分列,未掩盖Vulkan错误。
- run-ahead=0负控实际等apply并失去queue lead后失败,恢复1转绿。strict两类marker棘轮为空。
- GPU skip集合精确为旧282加新cache generic双后端14;专用cache7全部执行。无删名或额外skip。
- pull/push构建与生成器、field/dirty self-test、4个include probes全过。
G1 section-size/defined-symbol比较全0,`.text 10806051`、symbols增/删/变长/改名0/0/0/0;
不是跨构建原始机器码逐字节承诺。G2 **3019==3019**;G14 **3803→3826,+23/-0**。
- cache同步验证已加入CI,使用 `scripts/ci/magma_cache_checks.py`;入仓版本也独立跑过7/7。
## 实机条件与交付
Redmi `2f7cbe2e`,FCL `com.tungsten.fcl.mgdebug.debug`,Minecraft `26.3-rc-3`,
同一冻结初始世界副本、固定相机、RD32/simulation12、2620×1280、VSync off/maxFps260。
每臂独立重启、入场CPU温度低于40°C、进入世界后预热180秒,再采至少60秒。
最终所选两臂采样窗全部风扇观测均档位2、RPM>0;原始FCL计数按实际相邻日志间隔归一化。
| 模式 | CPU温度 °C | 大核观测 GHz | GPU观测 MHz |
|---|---:|---:|---:|
| Magma-monolith | 55.4–58.9 | 1.690–1.690 | 734–900 |
| Magma-inproc | 57.0–58.1 | 1.210–1.690 | 832–900 |
使用默认DVFS,没有关闭温控。初次候选inproc计时为116.77 FPS,但风扇被系统关闭,
该次计时不纳入最终配对,只保留其post-window profile。最终另跑一次fan2 inproc,
没有把两次结果平均或挑选最好值。新增fan变化检查会重新预热,采样窗若漂移则拒绝该次结果。
两组actual backend/transport/capability、全部stats `rsp=0`、PID与前后画面均核查;
inproc实际ARMED、strict/role-split=1;monolith无IPC配置、vbs=0。
- APK:`C:/Users/geekerwan/.codex/tmp/magma-perf-fix/FCL-magma-perf-70fb6689.apk`
- APK SHA256:`bfa352bcb3402d9a31252503bacf6fcdc21e28ffaaa929fd8c80e6f2e2781e4e`
- 已安装库SHA256:`11f26ca1f1d6c9a3d89134c31b2348306e669b1d9ebcc2fc77c7f5def2b4f818`
- 最终配对证据:`C:/Users/geekerwan/.codex/tmp/magma-perf-fix/final-evidence/`,
结论文件 `magma-pair.json`;包含source selection、原始计数/日志、4张验图、真实恢复核验。
通用四臂分析器的 `performance.json` 标2/4是因为本次只测Magma两臂,不能冒称又重测了Espryt。
- profile:`../magma-perf-baseline-profile/` 与 `../magma-perf-candidate70fb-bench/`,
含原始perf.data、匹配Build ID的符号缓存及报告。测试计时不使用profile期间的FPS。
- 主机证据:`/home/swung/w7/magma-perf-logs/`,前缀 `final-gates-70fb6689`、
`syncval-caches-70fb6689`、`syncval-runahead-70fb6689`、`negative-70fb6689`、
`pipeline-key-red-once-70fb`、`ci-cache7-ac1f`。
原世界61个文件已逐项SHA256核对不变,options/mg_env/mg_transport逐字节恢复、风扇恢复0,
只保留新APK安装。已有Gradle修改和父FCL冲突索引未动。没有将缓存优化写成P7全量完成。
+142
View File
@@ -0,0 +1,142 @@
# Magma run-ahead
**已完成,2026-09-20**。最终生产与实机行为头 `194382c96a8a5f51ef23f412fdccfbd40a82bf78`。
后续 `70fb6689` 已修复 RD32 下的 Magma inproc 性能差距:**86.85→116.73 FPS**,
同包 monolith **115.01 FPS**;根因、缓存生命周期与复测见 [性能修复报告](magma-rd32-performance-fix.md)。
后续同包的 **render distance 32 四组合性能测量**见 [rd32-fourway.md](rd32-fourway.md)。
该轮默认动态频率下,Espryt monolith/inproc 为62.18/64.02 FPS,Magma 为116.08/86.85 FPS;
不要将下面的功能验证窗口替代这份高负载性能记录。
本次是在已完成的 P5f 与 Magma inproc 游戏修复上继续实现异步排队,
不是重开 P5f 包,也不宣称 P6 spawn 或 P7/P8 全量实现。
契约见 `MobileGL/MG_Remote/CONTRACT-MAGMA-RUNAHEAD.md`。
## 实现
- Magma 独立 readiness 条件满足后发布 `kCapRunAheadApply`,复用既有客户端闩、
wait class、反向事件流控和 present credit。`MOBILEGL_IPC_RUN_AHEAD=0` 保留为配对对照。
reply、显式同步和 credit 耗尽的等待仍保留。
- wire draw/clear/color blit 不再逐 draw 提交并 `vkQueueWaitIdle`。render pass、
framebuffer、view 和 blit descriptor pool 按实际 submit index 延迟释放;
Present、重建和 shutdown 处理最后一批对象。独立 blit 不复写在途 descriptor set。
- texture 上传和 GPU 内容保留提交不能越过旧 draw;draw/dispatch 在取得当前
command buffer 前准备 image、sampled texture 和 FBO attachments。native blit
后同时失效 pipeline/dynamic state 与 uniform manager 的 descriptor 绑定缓存。
- GPU buffer readback 后保留后续 draw 已预约的 slice;CPU draw preparation 期间
不允许 idle-drain 回卷 transient arena。同 layout image transition 保留内存依赖。
- compute work-group 上限由本地 CapsMirror 回答,不再通过三个 getter 插入无谓
barrier。修改限于 transport 的两个 compute COUNT/SIZE 查询。
- Vulkan 验证层发现并修复 descriptor indexing API/extension 启用条件、含 dynamic
UBO layout 的非法 UPDATE_AFTER_BIND、HOST_WRITE stage 和 Present layout transition
的写后写依赖。wire 使用已有按内容版本分配的 descriptor set,不原地修改在途 set。
- 最小化窗口丢弃 recording 后,只有 CPU preparation、renderer submit 和纹理独立
upload fence 都空闲才回收 future-tag 对象。纹理 fence 只轮询,不新增 queue wait;
同时避免对象持续累积和误把 renderer watermark 当作整个队列的 idle 证明。
## Redmi 发现的 VAO 状态漏发
初版 `3c97ea9c` run-ahead 进入世界后触发 `Magma:vertex-layout@P7`。
`6f764c42` 诊断包关闭 run-ahead 仍复现:enabled attribute 1 对应的 buffer window
却是 `0+1`。因此没有删去边界检查,也没有把它当作驱动格式限制绕过。
根因是 dirty tracker 把 `{VAO lifetime, configVersion}` 用普通 hash-combine
压成一个值判断身份变化。普通整数对会碰撞;Redmi 实际记录的两个身份为
`174/37` 与 `48/8026`。缓冲家族因 aggregate 变化发布了新窗口,CSO 家族却
漏发 bind,形成旧布局与新窗口组合。现在精确比较两个字段,变化时重新检查
三个 vertex families,各 emitter 仍可抑制自身未变化的记录。
新测试通过合法 setter 构造真实 VAO 的碰撞配置,经实际 validate 路径检查
`A(0+1 enabled) → B(0 enabled) → A` 的绑定及窗口 `2→1→2`,不改私有计数器。
候选修复 `376c04be` 已在 Redmi 捕获碰撞被修复的日志,世界连续运行 64.167 秒,
验图正常。该诊断包不是最终交付验收包;初版失败证据保留。
## 主机验证
七种实际排队场景各测 present credit 1/3,共 14 项:
buffer SubData/respecify/delete-name-reuse、program/uniform 快照、SSBO 写回读、
native 与 double-converted vertex slice、旧 texture draw 与后续上传的顺序、
GPU clear 后首次 storage image 升级、credit 用完时客户端真实停车。
用已有 apply hook 暂停真实服务端,观察真实 emit/applied watermark 和 producerParked,
不伪造 capability/sequence,也不把 ARMED 日志当作排队证明。
关闭 run-ahead 的负控同一 testcase 必须实际等 apply、失去 client lead 并失败,
恢复后转绿。同步验证必须证明 Khronos layer 被 loader 插入,完整执行 14 项,
且零 VUID / SYNC-HAZARD / validation error。两项均已接入 CI,脚本为
`scripts/ci/magma_runahead_checks.py`。
RSP 测试采样也修正了真实的 fixture race:异步 EndFrame 返回不代表 Present
统计已发布,测试现在等该条已发出的 Present applied 后再读日志;生产未加等待。
最终行为头的结果如下,skip 不计 PASS,完整发现集与 JUnit 核对:
| 门 | 总数 | PASS | skip | failed |
|---|---:|---:|---:|---:|
| unit | 2312 | 2302 | 10 | 0 |
| integration-gpu | 1401 | 1119 | 282 | 0 |
| strict integration-split | 180 | 176 | 4 | 0 |
| 双块 split + magma | 245 | 239 | 6 | 0 |
| 其中 run-ahead 专项 | 14 | 14 | 0 | 0 |
| 其中 buffer 专项 | 19 | 19 | 0 | 0 |
| 其中两后端逐帧 RSP | 2 | 2 | 0 | 0 |
| Khronos synchronization validation | 14 | 14 | 0 | 0 |
- unit / GPU / 双块的 skip 名称与前一轮完整结果集精确相同;普通 GPU 发现的 14 个
run-ahead 副本只在专用车道运行,因此在那里按 fixture 声明 skip,专用 14 项均执行。
- strict marker 与双块 fatal 棘轮均空;初版负控与最终 run-ahead-off 负控均真实红转绿。
Tracker 碰撞回归临时撤掉 exact-pair dirty 分支后 rc=1,恢复后 rc=0;改动已还原。
- Vulkan layer 实际插入 14 次,零 VUID / SYNC-HAZARD / validation error。日志另外保留
28 条既有 MobileGL `GL_STENCIL_INDEX8` caps 枚举应用 ERROR;它们不是 layer 消息,
checker 按来源分列,含 Vulkan 标识的消息和 loader ERROR 仍硬失败。
- pull / push 构建通过;G1 `.text 10806051 → 10806051`,27815 defined symbols,
added/removed/resized/renamed **0/0/0/0**。G2 **3017 == 3017**。
G14 完整 JSON 名称集合 **3774 → 3803,+29 / -0**。
- G1 上述结论是仓库脚本的 section size / symbol name / symbol size 比较,
不声称不同构建的原始 `.text` 逐字节相等。额外只读反汇编核对发现原始差异全部
来自元数据:7255 条 RIP 引用因生成的 SPIRV-Cross version 字符串缩短7字节而
位移,解引用字符串相同;107 条 immediate 对应同一源码文本的 `__LINE__` 位移。
生成的版本字符串和时间戳也不同,未把这种构建可复现性差异记成运行逻辑变化。
- wire/field/dirty generators、field self-test 与四个 include closure probes 全过。
证据目录 `final-gates-194382c9/`、`negative-194382c9/`、`syncval-194382c9/`、
`tracker-red-once-194382c9/`,均在上述主机日志根目录下。
## FCL 实机验证
设备限定 Redmi `2f7cbe2e`,包名 `com.tungsten.fcl.mgdebug.debug`,
Minecraft `26.3-rc-3`,世界 `test`。复现脚本与准备/恢复步骤见
`tools/device_bench/magma_runahead/README.md`。
最终 APK `FCL-magma-runahead-194382c9.apk` 已覆盖安装,保留游戏数据:
- APK SHA256:`69973e2f51b87bd0128420da62b92fa2fb862a11067baf1b54a142f971d13357`
- `libMobileGL.so` SHA256:`046d86c288ce891b16770148578ba1a6fea4057783b69c2359f5830e58b7b223`
- APK 内与 `/data/app/.../lib/arm64/libMobileGL.so` 哈希一致,记录在
`final-artifact-identity.json`。三臂均使用此 APK,分别重启设备后运行。
| 臂 | 实际能力 | 世界连续运行 | 帧增量 / 近似 FPS | 图像 |
|---|---|---:|---:|---|
| Magma inproc RA=1 | ARMED | 64.472 s | 7680 / 119.122 | 地形、天空、手、hotbar 与方向正常 |
| Magma inproc RA=0 | 实际 Config run-ahead=0,无 ARMED | 60.589 s | 7320 / 120.813 | 同上 |
| GLES inproc RA=1 | ARMED | 60.865 s | 7080 / 116.323 | 同上 |
三臂数据与截图位于 `final-Magma-on/`、`final-Magma-off/`、`final-GLES-on/`。
Magma-on 有一次 `adb pidof` 查询超时(rc=124),随后仍为同一 PID `10141`,
帧与日志持续推进、无进程重启或 crash;不将它写成应用退出。
三臂共 193 个 stats windows 全部 `rsp=0`,strict=1、role-split-state=1,
六张世界截图均已检查;证据结论见各目录 `screenshot-review.json` 和汇总
`final-device-verdict.json`。三个不同 boot-id 分别为
`300c0044-058f-4c34-9e88-6e888d834877`、`bf9a1b6c-ce58-4ca6-bc71-8da52a856684`、
`f61e1c51-e354-4867-b708-72ca463e2119`。
原 `mg_env.txt`(空文件)和 `mg_transport.txt`(`inproc\n`)已恢复并逐一核对
SHA256,世界已保存退出;没有回滚世界内容。用户两份 Gradle 配置及父 FCL 的
原有未合并索引未改动。本轮未将库/APK 二进制提交到 Git。
所有主机原始日志保留在 `/home/swung/w7/magma-ra-logs/`;设备证据在
`C:/Users/geekerwan/.codex/tmp/magma-runahead/`。静态镜头、未锁频、天气和温度不受控,
帧计数只能作本次运行记录,不能把所有提升都归因于客户端 run-ahead;
本次还同时取消了 GPU 逐 draw 等待。具名 P7/P8 shape refusals 继续保留。
本次 RA=1 与 RA=0 的近似均值接近,不能据此宣称客户端 run-ahead 有特定 FPS 收益;
能确认的是所测世界已能在约 120 FPS 水平运行,真实排队与 credit 语义由主机专项证明。
+594
View File
@@ -0,0 +1,594 @@
{
"date": "2026-09-20",
"source": "194382c96a8a5f51ef23f412fdccfbd40a82bf78",
"library_sha256": "046d86c288ce891b16770148578ba1a6fea4057783b69c2359f5830e58b7b223",
"clock_control": "stock-dvfs",
"render_distance": 32,
"simulation_distance": 12,
"warmup_seconds": 180,
"fan_target": 2,
"arms": [
{
"name": "Espryt-monolith",
"mean_fps": 62.178237711677376,
"median_interval_fps": 59.97003214006533,
"p10_interval_fps": 56.94306106612412,
"sample_seconds": 60.020999908447266,
"intervals": 60,
"boot_id": "b19a24d3-bf9d-4c99-a64e-1e70fac40f0f",
"hardware_window": {
"samples": 11,
"all_observed_pins_match": null,
"fixed_clock_evaluation": "not_applicable_stock_dvfs",
"drift_samples": null,
"observed_clock_ranges": {
"policy0_min": {
"min": 556800,
"max": 556800,
"observed_values": [
556800
]
},
"policy0_max": {
"min": 1555200,
"max": 1996800,
"observed_values": [
1555200,
1785600,
1996800
]
},
"policy0_cur": {
"min": 1555200,
"max": 1996800,
"observed_values": [
1555200,
1785600,
1996800
]
},
"policy6_min": {
"min": 1017600,
"max": 1017600,
"observed_values": [
1017600
]
},
"policy6_max": {
"min": 1689600,
"max": 1958400,
"observed_values": [
1689600,
1958400
]
},
"policy6_cur": {
"min": 1689600,
"max": 1958400,
"observed_values": [
1689600,
1958400
]
},
"gpu": {
"min": 525000000,
"max": 660000000,
"observed_values": [
525000000,
607000000,
660000000
]
},
"gpu_min": {
"min": 12,
"max": 12,
"observed_values": [
12
]
},
"gpu_max": {
"min": 0,
"max": 0,
"observed_values": [
0
]
},
"busy": {
"min": 65,
"max": 81,
"observed_values": [
65,
66,
69,
70,
71,
77,
80,
81
]
}
},
"fan_observed_values": {
"fan_rpm": [
"14466",
"14487",
"14570",
"14591"
],
"fan_target": [
"2"
]
},
"temperature_c_min": 53.1,
"temperature_c_max": 55.8,
"sample_elapsed_seconds": [
219.111,
224.585,
230.177,
235.749,
241.223,
246.748,
252.337,
257.904,
263.443,
269.017,
274.616
]
},
"actual_runtime": {
"backend_names": [
"Direct (OpenGL ES)"
],
"ipc_lines": [],
"run_ahead_armed": false,
"caps_call_masks": [],
"run_ahead_cap_bit_seen": false,
"stats_rows": 137,
"residual_pulls_max": 0.0
},
"source_directory": "C:\\Users\\geekerwan\\.codex\\tmp\\rd32-fourway-20260920-stock-fan2-espryt\\Espryt-monolith"
},
{
"name": "Espryt-inproc",
"mean_fps": 64.02439006486937,
"median_interval_fps": 63.0,
"p10_interval_fps": 58.94104917019154,
"sample_seconds": 60.02400016784668,
"intervals": 60,
"boot_id": "ede56fd0-78de-44ec-8f52-125ea4c072b1",
"hardware_window": {
"samples": 11,
"all_observed_pins_match": null,
"fixed_clock_evaluation": "not_applicable_stock_dvfs",
"drift_samples": null,
"observed_clock_ranges": {
"policy0_min": {
"min": 556800,
"max": 556800,
"observed_values": [
556800
]
},
"policy0_max": {
"min": 1555200,
"max": 1785600,
"observed_values": [
1555200,
1785600
]
},
"policy0_cur": {
"min": 1555200,
"max": 1785600,
"observed_values": [
1555200,
1785600
]
},
"policy6_min": {
"min": 1017600,
"max": 1017600,
"observed_values": [
1017600
]
},
"policy6_max": {
"min": 1689600,
"max": 1689600,
"observed_values": [
1689600
]
},
"policy6_cur": {
"min": 1689600,
"max": 1689600,
"observed_values": [
1689600
]
},
"gpu": {
"min": 443000000,
"max": 607000000,
"observed_values": [
443000000,
525000000,
607000000
]
},
"gpu_min": {
"min": 12,
"max": 12,
"observed_values": [
12
]
},
"gpu_max": {
"min": 0,
"max": 0,
"observed_values": [
0
]
},
"busy": {
"min": 68,
"max": 83,
"observed_values": [
68,
73,
77,
78,
79,
83
]
}
},
"fan_observed_values": {
"fan_rpm": [
"14163",
"14262",
"14363"
],
"fan_target": [
"2"
]
},
"temperature_c_min": 53.9,
"temperature_c_max": 56.6,
"sample_elapsed_seconds": [
215.636,
221.183,
226.728,
232.298,
237.875,
243.496,
249.053,
254.657,
260.27,
265.886,
271.475
]
},
"actual_runtime": {
"backend_names": [
"Direct (OpenGL ES)"
],
"ipc_lines": [
"Config: IPC ring=8MiB stage=256MiB 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'"
],
"run_ahead_armed": true,
"caps_call_masks": [
"0x0",
"0x3fff00000600"
],
"run_ahead_cap_bit_seen": true,
"stats_rows": 137,
"residual_pulls_max": 0.0
},
"source_directory": "C:\\Users\\geekerwan\\.codex\\tmp\\rd32-fourway-20260920-stock\\Espryt-inproc"
},
{
"name": "Magma-monolith",
"mean_fps": 116.07722925432384,
"median_interval_fps": 116.0,
"p10_interval_fps": 114.8736338247419,
"sample_seconds": 60.02900004386902,
"intervals": 60,
"boot_id": "addd73b6-b29a-4f65-a359-7c2a39bb60a0",
"hardware_window": {
"samples": 11,
"all_observed_pins_match": null,
"fixed_clock_evaluation": "not_applicable_stock_dvfs",
"drift_samples": null,
"observed_clock_ranges": {
"policy0_min": {
"min": 556800,
"max": 556800,
"observed_values": [
556800
]
},
"policy0_max": {
"min": 1555200,
"max": 1555200,
"observed_values": [
1555200
]
},
"policy0_cur": {
"min": 1555200,
"max": 1555200,
"observed_values": [
1555200
]
},
"policy6_min": {
"min": 1017600,
"max": 1017600,
"observed_values": [
1017600
]
},
"policy6_max": {
"min": 1689600,
"max": 1689600,
"observed_values": [
1689600
]
},
"policy6_cur": {
"min": 1689600,
"max": 1689600,
"observed_values": [
1689600
]
},
"gpu": {
"min": 832000000,
"max": 900000000,
"observed_values": [
832000000,
900000000
]
},
"gpu_min": {
"min": 12,
"max": 12,
"observed_values": [
12
]
},
"gpu_max": {
"min": 0,
"max": 0,
"observed_values": [
0
]
},
"busy": {
"min": 73,
"max": 78,
"observed_values": [
73,
74,
75,
76,
78
]
}
},
"fan_observed_values": {
"fan_rpm": [
"14163",
"14182",
"14363",
"14384",
"14487"
],
"fan_target": [
"2"
]
},
"temperature_c_min": 55.8,
"temperature_c_max": 56.6,
"sample_elapsed_seconds": [
216.537,
222.12,
227.724,
233.316,
238.927,
244.534,
250.192,
255.859,
261.488,
267.099,
272.72
]
},
"actual_runtime": {
"backend_names": [
"Direct (Vulkan)"
],
"ipc_lines": [],
"run_ahead_armed": false,
"caps_call_masks": [],
"run_ahead_cap_bit_seen": false,
"stats_rows": 251,
"residual_pulls_max": 0.0
},
"source_directory": "C:\\Users\\geekerwan\\.codex\\tmp\\rd32-fourway-20260920-stock\\Magma-monolith"
},
{
"name": "Magma-inproc",
"mean_fps": 86.85293459363007,
"median_interval_fps": 84.5,
"p10_interval_fps": 70.0,
"sample_seconds": 60.021000146865845,
"intervals": 60,
"boot_id": "7627b982-c264-4d2f-a9cb-1ecf40146c9c",
"hardware_window": {
"samples": 11,
"all_observed_pins_match": null,
"fixed_clock_evaluation": "not_applicable_stock_dvfs",
"drift_samples": null,
"observed_clock_ranges": {
"policy0_min": {
"min": 556800,
"max": 556800,
"observed_values": [
556800
]
},
"policy0_max": {
"min": 1555200,
"max": 1996800,
"observed_values": [
1555200,
1996800
]
},
"policy0_cur": {
"min": 1363200,
"max": 1996800,
"observed_values": [
1363200,
1555200,
1785600,
1996800
]
},
"policy6_min": {
"min": 1017600,
"max": 1017600,
"observed_values": [
1017600
]
},
"policy6_max": {
"min": 1689600,
"max": 1958400,
"observed_values": [
1689600,
1958400
]
},
"policy6_cur": {
"min": 1689600,
"max": 1958400,
"observed_values": [
1689600,
1958400
]
},
"gpu": {
"min": 525000000,
"max": 734000000,
"observed_values": [
525000000,
607000000,
660000000,
734000000
]
},
"gpu_min": {
"min": 12,
"max": 12,
"observed_values": [
12
]
},
"gpu_max": {
"min": 0,
"max": 0,
"observed_values": [
0
]
},
"busy": {
"min": 73,
"max": 82,
"observed_values": [
73,
75,
76,
78,
79,
80,
82
]
}
},
"fan_observed_values": {
"fan_rpm": [
"14570",
"14591",
"14697",
"14783",
"14804"
],
"fan_target": [
"2"
]
},
"temperature_c_min": 52.3,
"temperature_c_max": 56.2,
"sample_elapsed_seconds": [
216.05,
221.629,
227.22,
232.809,
238.395,
243.946,
249.485,
255.097,
260.705,
266.288,
271.93
]
},
"actual_runtime": {
"backend_names": [
"Direct (Vulkan)"
],
"ipc_lines": [
"Config: IPC ring=8MiB stage=256MiB 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'"
],
"run_ahead_armed": true,
"caps_call_masks": [
"0x0",
"0x3fff00000400"
],
"run_ahead_cap_bit_seen": true,
"stats_rows": 183,
"residual_pulls_max": 0.0
},
"source_directory": "C:\\Users\\geekerwan\\.codex\\tmp\\rd32-fourway-20260920-stock\\Magma-inproc"
}
],
"comparisons": [
{
"backend": "Espryt",
"monolith_fps": 62.178237711677376,
"inproc_fps": 64.02439006486937,
"inproc_over_monolith_ratio": 1.0296912942716816,
"scope": "One round of observed sustained stock-DVFS performance; clocks may differ across arms, so this is not isolated architecture overhead."
},
{
"backend": "Magma",
"monolith_fps": 116.07722925432384,
"inproc_fps": 86.85293459363007,
"inproc_over_monolith_ratio": 0.7482340434172177,
"scope": "One round of observed sustained stock-DVFS performance; clocks may differ across arms, so this is not isolated architecture overhead."
}
],
"restoration": {
"world_files": 61,
"world_hashes_match_backup": true,
"config": {
"options.txt": "4d1cd0cb595819d924f8d5823910b643c865f12b3f59b6900abd54b04e2ee646",
"mg_env.txt": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"mg_transport.txt": "1d80cf637af2284a1763196d824b41f6f12bea849aa81f95ab8db0e5ce043c95"
},
"fan_target": "0",
"installed_library_sha256": "046d86c288ce891b16770148578ba1a6fea4057783b69c2359f5830e58b7b223"
}
}
+85
View File
@@ -0,0 +1,85 @@
# Redmi RD32 四组合性能记录
> 本文保留 `194382c9` 的基线。后续 `70fb6689` 已修复 Magma inproc 的缓存退化,
> 同RD32场景实测 inproc **116.73 FPS**、monolith **115.01 FPS**;见 [性能修复报告](magma-rd32-performance-fix.md)。
2026-09-20。用户要求把 Espryt / Magma × monolith / inproc 的 render distance 都设为32,实测一轮。
最终每组合选入一次完整窗口;原始数据、排除项与复算方法均保留。
## 结果
| 组合 | 平均 FPS | 秒区间 FPS 中位数 | 秒区间 FPS P10 | 有效秒数 / 区间数 |
|---|---:|---:|---:|---:|
| Espryt-monolith | 62.18 | 59.97 | 56.94 | 60.021 / 60 |
| Espryt-inproc | 64.02 | 63.00 | 58.94 | 60.024 / 60 |
| Magma-monolith | 116.08 | 116.00 | 114.87 | 60.029 / 60 |
| Magma-inproc | 86.85 | 84.50 | 70.00 | 60.021 / 60 |
这轮 Espryt inproc / monolith 为 **1.030 倍**,小差异不足以确立稳定优势;
Magma inproc / monolith 为 **0.748 倍**,即本轮平均低约 **25.2%**。
Magma monolith 仍在约120 FPS的平台附近,不能据此推断其无上限吞吐。
两种 inproc 均实际 `run-ahead ARMED`;不是把 Magma lockstep 混作 inproc 结果。
这是**单轮默认动态频率下的持续性能观测**,不是隔离出的固定频率架构开销。
不能把差值全部归因于线程拆分,也不能把它与此前 RD12、未统一条件的旧结果作严格倍率比较。
## 共同条件与采样
- Redmi M332BF `2f7cbe2e`;FCL `com.tungsten.fcl.mgdebug.debug`;Minecraft `26.3-rc-3`。
- 同一 APK / MobileGL 行为代码 `194382c96a8a5f51ef23f412fdccfbd40a82bf78`,测试期间未安装新库。
`libMobileGL.so` SHA256:`046d86c288ce891b16770148578ba1a6fea4057783b69c2359f5830e58b7b223`,测试结束仍一致。
APK 身份继承 [run-ahead 报告](magma-runahead.md);后续 Git 提交仅文档。
- `renderDistance:32`、`simulationDistance:12`、`overrideWidth:2620`、`overrideHeight:1280`、
`enableVsync:false`、`maxFps:260`、`inactivityFpsLimit:"minimized"`。F3关闭,FCL FPS计数开启。
测前/测后 options 均保留,并核对关键值。
- 原世界完整保留,在副本上固定初始相机、晴天和正午,关闭时间/天气推进与新生物生成;
每组恢复同一个副本快照,不依赖 force-stop 阻止自动保存。既有生物模拟仍保留。
- 每组独立重启,`cpuss-0-0` 入场低于40°C,进入世界后预热180秒,再独立采样至少60秒。
所选四组有四个不同 boot-id,八张 pre-window/final 图均人工检查;场景、方向与HUD正常。
- 所选四组测量窗所有硬件观测均为风扇档位2、RPM>0。CPU/GPU由系统DVFS与温控管理,
没有关闭温控。每约5秒记录频率、温度、GPU busy与风扇状态。
- FCL `getFps()` 返回的是自上次读取的 swap 计数。以同PID相邻 `FCLFPS` 日志的真实时间差归一化,
只保留完整落在测量窗内的区间;平均为总帧数/总时间。P10与中位数是这些约一秒区间的FPS分位,
**不是逐帧1% low**。MGPipe的120帧窗口计数仅作近似交叉核对,不作为主结果。
- 每组实际 backend/transport、capability 与 `rsp=0` 均核查。inproc使用strict=1、role-split=1、
stage=256 MiB、present credit=1;monolith实际无IPC配置、`vbs=0`。
## 测量窗硬件观测
| 组合 | CPU温度 °C | 大核实际频率 GHz | GPU实际频率 MHz | 风扇 RPM |
|---|---:|---:|---:|---:|
| Espryt-monolith | 53.1–55.8 | 1.690–1.958 | 525–660 | 14466–14591 |
| Espryt-inproc | 53.9–56.6 | 1.690–1.690 | 443–607 | 14163–14363 |
| Magma-monolith | 55.8–56.6 | 1.690–1.690 | 832–900 | 14163–14487 |
| Magma-inproc | 52.3–56.2 | 1.690–1.958 | 525–734 | 14570–14804 |
表中为有限采样点的范围,不表示采样间绝无变化。部分截图有读取硬件状态时产生的
Shell root toast;所有组使用相同遥测方式,未把它当作游戏图形错误。
Magma monolith的屏幕缺口留白在右侧,其余组在左侧;前后图方向一致,游戏视口均为2620×1280。
## 排除与恢复
最初按历史档案尝试固定频率:1100 MHz被厂商限到1050,1050持续负载又降到900,
900尝试则在正式窗口开始后发现大核被温控从1958.4改到1689.6 MHz。这些尝试均作废,
不进入表格,也没有通过关闭保护来强行维持频率。
第一份 stock Espryt monolith 结果为59.884 FPS,但窗口风扇全程为0/RPM0;它保留为排除控制。
补测的fan2结果62.178 FPS替代它,未合并、未平均或挑选多个有效窗口中的最好者。
其他三组原始窗口直接选入。选择映射与原因保存在 `selection.json`。
结束后原世界61个文件逐一SHA256核对完全一致;options.txt、mg_env.txt、mg_transport.txt
逐字节恢复(包括原RD12设置),风扇恢复0。临时设备世界副本已清理,主机证据保留。
既有Gradle修改与父FCL未合并索引未改动;本轮没有改渲染代码。
## 证据
最终选入证据:`C:/Users/geekerwan/.codex/tmp/rd32-fourway-20260920-final/`,包括:
- `performance.json`:从原始日志重算的完整区间、硬件观测与运行模式检查;
- `root-signoff.json`、`restoration-verified.json`、`fixture-hashes.json`:验图与真实恢复核验;
- `selection.json` 与四组原始summary、完整library/logcat、before/after截图;
- 原采样脚本在 `../rd32-fourway-20260920-stock/benchmark.py`;补测在
`../rd32-fourway-20260920-stock-fan2-espryt/benchmark.py`;离线分析器在
`../rd32-fourway-20260920-1050/analyze.py`,支持 `--root <目录> --require-complete`。
仓库内精简机读数据见 [rd32-fourway.json](rd32-fourway.json)。
+96
View File
@@ -0,0 +1,96 @@
# P5f 波次 2 集成报告
> 包:fc `b5c60d5a`、fe `203f59cc`、fm `3cc397d3`(fm 行为代码 `552ade5b`)。
> 按 fc → fe → fm 合入,验收代码头 `78ec3b67`;其后只补报告、注释和门名称。
> WSL 验证树 `/home/swung/w7/p5f-int`,日志 `/home/swung/w7/p5f-logs/`。
## 1. 结果
Espryt 与 Magma 的合并双块车道 **210 条:204 PASS、6 既有 skip、0 failed**。
`strict-expected-markers.txt` 与 `dualblock-expected-fatals.txt` 均为空集合,双向棘轮通过;
普通 Admitted、ESCALATED 与字段 Fatal 全为零。P5f 尚未收官:静态量、registry/反向通道复核、
字段表分类及设备门仍在后续范围,不能从本车道全绿推导这些工作已完成。
fe 改读服务端 framebuffer/texture/program 记录,扩 Begin XFB 快照,并修复快照被 make-current
重置丢失。fm 接通服务端纹理/FBO、无应用缓冲的 draw/compute、程序 Archive 和 uniform/image
描述符;不再把“所有 draw 都先到 buffer-legacy-arm”当事实,基线 gl_VertexID 像素用例已经证明
它不成立。支持范围由实际记录消费者决定,已有 P7 buffer 路径仍在触及客户端对象之前具名拒绝。
fc 的控制帧复审修复一同进入集成:wire 回复序号、void 成功回复、MetalLayer 拒绝、无指针
成员检查与并发/重入 probe 配对。分包说明见 [fc-report](fc-report.md)、[fe-report](fe-report.md)、
[fm-report](fm-report.md)。
## 2. 集成接缝与棘轮
- `PipeApply.h` 保留 fe 的 XFB span 状态与 fm 的 mip 工作字段;双方的 copy-image handle、
storage-block program handle 使用同一份定义和 sink 接线。
- `PipeApply.cpp` 同时保留 XFB make-current 生存期修复与无 buffer backend ops 时的纹理 staged
接收/重定义/销毁。不会为 Magma 假注册 buffer 支持,也不会与 Espryt hook 重复接收字节。
- 独立 fm 为可独立验证而携带的 Espryt copy-image/readback 接缝,与 fe 合并后仅保留一份。
- 合 fc 后实测仍是原 **6 对、155 条具名红**(`int-after-fc-dualblock-*`)。
合 fe 后为 **1 对、2 条 Magma Clear 红**(`int-after-fe-dualblock-*`)。
合 fm 后为 **0 对、0 红**;没有新增预期对。
- fe 负责原五对 Espryt 首阻塞;fm 负责 `GetFramebufferBindingSlot@Clear`。
`GetTextureObject@CopyImageSubData` 是双方共享端点接缝,集成只记一次删除。
strict 的两条原有 stale 行已有 f1 基线证据,其余八对随 fe 的读者迁移消失。
复审还修复并验证了:无缓冲 shader 支持、独立 family caps、sampler/image 记录解析、纹理 view
的 native STORAGE 用途升级及旧内容保留、非分层 image 忽略 Layer、sRGB 开关、1D 附件视图、
同 image 传输 layout 与临时 render-pass 资源的 GPU 生存期。
## 3. 最终门
表中 PASS 与 skip 分开计数;skip 不作为像素正确性的证据。
| 门 | 总条目 | PASS | skip | failed / 结论 |
|---|---:|---:|---:|---|
| unit | 2286 | 2276 | 10 | 0 |
| integration-gpu | 1375 | 1118 | 257 | 0;含原有功能/驱动/专属车道跳过 |
| integration-split,旋钮关 | 179 | 175 | 4 | 0 |
| strict,旋钮关 | 179 | 175 | 4 | 0;零三类 marker,空表棘轮通过 |
| 双块 split + magma | 210 | 204 | 6 | 0;空表棘轮通过 |
| Magma 主车道(包含在上一行) | 31 | 29 | 2 | 0;两项为既有 ClipDistance 驱动能力跳过 |
| f1 机制阴性对照 | 1 | — | 0 | knob=1 真绿;knob=0 因 distinct-block 自身断言真红 |
| P7 PackedFloat 格式探针 | 1 | — | 0 | 按预期失败,JUnit 与精确具名 Fatal 核对通过 |
pull / push 最终增量构建都 rc=0,生效宏分别 absent / `MOBILEGL_PIPE_PUSH=1`。
G1 带 `--fail-on-text-delta --fail-on-symbol-set-change` 硬门 rc=0:
`.text` **10806051 → 10806051**,defined symbols **27815 → 27815**,
**0 added / removed / resized / renamed**;data/bss/rodata 也零差。
G2:pull / push 各 **3011** 个 CTest 名,集合差为 0。
G14:f1 **3646 → 3716**,**新增 70、删除 0**,不存在重复注册名。
生成器 check 与 self-test 通过(12 / 13 / 27 个阴性控制),include closure 4 probes、
0 skipped、0 problems。文档引用 strict 检查仍有基线两处 basename 歧义:
`CONTRACT-P5.md` 的 `Init.cpp:44` 与 `Core.cpp:39`;不是本次新增,未把它报成全绿。
核心证据:`int-final-{unit,gpu,isplit}.log/xml`、`int-final-strict-gate.log`、
`int-final-dualblock-gate.log`、`int-final-negctl-gate.log`、`int-final-known-red.log/xml`、
`int-final-{pull,push}-build.log`、`int-final-g1-hard.log`、`int-final-name-gates.log`、
`int-final-gens-gate.log`。strict、双块、GPU 串行执行,marker 判定在各自运行后立即保存,
没有用被后续车道覆盖的私有日志补证。
## 4. Red-once
- fc:控制帧投递回退真红;后续序号、成功回复、MetalLayer、probe 配对与指针成员控制均
有实际红/绿证据,见 fc 报告。
- fe:`SplitCaptureSnapshotSurvivesMakeCurrentUntilObjectRelease` 先红后绿。
- fm:ProgramSource 退回 archive 旧 binding 值真红,record overlay 版本绿;另在集成树
`a6144426`(尚缺 named-mip 修复)运行 staging 生产测试,level-1 extent 为 0 而非 2×2×1
真红;合入修复后同用例 1/1 绿。证据为 `int-fm-staging-{red-once,green}.log`。
## 5. 明确保留的边界
- `FieldOwnership.def` 仍有 **13 个 BARRIER_PULLED 字段(17 行,含 forward 重复行)**。
可达消费者已改道;legacy accessor 分类、P8 client arrays 和 fv 的 RecordError 要在收口
逐项裁定,不能为把表清空而伪称旧指针 getter 是 record-supplied。逐帧 rsp 零门尚未单独验收。
- Magma 不发布 `kCapRunAheadApply`。普通无缓冲 draw、采样、compute imageStore 均在严格双块
下有真实像素证据;应用 buffer 消费、部分 native 格式/窗口能力仍是 P7/P12,具名拒绝。
lockstep 不作为跨角色读写的豁免,具体出口门 4 的回答见 fm 报告。
- R11F_G11F_B10F mipmap 的真实旧基线 inproc 像素测试也失败;保留单独已执行的
`integration-magma-p7-known-red`,强制 `Magma:mipmap-native-format@P7`,没有靠移标签藏红。
- fs / fr / fv 尚未开工。XFB snapshot/identity 与部分 registry 入口已被 fe/fm 改动,下一轮
先重核 f0 清单,不重复处理已退役的站点。`PipeInputs::IsLive` 与 `RecordError` 的边界仍在。
- 设备门未执行:本次 `adb devices -l` 只见 `10AG930MXC002B3 unauthorized`,未见指定的
Redmi `2f7cbe2e`。host lavapipe 结果不替代设备门。
- 本轮分包并行复审不替代 ID-66 要求的 P5f 阶段收官异模型族审查;P6 仍不开工。