Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Present VFR duplicate frames on a tempo #2379

Merged
merged 1 commit into from Apr 6, 2023
Merged

Present VFR duplicate frames on a tempo #2379

merged 1 commit into from Apr 6, 2023

Conversation

kcgen
Copy link
Member

@kcgen kcgen commented Apr 4, 2023

Potential fix for #2340

Adding @0mnicydle.

Here's VFR presenting duplicates at roughly 7 Hz in an otherwise static CLI:

2023-04-04_14-13

(the periodic jumps are the CLI application doing a redraw pass every ~15 seconds or so).

@kcgen kcgen added bug Something isn't working video Graphics and video related issues labels Apr 4, 2023
@kcgen kcgen self-assigned this Apr 4, 2023
@0mnicydle
Copy link

0mnicydle commented Apr 5, 2023

Thanks for taking a crack at this @kcgen, but after building this PR I'm seeing a minimum of almost 200fps at 1000Hz dos rate. Hoping for something that will result in single digit dupes per sec even at 1000Hz. Also an option to disable completely would be appreciated as any time the monitor spends drawing dupes represents a possible delay in showing the next real frame, depending on when it arrives. At very low dupe rates this probably wouldn't mean too much, but it would still be nice.

@kcgen
Copy link
Member Author

kcgen commented Apr 5, 2023

Thanks for the checking @0mnicydle, and your numbers make sense with the (currently fixed) one-fifth tempo (versus DOS rate).

I'll make the tempo a factor of the DOS rate: so the faster the rate, the more drawn out the tempo gets.

@0mnicydle
Copy link

0mnicydle commented Apr 5, 2023

New commit is working much better, thanks @kcgen. Though can you please tell me if there's an easy modification I can make to the code to play around with higher rates like ~10-30fps? You're gonna think I'm crazy, but I can feel a little bit of a delay coming out of what would normally be 0fps situations, which are now ~5fps situations, and I'm speculating that it's a result of my gsync monitor transitioning in and out of its LFC mode at these low rates; it's not something I can notice with VRR disabled.

@0mnicydle
Copy link

So for commit 6d307e4 I'm getting about ~28fps in previously 0fps situations (at 1000Hz), and I am no longer getting that little delay I was talking about when launching back into higher frame rates. It seems a shame to make the minimum rate so high for everyone just because of VRR strangeness, and I imagine the threshold for avoiding issues will be different on different VRR displays, so I still think it would be nice if this dupe rate was user configurable...

But as far as how it's behaving right now for my use case, loving it! Working like a champ! The minor delay thing comes back at 70Hz dos rate because now the dupe rate is back to single digits, but I personally won't be using VFR for 70Hz anyway.

Whatever the reason, whether it's LFC related or something else, my monitor doesn't seem to appreciate single digit frame rates and would rather see 0fps, go figure...

@kcgen
Copy link
Member Author

kcgen commented Apr 5, 2023

I'm getting about ~28fps in previously 0fps situations (at 1000Hz), and I am no longer getting that little delay

👍 ; thanks - I didn't have a chance to describe it before you tested it.

It seems a shame to make the minimum rate so high for everyone just because of VRR strangeness

The good news is the tempo scales with respect to the DOS rate.

In the current commit:

	constexpr auto min_dos_rate_hz    = 24.0;
	constexpr auto max_dos_rate_hz    = 1000.0;

	constexpr auto min_backfill_tempo = 4.0;
	constexpr auto max_backfill_tempo = 18.0;

At the lower bound, a (forced) DOS rate of 24 Hz will backfill every 4th call to the VFR presenter (but only after 'going dry'). At the other end, a (forced) DOS rate of 1000 Hz will backfill every 18th call.

For users without VRR displays and not overriding the DOS rate, the effective VFR dupe rate is around 10 Hz, which is reasonable given that's still ~100 ms to wait before filling in a (possibly) dropped frame.

Users with VRR displays and not overriding the DOS rate will be in CFR mode + vsync, so getting a steady ~59 to 70.2 FPS stream (plenty above even the worst monitors' 48 Hz LFC threshold).

If you want to experiment lowing the dupe rate, ratchet up the max_backfill_tempo value (say 20, 22, 25, etc) - Maybe you can go even lower! (although, 28 Hz is still no sweat if that's what's needed!).

@0mnicydle
Copy link

That all sounds very reasonable. Thanks for your efforts @kcgen!

@kcgen
Copy link
Member Author

kcgen commented Apr 5, 2023

@0mnicydle - I think you're the only one who's figured out how to run a bunch of these FPS-style games at fluid millisecond-level update rates.

There are a ton of users out there with fast PCs and 120+ Hz monitors who aren't aware they can experience games like System Shock at butter-smooth tear-free rates.

Would you be interested in helping them with tips or a short guide? - perhaps start with your settings for the handful of games where there's a marked benefit. No pressure; just if you want! 🙂

@0mnicydle
Copy link

I was wondering if you'd be interested in writing up a short guide on this (perhaps start with listing your settings for the handful of games where there's a marked benefit) - but no pressure, just if you want to!

Sure, it's the least I could do after all. I just found the discord server, so I'll be in touch when I have something for you.

@johnnovak
Copy link
Member

@0mnicydle I wanted to suggest writing such a guide myself but @kcgen beat me to it 😄 It seems you're the best person to do it with your experience in the subject and it would definitely benefit other people with VRR capable displays.

If you have even just a rough writeup, I can polish it up a little and create a new page for it on our wiki. Just send it to me on Discord 😄

@johnnovak
Copy link
Member

johnnovak commented Apr 5, 2023

For users without VRR displays and not overriding the DOS rate, the effective VFR dupe rate is around 10 Hz, which is reasonable given that's still ~100 ms to wait before filling in a (possibly) dropped frame.

So that's my use case @kcgen. If I understand this correctly, there will be screen updates at at least 100 ms intervals in text mode apps where I encountered the missing frame issue. That's good enough I think.

@kcgen
Copy link
Member Author

kcgen commented Apr 5, 2023

If I understand this correctly, there will be screen updates at at least 100 ms intervals in text mode apps where I encountered the missing frame issue.

That's right.

@ThomasEricB
Copy link
Contributor

ThomasEricB commented Apr 6, 2023

There are a ton of users out there with fast PCs and 120+ Hz monitors who aren't aware they can experience games like System Shock at butter-smooth tear-free rates.

I have a 144 hz monitor and I love System Shock! @0mnicydle

src/gui/sdlmain.cpp Outdated Show resolved Hide resolved
src/gui/sdlmain.cpp Outdated Show resolved Hide resolved
src/gui/sdlmain.cpp Outdated Show resolved Hide resolved
src/gui/sdlmain.cpp Outdated Show resolved Hide resolved
Copy link
Member

@johnnovak johnnovak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great improvement @kcgen 🎉

This is an insurance policy to ensure the last frame is shown
even if the host previously dropped it. This is a temporary
hack; it should be removed in the future when everyone's PC
display technology can support the > 70 Hz refresh rates
available in 1990s PC CRT monitors.
@kcgen
Copy link
Member Author

kcgen commented Apr 6, 2023

Thanks for all the testing and feedback, @0mnicydle 🚀

@kcgen kcgen merged commit 0f75587 into main Apr 6, 2023
53 checks passed
@kcgen kcgen deleted the kc/vrr-dupes-1 branch April 8, 2023 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working video Graphics and video related issues
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants