Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable vertical sync for glxgears

Tags:

linux

3d

glx

Sometimes you need to check whether you Linux 3D acceleration is really working (besides the glxinfo output). This can be quickly done by the glxgears tool. However, the FPS are often limited to the displays vertical refresh rate (i.e. 60 fps). So the tool becomes more or less useless since even a software render can produce 60FPS glxgears easily on modern CPUs.

I found it rather hard to get a quick and easy solution for this, I answer my own question. Hopefully it saves your time.

like image 375
mschmoock Avatar asked Jun 19 '13 16:06

mschmoock


2 Answers

The vblank_mode environment variable does the trick. You should then get several hundreds FPS on modern hardware. And you are now able to compare the results with others.

$>   vblank_mode=0 glxgears 
like image 109
mschmoock Avatar answered Sep 28 '22 10:09

mschmoock


If you're using the NVIDIA closed-source drivers you can vary the vertical sync mode on the fly using the __GL_SYNC_TO_VBLANK environment variable:

~$ __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 346.46 NVIDIA drivers.

like image 29
ali_m Avatar answered Sep 28 '22 08:09

ali_m