From Fedora Project Wiki

m (→‎Video decoding on Intel: remove duplication, add conjunction)
No edit summary
Line 23: Line 23:
== Video decoding ==
== Video decoding ==


Hardware accelerated video decoding (for video playback or for WebRTC) is [https://mastransky.wordpress.com/2020/09/29/firefox-81-on-fedora-with-va-api-webrtc-and-x11/ available on Intel/AMD] via VA-API for both X11(EGL) and Wayland and can be enabled by preferences at '''about:config'''.
Hardware accelerated video decoding (for video playback or for WebRTC) is [https://mastransky.wordpress.com/2020/09/29/firefox-81-on-fedora-with-va-api-webrtc-and-x11/ available on Intel/AMD] via VA-API for both X11(EGL) and Wayland. Since last Firefox update (101.0-2) [https://bodhi.fedoraproject.org/updates/FEDORA-2022-81dfe13ce1 F35], [https://bodhi.fedoraproject.org/updates/FEDORA-2022-a66739c5ad F36] it's enabled by default for Intel/AMD users.


=== Firefox 98 and later ===
You can check VA-API acceleration state at '''about:support''' page, look at '''VAAPI''' row. If there's '''
available by default''', you're running on hardware.


Due to [[https://bugzilla.mozilla.org/show_bug.cgi?id=1751363 Bug 1751363]] VA-API is blocked by RDD sandbox. That can be disabled by '''MOZ_DISABLE_RDD_SANDBOX=1''' env variable.
[[File:Support.png|thumb|center|Correct VA-API setup]]


=== Video decoding on AMD ===
You can '''disable''' it at '''about:config''' page setting '''media.hardware-video-decoding.enabled''' to '''false'''.


Accelerated video decoding works well on AMD as free drivers are available. You can enable it by these steps:
You may install [https://addons.mozilla.org/en-US/firefox/addon/enhanced-h264ify/ 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 (VP8, VP9, AV1) should be accelerated out of the box. You can install H.264 VA-API support it by these steps:


* Verify you're running on HW accelerated backend ('''WebRender''') under '''Wayland''' or '''X11/EGL''' at '''about:support'''.
* Install '''ffmpeg''', '''libva''' and '''libva-utils''' from [https://rpmfusion.org/ RPM Fusion repository].
* Install '''ffmpeg''', '''libva''' and '''libva-utils''' from [https://rpmfusion.org/ RPM Fusion repository].
* Run '''vainfo''' on terminal to verify that [https://en.wikipedia.org/wiki/Video_Acceleration_API VA-API works].
* Run '''vainfo''' on terminal to verify that [https://en.wikipedia.org/wiki/Video_Acceleration_API VA-API works].
* At '''about:config''' page set '''media.ffmpeg.vaapi.enabled''' to '''true'''
* Restart browser.
* Restart browser.
* You may install [https://addons.mozilla.org/en-US/firefox/addon/enhanced-h264ify/ enhanced-h264ify] Firefox extension to disable non-accelerated video formats.
* More info is [https://mastransky.wordpress.com/2020/06/03/firefox-on-fedora-finally-gets-va-api-on-wayland/ here].


=== Video decoding on Intel ===
=== Configure VA-API Video decoding on Intel ===


Accelerated video decoding works well on most Intel GPUs as free drivers are available. There are two<ref>There's also '''libva-intel-hybrid-driver''', but that only adds support for VP8 encoding and VP9 decoding with selected chips.</ref> 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'''.
Accelerated video decoding works well on most Intel GPUs as free drivers are available. There are two<ref>There's also '''libva-intel-hybrid-driver''', but that only adds support for VP8 encoding and VP9 decoding with selected chips.</ref> 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'''.
Line 47: Line 48:
You can enable VA-API on Intel by these steps:
You can enable VA-API on Intel by these steps:


* Verify you're running on HW accelerated backend ('''WebRender''') under '''Wayland''' or '''X11/EGL''' at '''about:support'''.
* Install '''libva''', '''libva-utils''', and '''libva-intel-driver''' packages.
* Install '''libva''', '''libva-utils''', and '''libva-intel-driver''' packages.
* Install '''ffmpeg'''  from [https://rpmfusion.org/ RPM Fusion repository].
* Install '''ffmpeg'''  from [https://rpmfusion.org/ RPM Fusion repository].
* Run '''vainfo''' on terminal to verify that [https://en.wikipedia.org/wiki/Video_Acceleration_API VA-API works]. If VA-API is disabled you're running on new hardware<ref>Ice Lake or newer</ref> and you need '''intel-media-driver''' from [https://rpmfusion.org/ RPM Fusion repository non-free].  
* Run '''vainfo''' on terminal to verify that [https://en.wikipedia.org/wiki/Video_Acceleration_API VA-API works]. If VA-API is disabled you're running on new hardware<ref>Ice Lake or newer</ref> and you need '''intel-media-driver''' from [https://rpmfusion.org/ RPM Fusion repository non-free].  
* At '''about:config''' page set '''media.ffmpeg.vaapi.enabled''' to '''true'''
* Restart browser.
* Restart browser.
* You may install [https://addons.mozilla.org/en-US/firefox/addon/enhanced-h264ify/ enhanced-h264ify] Firefox extension to disable non-accelerated video formats.
* More info is [https://mastransky.wordpress.com/2020/06/03/firefox-on-fedora-finally-gets-va-api-on-wayland/ here].


=== Video decoding on NVIDIA ===
=== Video decoding on NVIDIA ===


Firefox does not officially support hardware acceleration on NVIDIA, due to the NVIDIA drivers' lack of a usable VA-API interface.
Firefox does not support hardware acceleration on NVIDIA, due to the NVIDIA drivers' lack of a usable VA-API interface.


=== Troubleshooting ===
== Troubleshooting ==


Run Firefox on terminal with '''MOZ_LOG="PlatformDecoderModule:5"''' env variable. It produces a playback and decode log with VA-API / ffmpeg details.
* Verify you're running on HW accelerated backend ('''WebRender''') under '''Wayland''' or '''X11/EGL''' at '''about:support'''.
 
* Run '''vainfo''' on terminal to verify that [https://en.wikipedia.org/wiki/Video_Acceleration_API VA-API works].
Due to [[https://bugzilla.mozilla.org/show_bug.cgi?id=1751363 Bug 1751363]] VA-API is blocked by RDD sandbox on Firefox versions between 98 and 101. That can be disabled by '''MOZ_DISABLE_RDD_SANDBOX=1''' env variable.
* 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 ==
== 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.
Hardware accelerated video encoding (for WebRTC for instance) is not supported/implemented in Firefox, no matter which preference you set at '''about:config''' page.

Revision as of 10:06, 8 June 2022

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.

WebRender Firefox setup

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 NVIDIA proprietary drivers.

Video decoding

Hardware accelerated video decoding (for video playback or for WebRTC) is available on Intel/AMD via VA-API for both X11(EGL) and Wayland. Since last Firefox update (101.0-2) F35, F36 it's enabled by default for Intel/AMD users.

You can check VA-API acceleration state at about:support page, look at VAAPI row. If there's available by default, you're running on hardware.

Correct VA-API setup

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 (VP8, VP9, AV1) should be accelerated out of the box. You can install H.264 VA-API support it by these steps:

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.

You can enable VA-API on Intel by these steps:

Video decoding on NVIDIA

Firefox does not support hardware acceleration on NVIDIA, due to the NVIDIA drivers' lack of a usable VA-API interface.

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.

  1. There's also libva-intel-hybrid-driver, but that only adds support for VP8 encoding and VP9 decoding with selected chips.
  2. Ice Lake or newer