This is how I was able to get hardware acceleration working on Flatpak Firefox (version 83.0 at the time of writing this). Note that I am using an AMD GPU for this, though I believe it should work with other brands as well. This guide is for the Xorg display server.
flatpak install org.freedesktop.Platform.ffmpeg-full
. Choose
branch 19.08 when promptedflatpak override --env="MOZ_X11_EGL=1 MOZ_LOG=PlatformDecoderModule:5" org.mozilla.firefox
gfx.webrender.all=true
media.ffmpeg.vaapi.enabled=true
media.ffvpx.enabled=false
media.av1.enabled=false
media.ffmpeg.dmabuf-textures.enabled=true
flatpak run --verbose org.mozilla.firefox
.
Then, open a YouTube video. Right as the video starts playing, look for logs indicating
that it's working. As an example, I will show the relevant lines of output from the logs
that I see, indicating that it's working:
[Child 389: MediaPDecoder #2]: D/PlatformDecoderModule Initialising VA-API FFmpeg decoder
libva info: VA-API version 1.5.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/radeonsi_drv_video.so
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/intel-vaapi-driver/radeonsi_drv_video.so
libva info: Trying to open /usr/lib/x86_64-linux-gnu/GL/lib/dri/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_1_5
libva info: va_openDriver() returns 0
[AVHWDeviceContext @ 0x7f4efb9fad00] VAAPI driver: Mesa Gallium driver 20.1.2 for Radeon RX Vega (VEGA10,
DRM 3.39.0, 5.9.12-xanmod1, LLVM 9.0.1).
[Child 389: MediaPDecoder #2]: D/PlatformDecoderModule VA-API FFmpeg init successful
[Child 389: MediaPDecoder #3]: D/PlatformDecoderModule Choosing FFmpeg pixel format for VA-API video decoding.