Commit Graph

6 Commits

Author SHA1 Message Date
claude-noether 3834ba012f Phase 2 close: VP9 backend compiles clean on 7.0.0-rc3 arm64
Three commits stacked on boltzmann:~/src/linux-rockchip
vp9-enablement-iter1 branch (1262 LoC total):

  47431635801d  regs header VP9 struct definitions (+238)
  da8482271938  shared codec-spec helpers in rkvdec-vp9-common.h (+511)
  71cc0d96d212  new backend rkvdec-vdpu381-vp9.c + wiring (+513)

Module builds clean against 7.0.0-rc3 ARM64 kernel after fixing two
compiler-caught typos (BSP-style regNNN_ field naming vs mainline plain
names — exactly the namespace-bridging risk Janet flagged in v2 review).

What's NOT yet correct: 5 TODO Phase 2.1 markers in
vdpu381_config_vp9_regs covering RCB address setup, segmentation
register packing, ref-deltas/mode-deltas bit-packing, and probability
storage rotation. Each TODO has the BSP reference location identified
(mpp/hal/rkdec/vp9d/hal_vp9d_vdpu382.c lines).

Push to gitea hanging (ssh timeout); commits safe on boltzmann disk.

Phase 3 entry point documented: retry push, implement 5 TODOs, build,
backup ampere module, install + modprobe cycle, sanity v4l2-ctl
enumeration, pre-flight IRQ diagnostic, first decode attempt with
watchdog watch.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 23:21:57 +00:00
claude-noether a87678bbbf Phase 2: field-mapping table — legacy rkvdec_regs → rkvdec_vdpu381_regs_vp9
The translation guide for porting rkvdec_vp9_run and its config_*
helpers from the flat vdpu34x register layout to the segmented vdpu381
layout. Each row maps a legacy field to its new location across the
4 segments (common, vp9_param, common_addr, vp9_addr).

Key semantic deltas captured:
- reg02.dec_mode → reg009_dec_mode.dec_mode (VDPU381_MODE_VP9=2)
- Per-ref indexed arrays (reg17_19[i], reg29_31[i], reg37_39[i],
  reg48_50[i]) become separate per-frame-slot registers
  (last/golden/altref triplets) in vdpu381
- Decode trigger moves from RKVDEC_REG_INTERRUPT=0x004 +
  RKVDEC_INTERRUPT_DEC_E mask to VDPU381_REG_DEC_E=0x028 +
  VDPU381_DEC_E_BIT (single bit)
- reg09.yuv_virstride dropped (legacy-only convenience field)
- reg51.lastref_yuv_virstride dropped (not in vdpu381 layout)
- NEW fields surfaced: reg103_frame_flags (intra_only, prob_update_en,
  refresh_en, allow_high_precision_mv, interp_filter_switch_en),
  reg064_cprheader.cprheader_offset, reg105.count_update_en

Also captures 5 open questions for the next code-writing session
(prob-index rotation, delta_prob_base aliasing, RCB integration,
timeout threshold sizing).

This document IS the load-bearing artifact for the Phase 2 backend
implementation. The .c file translation walks this table line-by-line.

Companion to commit 47431635801d (regs header VP9 struct definitions).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 23:15:11 +00:00
claude-noether 5a8403a0bb Phase 1 v3 amendment: VP9 writes 4 segments not 5, narrow common-file split
Janet AMEND-cycle re-review of v2 returned 2 surgical corrections:

A. OFFSET_POC_HIGHBIT_REGS is HEVC/H.264 only — POC isn't a VP9
   concept. rkvdec-vdpu381-vp9.c writes 4 segments (COMMON,
   CODEC_PARAMS, COMMON_ADDR, CODEC_ADDR), not 5. Confirmed via BSP
   hal_vp9d_vdpu382.c — no poc_highbit reference anywhere in VP9
   path.

B. Common-file split narrowed: only spec-computation functions
   (probability init, segmap state, entropy update) move into a
   rkvdec-vp9-common.h header as static-inline helpers. The
   register-writing functions (config_seg_registers,
   config_ref_registers, config_registers) STAY in legacy
   rkvdec-vp9.c — they touch the legacy flat struct rkvdec_regs
   and can't share with the new vdpu381 struct without abstracting
   the register backend (over-engineering). The new backend
   rewrites these against the vdpu381 struct.

Bonus implementation hint: VDPU381_MODE_VP9=2 is already defined in
rkvdec-vdpu381-regs.h:22 — Casanova's v7.0 series had VP9 in mind
from the start, just didn't ship a backend.

RCB sizing tuning deferred to Phase 6 (vp9d_refine_rcb_size formula
from BSP).

With both amendments applied, Janet's verdict carry-forward is
PROCEED. Phase 2 implementation begins next session.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 23:12:47 +00:00
claude-noether 5a1ba37791 Phase 1 plan + v2 amendment per Janet architect review
Phase 1 v1 claimed VP9 enablement was a < 100-line wiring patch
reusing legacy rkvdec_vp9_fmt_ops in vdpu381_coded_fmts[]. Janet
architect review (verdict AMEND) surfaced two BLOCKERs that overturn
the thesis:

A. vdpu381_variant.num_regs is unset (defaults 0); legacy VP9 path's
   rkvdec_memcpy_toio writes MIN(sizeof, 0)=0 bytes. Zero MMIO config.

B. vdpu381 register layout is segmented across 5 distinct OFFSET_*
   blocks (COMMON, CODEC_PARAMS, COMMON_ADDR, CODEC_ADDR, POC_HIGHBIT)
   plus decode trigger at VDPU381_REG_DEC_E=0x028. Legacy VP9 writes
   flat-from-base+0 and triggers via RKVDEC_REG_INTERRUPT=0x004 —
   wrong register-block layout AND wrong trigger offset.

Plus Amendment C: BSP rkvdec2_irq checks BIT(1); mainline
vdpu381_irq_handler checks BIT(2). Same register (0x380), different
bit. VP9-set BIT(1) status would misclassify as ERROR.

Both blockers confirmed empirically by reading mainline rkvdec.c and
BSP mpp_rkvdec2.c source (rkvdec2_run dispatches via mpp_write_req
on req->offset, NOT a flat dump; trans_tbl_vp9d shares HEVC's
128..199 register-DMA range).

v2 architecture: new rkvdec-vdpu381-vp9.c backend (~600-800 lines)
+ extracted rkvdec-vp9-common.{c,h} for the SPEC layer (probability
tables, frame_ctx, segmap) + VP9 register-struct extensions in
rkvdec-vdpu381-regs.h. Reuses vdpu381_irq_handler, V4L2 controls,
RCB infrastructure, IOMMU path — all confirmed as codec-agnostic.

Sourcing the bit-packed register struct definitions from Rockchip
BSP MPP hal_vp9d_vdpu382.c (vdpu382 = sibling IP family).

Next: Phase 1 v2 → Janet re-review for sign-off before Phase 2 code.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 23:08:52 +00:00
claude-noether 8dce724b8c Phase 0: architectural correction — VP9 is a wiring patch, not a port
Rockchip BSP inspection (mpp_rkvdec2.c, soc.cmake, vp9d/CMakeLists.txt)
overturns the initial premise. The same physical rkvdec IP on RK3588
accepts two register-protocol dialects within its 0x400 MMIO window:

- vdpu381 dialect (Casanova mainline naming) — H.264 + HEVC
- vdpu34x dialect (Rockchip legacy naming)    — VP9 + AVS2

BSP rkvdec_rk3588_data uses rkvdec_v2_hw_info + rkvdec_v2_trans, the
same dispatch tables as RK356X. MPP userspace builds the vdpu34x VP9
backend for RK3588 because no vdpu381 VP9 backend exists; it isn't
needed — the existing vdpu34x register layout drives this hardware.

Implication: mainline rkvdec_vp9_fmt_ops (vdpu34x layout, written for
RK3399) can drive RK3588 rkvdec hardware as-is. VP9 enablement is a
< 100-line wiring patch (third entry in vdpu381_coded_fmts[] + maybe a
codec-aware IRQ split), not a 1000+ line backend port.

Open questions revised; risk register tightened.

Phase 1 starts by reading BSP rkvdec_rk3588_hw_ops IRQ + power-on
routines to resolve O2/O3 (codec-aware dispatch needed? mode-switch
register?) and BSP vp9d_vdpu34x.c for max-resolution + RCB usage.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 22:57:36 +00:00
claude-noether eb60ecd224 Phase 0: open campaign + substrate findings
Open ampere-vp9-enablement to enable VP9 hardware decode on RK3588 ampere
(rkvdec / vdpu381 register layout). Sibling to ampere-kernel-decoders
(closed at HEVC bit-perfect 2026-05-17 ~00:42).

Phase 0 substrate locked: upstream status (Collabora roadmap, no series
posted), legacy code reference (rkvdec-vp9.c 1042 lines, vdpu341),
vdpu381 pattern reference (rkvdec-vdpu381-hevc.c, struct-based regs +
common-file split), work-plan outline, open questions (chiefly: where
is the vdpu381 VP9 register layout documented), risk register.

Phase 1 (architectural plan + Sonnet review) next session.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 22:48:26 +00:00