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

(fix) Better no-stats vs no-framepace separation #2634

Merged
merged 4 commits into from
Jan 17, 2025

Conversation

shinyquagsire23
Copy link
Contributor

No description provided.

@shinyquagsire23 shinyquagsire23 requested a review from zmerp January 16, 2025 23:21
} else {
None
// Fallback to avoid deadlocking people's systems accidentally
Duration::from_micros(1000)
Copy link
Member

Choose a reason for hiding this comment

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

Maybe just use from_millis(1)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Honestly I was debating dropping it to 500, but sure

Copy link
Member

@zmerp zmerp left a comment

Choose a reason for hiding this comment

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

Thinking more about it, I think the logic needs to be flipped. first we should check if the session manager is up and use as fallback PRE_HEADSET_STATS_WAIT_INTERVAL. then if enforce_server_frame_pacing is false use a ZERO duration. I think this is fine. by looking at the graphs on Discord, I think that unconditional 1ms wait was causing some unnecessary slowdowns causing the server not to match the framerate of the client

@zmerp
Copy link
Member

zmerp commented Jan 17, 2025

Windows definitely doesn't have the resolution on 1 microsecond sleep... i think it's better to omit the sleep function entirely in that case

@shinyquagsire23
Copy link
Contributor Author

shinyquagsire23 commented Jan 17, 2025

I tested it on 1 microsecond and it seems fine, and to verify I loaded up the most unoptimized VRChat world I could find (~60fps on my 4090) and it seems to stay in the messy spiky client FPS state more often than 45Hz. I know technically it won't actually hit 1 microsecond bc scheduling resolution and such, but really I just want the equivalent of a yield there since SteamVR is a high priority process and it's good to yield when you can I think.

@shinyquagsire23
Copy link
Contributor Author

Actually I'll try a proper yield and see if that's fine or if there's unexpected issues, one sec

@The-personified-devil
Copy link
Collaborator

The-personified-devil commented Jan 17, 2025

I really want to know how windows even deals with that. Does it just yield continue immediately or does it end up still doing some minimal sleep interval (which I don't even fully understand because usually windows time slices are huge, but somehow for timers you can get increased precision wake-ups, idk)?

@shinyquagsire23
Copy link
Contributor Author

Tested the yield and it seems fine, also reordered the checks so that the StatsManager being missing will also sleep 8ms even if frame pacing is off, so no coil whine.

Copy link
Member

@zmerp zmerp left a comment

Choose a reason for hiding this comment

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

Looks good now

@zmerp zmerp merged commit 1e40b10 into alvr-org:master Jan 17, 2025
8 checks passed
zmerp pushed a commit that referenced this pull request Jan 18, 2025
* Better no-stats vs no-framepace separation

* millis

* micros

* yield
@zmerp zmerp mentioned this pull request Jan 18, 2025
zmerp pushed a commit that referenced this pull request Jan 18, 2025
* Better no-stats vs no-framepace separation

* millis

* micros

* yield
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants