V-Sync: Driver or Game?

Everything about displays and monitors. 120Hz, 144Hz, 240Hz, 4K, 1440p, input lag, display shopping, monitor purchase decisions, compare, versus, debate, and more. Questions? Just ask!
Sparky
Posts: 682
Joined: 15 Jan 2014, 02:29

Re: V-Sync: Driver or Game?

Post by Sparky » 12 Apr 2015, 18:36

Glide wrote:I'm not sure that I understand what point you are trying to make here.
All of the discussion here is about a V-Sync On scenario, where the goal is to get the smoothest gameplay possible.
Keeping things low latency at the same time is nice, but not the primary concern.

And you seem to be contradicting yourself in the same post.
Sparky wrote:Dunno why you say that it reduces latency, the difference between 2 3 and 4 is within the error bars for the first graph, and they're all over the latency of 1.
The upper graph shows that the max pre-rendered frames makes no difference to latency when V-Sync is disabled.
However, the lower graph shows that setting the max pre-rendered frames to 1 (the default is 3) removes a frame of latency when V-Sync is enabled - which is why I said that it reduces latency.
that implies the default is actually 2, and that setting it to 3 is simply non-functional. This is also what flood's testing shows. This is probably a d3d issue, not a GPU or game issue.
And in my own testing, reducing this to 1 also improves frame pacing in most games.

In CS:GO, latency seems to be the same for all values >1.
In other games, each pre-rendered frame may add an additional frame of latency.

In the same post, and the subsequent post, you do seem to agree that setting it to 1 reduces latency??
Sparky wrote:If it's not missing frames, the cap isn't doing anything. That would be identical to the latency for whatever v-sync PRF combo you were using uncapped. There is a caveat here in that a framerate cap very close to your refresh rate can take longer to creep into a high or low latency region, but a cap very slightly higher than your refresh rate will end up in the same place as no cap at all.
I guess I just don't understand the mechanics of this.
I thought the point of the cap was to push the render time to the last possible moment before it is sent to the display, to reduce latency.

Using Max Payne 2 as the example again, it's running at over 400 FPS (with 8xSGSSAA enabled)
So without a cap, the frame is rendered in the first 2.5ms and there's 14.2ms latency while it waits for the next refresh.
I thought the point of the cap was to push the render time towards the end of that 16.67ms period, to minimize the delay between your input and the screen updating.
And repeat that for every single step in the pipeline. Say the GPU spends 2.5ms on each frame, and the CPU spends 1ms working on each frame. With v-sync off, you get a buffer flip every 2.5ms, so you get 2.5ms of latency from the GPU calculation time, 2.5 or 5ms from the flip queue, 1ms from CPU calculation time, 1.5ms from the CPU waiting on the flip queue, a random 0~2.5ms of input data waiting on the CPU, and then tack on the USB, mouse, and monitor latency. With v-sync on(double buffered) and no framerate cap, you get 2.5ms from the GPU calculation time, 14.2ms from the GPU waiting on the display, 16.7 or 33.3ms from the flip queue, 1ms from CPU calculation time, 15.7ms from the CPU waiting on the flip queue, a random 0~16.7ms of input data waiting on the CPU, and then tack on the monitor/mouse/USB latency.

Now, if you leave v-sync on and cap framerate at 59.9fps in the game engine(like fps_max), you get a random delay between 0 and 16.7ms for the input data to get read by the CPU, 1ms of CPU processing, 0ms for the flip queue, 2.5ms for the GPU, and a random 0~16.7 of the GPU waiting on the next refresh.

Understand?

If you have access to that game, I suggest you try it rather than making assumptions.
Implementing a cap, whether that's 58 FPS or 65 FPS (for 60Hz V-Sync) makes a huge difference to latency when it's set to 8 pre-rendered frames.
65 FPS does not reduce latency as much as 58 FPS (I guess there is an additional frame) but it is still a significant reduction from running uncapped.

I'm not sure how you are supposed to get smooth gameplay if you are capping the framerate below the refresh rate.
That just results in tearing (adaptive v-sync) the frame-rate dropping to 30 FPS (regular v-sync) or stuttering. (triple-buffering)
All of which go against the intended goal here of having the smoothest gameplay possible.

And if that's the case, why not just run with V-Sync switched off at the highest framerate you can?
you'd still get tearing. The best option is g-sync or freesync. with framerate capped in game just inside the VRR range.
Sparky wrote:prerendered frames shouldn't really do anything to frame pacing, except provide some buffer if the cpu portion of the graphics pipeline freezes for a bit.
Well it makes a huge difference in a number of games/engines. That is why I started this topic, if you read the first post.

Here are the results when the game is allowed to set the max number of pre-rendered frames, and I used an RTSS cap since people said that may improve frame-pacing. (it did nothing)
And these are the results when the max number of pre-rendered frames is set to 1.
Sparky wrote:I did just test flip queue 0, 1, 2, 3, and 5 in CS:GO with double buffered v-sync and no cap(via radeonpro). 1 reduced lag by 1 frame, 0,2,3,5 did nothing. I added the data from 1 to the graph
Zero allows the application to specify what value to use. The default is 3 if it does not specify anything. That's why NVIDIA replaced "0" with "Use the 3D application setting".
Sparky wrote:The implementation of triple buffering should be the same regardless of where you turn it on. If your framerate is limited by v-sync, it does add input latency, othewise, not so much: https://docs.google.com/spreadsheets/d/ ... nteractive
I'm sorry, but the labels on your graph are quite cryptic.
If I am reading this correctly, in-game triple buffering has a frame of latency (I assume - the scale is useless) lower than forcing it externally via RivaTuner? You also mention that RadeonPro has an additional frame of latency over RivaTuner.
you can hover over the different bars to see the actual number.
Uncapped with vsync off is about 7.3ms
In game framerate cap at 85fps with vsync off is about 14ms.
In game framerate cap at 85fps with vsync on is about 21ms.
RT cap at 85fps with v-sync off is about 24.5ms.
RT cap at 85fps with v-sync on is about 31~32ms.
Uncapped with v-sync on is 56, 67, or 78, (double buffered with FQ=1, Double buffered with default FQ, and triple buffered with default FQ.)

This suggests that the implementation differs depending on where it is set.
triple buffering is set in game for all test runs, the only thing changing between triple buffered runs is where the FPS cap is coming from.
Sparky wrote:Dunno what GPU you have, but radeonpro also lets you force triple buffering. In the above graph I just turned it on in game.
I am using a GTX570 just now. NVIDIA only have the option to force triple-buffering for OpenGL.
I was under the impression that D3D Overrider's "triple buffering" increases the flip queue size, which is not the same thing as true triple-buffering - hence the additional frame of latency.
No idea, I haven't used the d3d overrider to force triple buffering. Have a reference?
Last edited by Sparky on 12 Apr 2015, 19:16, edited 1 time in total.

flood
Posts: 929
Joined: 21 Dec 2013, 01:25

Re: V-Sync: Driver or Game?

Post by flood » 12 Apr 2015, 18:50

tldr

why do people want vsync or fps capping anyway? is it for gsync?

Sparky
Posts: 682
Joined: 15 Jan 2014, 02:29

Re: V-Sync: Driver or Game?

Post by Sparky » 13 Apr 2015, 01:05

flood wrote:tldr

why do people want vsync or fps capping anyway? is it for gsync?
I guess in some cases eliminating tearing is more important than input lag. Single player games that can't manage hundreds of fps? FPS capping is important for g-sync, yes. If you're cpu limited with VRR, your graphics latency should be limited to actual calculation time, plus the random 0 to 1/framerate for the input timing.

Glide
Posts: 280
Joined: 24 Mar 2015, 20:33

Re: V-Sync: Driver or Game?

Post by Glide » 13 Apr 2015, 03:12

flood wrote:tldr
why do people want vsync or fps capping anyway? is it for gsync?
Because any time your framerate is not synced to the refresh rate it will tear and judder (V-Sync Off) or it will judder without tearing. (triple-buffering)

And it turns out that enabling V-Sync alone is not enough for judder-free gameplay.
In-game V-Sync often has bad frame-pacing (stutters even though it reads a constant "60 FPS") so this has to be replaced with V-Sync in the driver and the maximum number of pre-rendered frames often has to be reduced to 1 for good frame-pacing.

If I had the option for G-Sync or Adaptive-Sync, I would replace my current display, but all the existing G-Sync or Adaptive-Sync screens are small PC monitors, while I game on a 50" television.
And there are currently no televisions on the market which match the image quality and features of my existing display, even if they did support Adaptive-Sync.
If LG manage to sort out their quality control and image processing so that their OLED displays would be suitable as a monitor, or Samsung return to the OLED market, there might finally be something suitable for replacing my existing display.
Even then, there are currently no televisions with Adaptive-Sync support, and G-Sync is probably out of the question.

The last two-and-a-half pages seems to be people focusing on getting the lowest latency possible at the expense of smooth gameplay, which is bad advice here, when this topic was created to share my findings on why a game can read a constant "60" yet still be stuttering, and what can be done to fix that.

While I can understand people not wanting to go back and read the whole topic, I'm surprised that many people are skipping the first post.
Sparky wrote:that implies the default is actually 2, and that setting it to 3 is simply non-functional. This is also what flood's testing shows. This is probably a d3d issue, not a GPU or game issue.
As I said, setting it to zero (or "Use the 3D application setting" with NVIDIA) allows the game to specify a maximum number of pre-rendered frames.
The default for this is 3, but perhaps CS:GO is using 2. And perhaps it is internally limiting itself to 2 so setting a higher value does nothing.
Many different games/engines behave differently with this setting.

However in my testing, most games seem to benefit from reducing this to 1.
It typically removes at least one frame of latency—if not more—when V-Sync is enabled, while also improving frame-pacing.

Again: please read the very first post in this topic.
0 max pre-rendered frames, in-game v-sync
1 max pre-rendered frames, in-game v-sync
1 max pre-rendered frames, driver-forced v-sync

So there are similar benefits to doing this as there are from using a frame cap, only it does not interfere with game smoothness or frame-pacing—it actually improves it.

Jourgensen
Posts: 50
Joined: 15 Mar 2015, 09:19

Re: V-Sync: Driver or Game?

Post by Jourgensen » 14 Apr 2015, 19:33

I want to cap my fps for a simple reason : my gpu is noisy and get hot for nothing, I got a gtx980, I don't want to play à 350fps when my card can still be passive at 60 fps.
I would like to cap my fps on the nvidia panel.. but its impossible sadly.

Glide
Posts: 280
Joined: 24 Mar 2015, 20:33

Re: V-Sync: Driver or Game?

Post by Glide » 15 Apr 2015, 02:47

Jourgensen wrote:I want to cap my fps for a simple reason : my gpu is noisy and get hot for nothing, I got a gtx980, I don't want to play à 350fps when my card can still be passive at 60 fps.
I would like to cap my fps on the nvidia panel.. but its impossible sadly.
You can set a framerate cap in NVIDIA Inspector, which adjusts profile settings that are hidden in the NVIDIA Control Panel.

It does not seem to be quite as effective as capping via RTSS, but better than uncapped.

MrBonk
Posts: 11
Joined: 27 Mar 2015, 03:55

Re: V-Sync: Driver or Game?

Post by MrBonk » 16 Apr 2015, 02:21

Sparky wrote:
Glide wrote:I did some more testing, though I don't know how relevant the results will be to modern games.
I loaded up Max Payne 2, which uses DirectX 8, because it easily runs at hundreds of FPS and if you set it to a maximum of 8 pre-rendered frames it's the laggiest thing in the world.

If I enable an RTSS frame cap of 59/60 FPS, most of that lag is eliminated. 58 FPS in RTSS means that it misses sync and drops to 30 FPS.
If I use the NVIDIA frame cap options of 58/59/60 FPS it greatly reduces the lag - though perhaps not quite as much as RTSS.
So far, that's mostly what I expected.

But the problem is stuttering. Every few seconds it would miss a frame and because I left standard V-Sync enabled, that meant it would drop to 30 FPS.

At 61 FPS in RTSS, it must be right on the threshold of fixing the latency problems because it fluctuates between low latency and noticeably laggy. And the cap has to be raised to 62 FPS to eliminate the stuttering, which means that it's always laggy - though it's still a lot better than uncapped.


However, if I reduce the maximum number of pre-rendered frames to 1 and remove the cap, latency is already about the same as 8 pre-rendered frames with a 59 FPS cap.


If I add a 62 FPS cap in RTSS, or set the driver cap to 65 FPS (it jumps from 60 to 65, though I'm not sure whether you can set a custom limit) it now seems to be better than 8 pre-rendered frames with the 59 FPS cap for latency and it never misses a frame.
If it's not missing frames, the cap isn't doing anything. That would be identical to the latency for whatever v-sync PRF combo you were using uncapped. There is a caveat here in that a framerate cap very close to your refresh rate can take longer to creep into a high or low latency region, but a cap very slightly higher than your refresh rate will end up in the same place as no cap at all.

If I drop the cap to 59 FPS latency does seem to get lower still, but at that point it's back to skipping a frame every few seconds, and the difference in latency is minimal.

When I'm playing single-player games for enjoyment rather than competitive gaming, low latency is important, but keeping things absolutely smooth matters even more.


So it does seem that a frame cap can help improve latency, but in all of the games I have tested so far, the main thing with V-Sync on is to reduce the maximum number of pre-rendered frames to 1. And this usually helps improve frame pacing as well.

Of course this is all subjective - I'd love to see some hard data on this if you're able to test it.
But even so, running the game at 8 pre-rendered frames really magnifies any differences that there may be because it has so much latency by default.
prerendered frames shouldn't really do anything to frame pacing, except provide some buffer if the cpu portion of the graphics pipeline freezes for a bit.

I did just test flip queue 0, 1, 2, 3, and 5 in CS:GO with double buffered v-sync and no cap(FQ via radeonpro V-sync and double buffering in game). 1 reduced lag by 1 frame, 0,2,3,5 did nothing. I added the data from 1 to the graph
And yet we have already provided proof that reducing the amount of frames the CPU can render ahead reduces input latency with vsync AND in some cases stabalize frame times with vsync.



Sometimes things aren't the way textbook knowledge teaches you to think.

With a 1/2 refresh cap and pre-rendered 1 vs 3 the difference is immediately disercnible. Even at 60hz.

Download the Lost planet Extreme condition demo/benchmark. Set all the settings to maximum. Enable the in game vsync. Move the cursor with a controller or keyboard at the main menu up and down.

Then use Inspector and with the "Lost Planet Extreme Condition" profile, set the pre-rendered amount to 1. Repeat. Change it to 8. Repeat.

Glide
Posts: 280
Joined: 24 Mar 2015, 20:33

Re: V-Sync: Driver or Game?

Post by Glide » 01 Jun 2015, 10:58

MrBonk wrote:Update: I spoke with Unwinder about modifying Afterburner's to allow sub 100ms polling for more accurate monitoring without interference.

(Also: RTSS is technically the hardware monitoring part, which is what you need to monitor anything with AB such as framerate or use the OSD. So using FRAPS on top of it will most likely interfere. Pending any correction by the man himself. I have pointed him to this thread as well)

With a polling period of 1ms, Vsync forced on from drivers + Pre render 1 + a 60FPS cap from RTSS with a title that has a lot of problems as is(Final Fantasy XIII)
Shows standing still that the amount of variance is extremely small(The gaps are because there are no frames rendered in those samples. Frames are rendered 59/60 times a second, so obviously only every 16.x ms
http://u.cubeupload.com/MrBonk/wcap.jpg

Here is the raw data of 59 unique frame samples over 1 second (Ignore the spike. Is unrelated)
<snip>

Now here's a graph without the cap
http://u.cubeupload.com/MrBonk/nocap.jpg
You can already see there is a lot more variance

Here's another full second of frames
<snip>

The new version of Afterburner is out now. Was this feature removed, or is there a special configuration required to set this up?
It still seems to be limited to 100ms polling

Post Reply