I’m using Ubuntu 20.04.3 on AMD Ryzen 3 5300U with Renoir graphics, running Firefox 93 x64 on X11. I followed the guide on ArchWiki, but even though MOZ_LOG_="PlatformDecoderModule:5" firefox displays output
libva info: VA-API version 1.7.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_1_7
libva info: va_openDriver() returns 0
This is all the output of the log. The VA-API got one frame output... isn’t shown at all, plus the CPU usage for Firefox hovers at 56-68%. I’ve set environment variables in .profile as
export MOZ_DISABLE_RDD_SANDBOX=1
export MOZ_X11_EGL=1
What is preventing Firefox from using hardware acceleration here? The mpv successfully uses VA-API and CPU load for 1080p video is around 12-14% so I assume all the VA-API drivers are installed and working if used at all.
Edit: with MOZ_LOG="Dmabuf:5, PlatformDecoderModule:5" firefox I get the following output:
[Child 14739: MediaPDecoder #2]: D/PlatformDecoderModule VA-API Got one frame output with pts=0dts=0 duration=17000 opaque=-9223372036854775808
[Child 14739: MediaPDecoder #2]: D/Dmabuf DMABufSurfaceYUV::CreateYUVSurface() UID 1 from desc
[Child 14739: MediaPDecoder #2]: D/Dmabuf DMABufSurfaceYUV::UpdateYUVData() UID 1
[Child 14739: MediaPDecoder #2]: D/Dmabuf plane 0 size 1920 x 1080 format 20203852
[Child 14739: MediaPDecoder #2]: D/Dmabuf plane 1 size 960 x 540 format 38385247
[Child 14739: MediaPDecoder #2]: D/PlatformDecoderModule Created new VA-API DMABufSurface UID = 1
[Child 14739: MediaPDecoder #2]: D/PlatformDecoderModule VideoFrameSurfaceDMABuf: creating surface UID = 1
[Child 14739: MediaPDecoder #2]: D/PlatformDecoderModule VideoFrameSurfaceVAAPI: VAAPI locking dmabuf surface UID = 1
Full log here. Can this indicate VA-API is actually being used? If it really is VA-API, then why is the CPU usage high and after watching a video for 5 minutes continuously the fan gets loud?
>Solution :
A better way to check accelerated video decoding is through command sudo watch cat /sys/kernel/debug/dri/0/amdgpu_pm_info and check whether VCN or UVD enables when a video is played. If it stays disabled, then the video is software decoded. In my case VCN enables whenever firefox or mpv plays the video and stays disabled in chromium and opera. On newer cards, we need not use the enhanced-h264ify extension as VP8/VP9 is decoded in hardware.
Removing export MOZ_DISABLE_RDD_SANDBOX=1 doesn’t affect firefox VCN capability.