Enable Firefox hardware acceleration on Linux

Despite its past, Mozilla Firefox browser is now as fast and agile as its rival Google Chrome, but there is one aspect where the open source browser still loses a few points: the GPU hardware acceleration support on GNU/Linux. With this guide we will see how to enable Firefox hardware acceleration on Linux and therefore improving its performances.
The guide has been tested on Ubuntu LTS 14:04 with the proprietary NVIDIA drivers and Mozilla Firefox 34.0, but it should be valid for all distribution of Linux and newer versions of Mozilla Firefox.

Before enabling the hardware acceleration of Mozilla Firefox we have to first check that it isn’t doing it already. Type “about:support” in the address bar and check the value of “GPU Accelerated Windows“: if it is set to “0/1 Basic” it means that the hardware acceleration is not enabled on your copy of Mozilla Firefox.
Enable Firefox hardware acceleration on Linux - part 01
To enable Firefox hardware acceleration on Linux, go to “Firefox Preferences > Advanced > General” and enable “Use hardware acceleration when available
Enable Firefox hardware acceleration on Linux - part 02
Then, back to the main window of Mozilla Firefox, write “about:config” on the address bar and change the following two keys to “True
layers.acceleration.force-enabled
layers.offmainthreadcomposition.enabled

Enable Firefox hardware acceleration on Linux - part 03
Close Mozilla Firefox, open a terminal and type the following command:
sudo bash -c "echo export MOZ_USE_OMTC = 1 >> /etc/X11/Xsession.d/90environment"
And then reboot your computer to apply the above the changes.
After the reboot, reopen Mozilla Firefox and return to “about:support“; now “GPU Accelerated Windows” should be set to “1/1 OpenGL (OMTC)
Enable Firefox hardware acceleration on Linux - part 04
If it went well, you should notice a decreased load on the CPU (since part of the computation is outsourced to the GPU) and a decreased consumption of RAM.