Yet another thread on Firefox + VAAPI

Dont just make unsubstantiated claims because you cant configure it.
Theres nothing making it not work on manjaro when it would work on Arch, etc.

For my part it seems to work fine.

Which parts?
What packages do you have installed that you believe are required?
What firefox settings have you configured?

These firefox options are probably the ones in about:config

gfx.webrender.all > true
gfx.webrender.enabled > true
layers.acceleration.force-enabled > true
# media.ffmpeg.dmabuf-textures.enabled > true
media.ffmpeg.vaapi-drm-display.enabled > true
media.ffmpeg.vaapi.enabled > true
# media.ffvpx.enabled > false

(the ones commented out are probably not required but may be nice)

2 Likes

I’ve installed the vaapi-related packeges and seem to have hardware acceleration working fine e.g. in mpv, and to some degree, vlc (which seems to have other issues there, but those probably don’t belong here).
Yet, in Firefox, I always get the same high CPU, no matter what.

I’ve rechecked the options in about:config, but they are already set accordingly.

I have a Renoir CPU as well. Working fine here.

Start Firefox like this and check if it spits out lines with “VA-API” in it:
(Play a video and then check for vaapi…)

MOZ_LOG="PlatformDecoderModule:5" firefox

Stupid question - where does the log end up?
The console output doesn’t contain anything about vaapi, though, only numerous of those:

  [Child 74713: Main Thread]: D/PlatformDecoderModule Sandbox decoder rejects requested type
[Child 74713: Main Thread]: D/PlatformDecoderModule Sandbox decoder supports requested type
[Child 74713: MediaController #2]: D/PlatformDecoderModule Sandbox decoder supports requested type
[Child 74713: MediaController #2]: D/PlatformDecoderModule Sandbox decoder supports requested type
[Child 74713: MediaController #2]: D/PlatformDecoderModule Sandbox decoder supports requested type
[Child 74713: MediaController #2]: D/PlatformDecoderModule Sandbox decoder supports requested type
[Child 74713: MediaPDecoder #1]: D/PlatformDecoderModule AudioTrimmer[0x7f131f9b9660] ::Decode: sample[0,21000] no trimming information
[RDD 74972: MediaPDecoder #2]: D/PlatformDecoderModule OpusDataDecoder[0x7f8e06f650b0] ::Decode: Opus decoder skipping 312 of 960 frames
[Child 74713: MediaPDecoder #1]: D/PlatformDecoderModule AudioTrimmer[0x7f131f9b9660] ::HandleDecodedResult: sample[0,21000] (decoded[0,13500] no trimming needed
[RDD 74972: MediaPDecoder #1]: D/PlatformDecoderModule DAV1DDecoder[0x7f8e06fa2ab0] ::GetPicture: Decode error: -11
[RDD 74972: MediaPDecoder #3]: D/PlatformDecoderModule DAV1DDecoder[0x7f8e06fa2ab0] ::GetPicture: Decode error: -11

Seems you are trying to play a video with AV1 codec.
That codec is not supported to be decoded in hw by renoir.
Try some other video with VP9 or H264 for example.

https://www.youtube.com/watch?v=8Kb8s0P9D4I

Same CPU use - hovers around ~10% total, which is about one core fully occupied.
And still no mention whatsoever of vaapi:

[Child 81972: MediaPDecoder #4]: D/PlatformDecoderModule AudioTrimmer[0x7f44f145afc0] ::HandleDecodedResult: sample[34401000,34421000] (decoded[34394500,34414500] no trimming needed
[Child 81972: MediaPDecoder #4]: D/PlatformDecoderModule Got one frame output with pts=32800000 dts=32800000 duration=40000 opaque=-9223372036854775808
[Child 81972: MediaPDecoder #4]: D/PlatformDecoderModule AudioTrimmer[0x7f44f145afc0] ::Decode: sample[34421000,34441000] no trimming information
[Child 81972: MediaPDecoder #5]: D/PlatformDecoderModule AudioTrimmer[0x7f44f145afc0] ::HandleDecodedResult: sample[34421000,34441000] (decoded[34414500,34434500] no trimming needed
[Child 81972: MediaPDecoder #5]: D/PlatformDecoderModule Got one frame output with pts=32840000 dts=32840000 duration=40000 opaque=-9223372036854775808
[Child 81972: MediaPDecoder #5]: D/PlatformDecoderModule AudioTrimmer[0x7f44f145afc0] ::Decode: sample[34441000,34461000] no trimming information
[Child 81972: MediaPDecoder #4]: D/PlatformDecoderModule AudioTrimmer[0x7f44f145afc0] ::HandleDecodedResult: sample[34441000,34461000] (decoded[34434500,34454500] no trimming needed

If I picked a AV1 vid, that was by accident, I had also tried various VP9 before.

Yeah then, it’s indeed not switched on.

Try this config setting:
gfx.webrender.all = true

And then start with:
MOZ_EGL_X11=1 MOZ_LOG="PlatformDecoderModule:5" firefox

No, no change, but that’s no wonder, I had already set all of those variables…

Ok, sorry, no clue then. Working for me on cinnamon unstable.

1 Like

By the way, which driver is being used by vaapi on your system?
Did you also install vdpau or just vaapi?

$ pacman -Qs 'libva|vdpau|mesa|amd'   
amd-ucode 20201113.r1774.2ea8667-1
    Microcode update files for AMD CPUs
glu 9.0.1-2
    Mesa OpenGL Utility library
lib32-libva 2.8.0-1
    Video Acceleration (VA) API for Linux (32-bit)
lib32-libva-mesa-driver 20.2.2-2
    VA-API implementation for gallium (32-bit)
lib32-libva-vdpau-driver 0.7.4-6
    VDPAU backend for VA API (32-bit)
lib32-libvdpau 1.4-1
    Nvidia VDPAU library
lib32-mesa 20.2.2-2
    An open-source implementation of the OpenGL specification (32-bit)
lib32-mesa-vdpau 20.2.2-2
    Mesa VDPAU drivers (32-bit)
lib32-vulkan-intel 20.2.2-2
    Intels Vulkan mesa driver (32-bit)
lib32-vulkan-radeon 20.2.2-2
    Radeons Vulkan mesa driver (32-bit)
libva 2.9.1-1
    Video Acceleration (VA) API for Linux
libva-mesa-driver 20.2.2-2
    VA-API implementation for gallium
libva-utils 2.9.1-1
    Intel VA-API Media Applications and Scripts for libva
libva-vdpau-driver 0.7.4-4
    VDPAU backend for VA API
libvdpau 1.4-1
    Nvidia VDPAU library
libvdpau-va-gl 0.4.2-3
    VDPAU driver with OpenGL/VAAPI backend
mesa 20.2.2-2
    An open-source implementation of the OpenGL specification
mesa-demos 8.4.0-4
    Mesa demos and tools incl. glxinfo + glxgears
mesa-vdpau 20.2.2-2
    Mesa VDPAU drivers
mhwd-amdgpu 19.1.0-1
    MHWD module-ids for amdgpu
vamp-plugin-sdk 2.10.0-1 (pro-audio)
    The Vamp audio analysis plug-in system
vdpauinfo 1.4-1
    Command line utility for querying the capabilities of a VDPAU device
vulkan-intel 20.2.2-2
    Intels Vulkan mesa driver
vulkan-radeon 20.2.2-2
    Radeons Vulkan mesa driver
xf86-video-amdgpu 19.1.0-2 (xorg-drivers)
    X.org amdgpu video driver

(I removed some local things unrelated)

1 Like

Thanks!

Only differences I spot are that I was missing libvdpau-va-gl, which I have installed now (no change) and you are on a slightly newer version of some mesa packages. Are you using Testing branch?

I am on Unstable. So makes sense.

I doubt that the slightly newer Mesa branch is responsible here, but if so, it will eventually fix itself…

In the meantime, I might check out creating a new Firefox profile or play around with a few other settings. It’s strange, though, vaapi works in mpv, but is completely ignored in Firefox…

I found the solution! It’s actually rather simple and I was being stupid…

It’s not MOZ_EGL_X11=1, it’s MOZ_X11_EGL=1 :man_facepalming:

I guess it’s possible, that in the process of trying to fix this issue, I might have done something else, e.g. set a variable I had forgot earlier, or installed some missing package - but ultimately the issue was the above setting.
I had previously misspelled it and never checked on it thereafter.

Well, at least it works now, CPU use is much lower, just a few hours lost over it… :smiley:

Good you found it.
BTW … my preferred way of changing the firefox default env vars is like this:

  • Copy firefox.desktop file from /usr/share/applications to ~/.local/share/applications

  • Edit each Exec line to contain your values like this (I also set some for plasma integration):

Exec=/usr/bin/sh -c "MOZ_X11_EGL=1 GTK_USE_PORTAL=1 /usr/lib/firefox/firefox %u"
Exec=/usr/bin/sh -c "MOZ_X11_EGL=1 GTK_USE_PORTAL=1 /usr/lib/firefox/firefox --new-window %u"
Exec=/usr/bin/sh -c "MOZ_X11_EGL=1 GTK_USE_PORTAL=1 /usr/lib/firefox/firefox --private-window %u"

Then whenever you start FF from a key combo or link or menu … it will use your variables.
(and you arent editing a system file, which also means it wont overwrite during an update etc)

1 Like

A post was merged into an existing topic: Vaapi errors with intel i965

No it doesnt what?

As shown by previous posts it works there.
(and so the quote “For my part it seems to work fine.” is quite true)
If you have issues … then thats specific to you.

$ vainfo --display drm --device /dev/dri/renderD128
vainfo: VA-API version: 1.9 (libva 2.9.1)
vainfo: Driver version: Mesa Gallium driver 20.2.2 for AMD Radeon(TM) Vega 8 Graphics (RAVEN, DRM 3.35.0, 5.4.77-RAVEN, LLVM 11.0.0)
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointEncSlice
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointVLD
      VAProfileNone                   : VAEntrypointVideoProc

So maybe you want to open your own thread about how vaapi is somehow broken for you.
Make sure to read this first and include system information:

A post was split to a new topic: Vaapi errors with intel i965

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.