3D hardware acceleration improves gaming performance by providing higher frames per second (FPS) and smoother animations in everyday applications. It also enhances power efficiency since the GPU processes graphics more effectively.

Most modern Linux distributions automatically enable 3D hardware acceleration for compatible graphics cards. Although Linux drivers typically support a wide range of current graphics cards, some virtual devices within virtualization software like QEMU / KVM and VirtualBox may not be as well-supported.

To determine if 3D acceleration is enabled in Linux, you can use the standard tools glxinfo and glxgears, which are part of the mesa-utils package. While CentOS and SUSE include this package by default, Ubuntu does not.

Steps to verify 3D acceleration in Linux:

  1. Open the terminal.
  2. Install the mesa-utils package for your specific 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 with 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.