Skip to content

Conversation

jordan-woyak
Copy link
Member

@jordan-woyak jordan-woyak commented Mar 2, 2025

@Sam-Belliveau took a step in the right direction with #11348 but throttling at every event was unnecessary.
They limited Throttle to 1200hz, but I think that ultimately lead to throttling on random events and not necessarily on critical presentation events.

See comment by @phire here:
#11348 (comment)

Ideally, you only want to throttle to make sure the Input/Output events. It doesn't matter if the emulator races though to complete rendering of half the frame as fast as possible, as long as it stops before reading input or presenting the result to screen (or audio, though we delay that)

Throttling is now done just before user input, statistics counting, and presentation.

GPU-thread cannot sanely use CoreTiming so a presentation_time is calculated from CPU-thread and sent in the "async request".
This works well for "single" and "dual" core mode. Ideally this time would probably be sent to the various video backends, since at least vulkan has its own worker thread, but for now it's handled in Present.

"Immediate XFB" does not gain this benefit. Timing information isn't readily available where that event is processed. I might argue that people wanting to use Immediate XFB care more about latency than pacing, though.

I'd also argue that needing to Throttle in PerfTrackerCallback is unfortunate and I plan to move this functionality into one of the other throttled events in a future PR to minimize the amount of throttling.

Frame pacing has become much better for me, from this:
image
To this:
image

Note the change from -/+ 0.22ms -> -/+ 0.02ms
I get an improvement like this in most games.

Input latency should, if anything, be better, since throttling happens just before input grabbing.

@jordan-woyak jordan-woyak requested a review from phire March 2, 2025 09:34
@JMC47 JMC47 self-requested a review March 2, 2025 18:21
@jordan-woyak jordan-woyak force-pushed the frame-pacing branch 3 times, most recently from 2c83183 to eb43d47 Compare March 3, 2025 06:02
@jordan-woyak jordan-woyak changed the title Fix frame pacing. CoreTiming: Improve frame pacing Mar 4, 2025
@jordan-woyak jordan-woyak force-pushed the frame-pacing branch 3 times, most recently from f4451c0 to 79c1afb Compare March 5, 2025 20:46
@jordan-woyak jordan-woyak added the WIP / do not merge Work in progress (do not merge) label Mar 6, 2025
@jordan-woyak jordan-woyak removed the WIP / do not merge Work in progress (do not merge) label Mar 6, 2025
@iwubcode
Copy link
Contributor

Code wise I think this looks good. I did test on Windows and didn't see the same buttery smoothness @jordan-woyak was getting. However, they quickly found a solution and now I get similar numbers.

Once there's some resolution from the Windows side, I think we can move forward here. Great work!

Copy link
Contributor

@iwubcode iwubcode left a comment

Choose a reason for hiding this comment

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

It was mentioned that we will save the Windows issues for a future PR. If so, this LGTM.

@JMC47
Copy link
Contributor

JMC47 commented Mar 13, 2025

I figure we should get this on the road then.

@JMC47 JMC47 merged commit 0e2785a into dolphin-emu:master Mar 13, 2025
13 checks passed
@jordan-woyak jordan-woyak deleted the frame-pacing branch March 14, 2025 03:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants