Repository navigation
Add avd-fw and libva-v4l2_request-avd: hardware video decode on Apple Silicon - #3
Conversation
Adds install/hardware/apple/video-decode.sh, which installs avd-fw and libva-v4l2_request-avd from the omarchy-aarch64 repo. The kernel already ships the apple-avd driver and it autoprobes, but no distro packages its firmware, so the decoder sits idle on every boot. On the stock kernel this gives HEVC and VP9 hardware decode, both bit-exact against libavcodec. H.264 needs three driver fixes going upstream separately; without them it falls back to software and the rest still works. Roughly 84% less decode CPU time; the battery saving is a more modest ~0.2 W of ~7.8 W. The leaf is a no-op on non-Apple-Silicon hardware and warns rather than fails if the packages are unavailable, since hardware setup runs under set -e and video decoding in software is a degradation rather than a broken install. Includes a migration so existing installs pick it up, and a shell test alongside the asahi-audio one. Depends on omarchy-mac/omarchy-pkgs-aarch64#3, which adds the packages; this cannot merge until those are published.
The kernel already ships the apple-avd driver, and it autoloads and autoprobes -- but no distro packages its firmware, so every boot ends with 'Direct firmware load for apple/avd-fw-v2-t0.bin failed with error -2' and the video decoder sits idle. Asahi wrote that firmware as a clean MIT-licensed replacement rather than extracting Apple's; it is in no repository at all, including the AUR. Firmware alone is not enough: AVD is a stateless decoder and ffmpeg's v4l2m2m decoders are stateful, so the firmware gets you a /dev/video node nothing can drive. libva-v4l2_request-avd is the VA-API translation layer, and installs an asahi_drv_video.so alias -- the name libva derives from the DRM render node on Apple Silicon -- so applications need no environment variable. On the stock kernel this delivers HEVC and VP9 hardware decode, both bit-exact against libavcodec. H.264 additionally needs three driver fixes that are going upstream separately; without them it falls back to software and the rest still works. Both build under scripts/build-package.sh's exact flags and produce the artifact names the arch check expects. Verified in a pristine Arch ARM container from declared dependencies alone.
e3635ee to
317ac28
Compare
|
Field report from an M2 Max ( The AVD block does exist on this SoC. Its power domain is in the device tree: What's missing is an AVD device node. A full-depth search of every Neither matches The Nothing to fix in these packages — this is a device-tree/kernel-support gap per SoC, and they'd start working unchanged on a kernel whose DT describes the node. Just flagging that the premise holds on the M1 you tested and not on t6021, so the benefit is narrower than "Apple Silicon" until AVD is wired up for more SoCs. |
Adds two packages that get the Apple Video Decoder working on Apple Silicon.
The kernel already has the
apple-avddriver and it autoprobes, but nothingpackages its firmware, so it fails on every boot with
Direct firmware load for apple/avd-fw-v2-t0.bin failed with error -2and the decoder sits unused. Asahiwrote that firmware as an MIT-licensed replacement; it isn't in ALARM,
[extra]or the AUR.
libva-v4l2_request-avdis the VA-API side, for mpv and ffmpeg. AVD is astateless decoder and ffmpeg's
v4l2m2mdecoders are stateful, so the firmwarealone leaves you a
/dev/videonode nothing can drive. It's sofus13's fork ofmegi's driver, which has the AVD fixes the AUR's 1.2 doesn't. It installs an
asahi_drv_video.soalias so applications find it withoutLIBVA_DRIVER_NAME.Both are
source: localsince neither is in the AUR.avd-fwisany(rawCortex-M3 firmware, same on any build host); the shim is
compile. I built bothwith the flags
build-package.shuses and in a clean Arch ARM container to checkthe declared dependencies are complete.
Chromium already reaches the decoder via V4L2 directly once the firmware exists —
it doesn't need the VA-API package, just the flags from
archlinuxarm/PKGBUILDs#2193.
I've been testing this on an M1 MacBook Pro; happy to share measurements or
answer anything.