Force-Enable Hardware Acceleration in Firefox on Linux

Before any steps, let’s check if GPU acceleration is already on.

  1. Open about:support in Firefox.
  2. Navigate to Graphics section.
  3. Check the GPU Accelerated Windows field.

If it’s 1/1 or 1/2 or 2/2 or whatever, anyway, the first number must be greater than 0, then Firefox is already hardware accelerated. And you don’t need to take following procedures to force-enable it. Otherwise, let’s do a few modifications to force-enable the GPU acceleration in Firefox!

  1. Open about:config in Firefox.
  2. Set webgl.force-enabled to true. This will force-enable WebGL for us.
  3. Set layers.acceleration.force-enabled to true. This will force-enable Layers Acceleration.
  4. Set layers.offmainthreadcomposition.enabled to true. This will enable Off Main Thread Composition (OMTC), which should contributes to a faster and smoother composition.

If you want to enable more testing OMTC features, you could set layers.offmainthreadcomposition.async-animations to true as well. Other properties such as layers.async-video.enabled should already be true by default now. Therefore, you don’t need to mess with other values.

Another trivial yet important step is to set an environment variable. Before we set it for entire system, let’s check if Firefox can behave well with force-enabled GPU acceleration.

  1. Close all firefox processes.
  2. Run export MOZ_USE_OMTC=1 && firefox in terminal.

Now go to about:support to check if GPU acceleration is turned on. And test if Firefox still function well without glitches. In my case, the GPU Accelerated Windows field shows 1/1 OpenGL (OMTC).

If you’re satisfied with the result, let’s set this environment variable globally. Create a new file /etc/X11/xinit/xinitrc.d/ (you need root privilege) and fill in this file with following lines.

#force GPU acceleration for firefox
export MOZ_USE_OMTC=1

Now reboot your system, run Firefox as usual, i.e. from Application Launcher. Enjoy hardware accelerated Firefox!

P.S. I use Fedora as my Linux distribution, other distributions might have different init mechanism. In that case, you may need to put file in a different location.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s