Line 64: | Line 64: | ||
* Install '''ffmpeg''' from [https://rpmfusion.org/ RPM Fusion repository] for H.264 decoding. | * Install '''ffmpeg''' from [https://rpmfusion.org/ RPM Fusion repository] for H.264 decoding. | ||
* Install '''nvidia-vaapi-driver''' from [https://rpmfusion.org/ RPM Fusion repository non-free]. | * Install '''nvidia-vaapi-driver''' from [https://rpmfusion.org/ RPM Fusion repository non-free]. | ||
* Run Firefox and force enable VA-API as it's disabled on NVIDIA by default. Go to '''about:config''' page and set '''media.ffmpeg.vaapi.enabled''' to true. | * Run Firefox and force enable VA-API as it's disabled on NVIDIA by default. Go to '''about:config''' page and set '''media.ffmpeg.vaapi.enabled''' to '''true'''. | ||
* Run Firefox with '''NVD_BACKEND=direct MOZ_DISABLE_RDD_SANDBOX=1''' env variables. | * Run Firefox with '''NVD_BACKEND=direct MOZ_DISABLE_RDD_SANDBOX=1''' env variables. | ||
Revision as of 11:40, 25 January 2023
Firefox Hardware acceleration on Fedora
Firefox on Fedora supports hardware acceleration on Linux so let's look how to configure it and diagnose potential issues. This guide is adjusted for Fedora only and may not work for stock Mozilla binaries or other distros.
Web page rendering
Accelerated web page rendering is supported on both X11 and Wayland backends via WebRender.
Please note that Firefox requires a GPU with support for OpenGL 3.2 or newer or GLES 3.0 or newer to enable hardware acceleration (Source and further info). You can check your hardware using glxinfo | grep "profile version"
for OpenGL and eglinfo | grep version
for GLES.
You can check hardware acceleration state at about:support page, look at Compositing row. If there's WebRender, you're running on hardware. If there's WebRender (software) you're on non-accelerated backend.
Web page rendering on Wayland
Hardware acceleration should work out-of-the-box on Wayland. If not please file a bug for it.
Web page rendering on X11
X11 backend can tun in two modes - EGL and XGL. You should be on EGL unless you're running old NVIDIA proprietary drivers.
Video decoding
Hardware accelerated video decoding (for video playback or for WebRTC) is available via VA-API for both X11 and Wayland. Since firefox-101.0.1-4 package it's enabled by default for Intel/AMD users.
You can check VA-API acceleration state at about:support page, look at HARDWARE_VIDEO_DECODING row. If there's available by default, you're running on hardware by default.
You can disable it at about:config page setting media.hardware-video-decoding.enabled to false.
You may install enhanced-h264ify Firefox extension to disable non-accelerated video formats.
Configure VA-API Video decoding on AMD
Accelerated video decoding works well on AMD as free drivers are available. Free video formats (e.g. VP8/VP9/AV1) should be accelerated out of the box. You can add support for H.264 VA-API decode by these steps:
- Install ffmpeg from RPM Fusion repository. It's needed for H.264 decoding.
- On Fedora 37 and newer, install mesa-va-drivers-freeworld. See RPM Fusion howto (section Hardware codecs with AMD (mesa)) for instructions. It's needed for VA-API H.264 decoding.
- Run vainfo on terminal to verify that VA-API works.
- Restart browser.
Configure VA-API Video decoding on Intel
Accelerated video decoding works well on most Intel GPUs as free drivers are available. There are two[1] drivers for Intel cards, libva-intel-driver (provides i965_drv_video.so) and intel-media-driver (iHD_drv_video.so). Currently, Firefox works with either libva-intel-driver or intel-media-driver.
Refer to this Intel chipsets video features table on Wikipedia to determine which codecs your hardware supports.
You can enable VA-API on Intel by these steps:
- Install libva-intel-driver package to enable VA-API on Intel.
- Install ffmpeg from RPM Fusion repository for H.264 decoding.
- Run vainfo on terminal to verify that VA-API works. If VA-API is disabled you're running on new hardware[2] and you need intel-media-driver from RPM Fusion repository non-free.
- Restart browser.
Configure VA-API Video decoding on NVIDIA
Accelerated video decoding works on NVIDIA proprietary drivers thanks to Stephen "elFarto" and his nvidia-vaapi-driver project. It's VA-API implemention using NVIDIA's NVDEC decoder.
You can enable VA-API on NVIDIA / Fedora 37 by these steps:
- Install NVIDIA proprietary drivers.
- Install ffmpeg from RPM Fusion repository for H.264 decoding.
- Install nvidia-vaapi-driver from RPM Fusion repository non-free.
- Run Firefox and force enable VA-API as it's disabled on NVIDIA by default. Go to about:config page and set media.ffmpeg.vaapi.enabled to true.
- Run Firefox with NVD_BACKEND=direct MOZ_DISABLE_RDD_SANDBOX=1 env variables.
Troubleshooting
- Verify you're running on HW accelerated backend (WebRender) under Wayland or X11/EGL at about:support.
- Run vainfo on terminal to verify that VA-API works.
- Run Firefox on terminal with MOZ_LOG="PlatformDecoderModule:5" env variable. It produces a playback and decode log with VA-API / ffmpeg details.
- VA-API is also used for WebRTC (video conferencing like Google Meet, Zoom, Bluejeans). If you see any video artifacts you can disable VA-API for it. At about:config page set media.navigator.mediadatadecoder_vpx_enabled to false and restart browser.
Video encoding
Hardware accelerated video encoding (for WebRTC for instance) is not supported/implemented in Firefox, no matter which preference you set at about:config page.