Skip to content

feat(moq-vaapi)!: vendor moq-dev/vaapi in-tree and trim unused codecs - #8235

Merged
kixelated merged 3 commits into
mainfrom
vendor/moq-vaapi
Nov 8, 2026
Merged

kixelated merged 3 commits into
mainfrom
vendor/moq-vaapi

Conversation

@kixelated

@kixelated kixelated commented Nov 8, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

moq-vaapi lived in moq-dev/vaapi and shipped through crates.io. That made every fix a publish-then-bump round trip (the radeonsi fix waited a quest on it). The separate repo existed because the crate's build.rs needed libclang. moq-dev/vaapi#8 checked the bindings in, so nothing keeps it out of the monorepo. moq-nvenc and moq-v4l already moved in-tree the same way.

Approach

  • rs/moq-vaapi comes from moq-dev/vaapi at 24c7559 (0.2.1, which includes the radeonsi fix from moq-dev/vaapi#13). The root moq-vaapi dependency becomes a path dependency, version 0.2.1.
  • The crate uses the workspace versions of its dependencies: thiserror 2, libloading 0.9, and tracing instead of log. It also takes the workspace lints; the crate-level allow for vendored code now states its reason.
  • The justfile's vendor and bindgen recipes become rs/moq-vaapi/bindgen.sh, like moq-v4l's script. It reproduces the old bindings byte for byte. It also patches bindgen's Va::new bound, because libloading 0.9 no longer accepts AsRef<OsStr>.
  • Dropped the AV1, VP8, VP9, MPEG-2, and JPEG buffer wrappers and their bindgen allowlist entries, which no driver uses. libva.rs goes from 37k to 22k lines.
  • Docs and quests now point at the in-tree crate. The radeonsi quest is done: it waited only on taking 0.2.1, and its note goes into encode/backend/vaapi.rs.

Validation

  • just ci passes.
  • VA-API hardware tests (moq-vaapi plus moq-video's vaapi tests, ignored ones included, with openh264), using libva 2.24.1, iHD 26.3.5, and Mesa 26.2.6 from nixpkgs: 62/62 pass on both an Intel iGPU (renderD128) and an AMD RX 9070 (renderD129). The only skips are a test that skips by design when MOQ_VAAPI_DEVICE is set, and H.265 at 320x240 on radeonsi, which quest/m3/h265-min-width.md tracks.

Impact

  • moq-vaapi (breaking): the AV1, VP8, VP9, MPEG-2, and JPEG buffer types are gone: their PictureParameter, SliceParameter, IQMatrix, EncSequenceParameter, EncPictureParameter, and EncSliceParameter variants; BufferType::{HuffmanTable, Probability, QMatrix} with the HuffmanTable and QMatrix enums; and those codecs' bindgen types. There is no replacement; the crate only drives H.264 and H.265.
  • moq-vaapi logs through tracing instead of log.
  • No other public API or wire changes.

Alternatives

  • Keep moq-vaapi standalone. That costs a publish and a bump for every fix, and leaves the vendor-sync check in a second repo.
  • Keep the trimmed codecs. That means more upstream code to keep in sync for nothing.
  • Keep moq-dev/vaapi's CI check that regenerates the bindings and fails on drift. moq-v4l and moq-nvenc don't have one, and the bindings only change when someone runs the script.

Follow-ups

  • Archive moq-dev/vaapi once this lands, after pointing its README here (maintainer).
  • moq-vaapi still returns anyhow errors in its public API, against rs/AGENTS.md's thiserror-for-libraries rule. That was already true before the move and is left alone here.

(Written by Claude Opus 5.5)

🤖 Generated with Claude Code

Review

Rewritten by quest review after each round.

  • Reviewer: Codex, gpt-6.1-sol, medium effort
  • Session: 01a1b8bb-c209-78a2-b32b-a38f650f68b1, round 1
  • Head: c51c63f
  • Base: origin/main at 4a86602
  • Score: 9/10, Source review found no actionable regressions or blockers in the scoped diff, but builds and tests were not run as instructed.
  • Findings: none

kixelated and others added 3 commits November 7, 2026 15:56
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AV1, VP8, VP9, MPEG-2, and JPEG buffer wrappers and their bindings: the
encode and decode drivers only speak H.264 and H.265.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated marked this pull request as ready for review November 8, 2026 01:18
@coderabbitai

coderabbitai Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 2 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 51544ea3-00c7-44c0-a481-cf33704b6fda
Commits

Reviewing files that changed from the base of the PR and between 4a86602 and c51c63f.

Files ignored due to path filters: 1

  • Cargo.lock is excluded by !**/*.lock
Files selected for processing: 92

  • Cargo.toml
  • doc/lib/rs/index.md
  • quest/m1/README.md
  • quest/m1/vaapi-radeonsi.md
  • quest/m3/audit-deps.md
  • quest/m3/h265-min-width.md
  • quest/m3/vendor-sync/README.md
  • quest/m3/vendor-sync/vaapi.md
  • rs/moq-vaapi/CHANGELOG.md
  • rs/moq-vaapi/Cargo.toml
  • rs/moq-vaapi/LICENSE
  • rs/moq-vaapi/LICENSE.cros-codecs
  • rs/moq-vaapi/LICENSE.libva
  • rs/moq-vaapi/MIGRATE.md
  • rs/moq-vaapi/README.md
  • rs/moq-vaapi/bindgen.sh
  • rs/moq-vaapi/libva-wrapper.h
  • rs/moq-vaapi/libva/meson.build
  • rs/moq-vaapi/libva/va/compat_win32.h
  • rs/moq-vaapi/libva/va/drm/va_drm.h
  • rs/moq-vaapi/libva/va/sysdeps.h
  • rs/moq-vaapi/libva/va/va.h
  • rs/moq-vaapi/libva/va/va_android.h
  • rs/moq-vaapi/libva/va/va_backend.h
  • rs/moq-vaapi/libva/va/va_backend_prot.h
  • rs/moq-vaapi/libva/va/va_backend_vpp.h
  • rs/moq-vaapi/libva/va/va_compat.h
  • rs/moq-vaapi/libva/va/va_dec_av1.h
  • rs/moq-vaapi/libva/va/va_dec_hevc.h
  • rs/moq-vaapi/libva/va/va_dec_jpeg.h
  • rs/moq-vaapi/libva/va/va_dec_vp8.h
  • rs/moq-vaapi/libva/va/va_dec_vp9.h
  • rs/moq-vaapi/libva/va/va_dec_vvc.h
  • rs/moq-vaapi/libva/va/va_drmcommon.h
  • rs/moq-vaapi/libva/va/va_egl.h
  • rs/moq-vaapi/libva/va/va_enc_av1.h
  • rs/moq-vaapi/libva/va/va_enc_h264.h
  • rs/moq-vaapi/libva/va/va_enc_hevc.h
  • rs/moq-vaapi/libva/va/va_enc_jpeg.h
  • rs/moq-vaapi/libva/va/va_enc_mpeg2.h
  • rs/moq-vaapi/libva/va/va_enc_vp8.h
  • rs/moq-vaapi/libva/va/va_enc_vp9.h
  • rs/moq-vaapi/libva/va/va_fei.h
  • rs/moq-vaapi/libva/va/va_fei_h264.h
  • rs/moq-vaapi/libva/va/va_fei_hevc.h
  • rs/moq-vaapi/libva/va/va_internal.h
  • rs/moq-vaapi/libva/va/va_prot.h
  • rs/moq-vaapi/libva/va/va_str.h
  • rs/moq-vaapi/libva/va/va_tpi.h
  • rs/moq-vaapi/libva/va/va_trace.h
  • rs/moq-vaapi/libva/va/va_version.h.in
  • rs/moq-vaapi/libva/va/va_vpp.h
  • rs/moq-vaapi/libva/va/va_x11.h
  • rs/moq-vaapi/src/bindings.rs
  • rs/moq-vaapi/src/bindings/libva.rs
  • rs/moq-vaapi/src/bitstream_utils.rs
  • rs/moq-vaapi/src/buffer.rs
  • rs/moq-vaapi/src/buffer/enc_misc.rs
  • rs/moq-vaapi/src/buffer/h264.rs
  • rs/moq-vaapi/src/buffer/hevc.rs
  • rs/moq-vaapi/src/buffer/proc_pipeline.rs
  • rs/moq-vaapi/src/codec.rs
  • rs/moq-vaapi/src/codec/h264.rs
  • rs/moq-vaapi/src/codec/h264/dpb.rs
  • rs/moq-vaapi/src/codec/h264/nalu.rs
  • rs/moq-vaapi/src/codec/h264/nalu_writer.rs
  • rs/moq-vaapi/src/codec/h264/parser.rs
  • rs/moq-vaapi/src/codec/h264/picture.rs
  • rs/moq-vaapi/src/codec/h264/synthesizer.rs
  • rs/moq-vaapi/src/codec/h265.rs
  • rs/moq-vaapi/src/codec/h265/dpb.rs
  • rs/moq-vaapi/src/codec/h265/parser.rs
  • rs/moq-vaapi/src/codec/h265/picture.rs
  • rs/moq-vaapi/src/color.rs
  • rs/moq-vaapi/src/config.rs
  • rs/moq-vaapi/src/context.rs
  • rs/moq-vaapi/src/decode.rs
  • rs/moq-vaapi/src/decode/h265.rs
  • rs/moq-vaapi/src/display.rs
  • rs/moq-vaapi/src/dmabuf.rs
  • rs/moq-vaapi/src/encode.rs
  • rs/moq-vaapi/src/encode/h265.rs
  • rs/moq-vaapi/src/generic_value.rs
  • rs/moq-vaapi/src/image.rs
  • rs/moq-vaapi/src/lib.rs
  • rs/moq-vaapi/src/picture.rs
  • rs/moq-vaapi/src/pool.rs
  • rs/moq-vaapi/src/surface.rs
  • rs/moq-vaapi/src/usage_hint.rs
  • rs/moq-vaapi/src/vpp.rs
  • rs/moq-video/DESIGN-native-codecs.md
  • rs/moq-video/src/encode/backend/vaapi.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@kixelated kixelated left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review by review (OpenAI)

Reviewed c51c63f against the in-tree integration and moq-dev/vaapi at 24c755965066d57cda542a8e4a638e6665c8ccb4.

No actionable findings. The move preserves the H.264/H.265 driver behavior from the 0.2.1 source; the substantive wrapper deletion matches the explicitly documented unsupported-codec API removal. Workspace dependency/logging changes retain runtime libva loading, and the regeneration script carries the libloading 0.9 constructor-bound adjustment without adding a build-time bindgen requirement. Bringing this dependency in-tree removes the separate publish/bump cycle while retaining the upstream audit record.

Verification limits: GitHub-only static review, including upstream blob/content comparison, non-generated source delta, buffer dispatch, regeneration script and integration/docs. I did not regenerate or exhaustively re-audit generated bindings, run builds/tests, inspect a published crate artifact, or reproduce the Intel/AMD hardware results. Rechecked open/non-draft state, full head and published reviews immediately before this COMMENT.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No code issues found — one follow-up worth tracking so it survives the merge.

Reviewed changes

  • Vendors moq-dev/vaapi at 24c7559 (0.2.1) as rs/moq-vaapi, adds it to the workspace and default-members, and turns the root moq-vaapi dependency into a path dependency at the last published version.
  • Trims the AV1, VP8, VP9, MPEG-2, and JPEG buffer wrappers along with their bindgen allowlist entries, leaving H.264/H.265 only; src/bindings/libva.rs drops from 37436 to 22389 lines.
  • Replaces the standalone repo's just vendor/just bindgen recipes with rs/moq-vaapi/bindgen.sh, which regenerates from the vendored libva/ headers and carries the libloading 0.9 AsFilename bound.
  • Switches logging from log to tracing, adopts workspace dependencies and lints, and documents the allow blocks' reasons.
  • Repoints the docs, rs/moq-video design/module notes, and the vendor-sync quest at the in-tree crate, and deletes the completed radeonsi quest.

I checked the vendored tree against upstream 24c7559: libva/, libva-wrapper.h, and the license files are identical, and src/ differs only in the intended edits (tracing, trimmed buffer codecs, reason on the allow blocks). The regenerated bindings only lose items, so the trim did not perturb code it keeps, and the pointer-width #[cfg] matches libva's __x86_64__ || __LP64__ gate on every target, Windows x64 included.

ℹ️ The anyhow public API has no tracked follow-up

With the crate in-tree, rs/AGENTS.md's "thiserror for libraries" rule now applies to it, yet its public decode, encode, vpp, and dmabuf entry points still return anyhow::Result. The deferral exists only in this PR's body, which does not survive the merge, and CONTRIBUTING.md asks that out-of-scope findings become follow-up quests.

Technical details
# Track the anyhow -> thiserror conversion for moq-vaapi

## Affected sites
- `rs/moq-vaapi/src/decode.rs:290,318,341,377,383` — `Decoder::new/decode/decode_exported/flush*`
- `rs/moq-vaapi/src/encode.rs:228,346,386,433,573` — `Encoder::new/encode_nv12/encode_dmabuf/set_bitrate` and `probe`
- `rs/moq-vaapi/src/vpp.rs:58,91,103,118,169,294` — `probe` and `Processor` constructors/transforms
- `rs/moq-vaapi/src/dmabuf.rs:151,194` — `from_prime`/`import`
- `rs/moq-vaapi/src/decode.rs:1406`, `src/vpp.rs:324` — helpers that propagate `anyhow::Error`

## Required outcome
A quest under `quest/m3/vendor-sync/` (or another m3 owner) records the conversion, or the conversion lands with this PR. Whichever holds, the origin (`rs/AGENTS.md`'s thiserror rule) and the current `moq-video` callers that map these errors need to be named, since only the crate's shape changes.

## Open questions for the human
- Whether the conversion should replace the `VaError` wrappers with a single `Error` enum, or keep `VaError` and add context variants for the encode/decode layers.

Pullfrog  | Fix it ➔ | View workflow run | Using deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

@kixelated
kixelated added this pull request to the merge queue Nov 8, 2026
@kixelated

Copy link
Copy Markdown
Collaborator Author

Re the pullfrog note on moq-vaapi's anyhow public API: no follow-up quest, by maintainer decision. moq-video is the only consumer, and it wraps every moq-vaapi error into its own anyhow-backed Error::Codec (rs/moq-video/src/{decode,encode}/backend/vaapi.rs, frame/vaapi.rs). The root AGENTS.md forbids matching on errors, so typed variants would reach no consumer. Converting would rewrite about 165 sites in vendored cros-codecs code and widen the diff each vendor sync has to carry.

(Written by Claude Opus 5.5)

Merged via the queue into main with commit 65d4b7c Nov 8, 2026
10 checks passed
@kixelated
kixelated deleted the vendor/moq-vaapi branch November 8, 2026 01:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant