3D hardware acceleration in Linux enhances performance by allowing the GPU to handle graphical processing. This results in smoother animations and higher frame rates in both everyday applications and gaming. Ensuring that 3D acceleration is active can significantly improve system responsiveness and efficiency.

Many Linux distributions automatically enable 3D hardware acceleration if the system's graphics card is compatible. However, support can vary, particularly in virtualized environments such as QEMU, KVM, or VirtualBox. It's essential to verify whether your system is utilizing 3D acceleration, especially if you experience performance issues.

To check if 3D hardware acceleration is enabled, you can use the tools provided by the mesa-utils package. These tools allow you to confirm if your system is effectively using 3D acceleration. Follow the steps below to perform this check.

Steps to verify and test 3D hardware acceleration in Linux:

  1. Open the terminal on your Linux system.
  2. Install the mesa-utils package if it is not already installed.
    $ sudo apt update && sudo apt install --assume-yes mesa-utils # Ubuntu and other Debian derivatives
  3. Run the glxinfo tool to check if direct rendering is enabled.
    $ glxinfo | grep "direct rendering"
    direct rendering: Yes

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

  4. Use the glxgears tool to test the performance of 3D acceleration on your system.
    $ 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.