[osg-users] Enabling Vsync gives dramatic increase in latency

Robert Osfield robert.osfield at gmail.com
Thu Apr 16 07:22:01 PDT 2015


Hi Björn,

The driver will be queuing up multiple frames in the FIFO, something it
does to help improve the framerate, but increases frame latency.

We aren't powerless in this though, modern drivers and hardware support
putting fences into the pipeline and waiting on these to be completed on
the GPU.  In the svn/trunk vesion of the OSG you'll find a swap buffers
SyncSwapBuffersCallback implementation that does this for you.  You can
enable this via the env var OSG_SYNC_SWAP_BUFFERS=ON, or --sync on the
command line for examples like osgviewer.

Robert.



On 16 April 2015 at 13:59, Björn Blissing <bjorn.blissing at vti.se> wrote:

> Hi,
>
> I have made some experiments in regards to rendering latency in
> OpenSceneGraph. I have written a small test program which just shows one
> quad. During program execution the quad changes color from black to white
> 20 times. To my computer I have connected a light-to-voltage sensor which
> is attached to my monitor, the monitor is an Eizo LCD running in 60Hz.
>
> The setup allows me to log the time it takes for me to send a frame with
> the new quad color to when the light sensor picks up this change.
>
> The results surprised me a bit:
>
> Running with VSync OFF: min = 6ms, max = 21ms, mean = 14ms
> Running with VSync ON: min = 81ms, max = 96 ms, mean = 91ms
>
> So enabling VSync on my Nvidia card gave a increased latency of 75 ms,
> almost 5 full screen refreshes.
>
> Then I remembered that Robert said something about running OSG single
> threaded would give the lowest latency.
>
> So I set my application to run as single threaded:
>
> VSync ON, OSG single threaded mode: min = 43ms, max =  64ms, mean =  57ms
>
> Still a bit high, almost 3 full screen refreshes.
>
> So I poked around the NVidia settings with help of the Nvidia Inspector,
> which gives detailed control. The lowest latency I have been able to reach
> is with VSync enabled is the following setting combination:
>
> VSync = ON
> Maximum prerendered frames = 1
> Frame rate limiter = 60fps
> Threaded optimization = Off
>
> With these settings I have recorded the following latencies:
>
> Custom settings: min = 17ms, max =  42ms, mean =  30ms
>
> The mean difference between VSync OFF and this custom setting is 16 ms,
> i.e. about 1 screen refresh.
>
> I guess it is hard to push the latency any lower. Or is there any other
> setting which could reduce the latency even further?
>
> Test have been run on a computer with: Windows 7 64bit + Nvidia GTX570
> with driver 347.52 + OSG 3.2.1
>
> Best regards
> Björn
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=63433#63433
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20150416/e3f25c0e/attachment-0003.htm>


More information about the osg-users mailing list