iter39 Phase 4-6 LANDED on backend — Phase 7 awaiting fresnel power-on

Adds the iter39 sub-profile (H264 Hi10P + HEVC Main10) FR landing
materials and resumption sequence to the campaign repo.

- phase4_iter39_subprofile_plan.md: full Phase 4 plan with Phase 5
  sonnet-architect review amendments folded in. Documents the
  Option A/B/C/D scope tree, the locked Option C choice (full NV15→P010
  userspace unpack), the LOC breakdown (~180), and the test plan.
- phase7_iter39_test_rig.sh: end-to-end test script for fresnel. Encodes
  Hi10P + Main10 fixtures, runs libva vs kdirect bit-exact comparison
  (both via `-vf hwdownload,format=p010le` to normalize the NV15 stride
  difference between paths), SSIM_Y check vs SW reference, and verifies
  the iter38 5/5 baseline still holds.
- PRE_COMPACT_HANDOFF.md: TL;DR table row for iter39 (committed
  pending validation), Phase 7 resumption sequence, internals-summary
  for future-session resumption.

Backend tip: `662f887` (iter39 α-31) + `8746690` (unpack self-test) on
gitea master. Self-test passes on noether x86_64; compile-test clean on
boltzmann aarch64 native; self-review of commit vs Phase 5 amendments
APPROVED. Phase 7 actual decode test blocked on fresnel power-on.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-17 09:22:34 +00:00
parent e66c5c0583
commit 407c7c56e1
3 changed files with 327 additions and 4 deletions
+40 -4
View File
@@ -1,6 +1,6 @@
# Pre-Compact Handoff — Session 2026-05-14 (FINAL post iter38)
# Pre-Compact Handoff — Session 2026-05-17 (iter39 sub-profile work landed, pending fresnel test)
Use this doc to resume the fresnel-fourier campaign after Claude context compaction. **Campaign at definitive close: 5/5 codecs PASS in a single libva session, no env-override required.**
Use this doc to resume the fresnel-fourier campaign after Claude context compaction. **Iter38 close still holds (5/5 PASS, single libva session). Iter39 sub-profile work (H264 Hi10P + HEVC Main10) committed at backend `662f887` and awaiting Phase 7 validation on fresnel.**
## TL;DR
@@ -14,6 +14,7 @@ Use this doc to resume the fresnel-fourier campaign after Claude context compact
| Env-gated DIAG probes (iter29/30/33/35) | **CLEANED** | iter36 (-131 / +7 LOC) |
| α-26 mis-routed cosmetic | **REVERTED** | iter37 (1-line; rkvdec never read that field) |
| Libva multi-device probe | **DONE** | iter38 (single session serves all 5 codecs; no env override needed) |
| H264 Hi10P + HEVC Main10 sub-profile | **CODE LANDED — Phase 7 PENDING** | iter39 α-31 (backend 662f887): NV15 CAPTURE pix_fmt, synthetic-SPS bit_depth=2, NV15→P010 userspace unpack in copy_surface_to_image, P010 reporting in DeriveImage/QueryImageFormats. Self-tested (test_nv15_unpack passes on noether). Awaiting fresnel power-on for vainfo enumeration + libva.P010==kdirect.P010 bit-exact verification. |
| Codec | libva 10F sha | kdirect 10F sha | SW 10F sha | L==K | L==SW |
|---|---|---|---|---|---|
@@ -48,7 +49,7 @@ vainfo: Supported profile and entrypoints
| Component | Location | Tip |
|---|---|---|
| Campaign repo (this) | `/home/mfritsche/src/fresnel-fourier/` | `ba4b6fd` on gitea master |
| Libva backend fork (noether) | `/home/mfritsche/src/libva-multiplanar/libva-v4l2-request-fourier/` | `7ac934e` on gitea master |
| Libva backend fork (noether) | `/home/mfritsche/src/libva-multiplanar/libva-v4l2-request-fourier/` | `662f887` on gitea master (iter39 α-31; iter38b is `7ac934e`) |
| Libva backend (fresnel deploy) | `/home/mfritsche/src/libva-v4l2-request-fourier/` | sync to gitea master, `ninja -C build` |
| Kernel source (boltzmann) | `~/src/kernel-agent-bootstrap/build/marfrit-packages/arch/linux-fresnel-fourier/` | pkgrel=14 clean |
| Kernel running on fresnel | `linux-fresnel-fourier 7.0-14` | clean shipping kernel, no diagnostic printks |
@@ -153,7 +154,42 @@ Expect: 5× PASS.
1. **Multi-context simultaneously** — current design supports only one decode context at a time across devices (device switch tears down pools). Could be expanded to per-context pools to support simultaneous mixed-codec decode. Not requested.
2. **Sub-profile support** H264 Hi10P, HEVC Main10, VP9 Profile 2 are HW-supported on RK3399 but the libva backend has no entries in `pixelformat_for_profile` and elsewhere. Out of scope for this campaign.
2. ~~**Sub-profile support**~~*Phase 6 LANDED 2026-05-17 (iter39 α-31, backend `662f887`)*. H264 Hi10P + HEVC Main10 wired through the backend with NV15→P010 userspace unpack. VP9 Profile 2 explicitly excluded (RK3399 rkvdec kernel ctrl caps at PROFILE_0). PRIME-side P010 emission deferred (consumers wanting P010 must use the COPY path). Phase 7 test rig at `phase7_iter39_test_rig.sh`; awaiting fresnel.
## Resumption sequence — iter39 Phase 7 (when fresnel is up)
```bash
# 1. Sync + build backend on fresnel
ssh fresnel 'cd ~/src/libva-v4l2-request-fourier && \
git fetch && git reset --hard origin/master && \
ninja -C build && \
sudo install -m644 build/src/v4l2_request_drv_video.so /usr/lib/dri/'
# 2. Push test rig + run
scp ~/src/fresnel-fourier/phase7_iter39_test_rig.sh fresnel:/tmp/
ssh fresnel 'bash /tmp/phase7_iter39_test_rig.sh'
# Expected pass criteria:
# 1. vainfo lists VAProfileH264High10 + VAProfileHEVCMain10
# 2. libva.P010 SHA == kdirect.P010 SHA for Hi10P and Main10 fixtures
# (both paths use -vf hwdownload,format=p010le to normalize NV15)
# 3. SSIM_Y vs libavcodec SW (yuv420p10le) >= 0.999
# 4. iter38 5/5 PASS baseline still holds on H264/HEVC/VP9/VP8/MPEG-2
```
## Iter39 internals — pre-Phase 7 verification done
- **Self-test** of `nv15_unpack_plane_to_p010` (`tests/test_nv15_unpack.c` in backend): zero / all-max / 8 known vectors / remainder widths {1,2,3,7} / multi-row stride-padding / chroma-shape — ALL PASS on noether x86_64.
- **Compile-test**: aarch64 native build on boltzmann clean (gcc 15.2.1 / libva 1.23.0 / libdrm 2.4.133), .so produced, 0 new warnings.
- **Self-review of commit 662f887** vs Phase 5 amendments: APPROVED. All 3 mandatory amendments + MAX_PROFILES bump + guard updates + NV15-stride source confirmed present.
## Iter39 design notes (load-bearing)
- `driver_data->is_10bit` is the per-session flag (request.h). Set in `RequestCreateContext` from `config_object->profile`, cleared in `RequestDestroyContext`. Drives image.c P010 reporting/unpack and context.c CAPTURE pix_fmt.
- `video_format` cache invalidated on bit-depth transition (sibling to iter38's device-switch invalidation in `request_switch_device_for_profile`). Same session can now alternate Main → Main10 contexts.
- Synthetic SPS pre-seed (α-25 lineage) extended for 10-bit: `bit_depth_luma_minus8 = 2`. Image_fmt resolution in `rkvdec-h264-common.c:196` + `rkvdec-hevc-common.c:467` dispatches on bit_depth_luma_minus8 only — profile_idc ignored, `v4l2_ctrl_hevc_sps` has no profile_idc field at all.
- NV15 stride = V4L2-reported `destination_bytesperlines[i]` (kernel may pad above `ceil(width/4)*5`). NEVER assume `width*2`.
- VP9 Profile 2 NOT in any path. Added comment in config.c near VAProfileVP9Profile0 case to deter future "completeness" PRs.
## Memory entries (full campaign set)