How to force CPU Rendering on Linux with Firefox with Wayland

612 Views Asked by At

I am experimenting with Firefox 109.01 on a small embedded Linux 5.15 board with no GPU. The device has a small display and I can successfully render to it with Weston 11.

I have Chromium running on the board and drawing to the display with weston. Chromium has runtime flags to disable the gpu ( --disable-gpu ) and therefore not attempt to use opengl.

With Firefox, I cannot find a runtime option to disable trying to use the GPU or software GL ( mesa ) rendering. Firefox starts and immediately complains about not finding a GPU. It does, however, eventually render to the display, using Wayland. However, it is very slow compared to Chromium, and I think it may be using mesa under the hood, causing it to severly slow down. I tried to set some documented preferences in the 'user.js' file, but they did not help.

How can I disable any attempts by firefox to use OpenGL and/or GPU acceleration?

Errors:

Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: cannot access /sys/bus/pci (t=22.3929) [GFX1-]: glxtest: cannot access /sys/bus/pci
Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: cannot access /sys/bus/pci (t=22.3929) |[1][GFX1-]: glxtest: libEGL initialize failed (t=22.4033) [GFX1-]: glxtest: libEGL initialize failed
Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: cannot access /sys/bus/pci (t=22.3929) |[1][GFX1-]: glxtest: libEGL initialize failed (t=22.4033) |[2][GFX1-]: glxtest: EGL test failed (t=22.4039) [GFX1-]: glxtest: EGL test failed
Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: cannot access /sys/bus/pci (t=22.3929) |[1][GFX1-]: glxtest: libEGL initialize failed (t=22.4033) |[2][GFX1-]: glxtest: EGL test failed (t=22.4039) |[3][GFX1-]: No GPUs detected via PCI (t=22.405) [GFX1-]: No GPUs detected via PCI

Attempted preferences:

/usr/lib/firefox/browser/defaults/preferences/user.js
user_pref("dom.ipc.processCount", 1);
user_pref("gfx.webrender.software", true);
user_pref("browser.cache.disk.parent_directory", "/tmp");
user_pref("extensions.pocket.enabled", false);
user_pref("security.ssl.enable_ocsp_stapling", false);
user_pref("gfx.webrender.force-disabled", true);
user_pref("layers.acceleration.disabled", true);
user_pref("gfx.webrender.force-disabled", true);
user_pref("layers.acceleration.force-disabled", true);

Container Dockerfile:

FROM arm32v7/alpine:latest

RUN apk update && apk add weston weston-shell-desktop \
                    weston-backend-drm eudev libinput weston-terminal firefox

CMD [ "/sbin/init" ]

Running Firefox:

export XDG_RUNTIME_DIR=/tmp
export WAYLAND_DISPLAY=wayland-1
export WAYLAND_DEBUG=1
export GDK_BACKEND=wayland
export MOZ_ENABLE_WAYLAND=1
export MOZ_ACCELERATED=0
export MOZ_WEBRENDER=0
docker run -e XDG_RUNTIME_DIR=/tmp -e WAYLAND_DISPLAY=$WAYLAND_DISPLAY -v $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY:/tmp/$WAYLAND_DISPLAY --user=$(id -u):$(id -g) --net=host weston:latest firefox --kiosk --private-window https://10.88.0.1:743
0

There are 0 best solutions below