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

2015-05-13 Thread Björn Blissing
Jan Ciger wrote: Did you try to call glFlush() at the end of the each frame in your OpenGL application? That should force the driver to not buffer but to actually hold your program until the vsync event. Right now you are rendering much faster than the GPU can scan out, so your program

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

2015-05-12 Thread Björn Blissing
Hi again, I repeated my measurements with a pure OpenGL application and compared them to the previously recorded data from OSG: OpenGL + Nvidia Defaults + Vsync On Min: 56.7 Max: 65.0 Avg: 60.8 OpenGL + Nvidia Defaults + Vsync Off Min: 2.9 Max: 25.0 Avg: 14.6 OSG 3.2.1 + Nvidia Defaults + VSync

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

2015-05-12 Thread Jan Ciger
Hello Björn, On Tue, May 12, 2015 at 4:20 PM, Björn Blissing bjorn.bliss...@vti.se wrote: Hi again, I repeated my measurements with a pure OpenGL application and compared them to the previously recorded data from OSG: OpenGL + Nvidia Defaults + Vsync On Min: 56.7 Max: 65.0 Avg: 60.8

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

2015-04-27 Thread Jan Ciger
On Mon, Apr 27, 2015 at 3:20 PM, Björn Blissing bjorn.bliss...@vti.se wrote: Well, this is pretty much exactly my method. But instead of an oscilloscope I sample the signal with a A/D capture card at 10KHz. Here is the promised data about the Oculus Rift DK1 DK2: Oculus Rift DK1 + Vsync

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

2015-04-27 Thread Björn Blissing
d_a_heitbrink wrote: What we did for our test was trigger a A/D deviceto I think a go from 0 to 5v, and a we added a line in our fragment shader to over ride the color and set it to white, or black depending on a value of a uniform. We change the Uniform to 1 (to set it to white) and

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

2015-04-27 Thread Björn Blissing
Some minor notes about the latest numbers. First of all, the Oculus units were used as pure screens, i.e. no lens distortion shaders. For DK2 this means running the unit in extended mode. (To be able to run via Direct Mode I would have to modify my test program to use the Oculus SDK.)

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

2015-04-20 Thread Jan Ciger
On Mon, Apr 20, 2015 at 1:28 AM, David Heitbrink david-heitbr...@uiowa.edu wrote: If I remember from my conversations with people at NVidia, the least amount of latency you can get is 2-3 frames I cannot remember the exact number. If you select the additional per-rendered frames, this will

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

2015-04-19 Thread Jan Ciger
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 04/18/2015 04:30 PM, Björn Blissing wrote: Although very interesting, this discussion regarding minimum latency is a bit of a tangent from my initial questions. Rendering with VSync Off is not normally what you do in a production environment.

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

2015-04-19 Thread David Heitbrink
If I remember from my conversations with people at NVidia, the least amount of latency you can get is 2-3 frames I cannot remember the exact number. If you select the additional per-rendered frames, this will increase this. Also remember your display will also add some additional latency as

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

2015-04-19 Thread Björn Blissing
Jan Ciger wrote: Depends on what you define as production environment. Consumer GPUs have drivers optimized for games and there it is a common (and default) setting to have vsync off for the sake of the highest frame rate and lowest latencies. It is also a frequent recommendation to turn

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

2015-04-18 Thread Björn Blissing
Jan Ciger wrote: I find these techniques to be really fragile kludges and not really worth the effort most of the time - the saved 16ms of latency is imperceptible for the most people and most LCDs have response times (the time it physically takes to change the colour of a pixel) around

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

2015-04-18 Thread Jan Ciger
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 04/17/2015 06:55 PM, Björn Blissing wrote: Valve is using another idea, which Alex Vlachos presented at GDC. They start rendering of a new frame 2 ms before VSync. Using some clever tricks to detect when Vsync is about to occur: See page

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

2015-04-17 Thread Jan Ciger
On Thu, Apr 16, 2015 at 7:43 PM, Björn Blissing bjorn.bliss...@vti.se wrote: That does not seem entirely correct, if you look at the values for running without Vsync I have managed to get down to 4 ms and a mean of 14 ms. So I guess that my screen has a scan out time of ~4ms and since I am

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

2015-04-17 Thread Björn Blissing
Hi again, I also tried Roberts suggestion about using the trunk and OSG_SYNC_SWAP_BUFFERS=ON. To get better averages I took the measurements over 100 cycles: Recorded data: = OSG 3.2.1 + Nvidia Defaults + VSync On: min_latency = 59ms max_latency = 65ms mean_latency = 62ms OSG Trunk

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

2015-04-17 Thread Robert Osfield
Hi Björn, What happens when using use Custom NVidia settings and SYNC_SWAP_BUFFERS=ON ? Robert. On 17 April 2015 at 13:58, Björn Blissing bjorn.bliss...@vti.se wrote: Hi again, I also tried Roberts suggestion about using the trunk and OSG_SYNC_SWAP_BUFFERS=ON. To get better averages I

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

2015-04-17 Thread Björn Blissing
robertosfield wrote: Hi Björn, What happens when using use Custom NVidia settings and SYNC_SWAP_BUFFERS=ON ? Robert. Hi Robert, The latency values for SYNC_SWAP_BUFFERS=ON and OFF where exactly the same for the custom settings. Regards Björn -- Read this topic

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

2015-04-17 Thread Björn Blissing
Jan Ciger wrote: That actually sounds odd, because the monitor will not refresh the image faster than its fixed refresh rate. 4ms would require 250Hz refresh, I am not aware of any commonly sold LCD that could go that fast. Even 120Hz ones are quite rare. Are you sure it is not an

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

2015-04-17 Thread Jan Ciger
On Fri, Apr 17, 2015 at 1:57 PM, Björn Blissing bjorn.bliss...@vti.se wrote: Looking at this plot it seems like the latency times are varying according to a pattern. My guess is that the screen runs asynchronously with the GPU. That it certainly does. Modern LCDs are not tied to the

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

2015-04-17 Thread Jan Ciger
On Fri, Apr 17, 2015 at 6:10 PM, Björn Blissing bjorn.bliss...@vti.se wrote: But my main point still stands; it is possible to record latencies that are close to the scanout time of the screen with VSync Off (albeit for very simple rendering). Yes, but not consistently for every frame.

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

2015-04-17 Thread Björn Blissing
Jan Ciger wrote: Yes, but not consistently for every frame. Assuming that each frame you are drawing takes the same time, you need to get lucky for that to happen and then the next frame is going to have a much higher latency. Of course! I am certainly not claiming that hitting optimal

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

2015-04-17 Thread Björn Blissing
Jan Ciger wrote: What happens is that sometimes your program gets lucky and tells the GPU to swap buffers just in time before the start of the next frame - then you have very little latency, because the change gets visible almost immediately (modulo the input latency of the monitor

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

2015-04-16 Thread Björn Blissing
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

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

2015-04-16 Thread Jan Ciger
Hello Björn, On Thu, Apr 16, 2015 at 2:59 PM, Björn Blissing bjorn.bliss...@vti.se wrote: 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

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

2015-04-16 Thread Robert Osfield
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

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

2015-04-16 Thread Björn Blissing
robertosfield wrote: 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