firefox-fourier: v4l2-request hwaccel inert on Pi 5 — no libavcodec with --enable-v4l2-request at the soname Firefox loads #59
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The firefox-fourier package on a Pi 5 / CM5 (Debian trixie aarch64) silently falls back to software decode for every codec. The patched
InitV4L2RequestDecoderruns, calls into the libavcodec Firefox dlopened, and the libavcodec reports it has no v4l2_request hwaccel registered for that codec. Firefox unwinds throughInitV4L2Decoder(statefulh264_v4l2m2m— also missing), then through stock VAAPI lookup (no*_vaapicodecs in modern FFmpeg), and finally lands onUsing preferred software codec h264. The daedalus_v4l2 daemon stays dark — daemon journal shows 0 REQ_DECODE despite Firefox running at 25-30% CPU on the video tab.Observed on higgs (Pi CM5, kernel 6.18.29, firefox-fourier
1:150.0.3-1+rpt1+fourier1):Daedalus daemon journal during 30s of YouTube playback: zero REQ_DECODE.
Root cause — three libavcodecs on the box, none usable
--enable-v4l2-request?/usr/lib/firefox/libmozavcodec.so(FFVPX bundle)libmozavcodec.so)Supports())/usr/lib/aarch64-linux-gnu/libavcodec.so.61(Debianlibavcodec61).61/opt/fourier/lib/libavcodec.so.62(ffmpeg-v4l2-request-fourier).62ld.sorefuses to satisfy a.so.61DT_NEEDED with a.so.62fileVerification:
dpkg -S /usr/lib/aarch64-linux-gnu/libavcodec.so.61→libavcodec61:arm64(Debian stock).ffmpeg -hide_banner -buildconf | grep v4l2on the Debian-stock binary returns empty./opt/fourier/bin/ffmpeg -hide_banner -hwaccels(the fourier-prefix binary) returnsvdpau / vaapi / drm / vulkan / v4l2request— has the feature, wrong soname. RDD's/proc/$pid/mapsshows/usr/lib/firefox/libmozavcodec.so+libmozavutil.soloaded; nolibavcodec.so.61orlibavcodec.so.62mapped at all.The mozconfig comment claims the design intent is "the v4l2_request hwaccel routing happens via the system libavcodec loaded at startup" — but on Debian trixie the system libavcodec (
.61) is stock without the feature, andLD_LIBRARY_PATH=/opt/fourier/libdoesn't help because of the soname split.What's blocked
Full Pi 5 Fourier campaign on the consumer end. The other layers all work:
/opt/fourier/has--enable-v4l2-request+--enable-vaapi.When the daemon was reached directly (test_m2m_decode harness, ffmpeg via vaapi command-line) the stack decoded H.264 at 30 fps clean (60/60 frames, zero errors, unique fnv1a hashes). YouTube via Firefox: zero REQ_DECODE. The only missing piece is making Firefox actually call into a libavcodec that has v4l2_request registered.
Proposed fix paths
A.
libavcodec61-fouriercompat package (recommended)New package in marfrit-packages that ships
libavcodec.so.61(matching Debian's soname) built with--enable-v4l2-request+--enable-vaapi, with:When installed, replaces Debian's stock libavcodec61 with a feature-on variant at the same soname. Firefox's OSLibrary PDM dlopens it at startup, v4l2_request hwaccel is now registered on the generic h264 codec, the patched
InitV4L2RequestDecoderfinds the DRM hwaccel inhw_configs, succeeds, decode flows through libavcodec → V4L2 stateless → daedalus_v4l2 → daemon. Touches no other consumers (ffmpeg CLI, mpv, anything-else-linked-against-libavcodec61).Main risk: ABI compat with downstream packages. Since
--enable-v4l2-requestis an ADDITIVE configure flag (doesn't remove or rename anything in the public API) the ABI surface should be identical to Debian's; only added codepaths. Verifiable viaabidiffagainst Debian's.so.61.Minor risk: Debian package updates of
libavcodec61will fight with the Replaces/Conflicts on apt upgrades. Pin the marfrit-packages variant via apt preferences.B. Enable v4l2-request in FFVPX inside the firefox-fourier build
Add to
arch/firefox-fourier/mozconfig:(exact Mozilla configure key may vary — needs verification against the FFVPX build subtree). This makes the bundled
libmozavcodec.soregister the v4l2_request hwaccel. Then both FFVPX and OSLibrary PDM paths support it.Main risk: Mozilla's FFVPX is a stripped-down build optimised for sandbox safety; adding hwaccel may pull in libraries Mozilla deliberately excluded (libdrm, libv4l2). May require also adding
--enable-libdrm --enable-libv4l2to the FFVPX configure, which inflateslibmozavcodec.sosize and changes its dlopen surface.C. Both A and B (defense in depth)
If both land, every PDM path supports v4l2_request — no profile-pref churn needed.
Recommendation
Ship A first (smaller blast radius, no Mozilla-internal build changes, fixes the path the mozconfig already documents as the design intent). B as follow-up if any consumer ends up wanting bundled-only operation (e.g. a Firefox-portable scenario where system libavcodec might be a stock Debian one).
Happy to draft the libavcodec61-fourier package skeleton — would reuse the existing ffmpeg-v4l2-request-fourier build script with a different install prefix + Debian control fields.
Related
PLAN.mdexplicitly mentions the v4l2_request hwaccel path requires libavcodec with--enable-v4l2-request— the gap is in which libavcodec ends up dlopened on a fresh Debian trixie install.Status 2026-05-21 — original symptom resolved, AV1 still in flight
What landed
Both halves of the title's
ORlanded in practice, via the compat-package route:libavcodec61on Pi CM5 is now8:7.1.3-0+deb13u1+rpt1+fourier2— soname-compatible Debian-stock rebuild with--enable-v4l2-request. dpkg confirmed on higgs.ffmpeg-v4l2-request-fourier2:8.1+rfourier+gb57fbbe-4is installed.libva-v4l2-request-fourierroutes Pi CM5 traffic through thedaedalus_v4l2kmod into the userspace daemon (/opt/fourierlibavcodec), bypassing Firefox's bundledlibmozavcodec(FFVPX) entirely.Verified end-to-end on Pi CM5
Firefox YouTube playback now engages the daedalus daemon —
journalctl -u daedalus-v4l2shows the liveREQ_DECODEstream, libva opensdaedalus_v4l2 at video_fd=34 media_fd=35,cap_pool_init: 24 slots ready,h264_set_controls VAProfile=6 ...per request, decode succeeds. The original issue-body symptom ("silently falls back to software decode for every codec") no longer reproduces.VP9 same path.
Design note for future-self
The
firefox-fourier ↔ FFVPX --enable-v4l2-requestoption mentioned first in the title was never pursued. The compat-package route turned out to be the cleaner deliverable: we get the v4l2-request hwaccel surfaced at the soname Firefox loads without touching FFVPX's vendored mozilla build. Decision was driven by the observation that on a Pi CM5 the actual hot path skips Firefox's libavcodec entirely (libva → kernel → daemon) — so the FFVPX patch would have shipped code that real workloads don't exercise.Still in flight
reauktion/daedalus-v4l2as the daemon-half of issue #11 (and task #144 in our local list). When that lands the same end-to-end path will cover AV1.daedalus-v4l2#11is resolved. Either works.Close-out
Original symptom (firefox-fourier silently falling back to software for H.264/VP9 on Pi 5 / CM5) resolved via the
libavcodec61-fouriercompat-package route per marfrit's 2026-05-21 status comment. Verified end-to-end on higgs with liveREQ_DECODEstream injournalctl -u daedalus-v4l2for both codecs.AV1 is not covered by this fix — it needs daemon-side OBU sequence-header synthesis (the AV1 analogue of the H.264 DAEMON-PPS path). The earlier comment referenced
daedalus-v4l2#11for this, but #11 is actually a different scope (H.264 B-frame display-order re-architecture). Created a fresh AV1-specific tracking issue with the correct scope:→ reauktion/daedalus-v4l2#14 — daemon: AV1 OBU sequence-header synthesis
reauktion/daedalus-v4l2#14
Closing this one as resolved. AV1 work lives in daedalus-v4l2#14 from here on.
Closes #59.