Firefox on Linux have suffered by poor WebGL performance for long, long time. It was given by missing general acceleration on Linux as there are always broken gfx drivers on X11, various hacks and different standards, closed source drivers and so on. Long story short – to do gfx acceleration seriously on Linux have been PITA. For instance Chrome (which supports gfx acceleration on Linux/X11) shows long list of active exceptions and workarounds listen at chrome://gpu/ page.
It’s also reason why Firefox never enabled it by default although it also implements gfx acceleration – Mozilla does not have resources to spend too much time on every broken gfx card / driver.
Fortunately situation was changed with Wayland. Working gfx acceleration is a sort of prerequisite to even start a decent Wayland compositor like Mutter or Plasma so when Firefox is launched on Wayland we can pretty much expect working GL environment. Also dmabuf is widely supported by Wayland compositor so we finally have all pieces together to build fully accelerated browser on Linux which is equal to its Windows siblings.
Firefox supports two acceleration modes – WebRender and GL compositor. WebRender is the new one and it’s superior in web content rendering. GL compositor is the former one, less advanced but it’s still faster for some scenarios where bits are heavily shifted from one side to another one – video playback and WebGL.
Both WebRender and GL compositor have implemented dmabuf back end which means textures used by WebRender/GL compositor can be created directly at GPU and shared without copy among compositor / GPU browser processes. Such GPU memory can be in the same time mapped as EGL framebuffer so we can render WebGL frames directly to GPU memory, handle them from webgl process to chrome process and render it as a texture to a web page.
All those pieces are tied together in recent nightly where we finally have full WebGL support on Wayland and it will be shipped as Firefox 75. If you run Fedora/Gnome you can try it by yourself. Just grab latest nightly from Mozilla, enable HW acceleration, set widget.wayland-dmabuf-webgl.enabled to true at about:config, restart browser and open your favorite WebGL application like maps.google.com or WebGL samples.