diff --git a/phase6_iter5b_implementation.md b/phase6_iter5b_implementation.md new file mode 100644 index 0000000..75226a6 --- /dev/null +++ b/phase6_iter5b_implementation.md @@ -0,0 +1,73 @@ +# Iteration 5b — Phase 6 (implementation) + +Commits A + B + C landed on fork master 2026-05-12. All built clean on fresnel `linux-fresnel-fourier 7.0-1` (libva 1.23, ninja 1.13.2, gcc 15.2.1). No fix-forward needed. + +## Commits + +| SHA | Files | LOC | Summary | +|---|---|---|---| +| `ce304ef` (A) | `src/codec.h` (new) · `src/codec.c` (new) · `src/meson.build` | +102 / -2 | NEW codec.h/codec.c — `pixelformat_for_profile()` helper mapping VAProfile → V4L2 OUTPUT FOURCC. Register in meson.build sources + headers. | +| `f8256e6` (B) | `src/request.h` · `src/config.c` | +24 | request.h: `last_output_pixelformat` field on `struct request_data`. config.c: wire up dead `object_config->pixelformat` at CreateConfig via the helper. IMP-2 amendment. | +| `4b2288f` (C) | `src/surface.c` | +78 / -11 | NEW `find_sole_active_pixelformat()` static helper (CRIT-1-corrected: `int iter` per request.c:411-418 pattern). Replace surface.c:173 hardcode with helper call. Extend gate to fire on pixelformat change. Comment updated to mention "codec change" alongside resolution (IMP-1). | + +**Total**: 3 commits, 188 LOC delta, 5 files modified + 2 NEW. + +Fork tip: `4b2288f`. Backend installed SHA256 `d7722da742bfcb86a9136b07e6d9a5de23668f37fcad328258966c5338265e82` (pre-iter5b was `6e90b7a9b2c33480…`). + +## Phase 5 amendments incorporated + +| ID | Amendment | Where landed | +|---|---|---| +| CRIT-1 | iterator type `int` (not `struct object_heap_iterator`); cast-on-return pattern | `surface.c::find_sole_active_pixelformat`, mirrors request.c:411-418 | +| IMP-1 | Gate comment mentions codec/profile change alongside resolution | `surface.c:178-200` updated comment block | +| IMP-2 | Wire `object_config->pixelformat` at CreateConfig; helper returns FOURCC directly | `config.c::RequestCreateConfig` populates field; `find_sole_active_pixelformat` returns `config_object->pixelformat` directly (one fewer indirection) | +| IMP-3 | Commit message precision (hantro substitution to MPEG2_DECODER) | Commit C message body uses precise framing | + +All 4 Phase 5 amendments incorporated in the actual commits, no follow-up edits needed. + +## Phase 1 criteria status (post-Phase-6, pre-Phase-7) + +| # | Criterion | Build-time signal | Empirical signal | +|---|---|---|---| +| 1 | HEVC + VP9 + VP8 libva == kdirect == sw | Backend built clean; new SHA installed | Pending Phase 7 sweep | +| 2 | MPEG-2 unchanged | hantro path's MPEG2_SLICE mapping unchanged (helper returns MPEG2_SLICE for both VAProfileMPEG2Simple + Main) | Pending Phase 7 sweep | +| 3 | H.264 keyframe still decodes | H264_SLICE mapping preserved | Pending Phase 7 sweep | +| 4 | Control-payload anchors hold | No code touching control-handling | Pending Phase 7 strace anchor diff | + +## Build inputs verified + +- `pixelformat_for_profile()` symbol resolved: gcc compiled `surface.c::find_sole_active_pixelformat` without missing-symbol errors → codec.h #include chain correct. +- `config.h` included in surface.c — `struct object_config` access works → no missing-type errors at compile. +- `int iter` pattern: ninja build succeeded → no implicit-int-conversion warning, no struct-undefined error. +- `last_output_pixelformat` field added to `struct request_data`: ninja compiled request.c et al. cleanly → no field-already-exists / type-mismatch errors. + +## Build environment + +``` +Linux fresnel 7.0.0-fresnel-fourier #1 SMP PREEMPT Sat May 9 19:24:42 CEST 2026 aarch64 +libva 1.23 / meson 1.x / ninja 1.13.2 / gcc 15.2.1 +fork tip: 4b2288f +backend SHA256: d7722da742bfcb86a9136b07e6d9a5de23668f37fcad328258966c5338265e82 +``` + +## Phase 7 readiness + +The Phase 4 plan's C7 verification matrix is ready to run. Phase 3 sweep script preserved on fresnel at `/tmp/iter5_p3/sweep.sh` and in `iter5_phase3_baseline.tgz`. Expected post-fix hash matrix: + +| Codec | Pre-fix libva | Expected post-fix libva | kdirect (anchor) | +|---|---|---|---| +| H.264 1080p30 | `71ac099b…` (keyframe partial) | unchanged — Bug 4 deferred | `1e7a0bc9…` | +| HEVC 720p | `06b2c5a0…` (all-zero) | **`9340b832…`** | `9340b832…` | +| VP9 720p | `06b2c5a0…` (all-zero) | **`4f1565e8…`** | `4f1565e8…` | +| MPEG-2 720p | `19eefbf4…` (worked) | `19eefbf4…` (unchanged) | `19eefbf4…` | +| VP8 720p | `06b2c5a0…` (all-zero) | **`136ce5cb…`** | `136ce5cb…` | + +Phase 7 binary checks: `cmp -s libva_.yuv kdirect_.yuv` for each of {hevc, vp9, vp8}. 3 of 3 must pass. MPEG-2 + H.264 cmp-against-prior-Phase-3-anchor must hold (no regression). + +## Substrate state at Phase 6 close + +- Fork tip `4b2288f` on noether + fresnel + gitea (push via `claude-noether@git.reauktion.de` SSH). +- Backend installed at `/usr/lib/dri/v4l2_request_drv_video.so` SHA256 `d7722da742bfcb86a9136b07e6d9a5de23668f37fcad328258966c5338265e82`. +- Kernel: `linux-fresnel-fourier 7.0-1` (unchanged; no kernel work in iter5b). +- Test fixtures unchanged. +- Phase 7 sweep ready to execute.