Enabling/Disabling Vsync (Jetson TX1)

Hi!

I have a Jetson TX1 Developer Kit with L4T installed, and would like to display some patterns with OpenGL (with fix fps without tearing). I want to enable Vsync in software, but as far as I know, there is no GLX_EXT_swap_control extension support for Tegra X1 so I can’t use OpenGL commands like glXSwapIntervalEXT to set the Vsync option. There is no nvidia-settings command/app for L4T neither, as I know.
I think the default value of Vsync must be OFF, because executing glxgears returns framerate over 2000fps.
Could someone help me, how I can enable/disable Vsync?

Thanks in advance,

BlaBla019

Hi blabla019,

Sorry for the late response.

On TX1 that sync to vblank can be enabled/disabled using following options –

  1. Command line argument __GL_SYNC_TO_VBLANK=1 / __GL_SYNC_TO_VBLANK=0
  2. Using nvidia-settings from another machine as described in https://devtalk.nvidia.com/default/topic/759888/-jetson-tk1-vertical-sync-and-triple-buffering/?offset=7#4608645

Sync to vblank is enabled by default. This can be verified using “glxgears –fullscreen”, which should show ~60fps.

Thanks

Hi!

Thanks for your reply!
I haven’t got a chance yet to try the second option from another machine, but command line argument and fullscreen mode doesn’t work:

ubuntu@tegra-ubuntu:~$ export __GL_SYNC_TO_VBLANK=1; glxgears -fullscreen
5182 frames in 5.0 seconds = 1036.183 FPS
5238 frames in 5.0 seconds = 1047.534 FPS
5240 frames in 5.0 seconds = 1047.940 FPS

Hi blabla019,

It’s a bit wire that Command line argument can’t work well in your environment.
How’s about the 2nd option - using nvidia-settings from another machine?
Do you have chance to get it a try?

Thanks

Hi blabla019,

I think tha you are not seeing ~60fps (sync to vblank) because you’re running glxgear under compiz.
This may be related to old bug (not related to nvidia) - https://bugs.launchpad.net/compiz-core/+bug/985369 . “glxgears –fullscreen” should show ~60fps if run without compositor.

Thanks

Hi!

Thank you for your help!
I haven’t tried “glxgears –fullscreen”compiz, but tried the second option (using nvidia-settings from another machine), and managed to enable/disable VSYNC. I have tested ON/OFF VSYNC in my OpenGl application, and works perfectly as expected.

Thanks again!

Hi Kayccc,

How about enable VSYNC if we start the Xserver manually, just run X & or xinit & instead of running Ubuntu’s session? Thank you.

Kevin

Hi usaarizona,

Both the methods from my previous post should also work with bare X11.

Please get it a try.

Thanks

Hi Kayccc,

We tried the first commandline method, export __GL_SYNC_TO_VBLANK=1 before enabling X server, and then run our full screen opengl application, we still can notice a lot tearing when playing video, this won’t be seen if we using Ubuntu-session even without setting __GL_SYNC_TO_VBLANK=1, any clue? Thank you

Kevin

Hi usaarizona

Could you share application with which tearing is observed (or share a simplified version demonstrating tearing) ?
Do you see tearing / fps which is not 60 with gears ?

We don’t see any reason why exporting __GL_SYNC_TO_VBLANK=1 before starting Xserver will not work.

Thanks

Hi Kayccc,

It is just a simple openGL program based on freeglut, we use double buffer when init freeglut, yes, we can control the SYNC_TO_VSYNC on and off using __GL_SYNC_TO_VBLANK=1/0 when in Ubuntu session, I notice tearing when set __GL_SYNC_TO_VBLANK to 0, and tearing is gone when set to 1, but this is true only when I run the program in the Ubuntu, if I start the X server using X & or xinit instead, then __GL_SYNC_TO_VBLANK seems no affect to the tearing program, I always see the tearing, is there any trick step I need to follow when run bare X server to enable V-SYNC? Thank you.

Kevin

Hi Kayccc,

Also, I can not find nvidia-settings in TX1, could you explain how to use both in Ubuntu-session and bare X, thank you.

Kevin

Hi Kayccc,

Updates, we ran “glxgears” full screen in bare X, and it seems we can control the frame rate to sync with V-sync of monitor by setting __GL_SYNC_TO_VBLANK=1/0, but it seems that glut’s “glutSwapBuffers” can not successfully sync to V blanking in bear X, we are still under investigating, thank you.

Kevin