Blame

46608d admin 2025-06-20 22:38:15
initial firefox vaapi
1
# GPU Acceleration
2
c08ec2 admin 2025-06-20 23:24:43
firefox vaapi
3
## Firefox Hardware Video Acceleration
4
### Configuring the nvidia-vaapi-driver
46608d admin 2025-06-20 22:38:15
initial firefox vaapi
5
VAAPI acceleration in Firefox on Debian 12 is tricky because many of the components are broken with fixes hiding in newer versions that have yet to be released through Debian's repositories.
6
c08ec2 admin 2025-06-20 23:24:43
firefox vaapi
7
I was only able to get this working by manually building and installing the following updated packages:
46608d admin 2025-06-20 22:38:15
initial firefox vaapi
8
- nvidia-driver v570.169
c08ec2 admin 2025-06-20 23:24:43
firefox vaapi
9
- nvidia-smi v570.169 (comes with manually installed nvidia-driver)
10
- [nvidia-vaapi-driver](https://github.com/elFarto/nvidia-vaapi-driver) v0.0.14
11
12
Other packages used (installed through Debian 12 repository):
13
- firefox-esr v128.11
14
- vainfo v2.12
15
16
Once you have installed the packages above you can verify `nvidia-vaapi-driver` is working by running `vainfo`:
17
```
18
user@debian:~$ vainfo
19
libva info: VA-API version 1.17.0
20
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/nvidia_drv_video.so
21
libva info: Found init function __vaDriverInit_1_0
22
libva info: va_openDriver() returns 0
23
vainfo: VA-API version: 1.17 (libva 2.12.0)
24
vainfo: Driver version: VA-API NVDEC driver [direct backend]
25
vainfo: Supported profile and entrypoints
26
VAProfileMPEG2Simple : VAEntrypointVLD
27
VAProfileMPEG2Main : VAEntrypointVLD
28
VAProfileVC1Simple : VAEntrypointVLD
29
VAProfileVC1Main : VAEntrypointVLD
30
VAProfileVC1Advanced : VAEntrypointVLD
31
VAProfileH264Main : VAEntrypointVLD
32
VAProfileH264High : VAEntrypointVLD
33
VAProfileH264ConstrainedBaseline: VAEntrypointVLD
34
VAProfileHEVCMain : VAEntrypointVLD
35
VAProfileVP8Version0_3 : VAEntrypointVLD
36
VAProfileVP9Profile0 : VAEntrypointVLD
37
VAProfileAV1Profile0 : VAEntrypointVLD
38
VAProfileHEVCMain10 : VAEntrypointVLD
39
VAProfileHEVCMain12 : VAEntrypointVLD
40
VAProfileVP9Profile2 : VAEntrypointVLD
41
VAProfileHEVCMain444 : VAEntrypointVLD
42
```
43
Here we are looking to see that the driver has loaded without errors and that we are using the `[direct backend]`. If the driver is defaulting to the`[egl backend]` you can force it to use `direct` by setting the following environment variable:
44
```
45
export NVD_BACKEND=direct
46
```
47
48
### Configuring Firefox
49
Before launching Firefox I recommend setting the following environment variable in your terminal to enable NV logging:
50
```
51
export NVD_LOG=1
52
```
53
54
Now launch Firefox using the following parameters:
55
```
56
MOZ_DISABLE_RDD_SANDBOX=1 firefox
57
```
58
59
In Firefox you will need to set the `media.ffmpeg.vaapi.enabled` option to `true` in the `about:config` page:
60
![](./image-1750461112849.png)
61
62
Now close Firefox and restart using the same command. To verify that video hardware decoding is working you can play a YouTube video and check the output of `nvidia-smi`:
63
```
64
user@debian:~$ nvidia-smi
65
Fri Jun 20 19:14:17 2025
66
+-----------------------------------------------------------------------------------------+
67
| NVIDIA-SMI 570.169 Driver Version: 570.169 CUDA Version: 12.8 |
68
|-----------------------------------------+------------------------+----------------------+
69
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
70
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
71
| | | MIG M. |
72
|=========================================+========================+======================|
73
| 0 NVIDIA GeForce RTX 4090 Off | 00000000:06:00.0 On | Off |
74
| 0% 38C P2 80W / 450W | 1090MiB / 24564MiB | 5% Default |
75
| | | N/A |
76
+-----------------------------------------+------------------------+----------------------+
77
78
+-----------------------------------------------------------------------------------------+
79
| Processes: |
80
| GPU GI CI PID Type Process name GPU Memory |
81
| ID ID Usage |
82
|=========================================================================================|
83
| 0 N/A N/A 989 G /usr/lib/xorg/Xorg 317MiB |
84
| 0 N/A N/A 33599 G alacritty 29MiB |
85
| 0 N/A N/A 40272 G ...ler --variations-seed-version 48MiB |
86
| 0 N/A N/A 42045 G alacritty 15MiB |
87
| 0 N/A N/A 49174 G alacritty 15MiB |
88
| 0 N/A N/A 52330 G firefox-esr 130MiB |
89
| 0 N/A N/A 55294 C+G /usr/lib/firefox-esr/firefox-esr 423MiB |
90
+-----------------------------------------------------------------------------------------+
91
```
92
We are looking for a Firefox process with a `Type` or either `C` or `C+G`.
93
94
You can also use `nvidia-smi pmon` to show the usage of the decode engine:
95
```
96
user@debian:~$ nvidia-smi pmon
97
# gpu pid type sm mem enc dec jpg ofa command
98
# Idx # C/G % % % % % % name
99
0 49174 G - - - - - - alacritty
100
0 52330 G 0 0 - - - - firefox-esr
101
0 55294 C+G 1 0 - 4 - - firefox-esr
102
0 989 G 1 0 - - - - Xorg
103
0 33599 G - - - - - - alacritty
104
0 40272 G - - - - - - chrome --type=g
105
0 42045 G - - - - - - alacritty
106
```
107
I had to bump up the video quality to 1080p@60 for it to show a usage greater than 0%.
108
109
### References
110
- https://wiki.debian.org/Firefox#Nvidia
111
- https://github.com/elFarto/nvidia-vaapi-driver