Change:
inherit src unpackPhase meta; patches = [ <ins> (fetchpatch { # RDD Sandbox paths for NixOS, remove with Firefox>=100 # https://hg.mozilla.org/integration/autoland/rev/5ac6a69a01f47ca050d90704a9791b8224d30f14 # https://bugzilla.mozilla.org/show_bug.cgi?id=1761692 name = "mozbz-1761692-rdd-sandbox-paths.patch"; url = "https://hg.mozilla.org/integration/autoland/raw-rev/5ac6a69a01f47ca050d90704a9791b8224d30f14"; hash = "sha256-+NGRUxXA7HGvPaAwvDveqRsdXof5nBIc+l4hdf7cC/Y="; }) </ins> ] ++ lib.optional (lib.versionAtLeast version "86") ./env_var_for_system_dir-ff86.patch ++ lib.optional (lib.versionAtLeast version "90" && lib.versionOlder version "95") ./no-buildconfig-ffx90.patch

Discussion:
Firefox would not take advantage of hardware acceleration, even through And the suggestion at were followed Steps to reproduce the behavior: firefox as suggested by the arch wiki ="PlatformDecoderModule:5" firefox 2&1 a video on youtube No frames are dropped system: host os: multi-user?: sandbox: version: nixpkgs:
Which firefox version are you using? What display server are you using? Try to confirm that things work with , the official Mozilla build. I have a vague idea in my mind that hwdec does not work on Wayland currently.
Firefox 96 on plasma wayland, but similar oroblems I've got them even on X11 It seems that on there are still dropped frames,
Enabled media.navigator.mediadatadecodervpxenabled on Firefox 96.0.2 on sway/wlroots. Confirmed it's not working. The shared libraries it tries to open do exist. On Intel 8th gen iGPU with VA-API support looking just fine.
I'm not sure what that means. Does the log indicate VA-API gets used?
The issues posted after seem to be different though. Their driver successfully loads. The other logs show that the driver fails to load, returning .
All logs I saw failed to load with -1, care to clarify?
The very first log. I can later attach mine as well, as mine does also load successfully on an Intel CPU but doesn't show that hardware acceleration is enabled. Edit:_ I basically have the same log as you have with the Intel CPU. The only difference is the version as I have another CPU. The encoding/decoding features are also listed. It's just that none of my browsers picks up on them and uses software implementations instead.
Upstream also asked me about ,apparently the libva api for AMD? It seems to be not packaged on NixOS
This post is more detailed.
I have read that wiki article but according to it may be obsolete. The problem is that it does not seem to be packaged
Ah! I wasn't aware of that bug report. Let me know if that mesa package works for you. I still haven't figured it out with Intel.
In your latest log, was found and loaded. Maybe it was just blocked by the RDD (media process) sandbox before?

I have just updated to firefox 98 beta and sadly the issue persists.
Does it work if you start Firefox with MOZDISABLERDD_SANDBOX=1 environment variable?
Yes, it works with MOZDISABLERDDSANDBOX=1
FWIW, I'm using intel's vaapi and the only settings I had to change to get firefox video hardware acceleration were: Work on wayland, with both and . Checked with .
It doesn't work for me. I have tried intel-media-driver and vaapiIntel but no succes either. I have also noticed this line while opening firefox with MOZLOG="PlatformDecoderModule:5": [Child : Main Thread]: D/PlatformDecoderModule FFMPEG: VA-API FFmpeg is disabled by platform
It seems that Firefox 97 (despite what archwiki claims, maybe from how its packaged) needs the environment variable and av1 to be disabled with an extension or the config edit: according to vaapi av1 decoding should be in Firefox 98.
is 98 available for nix already? I can't seem to find it :thinking:
Nope, nixos-unstable only has Firefox 97
To add another data point here, I'm using Firefox 97 on NixOS stable and I have not been able to get video acceleration to work. It seems to work just fine for other applications like mpv, and I don't get any error messages when I run vainfo. I have intel-media-driver installed, since the older Intel driver is not compatible with my hardware. I am using the package on Plasma, with the following relevant config options set to true: media.hardware-video- media.hardware-video-decoding.enabled However, I still get the message D/PlatformDecoderModule FFMPEG: VA-API FFmpeg is disabled by platform when I run .
Firefox 98 has not yet been released.
I also ran in to this issue. Here's my current findings. First what appears to be working for me on 97.0.2: With only the set in . Okay, so for testing I've been using to see what files are being blocked. There's a few options that are supposed to add paths to an allow list, but unfortunately they're not applied in . I first noticed that the sandbox was blocking access to . The sandbox adds to the allow list, but of course that doesn't help here.

It also adds anything in and though, so I put the driver in there. After that it then started complaining about , which is a build input of , so I that (there's a few others, but they at least didn't complain). I don't know the best way to solve the overall issue. A partial solution seems to be to set , but that still doesn't add the dependencies of the drivers. Perhaps some ldd magic in the wrapper would be better?
On Firefox 98.0.2 right now and I can confirm that VA-API with amdgpu works when disabling the RDD sandbox. This is awesome. Thanks for your findings and linking the location in the firefox codebase. I think we can apply a patch in this case. Although on second thought if a fix can be applied to the wrapper that is a more stable fix.
Everyone, feel free to test-drive .
this did nothing for me [Child : Main Thread]: D/PlatformDecoderModule FFMPEG: VA-API FFmpeg is disabled by platform wayland/amdgpu edit: scratch that, it appears firefox just always displays this? even if overridden by flags? I do get the vaapi initialisation text later, keeping this comment so people don't think like me it's not functioning while in fact it might be edit2: actually, it doesn't look like it's actually accelerating anything with gpu decode, even if i see the initialisation text, needs further debugging work
make sure you're decoding a video that your GPU is able to accelerate. Many GPUs (especially older ones) don't have VP9 decoder hardware which you need for i.e. YouTube or Netflix.
Yeah, I did verify that. My AMD Radeon RX 6800 supports VP9 acceleration if I'm reading the vainfo output correctly. On Wed, Mar 30, 2022, 8:28 AM Atemu
To echo justinkb: I have an Intel 11th-gen iGPU and have but also that being an improvement over before the patch. However, when observing , there is no video render usage from Firefox (compared with e.g. mpv).
This issue has been mentioned on NixOS Discourse. There might be relevant details there: