mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-18 23:43:23 +09:00
Two things land together: the plan and contract draft P6 needs before it starts, and the
working notes that until now existed on exactly one machine.
1. P6's plan and contract draft (neither started; not one line of code)
docs/Disaggregated/P6-SPAWN-PLAN.md the package plan
docs/Disaggregated/P6-CONTRACT-DRAFT.md the contract draft (moves to
MG_Remote/CONTRACT-P6.md when c6 lands)
The three findings that mattered, all written into the documents:
a. P6 is SMALLER than its roadmap cell suggests. The transport primitives are already in
the tree and already tested: SocketDoorbell including hangup detection and the two
lost-wakeup fences (Doorbell.cpp:211-360, four cases in FdPassingTest), SCM_RIGHTS fd
passing, ShmSegment::Adopt, and the SurfaceOp / WindowKind schema already defined in
protocol.fbs. inproc uses a real second shm mapping rather than an alias, and
SessionRings.h:22-28 says that was done so today is not the first time it runs. P6 is
assembly plus a control plane plus a process, not "write a socket transport".
b. The evidence for "P6 is only a transport swap" has EXPIRED. It was bought by P5c, whose
audit found 59 direct memory accesses in a tree that already looked clean. P5e changed
the tree again. So the first package, a6, is a read-only audit that writes no code, and
every contract row that depends on it is marked PENDING a6 rather than decided in
advance.
c. P6 does not get a game running on the phone. ANativeWindow* is meaningless in the child,
and protocol.fbs:186-196's own comment says Android transfers the window out of band -
that band is P12. P6 lands pbuffer / surfaceless / offscreen, which is what HeadlessGL,
the split-equivalent lane and trace replay need, and which is exactly what P6's own exit
gate measures. A real window reaching the server is a named refusal. This gets its own
section because "P6 is done" would otherwise read as "the game runs now".
The contract adds rule G: a role may not name a process-local handle. It extends P5c's
rule E (a role may not name the other role's memory) from memory to identity - EGLDisplay /
EGLSurface / EGLContext / ANativeWindow* / fd number / pid / mapped address either cross as
a token this contract defines or they do not cross, and a descriptor crosses only through
SCM_RIGHTS, where the kernel renumbers it.
What P5e left for P6 gets its own section. The latch semantics are already designed
(ARCHITECTURE.md:504) and are copied unchanged. What is new is that after run-ahead the
client no longer waits while the peer process can DIE: the client holds records that were
published and will never be applied, and Android's freezer suspends the child without
closing anything. So slow and dead must be distinguishable WITHOUT a timeout threshold.
That is P6's only new design; everything else is carriage. It shares a predicate with E1's
outstanding re-specification (ID-122), and the two should be designed together.
Two gates carried over from P5e's lessons: G2 requires integration-spawn's test-name set to
match integration-split's name for name, because a differing set means the lane is quietly
running less; and the arm-proof gate requires every entry to record the child pid and
transport=spawn in its OWN private log - ID-124 established that this kind of false green
really happens, and a spawn lane that actually ran monolith would pass every other gate.
S2's shape must be settled before it is written, and the document says why: E1 is the
cautionary case.
2. The working notes move into the repository (docs/Disaggregated/notes/, 415 .md files)
ROADMAP / CURRENT_STAGE_PROGRESS / MEASUREMENTS cite ruling numbers, audit line numbers and
the provenance of gate figures from ~/w7/notes/, a directory that exists on one machine and
is under no version control. A record cited hundreds of times that lives only locally is not
a record, so it moves in whole, with its directory structure intact.
Only .md moves. Scripts, run logs, census and gate result JSON, patches, APKs and nm dumps
stay where they are: they are evidence DATA rather than documents - large, regenerated per
run, and mostly carrying absolute paths and device serials that mean something only on the
machine that produced them. The mapping and this split are written in
docs/Disaggregated/notes/README.md.
Two exceptions are recorded there too: P6's BRIEF has been promoted to a first-class
document and keeps no copy under notes/, so the two cannot drift apart; and recovered/ holds
material salvaged from failed workflow runs, which may duplicate the like-named phase
directories and is kept because a few of those were the only complete version at the time.
CI's citation lint takes docs/Disaggregated/*.md only (non-recursive), and notes/ is
deliberately outside it: those notes' file:line citations were written against their own
code heads, and resolving them against today's HEAD would fail wholesale - which is not an
error, it is their correct state as a historical record. To check one, use the revision it
declares (--rev).
3. Inconsistencies fixed in passing
- README.md's status line still said P5e was in progress while the stage table already said
closed.
- CURRENT_STAGE_PROGRESS's next-step item 1 still listed the exit gate as pending, though
(a) and (b) were run in the previous commit; rewritten to closed plus the one item that
actually remains (E1).
- ROADMAP's P6 row still had the pre-phase plan in three of its cells; it now carries the
package order, the scope boundary and the two new gates.
Checked with check_doc_citations.py: 125 citations across docs/Disaggregated/*.md, 0 problems.
215 lines
12 KiB
Markdown
215 lines
12 KiB
Markdown
# P1 package `fix-tests` — F3 only (`p1/fix-tests`, WSL `~/w7/p1-fix-tests`)
|
||
|
||
Branch `p1/fix-tests`, branched from the integrated `feat/disaggregated @ 97b997d5`.
|
||
Owns finding **F3** and nothing else. F1, F2 and F4 belong to other packages and were not touched.
|
||
|
||
## Commits
|
||
|
||
| sha | subject |
|
||
|---|---|
|
||
| `c67c47f7` | `[Test] (Pipe): let a test that drives a backend helper directly declare the verb it stands in` |
|
||
|
||
Diff against the branch point (`git diff --stat 97b997d5..HEAD`):
|
||
|
||
```
|
||
MobileGL/MG_Test/Framebuffer/FramebufferTest.cpp | 30 ++++++++-
|
||
MobileGL/MG_Test/SanityTest.cpp | 18 +++++-
|
||
MobileGL/MG_Test/ScopedPipeVerb.h | 78 ++++++++++++++++++++++++
|
||
MobileGL/MG_Test/Texture/TextureTest.cpp | 7 +++
|
||
4 files changed, 128 insertions(+), 5 deletions(-)
|
||
```
|
||
|
||
Nothing outside `MobileGL/MG_Test/**` was touched; `MG_Test/Pipe/**` (the other package's) was
|
||
not touched either; no production source, no `scripts/`, no CMake, no fixture.
|
||
`MG_IntegrationTest/**` was not touched: the helper is a header-only class used only by unit
|
||
targets, and every one of them already has `${MGL_ROOT}/MobileGL` on its include path, so no
|
||
shared helper needed to move there.
|
||
|
||
## What the fix is
|
||
|
||
`MobileGL/MG_Test/ScopedPipeVerb.h` — `MobileGL::MG_Test::ScopedPipeVerb`, an RAII
|
||
"this test is standing inside verb X" object:
|
||
|
||
* **ctor** calls the real `MG_Pipe::MGPipeFillForVerb(verb)` — the exact call `MG_Impl` makes
|
||
before that verb reaches a backend. Nothing is bypassed and nothing is faked: the block is
|
||
filled out of the live `GLContext` through the production filler.
|
||
* **`Renew()`** re-fills the same verb, for a test that drives the helper again after moving
|
||
frontend state — that is what a second GL entry point's `MGP_FILL` would have done.
|
||
* **dtor** re-arms the poison with a `kQuery` fill (`GetGpuTimestampNs`, whose class mask is a
|
||
single field): the serial bumps and every field the scope stamped goes stale. This matters
|
||
when the suite runs as one process — a developer running `./FramebufferTest` directly rather
|
||
than one ctest entry per case — where otherwise one case's declaration would silently cover a
|
||
later case that forgot to make one.
|
||
* **pull build**: the whole class body is `#if MOBILEGL_PIPE_PUSH`-gated to nothing; the
|
||
constructor still takes an `MGPipeVerb` (the enum is unconditional in `MGPipe.h`), so call
|
||
sites are identical in both arms and cannot rot.
|
||
|
||
Placement rule, copied from the brief's D7 for `MGP_FILL`: the declaration goes **immediately
|
||
before** the backend call, after every frontend mutation that call is meant to see. A call of a
|
||
different verb *class* in the same test gets its own nested scope (`{ ScopedPipeVerb clear(Clear); ... }`).
|
||
|
||
It is not a global escape hatch, the poison was not weakened, and no test name changed.
|
||
|
||
### Where it is used (exactly the eleven failing entries, no others)
|
||
|
||
| file | test | verb declared | why |
|
||
|---|---|---|---|
|
||
| `MG_Test/SanityTest.cpp` | `DirectGLESSanity.BindsAMultisampleTextureDespiteTheDefaultMipmapFilter` | `DrawArrays` | `DirectGLES::BindCurrentTextures()` is the per-draw unit walk — it reads `GetProgramForDraw`, a `kDraw`-only field |
|
||
| `MG_Test/SanityTest.cpp` | `DirectGLESSanity.BindingZeroClearsPreviousNativeTextureBinding` | `DrawArrays` + 2×`Renew()` | three walks = three draws; the third stands after `glBindTexture(GL_TEXTURE_2D, 0)` |
|
||
| `MG_Test/SanityTest.cpp` | `DirectGLESTextureSync.UnitMemoRefusesToDriveATwinFromAnotherTexture` | `DrawArrays` + `Renew()` | `SyncNeccessaryTextures()` is the per-draw unit walk; the second fill re-reads the memo keys, which is the premise (the silent slot swap moved none of them) |
|
||
| `MG_Test/Framebuffer/FramebufferTest.cpp` | `DrawIntoAWidenedDrawBufferReachesTheDriverWithAlphaWritesMaskedOff` | `DrawArrays` | `SyncRenderState(forColorClear=false)` is the draw arm |
|
||
| `…` | `ClearIntoAWidenedDrawBufferKeepsAlphaWritableAndSubstitutesOne` | `DrawArrays`, then `Clear` (nested scopes) | the test issues a draw then a clear; the clear half must go through on `kClear`'s fill set alone |
|
||
| `…` | `ApplicationAlphaMaskOffIsStillHonouredOnANativeDrawBuffer` | `DrawArrays` | |
|
||
| `…` | `DualSourceBlendFactorsReachTheDriverWhenTheExtensionIsThere` | `DrawArrays` | |
|
||
| `…` | `DualSourceBlendIsDeclinedRatherThanThrownWhenTheExtensionIsMissing` | `DrawArrays` + `Renew()` | two draws, `glBlendFunc` between them |
|
||
| `…` | `DualSourceFactorsAreDeclinedEvenWithBlendingDisabled` | `DrawArrays`, `Clear` (nested), `Renew()` | draw / clear / draw |
|
||
| `…` | `DualSourceFactorsWithBlendingDisabledStillReachACapableDriver` | `DrawArrays` | |
|
||
| `MG_Test/Texture/TextureTest.cpp` | `TextureTest.StorePackedWordsToClientCopiesWordsVerbatimUnderPackParams` | `ReadPixels` + `Renew()` | `ReadbackImpl::StorePackedWordsToClient` reads the PACK block; two stores with `glPixelStorei` between |
|
||
|
||
## Verification — commands and actual output
|
||
|
||
Environment: WSL Arch, `CCACHE_BASEDIR=/home/swung/w7`, `cmake --build <dir> -j 12`.
|
||
|
||
### Baseline before the fix (the failure being fixed, reproduced)
|
||
|
||
```
|
||
ctest --test-dir build-linux -L unit --no-tests=error -j 8 # rc=0 100% passed, 0 failed out of 1482
|
||
ctest --test-dir build-push -L unit --no-tests=error -j 8 # rc=8 99% passed, 11 failed out of 1482
|
||
ctest --test-dir build-verify -L unit --no-tests=error -j 8 # rc=8 99% passed, 11 failed out of 1482
|
||
```
|
||
|
||
The 11 in both are exactly the F3 list (push reports `Failed` / one `SEGFAULT` — that build has
|
||
`MOBILEGL_PIPE_POISON == 0`, so it reads the *zeroed* block rather than aborting; verify reports
|
||
`Subprocess aborted`, the poison Fatal).
|
||
|
||
### (a) `ctest -L unit` green in all three build dirs
|
||
|
||
```
|
||
cmake --build build-linux -j 12 # 0
|
||
cmake --build build-push -j 12 # 0
|
||
cmake --build build-verify -j 12 # 0
|
||
ctest --test-dir build-linux -L unit --no-tests=error -j 8 # rc=0 100% tests passed, 0 tests failed out of 1482
|
||
ctest --test-dir build-push -L unit --no-tests=error -j 8 # rc=0 100% tests passed, 0 tests failed out of 1482
|
||
ctest --test-dir build-verify -L unit --no-tests=error -j 8 # rc=0 100% tests passed, 0 tests failed out of 1482
|
||
```
|
||
|
||
Additionally, each affected binary run **whole, in one process** (verify build), which is the
|
||
case the destructor's re-arm protects:
|
||
|
||
```
|
||
build-verify/MobileGL/MG_Test/SanityTest exit=0 82 tests, PASSED
|
||
build-verify/MobileGL/MG_Test/Framebuffer/FramebufferTest exit=0 61 tests, PASSED
|
||
build-verify/MobileGL/MG_Test/Texture/TextureTest exit=0 192 tests, PASSED
|
||
```
|
||
|
||
### (b) pull build symbol-identical to `~/w7/p1-before-libMobileGL.so`
|
||
|
||
```
|
||
python3 scripts/symbol_report.py --before ~/w7/p1-before-libMobileGL.so \
|
||
--after build-linux/libMobileGL.so --threshold 0
|
||
```
|
||
|
||
```
|
||
symbol-report: before: /home/swung/w7/p1-before-libMobileGL.so (19100448 bytes on disk)
|
||
symbol-report: after : build-linux/libMobileGL.so (19100448 bytes on disk)
|
||
symbol-report: .text 10792579 -> 10792579 (+0, +0.000%)
|
||
symbol-report: .data 76824 -> 76824 (+0) .bss 1296872 -> 1296872 (+0) .rodata 1534938 -> 1534938 (+0)
|
||
symbol-report: 27799 -> 27799 defined symbols: 0 added, 0 removed, 0 resized, 0 renamed
|
||
```
|
||
|
||
**0 / 0 / 0 / 0, `.text` delta 0.** (Expected by construction: the library contains no test code,
|
||
and the helper is a no-op header in the pull build anyway.)
|
||
|
||
### (c) `ctest -N` name diff
|
||
|
||
```
|
||
ctest --test-dir build-linux -N > ft-N-raw.txt
|
||
sed -n 's/^ *Test *#[0-9]*: //p' ft-N-raw.txt | sort > ft-names-linux.txt # 2360 names
|
||
comm -23 ~/w7/p1-before-ctest-names.txt ft-names-linux.txt | wc -l # 0 removed
|
||
comm -13 ~/w7/p1-before-ctest-names.txt ft-names-linux.txt # 26 added
|
||
```
|
||
|
||
**Zero removed.** The 26 additions are all from the earlier P1 packages, already merged at the
|
||
branch point — **this package adds none**:
|
||
`DirectGLES|DirectVulkan.PipeVerifyArmingScenario.{Armed,CorruptedFieldIsReported}`,
|
||
`DirectGLES|DirectVulkan.PoisonOmissionScenario.{OmittedFieldAbortsOnThatVerb,TheSequenceThePoisonControlsRun,WithoutOmissionCompletes}`,
|
||
`PipeCatalogue.{FloatVectorsCompareBitwise,SixValueStructsHaveFieldLists,StickyFieldsAreExactlyTheSeven,VerbTableIsTheFunctionTable}`,
|
||
and the 13 `PipeInputsTest.*`.
|
||
|
||
`build-push` registers the same 2360 names (0 added / 0 removed vs `build-linux`). `build-verify`
|
||
registers 3178 — the extra 818 are the `integration-verify` lane that `MOBILEGL_ITEST_REQUIRE_GPU=ON`
|
||
turns on in that configuration, not a name change from this package.
|
||
|
||
### (d) the helper is not a rubber stamp
|
||
|
||
Two mutations of `FramebufferTest.DrawIntoAWidenedDrawBufferReachesTheDriverWithAlphaWritesMaskedOff`
|
||
in `build-verify`, run directly with `MOBILEGL_LOG_FILE_PATH` set so the Fatal line is readable:
|
||
|
||
**A — the declaration deleted from that one test:**
|
||
|
||
```
|
||
exit=134 (SIGABRT)
|
||
Fatal{UnmigratedPipeInput, "GetRenderStateParametersVersion@<none>"}
|
||
```
|
||
|
||
**B — the declaration kept but naming the WRONG verb class** (`GenerateMipmap`, `kTextureOp`,
|
||
whose mask does not carry the render-state fields):
|
||
|
||
```
|
||
exit=134 (SIGABRT)
|
||
Fatal{UnmigratedPipeInput, "GetRenderStateParametersVersion@GenerateMipmap"}
|
||
```
|
||
|
||
B is the stronger half: the helper does not make the poison tolerant, it fills exactly the named
|
||
verb's class mask, and a read outside that mask still aborts naming the field **and the declared
|
||
verb**. The fill table remains the only thing that says what a verb may read.
|
||
|
||
**C — restored:** `exit=0`, `100% tests passed, 0 tests failed out of 1`, and
|
||
`git status --porcelain -- MobileGL/ scripts/ CMakeLists.txt` is empty. The tree ends clean at
|
||
`c67c47f7`.
|
||
|
||
## F2 enumeration
|
||
|
||
Not owned by this package. F1, F2 and F4 were not touched.
|
||
|
||
## Deviations
|
||
|
||
1. **Tree path.** The tree is `~/w7/p1-fix-tests` (the task text said `~/w7/fix-tests`). Branch,
|
||
branch point (`97b997d5`) and ownership are as briefed. Tree wins.
|
||
2. **The three build directories did not exist.** The task said the tree has `build-linux`,
|
||
`build-push` and `build-verify` configured; it had none. I configured them myself, copying
|
||
`~/w7/pipe`'s cache flags exactly (Release, `/usr/sbin/clang++`, ccache, INFO, `BUILD_TEST=ON`,
|
||
`BUILD_INTEGRATION_TEST=ON`, mesa EGL vendor + lavapipe ICD, `CMAKE_POLICY_VERSION_MINIMUM=3.5`;
|
||
`MOBILEGL_PIPE_PUSH=ON` for push, `MOBILEGL_PIPE_VERIFY=ON` + `ITEST_REQUIRE_GPU=ON` for verify,
|
||
matching `~/w7/pipe/build-verify`).
|
||
3. **`-DMOBILEGL_BUILD_BENCHMARK=OFF` added to all three configures.** With benchmark left at its
|
||
default the configure dies in the fetched Google Benchmark sub-project
|
||
(`CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage` from its
|
||
`check_cxx_compiler_flag`). `~/w7/pipe`'s three caches all carry
|
||
`MOBILEGL_BUILD_BENCHMARK:BOOL=OFF`, so this reproduces the reference trees rather than
|
||
changing anything. A transient `googletest` clone failure on the first `build-verify` configure
|
||
was cleared by deleting `build-verify/_deps/googletest-{src,subbuild}` and re-configuring.
|
||
4. **`ctest -N` baseline.** Acceptance (c) does not name a baseline file; I used
|
||
`~/w7/p1-before-ctest-names.txt` (the pre-P1 list), which is the strictest available and shows
|
||
both that nothing was removed and that the only 26 additions in the whole lane came from the
|
||
other packages.
|
||
5. **Extra demonstration.** Acceptance (d) asks only for the removal case (A). I also ran the
|
||
wrong-verb case (B), because "removing it makes the test fail" alone would also hold for a
|
||
rubber stamp that filled everything; B is what shows it does not.
|
||
6. **Destructor behaviour is a design choice not spelled out in the brief.** Leaving the scope
|
||
re-arms the poison (a one-field `kQuery` fill) rather than doing nothing. Rationale in the
|
||
header and above; without it a single-process run of a test binary would let one case's
|
||
declaration cover a later case that made none. It uses only the public filler — no production
|
||
source, and no new API, was needed.
|
||
|
||
## Unfinished
|
||
|
||
Nothing in this package's scope.
|
||
|
||
Out of scope, and still open where the findings file left them: **F1** (missing `FillPoints.def`
|
||
rows), **F2** (`GetSamplingResolutionGeneration` going stale mid-verb) and **F4** (the
|
||
integrator's command corrections). Consequently the `integration-verify` lane and the 79-case
|
||
verify retrace were **not** run here — they are still red for F1/F2 reasons this package does not
|
||
own, and running them would prove nothing about F3. The only lane this package's change can
|
||
affect is `ctest -L unit`, which is green in all three build directories.
|