3

Trying to turn on GPU acceleration in Firefox 115 snap.

Ubuntu 22.04.2 LTS

NVIDIA Corporation GP106 [GeForce GTX 1060 6GB]

NVIDIA Driver Version: 535.54.03

layers.acceleration.force-enabled = true

layers.offmainthreadcomposition.enabled = true (this key was missing, created it)

I restarted Firefox, rebooted system. To check if it works I started nvidia-smi dmon, played youtube and local h264.mp4 with Firefox to see if there is anything other than 0 in dec column of terminal output. When I play a video with VLC, it shows some % of decoding load with GPU, but Firefox refuse to use GPU. Any ideas how to fix it? Thank you!

UPDATE

Thanks to Raffa's answer, I've changed some other settings, here they are:

gfx.webrender.all false -> true
dom.webgpu.enabled false -> true
layers.gpu-process.enabled false -> true
layers.mlgpu.enabled add
media.gpu-process-decoder false -> true
media.ffmpeg.vaapi.enabled true (no change)

No success. Also tried the same tests with Chromium, no success. In Firefox about:support I have found a lot of failures, here are some of them:

WebGPU adapter by default "navigator.gpu.requestAdapter({})": { "not_supported": "WebGPU is not yet available in Release or Beta builds."

GPU_PROCESS Disabled by default = Enabled via layers.gpu-process.enabled = Blocked; error code FEATURE_FAILURE_DISABLED

WEBRENDER_COMPOSITOR Disabled by default = Cannot be enabled in release or beta = Blocked; error code FEATURE_FAILURE_DISABLE_RELEASE_OR_BETA

WEBGPU WebGPU cannot be enabled in release or beta = Blocked; error code WEBGPU_DISABLE_RELEASE_OR_BETA

HARDWARE_VIDEO_DECODING default = available ; user = force_enabled ; runtime = unavailable = Force disabled by gfxInfo = Blocked; error code FEATURE_FAILURE_VIDEO_DECODING_TEST_FAILED

Now i wonder, maybe i should try some alpha build?

UPDATE 2

So I have tried Firefox Nightly which is early alpha build. And yes, some failure strings from about:support gone, for example this one: WebGPU adapter by default "wgpuBackend": "Vulkan", "wgpuDevice": 7171, "wgpuDeviceType": "DiscreteGpu", "wgpuDriver": "NVIDIA", "wgpuDriverInfo": "535.54.03", "wgpuName": "NVIDIA GeForce GTX 1060 6GB", "wgpuVendor": 4318

But still HARDWARE_VIDEO_DECODING says Force disabled by gfxInfo ; FEATURE_FAILURE_VIDEO_DECODING_TEST_FAILED

After changing setting media.hardware-video-decoding.force-enabled = true and restarting Firefox Nightly i see in terminal output [GFX1-]: vaapitest: ERROR [GFX1-]: vaapitest: VA-API test failed: failed to initialise VAAPI connection.

So far what I found is that VA-API can not work with proprietary Nvidia drivers that I need to encode video with GPU (NVENC). It seems I have to stop here, hope someone will find a solution.

Elven
  • 61

1 Answers1

0

OK, finally I have found a solution. Some theory you can find here and here. In short: Firefox understand only VA-API HW acceleration. VA-API do not support Nvidia proprietary drivers. So we need a driver, that pretend to be VA-API but have NVDEC under its hood. Driver is here.

3 important things:

  1. I was unable to make Firefox stable to see this new driver. So I had to install unstable branch Firefox Nightly.

  2. It did not work on default EGL backend so I had to add NVD_BACKEND=direct to /etc/environment

  3. It's a bit tricky to make it understand VP9 codec that YouTube often use. So install that libgstreamer-plugins-bad1.0-dev before compiling or just install FF addon h264ify that will force YouTube to use good old h264 codec.

Elven
  • 61
  • I do not understand the part of libgstreamer-plugins-bad1.0-dev. What am I supposed to be compiling? I hope not Firefox as it's managed by my package manager and I like to keep it that way. And compiling is impossible anyways because I seem to be cursed by always having compiler error whenever I try to compile whatever downloaded sources, and no amount of googling helps because no one else in the world ever has my compiler errors. – Mark Jeronimus Jan 30 '24 at 21:56