Disable vertical sync for glxgears

Sometimes you need to check if you are really working on Linux 3D acceleration (other than glxinfo output). This can be done quickly with the glxgears tool. However, FPS is often limited by vertical refresh rate (i.e. 60 frames per second). Thus, the tool becomes more or less useless, since even software rendering can easily produce 60FPS glxgears on modern processors.

It was quite difficult for me to get a quick and easy solution for this, I answer my own question. Hope this saves you some time.

+73
linux 3d glx
Jun 19 '13 at 16:09 on
source share
7 answers

The vblank_mode environment vblank_mode does the trick. Then you should get a few hundred FPS on modern hardware. And now you can compare the results with others.

 $> vblank_mode=0 glxgears 
+101
Jun 19 '13 at 16:09 on
source share

If you are using NVIDIA closed source drivers, you can change the vertical sync mode on the fly using the __GL_SYNC_TO_VBLANK environment __GL_SYNC_TO_VBLANK :

 ~$ __GL_SYNC_TO_VBLANK=1 glxgears Running synchronized to the vertical refresh. The framerate should be approximately the same as the monitor refresh rate. 299 frames in 5.0 seconds = 59.631 FPS ~$ __GL_SYNC_TO_VBLANK=0 glxgears 123259 frames in 5.0 seconds = 24651.678 FPS 

This works for me on Ubuntu 14.04 using the NVIDIA 346.46 drivers.

+60
Mar 29 '15 at 12:45
source share

For Intel Graphics and AMD / ATI Open Source Graphics Drivers

Locate the "Device" section /etc/X11/xorg.conf , which contains one of the following directives:

  • Driver "intel"
  • Driver "radeon"
  • Driver "fglrx"

And add the following line to this section:

 Option "SwapbuffersWait" "false" 

And run the application with the environment variable vblank_mode set to 0 :

 $ vblank_mode=0 glxgears 

For Nvidia Graphics with the Nvidia Proprietary Driver

 $ echo "0/SyncToVBlank=0" >> ~/.nvidia-settings-rc 

The same change can be made in the nvidia-settings GUI by nvidia-settings option in X Screen 0 / OpenGL Settings / Sync to VBlank . Or, if you just want to test the parameter without changing your ~/.nvidia-settings-rc file, you can do something like:

 $ nvidia-settings --load-config-only --assign="SyncToVBlank=0" # disable vertical sync $ glxgears # test it out $ nvidia-settings --load-config-only # restore your original vertical sync setting 
+26
Aug 05 '13 at 15:53
source share

Disabling the Sync to VBlank checkbox in nvidia settings (the "OpenGL Settings" tab) does the trick for me.

+6
Jul 11 '13 at 3:24
source share

I found a solution that works on an Intel card and on an nvidia card using Bumblebee.

<P → export vblank_mode = 0
glxgears
...
optirun glxgears
...
export vblank_mode = 1
+4
Aug 14 '15 at 0:21
source share

Having collected all the other answers together, we present the command line that will work:

 env vblank_mode=0 __GL_SYNC_TO_VBLANK=0 glxgears 

This provides the benefits of working with Mesa and NVidia drivers and does not require any changes to the configuration files.

+3
May 23 '18 at 1:50
source share

For Intel drivers, this method also exists.

Disable Vertical Sync (VSYNC)

The smart driver uses Triple Buffering for vertical synchronization, which provides full performance and avoids the gap. To disable vertical sync (e.g. for benchmarking), use this .drirc in your home directory:

 <device screen="0" driver="dri2"> <application name="Default"> <option name="vblank_mode" value="0"/> </application> </device> 
+2
Nov 28 '13 at 10:12
source share



All Articles