3D hardware acceleration provides higher FPS (frames per second) in games and smoother animation when using everyday applications. It also gives better power consumption as the GPU can process graphics more efficiently.

Modern Linux distributions enable 3D hardware acceleration by default for supported graphics cards. While Linux driver support for most current graphics cards is excellent, the same could not be said for some virtual devices in some virtualization software such as QEMU / KVM and VirtualBox.

The standard tools for testing if 3D acceleration is enabled in Linux are glxinfo and glxgears. These tools are part of mesa-utils package and are installed by default in CentOS and SUSE but not in Ubuntu.

Steps to verify 3D acceleration in Linux:

  1. Launch terminal.
  2. Install mesa-utils package for your Linux distribution.
    $ sudo apt update && sudo apt install --assume-yes mesa-utils #Ubuntu and other Debian derivatives
  3. Check for direct rendering value in glxinfo.
    $ glxinfo | grep "direct rendering"
    direct rendering: Yes

    The value should be Yes to indicate 3D acceleration is enabled.

  4. Test 3D acceleration using glxgears.
    $ glxgears
    Running synchronized to the vertical refresh.  The framerate should be
    approximately the same as the monitor refresh rate.
    218 frames in 5.0 seconds = 43.545 FPS
    291 frames in 5.0 seconds = 58.012 FPS
    291 frames in 5.0 seconds = 57.831 FPS
    270 frames in 5.0 seconds = 53.988 FPS
    290 frames in 5.0 seconds = 57.817 FPS
    282 frames in 5.0 seconds = 56.078 FPS
    290 frames in 5.0 seconds = 57.989 FPS
    284 frames in 5.0 seconds = 56.620 FPS
    299 frames in 5.0 seconds = 59.733 FPS

    The frame rate will not exceed the screen's refresh rate if vertical sync is enabled. Disable vertical sync by setting vblank_mode (or __GL_SYNC_TO_VBLANK if you're using NVIDIA's proprietary driver) environment variable to 0.

    $ vblank_mode=0 glxgears
Discuss the article:

Comment anonymously. Login not required.