Firefox fork floorp hardware video decode seems to not be working with the flatpak

Which Linux distro are you using?
arch

Which release version?
2024-09-22

Which kernel are you using?
6.10.10-arch1-1

Which BIOS version are you using?
03.05

Which Framework Laptop 13 model are you using?
AMD Ryzen™ 7040 Series

im using the floorp flatpak and with vaapi enabled when watching a 720p youtube video the power usage is ~15-19w but,
with mpv with the same video downloaded via yt-dlp using vaapi power usage is about ~9.2w

  • i’ve tried using enhanced-h264ify to disable av1 vp9 vp8, but power usage never gets near mpv
  • i’ve enabled media.ffmpeg.vaapi.enabled and gfx.webrender.all
> pacman -Q | grep libva
libva 2.22.0-1
libva-mesa-driver 1:24.2.3-1
libva-utils 2.22.0-1

running with MOZ_LOG=“FFmpegVideo:5” give:

console.warn: "CSK Init Completed"
Missing chrome or resource URL: chrome://floorp/skin/designs/lepton/edit-active.svg
console.error: ({})
console.log: ({initialized:true})
console.log: false
JavaScript error: moz-extension://582feedb-719e-4d2b-b38d-59565952514f/background.js, line 1: TypeError: null has no properties
JavaScript error: , line 0: uncaught exception: Object
console.log: "blob:null/1828eec4-ec6f-4b53-bcc6-07eb07bc2c93"
console.log: "blob:null/9a2fbd31-21fe-438c-bfa9-7f4a5fd1e4af"
console.log: "blob:null/2bf92eab-a340-4504-b71f-2f2066c023bf"
libva info: VA-API version 1.22.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_22
Failed to create /home/irlname/.var/app/one.ablaze.floorp/cache for shader cache (Permission denied)---disabling.
libva info: va_openDriver() returns 0
Failed to create /home/irlname/.var/app/one.ablaze.floorp/cache for shader cache (Permission denied)---disabling.
Failed to create /home/irlname/.var/app/one.ablaze.floorp/cache for shader cache (Permission denied)---disabling.
Failed to create /home/irlname/.var/app/one.ablaze.floorp/cache for shader cache (Permission denied)---disabling.
Failed to create /home/irlname/.var/app/one.ablaze.floorp/cache for shader cache (Permission denied)---disabling.
Failed to create /home/irlname/.var/app/one.ablaze.floorp/cache for shader cache (Permission denied)---disabling.
Failed to create /home/irlname/.var/app/one.ablaze.floorp/cache for shader cache (Permission denied)---disabling.
Failed to create /home/irlname/.var/app/one.ablaze.floorp/cache for shader cache (Permission denied)---disabling.
Failed to create /home/irlname/.var/app/one.ablaze.floorp/cache for shader cache (Permission denied)---disabling.
Failed to create /home/irlname/.var/app/one.ablaze.floorp/cache for shader cache (Permission denied)---disabling.
Failed to create /home/irlname/.var/app/one.ablaze.floorp/cache for shader cache (Permission denied)---disabling.
Failed to create /home/irlname/.var/app/one.ablaze.floorp/cache for shader cache (Permission denied)---disabling.
[Child 269, MediaDecoderStateMachine #1] WARNING: 7fc5419d9ca0 OpenCubeb() failed to init cubeb: file /home/runner/work/Floorp/Floorp/dom/media/AudioStream.cpp:285

im not sure if vaapi is working from these logs
i don’t know why it’s failing to create the cache folder
there seems to be some libva stuff here but power usage it still very high compared to mpv

  1. Check about:support
  2. Make sure hardware decoding and vaapi is force enabled if blocklisted
  3. Install Firefox and compare
  4. Use amdgpu_top and check for media usage

@parawizard checking mpv again it seems vaapi also isn’t working for some reason it’s just more efficient in cpu i guess.
i checked using amdgpu_top for media usage and neither floorp or mpv said more then 0%

> mpv --hwdec=vaapi ~/video.webm
 (+) Video --vid=1 (*) (vp9 1280x720 6.000fps)
 (+) Audio --aid=1 --alang=eng (*) (opus 2ch 48000Hz)
[vo/gpu/drm] VT_GETMODE failed: Inappropriate ioctl for device
[vo/gpu/drm] Failed to set up VT switcher. Terminal switching will be unavailable.
_amdgpu_device_initialize: amdgpu_query_info(ACCEL_WORKING) failed (-13)
amdgpu: amdgpu_device_initialize failed.
[vo/gpu/opengl] Failed to get EGL display.
[vo/gpu] Failed to setup EGL.
[vo/gpu] Failed to commit atomic request: No such file or directory
[vo/gpu-next/drm] Can't handle VT release - signal already used
[vo/gpu-next/drm] Failed to set up VT switcher. Terminal switching will be unavailable.
_amdgpu_device_initialize: amdgpu_query_info(ACCEL_WORKING) failed (-13)
amdgpu: amdgpu_device_initialize failed.
[vo/gpu-next/opengl] Failed to get EGL display.
[vo/gpu-next] Failed to setup EGL.
[vo/gpu-next] Failed to commit atomic request: No such file or directory
Failed to open VDPAU backend libvdpau_nvidia.so: cannot open shared object file: No such file or directory
[vo/vdpau] Error when calling vdp_device_create_x11: 1
ALSA lib dlmisc.c:339:(snd_dlobj_cache_get0) Cannot open shared library libasound_module_pcm_pipewire.so (/nix/store/hh9gibhh5xd6i80vvs66aky3r3wkvyfj-alsa-lib-1.2.11/lib/alsa-lib/libasound_module_pcm_pipewire.so: cannot open shared object file: No such file or directory)
[ao/alsa] Playback open error: No such device or address
[ALSOFT] (EE) Failed to connect PipeWire event context (errno: 112)
ALSA lib dlmisc.c:339:(snd_dlobj_cache_get0) Cannot open shared library libasound_module_pcm_pipewire.so (/nix/store/hh9gibhh5xd6i80vvs66aky3r3wkvyfj-alsa-lib-1.2.11/lib/alsa-lib/libasound_module_pcm_pipewire.so: cannot open shared object file: No such file or directory)
[ao/openal] could not open device
ALSA lib dlmisc.c:339:(snd_dlobj_cache_get0) Cannot open shared library libasound_module_pcm_pipewire.so (/nix/store/hh9gibhh5xd6i80vvs66aky3r3wkvyfj-alsa-lib-1.2.11/lib/alsa-lib/libasound_module_pcm_pipewire.so: cannot open shared object file: No such file or directory)
[ao/sdl] could not open audio: ALSA: Couldn't open audio device: No such device or address
[ao] Failed to initialize audio driver 'sdl'
Could not open/initialize audio device -> no sound.
Audio: no audio
VO: [wlshm] 1280x720 yuv420p
V: 00:00:57 / 24:00:01 (0%)

What does vainfo tell you?

@parawizard

> vainfo
Trying display: wayland
vainfo: VA-API version: 1.22 (libva 2.22.0)
vainfo: Driver version: Mesa Gallium driver 24.2.3-arch1.1 for AMD Radeon 780M (radeonsi, gfx1103_r1, LLVM 18.1.8, DRM 3.57, 6.10.10-arch1-1)
vainfo: Supported profile and entrypoints
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointEncSlice
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointEncSlice
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointVLD
      VAProfileAV1Profile0            : VAEntrypointVLD
      VAProfileAV1Profile0            : VAEntrypointEncSlice
      VAProfileNone                   : VAEntrypointVideoProc

im using the floorp flatpak and with vaapi enabled […]

Can confirm on Gentoo that this problem happens by default. This is because the flatpak by default lacks dri permissions . EDIT: It seems it tries to enable all device access, but still requires manual intervention. Frankly, I’ve no idea why.

This can be fixed by giving it permission with this command:
flatpak --user override --device=dri one.ablaze.floorp

checking mpv again it seems vaapi also isn’t working for some reason

Looking at your mpv output, it’s using the wlshm video output. According to the manual it explicitly does not use hardware acceleration, which explains why vaapi isn’t working, and is used as a fallback.

A few questions:

  • Are you also running mpv in a container like flatpak, or the native Arch package?
  • Do you have working graphics drivers?
    • What’s the output of eglinfo -B? (from mesa-utils Arch package)
    • What’s the output of ls -l /dev/dri?
    • And if your card (presumably /dev/dri/card0) belongs to the video group, is your user in this group? (usermod -aG video irlname and then relog)

Sidenote/question: did you switch to nixos for mpv?

@andyg i can’t add my user to video because my user is a freeipa user not a local user but i made a script and udev rule that seems to add rw acls (at the end of this reply btw).

looking again at mpv prompted by your question about nixos i found mpv for some reason in the packages i install via nix package manager in my ansible playbook for all my linux stuff despite also being installed natively in arch, debian, and almalinux. i don’t know why i put it there.

testing without the nix package manager version and mpv --hwdec=vaapi --vo=gpu ~/video.webm hardware decoding is working. edit: with amdgpu_top it still says 0% media even though mpv says: Using hardware decoding (vaapi)., i don’t know if amdgpu_top is correct or not.

even after flatpak --user override --device=dri one.ablaze.floorp and restarting it’s still using a lot of power, is there a good way to tell if it’s detecting support for vaapi?

there is no card0

> getfacl /dev/dri/card1
getfacl: Removing leading '/' from absolute path names
# file: dev/dri/card1
# owner: root
# group: video
user::rw-
user:irlname:rw-
group::rw-
group:root:rw-
group:video:rw-
group:video_freeipa:rw-
mask::rw-
other::---

eglinfo -B:

> eglinfo -B
_amdgpu_device_initialize: amdgpu_query_info(ACCEL_WORKING) failed (-13)
amdgpu: amdgpu_device_initialize failed.
GBM platform:
EGL API version: 1.5
EGL vendor string: Mesa Project
EGL version string: 1.5
EGL client APIs: OpenGL OpenGL_ES
OpenGL core profile vendor: Mesa
OpenGL core profile renderer: llvmpipe (LLVM 18.1.8, 256 bits)
OpenGL core profile version: 4.5 (Core Profile) Mesa 24.2.3-arch1.1
OpenGL core profile shading language version: 4.50
OpenGL compatibility profile vendor: Mesa
OpenGL compatibility profile renderer: llvmpipe (LLVM 18.1.8, 256 bits)
OpenGL compatibility profile version: 4.5 (Compatibility Profile) Mesa 24.2.3-arch1.1
OpenGL compatibility profile shading language version: 4.50
OpenGL ES profile vendor: Mesa
OpenGL ES profile renderer: llvmpipe (LLVM 18.1.8, 256 bits)
OpenGL ES profile version: OpenGL ES 3.2 Mesa 24.2.3-arch1.1
OpenGL ES profile shading language version: OpenGL ES GLSL ES 3.20

Wayland platform:
EGL API version: 1.5
EGL vendor string: Mesa Project
EGL version string: 1.5
EGL client APIs: OpenGL OpenGL_ES
OpenGL core profile vendor: AMD
OpenGL core profile renderer: AMD Radeon 780M (radeonsi, gfx1103_r1, LLVM 18.1.8, DRM 3.57, 6.10.10-arch1-1)
OpenGL core profile version: 4.6 (Core Profile) Mesa 24.2.3-arch1.1
OpenGL core profile shading language version: 4.60
OpenGL compatibility profile vendor: AMD
OpenGL compatibility profile renderer: AMD Radeon 780M (radeonsi, gfx1103_r1, LLVM 18.1.8, DRM 3.57, 6.10.10-arch1-1)
OpenGL compatibility profile version: 4.6 (Compatibility Profile) Mesa 24.2.3-arch1.1
OpenGL compatibility profile shading language version: 4.60
OpenGL ES profile vendor: AMD
OpenGL ES profile renderer: AMD Radeon 780M (radeonsi, gfx1103_r1, LLVM 18.1.8, DRM 3.57, 6.10.10-arch1-1)
OpenGL ES profile version: OpenGL ES 3.2 Mesa 24.2.3-arch1.1
OpenGL ES profile shading language version: OpenGL ES GLSL ES 3.20

X11 platform:
EGL API version: 1.5
EGL vendor string: Mesa Project
EGL version string: 1.5
EGL client APIs: OpenGL OpenGL_ES
OpenGL core profile vendor: AMD
OpenGL core profile renderer: AMD Radeon 780M (radeonsi, gfx1103_r1, LLVM 18.1.8, DRM 3.57, 6.10.10-arch1-1)
OpenGL core profile version: 4.6 (Core Profile) Mesa 24.2.3-arch1.1
OpenGL core profile shading language version: 4.60
OpenGL compatibility profile vendor: AMD
OpenGL compatibility profile renderer: AMD Radeon 780M (radeonsi, gfx1103_r1, LLVM 18.1.8, DRM 3.57, 6.10.10-arch1-1)
OpenGL compatibility profile version: 4.6 (Compatibility Profile) Mesa 24.2.3-arch1.1
OpenGL compatibility profile shading language version: 4.60
OpenGL ES profile vendor: AMD
OpenGL ES profile renderer: AMD Radeon 780M (radeonsi, gfx1103_r1, LLVM 18.1.8, DRM 3.57, 6.10.10-arch1-1)
OpenGL ES profile version: OpenGL ES 3.2 Mesa 24.2.3-arch1.1
OpenGL ES profile shading language version: OpenGL ES GLSL ES 3.20

Surfaceless platform:
EGL API version: 1.5
EGL vendor string: Mesa Project
EGL version string: 1.5
EGL client APIs: OpenGL OpenGL_ES
OpenGL core profile vendor: AMD
OpenGL core profile renderer: AMD Radeon 780M (radeonsi, gfx1103_r1, LLVM 18.1.8, DRM 3.57, 6.10.10-arch1-1)
OpenGL core profile version: 4.6 (Core Profile) Mesa 24.2.3-arch1.1
OpenGL core profile shading language version: 4.60
OpenGL compatibility profile vendor: AMD
OpenGL compatibility profile renderer: AMD Radeon 780M (radeonsi, gfx1103_r1, LLVM 18.1.8, DRM 3.57, 6.10.10-arch1-1)
OpenGL compatibility profile version: 4.6 (Compatibility Profile) Mesa 24.2.3-arch1.1
OpenGL compatibility profile shading language version: 4.60
OpenGL ES profile vendor: AMD
OpenGL ES profile renderer: AMD Radeon 780M (radeonsi, gfx1103_r1, LLVM 18.1.8, DRM 3.57, 6.10.10-arch1-1)
OpenGL ES profile version: OpenGL ES 3.2 Mesa 24.2.3-arch1.1
OpenGL ES profile shading language version: OpenGL ES GLSL ES 3.20

Device platform:
Device #0:

Platform Device platform:
EGL API version: 1.5
EGL vendor string: Mesa Project
EGL version string: 1.5
EGL client APIs: OpenGL OpenGL_ES
OpenGL core profile vendor: AMD
OpenGL core profile renderer: AMD Radeon 780M (radeonsi, gfx1103_r1, LLVM 18.1.8, DRM 3.57, 6.10.10-arch1-1)
OpenGL core profile version: 4.6 (Core Profile) Mesa 24.2.3-arch1.1
OpenGL core profile shading language version: 4.60
OpenGL compatibility profile vendor: AMD
OpenGL compatibility profile renderer: AMD Radeon 780M (radeonsi, gfx1103_r1, LLVM 18.1.8, DRM 3.57, 6.10.10-arch1-1)
OpenGL compatibility profile version: 4.6 (Compatibility Profile) Mesa 24.2.3-arch1.1
OpenGL compatibility profile shading language version: 4.60
OpenGL ES profile vendor: AMD
OpenGL ES profile renderer: AMD Radeon 780M (radeonsi, gfx1103_r1, LLVM 18.1.8, DRM 3.57, 6.10.10-arch1-1)
OpenGL ES profile version: OpenGL ES 3.2 Mesa 24.2.3-arch1.1
OpenGL ES profile shading language version: OpenGL ES GLSL ES 3.20

Device #1:

Platform Device platform:
EGL API version: 1.5
EGL vendor string: Mesa Project
EGL version string: 1.5
EGL client APIs: OpenGL OpenGL_ES
OpenGL core profile vendor: Mesa
OpenGL core profile renderer: llvmpipe (LLVM 18.1.8, 256 bits)
OpenGL core profile version: 4.5 (Core Profile) Mesa 24.2.3-arch1.1
OpenGL core profile shading language version: 4.50
OpenGL compatibility profile vendor: Mesa
OpenGL compatibility profile renderer: llvmpipe (LLVM 18.1.8, 256 bits)
OpenGL compatibility profile version: 4.5 (Compatibility Profile) Mesa 24.2.3-arch1.1
OpenGL compatibility profile shading language version: 4.50
OpenGL ES profile vendor: Mesa
OpenGL ES profile renderer: llvmpipe (LLVM 18.1.8, 256 bits)
OpenGL ES profile version: OpenGL ES 3.2 Mesa 24.2.3-arch1.1
OpenGL ES profile shading language version: OpenGL ES GLSL ES 3.20

udev acl stuff here (this seems kinda janky so let me know if you have a better way):

/etc/udev/rules.d/99-video.rules:

SUBSYSTEM=="drm", KERNEL=="card*", RUN+="/usr/local/sbin/set_video_udev_acls.sh %k"

/usr/local/sbin/set_video_udev_acls.sh:

#!/bin/bash

DEVICE="/dev/dri/$1"
groups=("video" "video_freeipa")  # List of groups to set ACL for

for i in "${!groups[@]}"; do
	group="${groups[$i]}"
	if [ -e "$DEVICE" ]; then
		setfacl -m g:$group:rw $DEVICE
	fi
done

looking again at about:config
i found this:
flrp_hwdecinfo.webp

eglinfo -B:
[…]
i found this: […]

Looks like all’s good regarding the video driver then.

is there a good way to tell if it’s detecting support for vaapi?

Other than the table in about:support#media, which looks good, you can see it being used with the tool amdgpu_top you mentioned. See the VCN usage for RDD Process:

@andyg i looked at the media section look above your post.

there doesn’t seem to be any VCN usage for RDD Process
amdgpu top

I’m starting to think that amdgpu_top’s activity and fdinfo panels aren’t reporting correctly considering there is 0% GFX usage in the fdinfo table, and you said for mpv:

with amdgpu_top it still says 0% media even though mpv says: Using hardware decoding (vaapi)., i don’t know if amdgpu_top is correct or not.

But it is possible that hardware-accelerated decoding failed after mpv began trying to play video with vaapi (though I’d imagine it’d spew an error if it did), and it would fallback to software decoding.
Try playing a video with mpv and press I. It’ll display information on the screen. There should be a line Video: <codec> HW: <hwdec>, where <hwdec> is vaapi. If not, then it failed at some point. Otherwise, amdgpu_tool is reporting wrong. Hopefully that gives you confidence.

I could also ask: do you see lower CPU usage for the browser when decoding “heavy” (VP9/AV1 4k60fps) video with media.ffmpeg.vaapi.enabled set to true as opposed to false?

Maybe worth opening an issue on amdgpu_top’s GitHub if it’s reporting wrong on your system.

Do you have native firefox available? amdgpu_top shows correctly for me using that. I would try some more apps