Skip to content

Add avd-fw and libva-v4l2_request-avd: hardware video decode on Apple Silicon - #3

Merged
scottjones merged 1 commit into
omarchy-mac:mainfrom
kcirtapfromspace:avd-hardware-video-decode
Sep 5, 2026
Merged

scottjones merged 1 commit into
omarchy-mac:mainfrom
kcirtapfromspace:avd-hardware-video-decode

Conversation

@kcirtapfromspace

@kcirtapfromspace kcirtapfromspace commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Adds two packages that get the Apple Video Decoder working on Apple Silicon.

The kernel already has the apple-avd driver and it autoprobes, but nothing
packages its firmware, so it fails on every boot with Direct firmware load for apple/avd-fw-v2-t0.bin failed with error -2 and the decoder sits unused. Asahi
wrote that firmware as an MIT-licensed replacement; it isn't in ALARM, [extra]
or the AUR.

libva-v4l2_request-avd is the VA-API side, for mpv and ffmpeg. AVD is a
stateless decoder and ffmpeg's v4l2m2m decoders are stateful, so the firmware
alone leaves you a /dev/video node nothing can drive. It's sofus13's fork of
megi's driver, which has the AVD fixes the AUR's 1.2 doesn't. It installs an
asahi_drv_video.so alias so applications find it without LIBVA_DRIVER_NAME.

Both are source: local since neither is in the AUR. avd-fw is any (raw
Cortex-M3 firmware, same on any build host); the shim is compile. I built both
with the flags build-package.sh uses and in a clean Arch ARM container to check
the 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.

scottjones pushed a commit to omacom/omarchy-mac that referenced this pull request Sep 5, 2026
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.
@scottjones
scottjones force-pushed the avd-hardware-video-decode branch from e3635ee to 317ac28 Compare September 5, 2026 20:07
@scottjones
scottjones merged commit 8d0d453 into omarchy-mac:main Sep 5, 2026
@scottjones

Copy link
Copy Markdown
Collaborator

Field report from an M2 Max (apple,j414c, SoC apple,t6021), after these packages landed via omarchy-mac#298's migration. Both installed cleanly, but the decoder never comes up here — and the reason is worth recording, because it's a narrower thing than "unsupported".

The AVD block does exist on this SoC. Its power domain is in the device tree:

power-controller@260 = ane_sys     (Neural Engine)
power-controller@268 = avd_sys     (Apple Video Decoder)

What's missing is an AVD device node. A full-depth search of every compatible property in the live tree finds nothing ending in -avd, and the driver matches only:

alias: of:N*T*Capple,t8140-avdC*
alias: of:N*T*Capple,t8132-avd

Neither matches t6021. So apple-avd never probes, and consequently:

$ dmesg | grep -c avd-fw
0

The Direct firmware load for apple/avd-fw-v2-t0.bin failed with error -2 that motivated this PR never appears on this machine — there's no device to request firmware. CONFIG_VIDEO_APPLE_AVD=m and apple-avd.ko are both present; there's simply nothing to bind to. (/dev/video0 here is the ISP at isp@384000000, the camera, unrelated.)

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.

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