Package Apple Video Decoder firmware and the VA-API driver

This commit is contained in:
Scott Jones committed 2026-09-14 21:58:02 -04:00
1 parent cc143f7352
commit 6877d75e87
5 files changed
+148

No files matched your search

@@ -0,0 +1,12 @@
{
"source": "local",
"upstream": {
"watch": {
"git_tags": "https://github.com/sofus13/libva-v4l2_request.git",
"pattern": "(?P<version>[0-9]+(?:\\.[0-9]+)*)"
}
},
"rebuild_on": [
"libva"
]
}
+55
View File
@@ -0,0 +1,55 @@
# VA-API driver with Apple Video Decoder fixes from the sofus13 fork.
# The asahi alias lets libva discover it on Apple Silicon.
_fork=sofus13
pkgname=libva-v4l2_request-avd
pkgver=1.3
pkgrel=1
pkgdesc='VA-API driver for V4L2 stateless decoders, with Apple Video Decoder (AVD) support'
arch=('aarch64')
url="https://github.com/$_fork/libva-v4l2_request"
license=('GPL-3.0-or-later')
# The driver is a dlopen()ed plugin: it links only libc and exports the VA
# backend entry point (__vaDriverInit_1_24), so libva is a runtime rather than
# a link-time dependency -- and that symbol is versioned, so this needs a
# rebuild whenever libva's driver ABI is bumped. libdrm is only used for
# drm_fourcc.h constants at compile time.
depends=('glibc' 'libva')
makedepends=('meson' 'libdrm')
provides=('libva-v4l2_request')
conflicts=('libva-v4l2_request')
install="$pkgname.install"
source=("$pkgname-$pkgver.tar.gz::$url/archive/refs/tags/$pkgver.tar.gz")
sha256sums=('3670a1712f9f0a5a61bd44a781eba81dd9b2e0fd8271417ca8a9fbbed9dccfe9')
build() {
# driverdir is left unset so meson takes it from libva's pkg-config
# (/usr/lib/dri); the codec set is decided by configure-time checks against
# the kernel uapi headers, so linux-api-headers governs what gets built in.
# Plain meson rather than arch-meson: the latter lives in devtools, which is
# not a safe assumption outside a clean chroot. buildtype=plain hands the
# compiler makepkg's own CFLAGS/LDFLAGS, which is what arch-meson does too.
meson setup \
--prefix=/usr \
--buildtype=plain \
--wrap-mode=nodownload \
"libva-v4l2_request-$pkgver" build
meson compile -C build
}
package() {
meson install -C build --destdir "$pkgdir"
# libva picks its driver from the DRM driver name of the render node, which
# on Apple Silicon is "asahi", so it looks for asahi_drv_video.so. Nothing
# else ships that name (mesa provides no VA driver for asahi), so aliasing it
# here makes every VA-API application find the decoder with no environment
# variable at all. If mesa ever ships its own asahi_drv_video.so this will
# collide and pacman will say so at install time.
ln -sf v4l2_request_drv_video.so "$pkgdir/usr/lib/dri/asahi_drv_video.so"
install -Dm644 "libva-v4l2_request-$pkgver/COPYING" \
"$pkgdir/usr/share/licenses/$pkgname/COPYING"
install -Dm644 "libva-v4l2_request-$pkgver/README" \
"$pkgdir/usr/share/doc/$pkgname/README"
}
@@ -0,0 +1,21 @@
post_install() {
cat <<'MSG'
==> This package installs itself as asahi_drv_video.so as well, which is the
name libva looks for on Apple Silicon, so VA-API applications should pick
the decoder up with no configuration.
If something does not, select it explicitly for the session:
LIBVA_DRIVER_NAME=v4l2_request
==> Check with: vainfo
==> mpv: mpv --hwdec=vaapi video.mp4
==> Firefox: additionally needs MOZ_DISABLE_RDD_SANDBOX=1, because the RDD
sandbox blocks the /dev/video* and /dev/media* access this
driver requires. That weakens Firefox's media sandbox.
MSG
}
post_upgrade() {
post_install
}