Latest update broke GPU acceleration in Firefox

It seems that the latest update, from today, broke GPU hardware acceleration in Firefox.

Based on my tests, it broke avc, which affects Rumble directly.
Youtube VP9 and AV1 are working, but some videos show an error that it can’t be displayed in that browser.

My system
Ryzen CPU without integrated graphics.
GPU: AMD Radeon 6750 XT.
Gnome + Wayland
Firefox running natively on Wayland.

Below are the updates that I believe that are related to the issue, but there are others that might triggered this bug, such as gstreamer and derivatives, wayland-protocols. So I’m still trying to understand what happened.

Updates that I believe are related to the issue
[2023-03-09T13:28:13-0300] [ALPM] upgraded ffmpeg (2:5.1.2-2 -> 2:6.0-3)
[2023-03-09T13:28:13-0300] [ALPM] upgraded ffmpegthumbnailer (2.2.2-4 -> 2.2.2-5)

Running Firefox with debug mode enabled while trying to play videos in Rumble website:

MOZ_ENABLE_WAYLAND=1 MOZ_LOG="PlatformDecoderModule:5" firefox
[Child 8359, MediaDecoderStateMachine #1] WARNING: Decoder=7f731dcef300 Decode error: NS_ERROR_DOM_MEDIA_FATAL_ERR (0x806e0005) - Error no decoder found for audio/mp4a-latm: file /build/firefox/src/firefox-110.0.1/dom/media/MediaDecoderStateMachineBase.cpp:164
[Child 8359: MediaSupervisor #1]: D/PlatformDecoderModule FFmpeg decoder rejects requested type 'video/avc'
[Child 8359: MediaSupervisor #1]: D/PlatformDecoderModule Agnostic decoder rejects requested type 'video/avc'
[Child 8359, MediaDecoderStateMachine #1] WARNING: Decoder=7f731dcef300 Decode error: NS_ERROR_DOM_MEDIA_FATAL_ERR (0x806e0005) - Error no decoder found for video/avc: file /build/firefox/src/firefox-110.0.1/dom/media/MediaDecoderStateMachineBase.cpp:164

I’ll downgrade ffmpeg to test, not sure what is the culprit yet.

Edit: Ohh, upgrading Firefox to 110.0.1-2 solved the issue
I’ll keep testing and report back my findings if the issue persists.

Probably somebody just forgot some compilation flags in Arch repo package… :laughing:

4 Likes

Spoke too early… I can play the videos, they at least work now, but the CPU usage is as high as it is when not using HW accel.

1 Like

Same video, same resolution, comparison:

After the update:

Before the update:

What is the issue that you see? How are you testing? I can try on my system which is similar. Which videos couldn’t you play?

This video is 4k60 fps.

Before the update, I was getting around 7-15% CPU usage while playing the video above, in 4k60.
After the update, I’m getting 70-110% CPU usage while playing this same video, at the same resolution.

To get VA-PI acceleration, I followed Arch’s wiki https://wiki.archlinux.org/title/firefox#Hardware_video_acceleration

Gnome in Wayland
MOZ_ENABLE_WAYLAND=1 env for firefox
media.ffmpeg.vaapi.enabled to true in user.js

These settings were working perfectly before the update.
Same settings don’t work after the update.

I’m still trying to understand, but it seems isolated to Firefox, since MPV works well with all kind of media using VA-PI, tested and it works perfectly for H264, VP9 and AV1.

I just restored a snapshot from before these updates from today, and noticed during the Firefox debug that the only difference is this:

[Child 4695, MediaDecoderStateMachine #1] WARNING: Decoder=7f4e9ef61400 state=DECODING_METADATA Decode metadata failed, shutting down decoder: file /build/firefox/src/firefox-110.0.1/dom/media/MediaDecoderStateMachine.cpp:372
[Child 4695, MediaDecoderStateMachine #1] WARNING: Decoder=7f4e9ef61400 Decode error: NS_ERROR_DOM_MEDIA_METADATA_ERR (0x806e0006) - static MP4Metadata::ResultAndByteBuffer mozilla::MP4Metadata::Metadata(mozilla::ByteStream *): Cannot parse metadata: file /build/firefox/src/firefox-110.0.1/dom/media/MediaDecoderStateMachineBase.cpp:164
[Child 4695, MediaDecoderStateMachine #1] WARNING: Decoder=7f4e9ef61700 state=DECODING_METADATA Decode metadata failed, shutting down decoder: file /build/firefox/src/firefox-110.0.1/dom/media/MediaDecoderStateMachine.cpp:372
[Child 4695, MediaDecoderStateMachine #1] WARNING: Decoder=7f4e9ef61700 Decode error: NS_ERROR_DOM_MEDIA_METADATA_ERR (0x806e0006) - static MP4Metadata::ResultAndByteBuffer mozilla::MP4Metadata::Metadata(mozilla::ByteStream *): Cannot parse metadata: file /build/firefox/src/firefox-110.0.1/dom/media/MediaDecoderStateMachineBase.cpp:164

Based on the above output, the decoder is being shutdown for some reason that I don’t understand yet.

I have no issue on KDE. :rofl:

Edit: Not using Wayaland!

3 Likes

I heard somewhere that you like broccoli :rofl: :rofl: :rofl:

2 Likes

Better than cauliflower! :laughing:

Edit: Video plays perfectly! On RX 590 too!

3 Likes

@anon49550872

This one too.

Edit: You should try Kde Plasma. I heard it works great. No bugs! :rofl:

2 Likes

Yes, I had three updates today, and now they play perfectly too, but without HW accel, which hits hard the CPU.

The first update, broke video playback for some codecs, at least this is was I could find out.

First update
extra/alsa-plugins           1:1.2.7.1-1    1:1.2.7.1-2     0,00 MiB
extra/chromaprint            1.5.1-6        1.5.1-7         0,00 MiB
extra/ffmpeg                 2:5.1.2-2      2:6.0-3         0,51 MiB
extra/ffmpegthumbnailer      2.2.2-4        2.2.2-5        -0,01 MiB
extra/firefox                110.0.1-1      110.0.1-2       0,17 MiB
extra/gst-libav              1.22.0-4       1.22.1-1        0,00 MiB
extra/gst-plugin-gtk         1.22.0-4       1.22.1-1        0,00 MiB
extra/gst-plugins-bad        1.22.0-4       1.22.1-1        0,00 MiB
extra/gst-plugins-bad-libs   1.22.0-4       1.22.1-1        0,00 MiB
extra/gst-plugins-base       1.22.0-4       1.22.1-1        0,00 MiB
extra/gst-plugins-base-libs  1.22.0-4       1.22.1-1        0,01 MiB
extra/gst-plugins-good       1.22.0-4       1.22.1-1        0,01 MiB
extra/gst-plugins-ugly       1.22.0-4       1.22.1-1        0,00 MiB
extra/gstreamer              1.22.0-4       1.22.1-1        0,02 MiB
core/hwdata                  0.367-1        0.368-1         0,03 MiB
extra/libde265               1.0.11-1       1.0.11-2        0,00 MiB
community/mpv                1:0.35.1-2     1:0.35.1-3      0,00 MiB
extra/openal                 1.23.0-1       1.23.0-2        0,00 MiB
extra/tinycompress           1.2.8-1        1.2.8-2         0,00 MiB
extra/wayland-protocols                     1.31-1          0,49 MiB

Second update was only for firefox, this update fixed the video playback, however GPU HW acceleration is broken

Third update didn’t fix the problem with GPU HW acceleration.

Third update
extra/gst-libav              1.22.1-1       1.22.1-2        0,00 MiB             0,09 MiB
extra/gst-plugin-gtk         1.22.1-1       1.22.1-2        0,00 MiB             0,03 MiB
extra/gst-plugins-bad        1.22.1-1       1.22.1-2        0,00 MiB             1,07 MiB
extra/gst-plugins-bad-libs   1.22.1-1       1.22.1-2        0,00 MiB             2,37 MiB
extra/gst-plugins-base       1.22.1-1       1.22.1-2        0,00 MiB             0,31 MiB
extra/gst-plugins-base-libs  1.22.1-1       1.22.1-2        0,00 MiB             2,15 MiB
extra/gst-plugins-good       1.22.1-1       1.22.1-2        0,00 MiB             2,13 MiB
extra/gst-plugins-ugly       1.22.1-1       1.22.1-2        0,00 MiB             0,21 MiB
extra/gstreamer              1.22.1-1       1.22.1-2        0,00 MiB             1,78 MiB
extra/imath                  3.1.6-2        3.1.7-1         0,00 MiB             3,96 MiB
extra/openexr                3.1.5-1        3.1.5-2        -0,01 MiB             1,15 MiB

:rofl:
Can you please check how is your CPU usage during the playback of that 4k60 video?

No issues here. Not sure if it’s using hardware acceleration?

2 Likes

Tell me how and i will.

2 Likes

Open firefox as you usually do, start the playback of that 4k60 video, change the video resolution to 4k60, open console or any other terminal you prefer, and type htop to observe the CPU usage.

If you don’t have htop, you can install like this: sudo pacman -S htop

My resolution goes to 4k but is 2160

1 Like

Hm, thanks ricklinux, it seems that you are not getting GPU HW acceleration too…
Not sure if this is related to the DE, it seems something between ffmpeg update and Firefox…

MPV works perfectly by the way…

I don’t have any settings to set for Hardware acceleration maybe?

Edit: It plays smooth no problem all the way to the end

Edit2: On Kde you just install and it’s a go! :rofl:

Edit3: No extensions needed!

1 Like

According to arch’s wiki (link posted above), Firefox VA-PI acceleration works with X11 and Wayland.
So, I suppose all you have to do is to set media.ffmpeg.vaapi.enabled to true in user.js, like this user_pref("media.ffmpeg.vaapi.enabled",true);

Or, can change this variable in about:config

1 Like

If it works in KDE, Wayland or X11, it means that the problems I’m facing are with Gnome, most likely gstreamer and derivatives of it.