1 Commits

Author SHA1 Message Date
claude-noether 6e8c970c1d iter2 Phase 0 + Phase 1 lock: HEVC Main on rkvdec
Iteration 2 of the campaign 8(+1)-phase loop opens following iter1
close (dc69378). Per phase0_evidence/2026-05-07/cross_validator_
traces.md suggested ordering, iter2 attacks HEVC Main on rkvdec —
the kernel + driver path is verified working (cross-validator sweep
exit 0); broken link is the libva backend at five distinct sites:

  src/config.c HEVCMain case fall-through (analogous to iter1 Bug 1)
  src/picture.c HEVCMain explicit UNSUPPORTED_PROFILE reject (NEW)
  src/h265.c uncompiled in build (presumably staging-era CIDs;
              Phase 2 source-read decides scope of rewrite)
  include/hevc-ctrls.h staging-era local header (deferred from
              iter1 Phase 5 Nit 6; iter2 closes the loop)
  src/meson.build h265.c commented out (re-enable)

Plus possible novel issues vs iter1's MPEG-2 work:
  - HEVC has 10 stateless control IDs vs MPEG-2's 3 (much larger
    rewrite if h265.c uses staging-era API)
  - HEVC slice_params is dynamic-array (kernel rkvdec accepts up
    to 600 entries) — different submission shape vs MPEG-2 single-
    struct or H.264 fixed-shape
  - HEVC SCALING_MATRIX is conditional (only when scaling_list_
    enabled in SPS); mapping VAIQMatrixBufferHEVC to V4L2 control
  - HEVC ENTRY_POINT_OFFSETS is in kernel surface (tile/slice
    resync) but campaign fixture doesn't use tiles — defer

Locked research question:

  Make HEVC Main the third codec to pass boolean-correctness on
  fresnel via libva-v4l2-request-fourier — mpv --hwdec=vaapi
  bbb_720p10s_hevc.mp4 engages backend cleanly and DMA-BUF GL
  import yields HW pixels byte-identical to SW reference for the
  same frames.

Phase 1 success criterion (5 boolean checks, all must pass):

  1. vainfo enumerates VAProfileHEVCMain on rkvdec env binding
     (regression check; already passes today).
  2. vaCreateConfig(VAProfileHEVCMain, VLD) returns VA_STATUS_
     SUCCESS. (Pre-iter2: VA_STATUS_ERROR_UNSUPPORTED_PROFILE.)
  3. ffmpeg -hwaccel vaapi -i bbb_720p10s_hevc.mp4 -frames:v 5
     -f null - exits 0 cleanly with no Failed-to-create-decode-
     configuration lines and no S_EXT_CTRLS EINVAL on HEVC
     controls. (Phase 1 criterion 3 anchored on ffmpeg-direct,
     mirroring iter1 Phase 5 Q4 amendment for codecs mpv may
     filter out.)
  4. mpv --hwdec=vaapi --vo=image at +02s seek: 2 distinct frames
     hash-equal to SW reference, hash-differ from each other (real
     motion). DMA-BUF GL import path per memory feedback_rockchip_
     pixel_verify_path.md (NOT ffmpeg-vaapi+hwdownload, which is
     cache-stale on RK3399 for both H.264 and MPEG-2 per iter1
     Phase 6/7 findings).
  5. iter1 MPEG-2 + T4 H.264 reference hashes BOTH still match
     (regression check on prior-iteration cells):
       MPEG-2 +02s: HW1=6e7873030dbf...   HW2=ccc7ce08810d...
       H.264 +30s:  HW1=f623d5f7a416...   HW2=7d7bc6f2146d...

Substrate carry-over:

  - libva-v4l2-request-fourier master tip post-iter1-close
    (commits e7dad7a..229d6d1 stack on iter8 65969da).
  - bbb_720p10s_hevc.mp4 fixture (620 KB, HEVC Main, 1280x720,
    24fps, 10s, yuv420p; provenance phase0_evidence/2026-05-07/
    test_fixtures.md).
  - Cross-validator anchor: phase0_evidence/2026-05-07/
    cross_validator/hevc/ — 14 S_EXT_CTRLS + 5 QUERY_EXT_CTRL
    (HEVC slice_params dynamic-array introspection unique among
    the 5 codecs) + 4 REQUEST_ALLOC.
  - Memory carries forward: feedback_gitea_as_claude_noether,
    feedback_no_session_termination_attempts, feedback_header_
    deletion_check (iter1 lesson L1 — apply to hevc-ctrls.h
    deletion), feedback_review_empirical_over_theoretical
    (iter1 lesson L2 — apply to Phase 5 review responses),
    feedback_rockchip_pixel_verify_path (iter1 lesson L3 —
    DMA-BUF GL is the verifier, NOT cached-mmap).

Out-of-scope (LOCKED): VP9/VP8 (later iterations); HEVC Main 10
(silicon support unverified); HEVC Main Still Picture; performance
metrics; long-duration HEVC stress; tile / wavefront parallel
processing (ENTRY_POINT_OFFSETS); Phase 4 cross-cutting backlog
(B1 device-discovery, B3 BeginPicture profile-aware reset, B4
context.c log suppression, B5 vbv_buffer_size negotiation, L3
vaDeriveImage cache-stale fix); chromium-fourier 149 install;
src/context.c changes; upstream engagement.

Predecessor open questions:
  - iter1 B3 latent surface-reuse bug (picture.c:287
    h264.matrix_set=false hits union byte 240) — for HEVC, the
    union member is params.h265.{picture,slice,iqmatrix,
    iqmatrix_set}. params.h265 layout differs from params.mpeg2.
    Phase 2 source-read action item: verify whether byte 240 lands
    in a meaningful HEVC field. If so, iter2 may need to address
    even though MPEG-2 didn't.

Phase 2 source-read targets (queued for next phase):
  - src/h265.c (~267 lines) — current state, target API
  - src/picture.c:204-206 (the explicit HEVC reject)
  - src/config.c:55-69 (confirm HEVCMain fall-through)
  - src/surface.h:103-108 (params.h265 struct)
  - include/hevc-ctrls.h (staging-era; identify CID/struct refs)
  - src/meson.build (commented-out h265.c)
  - linux/v4l2-controls.h:2110+ (modern HEVC stateless UAPI)
  - drivers/staging/media/rkvdec/rkvdec_hevc.c (rkvdec contract)
  - libavcodec/v4l2_request_hevc.c (FFmpeg reference impl)
  - va/va_dec_hevc.h (VAAPI HEVC buffer structs)

Predicted iter2 close shape: similar pattern to iter1 (config
break + h265.c new-API rewrite + header delete + meson re-enable
+ picture.c reject removal). Larger code change than iter1
(predicting 250-400 lines for h265.c rewrite vs iter1's ~120 lines
for mpeg2.c). One novel construct (slice_params dynamic-array)
worth Phase 4 contract-clause-level attention. Expect Phase 6
takes longer than iter1; Phase 7 harness re-uses iter1's pattern.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-08 09:44:30 +00:00