VSync of OpenGL Animations on Headless Server

Hi All,

I am trying to run an OpenGL ES Application on an G2 instance in headless mode which has Nvidia GPU, after a lot of struggle I managed to get the application harness the power of GPU. Now the only problem which I am not able to solve is screen tearing, the same application is running properly on a local machine which has monitor and a different nvidia card.

After following lot of forums I have tweaked the X config file, of which I am posting the sections Moitor, Device and Screen below

[i]Section “Monitor”
Identifier “Headless”
HorizSync 80.0 - 80.0
VertRefresh 75.0
Modeline “1280x1024_75.00” 138.45 1280 1368 1504 1728 1024 1025 1028 1069 -Hsync +Vsync
Option “RegistryDwords” “PerfLevelSrc=0x2222”
EndSection

Section “Device”
Identifier “Card0”
Driver “nvidia”
Option “AllowEmptyInitialConfiguration” “true”
Option “TripleBuffer” “True”
BusID “PCI:0:3:0”
EndSection

Section “Screen”
Identifier “Screen0”
Device “Card0”
Monitor “Headless”
DefaultDepth 24
#Option “UseDisplayDevice” “none”
SubSection “Display”
Viewport 0 0
Virtual 1280 1024
Depth 1
EndSubSection
SubSection “Display”
Viewport 0 0
Virtual 1280 1024
Depth 4
EndSubSection
SubSection “Display”
Viewport 0 0
Virtual 1280 1024
Depth 8
EndSubSection
SubSection “Display”
Viewport 0 0
Virtual 1280 1024
Depth 15
EndSubSection
SubSection “Display”
Viewport 0 0
Virtual 1280 1024
Depth 16
EndSubSection
SubSection “Display”
Viewport 0 0
Virtual 1280 1024
Depth 24
EndSubSection
EndSection[/i]

Initially I was using the option “UseDisplayDevice” “none” for which I later get to know that it has the limitation of OpenGL SyncToVBlank will have no effect. Later I come across the option “AllowEmptyInitialConfiguration” “true” which made it possible to run the X server without having a display, post which I have enabled SyncToVBlank and made sure it is enabled properly by checking “nvidia-settings --query=SyncToVBlank --verbose”. Even after enabling the SyncToVBlank the application is giving me too many frames because of which I could see tearing of the output.

Please find the glxgears output after enabling the SyncToVBlank(Please note I am only providing the glxgears for refernence, the actual application is also giving me more frames per second)

glxgears
111926 frames in 5.0 seconds = 22385.037 FPS
112619 frames in 5.0 seconds = 22523.715 FPS

Please help me if I am missing any thing to configure properly and make the headless server gives synchronized output whithout any screen tearing. Thanks in advance.