No WebGL on Debian laptop

Firefox 102 on my Purism Librem 13 laptop (running Debian unstable) told me that it does not support WebGL. about:support showed me

WebGL-1-Driver: Renderer
WebGL creation failed:
* WebglAllowWindowsNativeGl:false restricts context creation on this system. ()
* Exhausted GL driver options. (FEATURE_FAILURE_WEBGL_EXHAUSTED_DRIVERS)

I checked glxgears and even that failed, as well as glxinfo:

$ glxgears
Xlib:  extension "GLX" missing on display ":0".
Error: couldn't get an RGB, Double-buffered visual

It turned out that nvidia drivers were installed and were configured to be used:

$ update-alternatives --get-selections|grep glx
glx                            auto     /usr/lib/nvidia
 
$ update-alternatives --list glx
/usr/lib/mesa-diverted
/usr/lib/nvidia
/usr/lib/nvidia/bumblebee

So I removed the nvidia package and rebooted:

$ apt purge glx-alternative-nvidia

glxgears ran fine now! Unfortunately, Firefox still told me that WebGL was not working.

Filtering about:config by webgl showed me why:

gfx.blacklist.webgl.allow-oop.failureid FEATURE_FAILURE_GLXTEST_FAILED
gfx.blacklist.webgl.angle.failureid FEATURE_FAILURE_GLXTEST_FAILED
gfx.blacklist.webgl.msaa.failureid FEATURE_FAILURE_GLXTEST_FAILED
gfx.blacklist.webgl.opengl.failureid FEATURE_FAILURE_GLXTEST_FAILED
gfx.blacklist.webgl2.failureid FEATURE_FAILURE_GLXTEST_FAILED

After deleting those configuration entries and restarting Firefox, get.webgl.org showed me a spinning cube and Your browser supports WebGL.

Written by Christian Weiske.

Comments? Please send an e-mail.