Skip to content

video-encoder: package the AVE VA-API encoder and a decode/encode VA driver - #242

Closed
EdupugantiAkhil wants to merge 1 commit into
aurora-silicon:mainfrom
EdupugantiAkhil:ave-vaapi-encoder
Closed

EdupugantiAkhil wants to merge 1 commit into
aurora-silicon:mainfrom
EdupugantiAkhil:ave-vaapi-encoder

Conversation

@EdupugantiAkhil

Copy link
Copy Markdown
Contributor

This adds aurora.videoEncoder.enable (off by default) for VA-API hardware video encoding on the Apple AVE. It installs:

  • aurora-ave-vaapi: ave_drv_video.so, the VA-API H.264 (CB/Main/High) and HEVC (Main/Main 10) encoder for the apple-ave V4L2 driver.
  • aurora-va-dispatch: a VA driver that loads libva-v4l2-request (AVD decode) and aurora-ave-vaapi (AVE encode), and routes each call.
    • libva and Chrome load one VA driver per process, so without this, enabling the encoder would lose hardware decode.
    • It takes the aurora_drv_video.so name from libva-v4l2-request-avd's alias (via hiPrio).

Both build from the placeholder repository https://github.com/EdupugantiAkhil/aurora-ave-vaapi (pinned in sources.json) until you decide where this code should live. One option is merging encode into libva-v4l2_request, which would make the dispatcher unnecessary. Both run their host tests in the build.

Depends on:

Testing (MacBook Air M4, J713, same driver sources):

  • FFmpeg with LIBVA_DRIVER_NAME=ave: H.264 44.7/45.3 dB and HEVC 43.5/43.8 dB PSNR (720p/1080p).
  • Chrome 156 WebCodecs H.264 through the dispatcher: 44.7 dB.
  • Hardware decode through the dispatcher: unchanged, byte-exact.
  • With the option enabled, a graphics driver env has aurora_drv_video.so pointing at the dispatcher.

Known gap: FFmpeg encode through the dispatcher fails. FFmpeg creates its surfaces without a usage hint, so they go to the decoder. LIBVA_DRIVER_NAME=ave works. I'd fix this after the decision on where the encoder lives.

AI disclosure: developed with AI assistance (Claude). The commit carries an Assisted-by trailer.

🤖 Generated with Claude Code

…driver

Add aurora.videoEncoder.enable (off by default). It installs:
- aurora-ave-vaapi: ave_drv_video.so, a VA-API H.264/HEVC (Main, Main 10)
  encoder for the apple-ave V4L2 driver;
- aurora-va-dispatch: a VA driver that loads libva-v4l2-request (AVD
  decode) and aurora-ave-vaapi (AVE encode) and routes each call. libva
  and Chrome load one VA driver per process, so without it enabling the
  encoder would lose hardware decode. It takes the aurora_drv_video.so
  name from libva-v4l2-request-avd's alias.

Both build from the placeholder repository
EdupugantiAkhil/aurora-ave-vaapi until the maintainers decide where this
code lives, and both run their host tests in the build.

Depends on: the T8132 apple-ave variant and device tree
(aurora-silicon/linux), the aura T8132 AVE firmware handoff, and, for
Chrome, the Mesa GBM NV12/P010 change (aurora-silicon/mesa#218) plus
Chrome's AcceleratedVideoEncoder feature.

Tested on a MacBook Air M4 (J713) with the same driver sources: FFmpeg
H.264 44.7/45.3 dB and HEVC 43.5/43.8 dB PSNR (720p/1080p, encoder driver
directly); Chrome WebCodecs H.264 44.7 dB through the dispatcher;
hardware decode unchanged.

Known gap: FFmpeg encode through the dispatcher fails, because FFmpeg
creates its surfaces without a usage hint and they go to the decoder.
LIBVA_DRIVER_NAME=ave works.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Akhil <akhile76@gmail.com>
@RyanTheTide

Copy link
Copy Markdown
Contributor

@EdupugantiAkhil thanks, the packaging is clean and the option is off by default. Since the source still lives in a placeholder repo, FFmpeg encode through the dispatcher fails, and linux#1489, aura#152 and mesa#218 are still open, could you mark this as a draft for now? Once the encoder has a home (we'd lean toward merging encode into libva-v4l2_request so the dispatcher is not needed) please rebase on main and point sources.json at that repository.

@EdupugantiAkhil
EdupugantiAkhil marked this pull request as draft November 12, 2026 22:24
@EdupugantiAkhil

Copy link
Copy Markdown
Contributor Author

@EdupugantiAkhil thanks, the packaging is clean and the option is off by default. Since the source still lives in a placeholder repo, FFmpeg encode through the dispatcher fails, and linux#1489, aura#152 and mesa#218 are still open, could you mark this as a draft for now? Once the encoder has a home (we'd lean toward merging encode into libva-v4l2_request so the dispatcher is not needed) please rebase on main and point sources.json at that repository.

I will differ this task until the dependencies get resolved/merged

@EdupugantiAkhil

Copy link
Copy Markdown
Contributor Author

Sorry, I should not have marked this as ready for review until the depend PRs got merged

techmore pushed a commit to techmore/nixos-aurora that referenced this pull request Nov 13, 2026
aurora-wip 8f013bf9: the M5 family caches its native graphics programs
per linked shader (mesa#257), AGX3 keeps the move after a projective
multiply, which fixes G17S mediump varyings and the M5's GLES3
failures (mesa#258), and G17P batches a render's software
tessellation stages (mesa#228). Also depth clip control, restart
state and storage image compression on G17P, M5 compute improvements,
VK_EXT_external_memory_host with GEM_USERPTR, and smaller fixes
(mesa#214, aurora-silicon#225, aurora-silicon#227, aurora-silicon#229, aurora-silicon#231, aurora-silicon#238-aurora-silicon#242, aurora-silicon#252, aurora-silicon#253).

Signed-off-by: Diljit Singh <hey@djdev.me>
@RyanTheTide

Copy link
Copy Markdown
Contributor

Blockers: 3.

The earlier request covers the placeholder source repo, the dispatcher-vs-merge-into-libva-v4l2-request decision and the FFmpeg gap. Since then aura#152 and mesa#218 have merged, but linux#1489 (the T8132 apple-ave variant) is still open. Points for the rework:

  1. The dispatcher is built as a board-specific driver. It's j713_dispatch.c / j713_drv_video.so with J713_VA_DEC_DRIVER, J713_VA_ENC_DRIVER and J713_VA_DISPATCH_TRACE environment overrides (va-dispatch/j713_dispatch.c:30-33, :817-819 at e40b036). Yet aurora.videoEncoder.enable installs it on any Mac. If it stays, give it a generic name and drop the env overrides. The Nix store paths passed through DEC=/ENC= already pin the inner drivers.
  2. It looks up the inner drivers' init symbol by the literal __vaDriverInit_1_24 and exports only that name (j713_dispatch.c:59, :811-813). libva-v4l2-request exports __vaDriverInit_1_<VA_MINOR_VERSION> of the libva it's built against. With any nixpkgs libva other than 2.24, load_inner fails for decode, and enabling the option silently loses hardware decode. Use VA_DRIVER_INIT_FUNC_S from <va/va_backend.h> for both the export and the lookup, and add an installCheckPhase that dlopens both inner drivers through the built dispatcher.
  3. Commit 28b0f7e carries an Assisted-by: Claude:claude-opus-5-5 trailer. Commits need only the human Signed-off-by. The PR description should end with Assisted-by: LLM (Claude:Opus 5.5) instead of the "Generated with Claude Code" footer.

The PR also conflicts with main and no CI ran on the branch.

HW row: once linux#1489 has merged and the source has moved to its final home, on a NixOS build of the rebased head on the J713: vainfo through aurora_drv_video.so listing both VLD and EncSlice entrypoints, FFmpeg and Chrome encode through the default driver (no LIBVA_DRIVER_NAME), byte-exact AVD decode unchanged, and the option enabled on one Mac without AVE support still decoding. All with 0 failed units and no new kernel errors.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor

@EdupugantiAkhil checking open drafts today. To come out of draft, this still needs:

  • It conflicts with main. Merge main in or rebase (no force push needed: a merge commit is fine).
  • Then a test run at the final head on a Mac with the hardware it touches, and mark it ready for review.

If it's no longer needed, say so here and we'll close it. Otherwise it stays open as a draft until these are done.

@EdupugantiAkhil

Copy link
Copy Markdown
Contributor Author

Not needed anymore: encoding moved into the VA driver itself (https://github.com/EdupugantiAkhil/libva-v4l2_request/tree/ave-encode, to be proposed after omacom/libva-v4l2_request#114), so the dispatcher and the separate encoder package go away. Closing; packaging will come as a new PR once the driver lands.

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.

2 participants