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

[Windows] Ignore "Render Duplicate Frames to 60 Hz" when unthrottling #12975

Closed
Leopard20 opened this issue May 25, 2020 · 15 comments
Closed

[Windows] Ignore "Render Duplicate Frames to 60 Hz" when unthrottling #12975

Leopard20 opened this issue May 25, 2020 · 15 comments
Milestone

Comments

@Leopard20
Copy link
Contributor

Leopard20 commented May 25, 2020

On Windows (and maybe Linux too), you should ignore the Render Duplicate Frames to 60 Hz setting when unthrottling, otherwise unthrottle doesn't work.

@unknownbrackets
Copy link
Collaborator

unknownbrackets commented May 25, 2020

It already does this, although only when you've enabled vsync in PPSSPP settings. What backend are you using where this doesn't work?

Note: there were bugs in this in v1.9.x. I'm talking about the latest git build.

-[Unknown]

@Leopard20
Copy link
Contributor Author

Leopard20 commented May 26, 2020

Latest git build (v1.9.3-960), Vulkan backend, using PPSSPP's vsync option.

It was weird though, it was as if the emulator was skipping frames when I unthrottled. The audio was playing normally.

P.S: When I turn on Vsync from the Nvidia Control Panel, unthrottle simply has no effect at all. I'm not sure if you can fix this case though.

@Leopard20
Copy link
Contributor Author

Leopard20 commented May 26, 2020

Another question: can you add an option to switch to the "Android-style" frameskipping on Windows? (if not too much work and worth the effort, of course)

@unknownbrackets
Copy link
Collaborator

unknownbrackets commented May 26, 2020

Hm. Maybe we should just recreate the swapchain (like when you resize the window) when toggling unthrottle if vsync is on. That may give better results and be more consistent across drivers. Downside: it would probably flicker.

There's an ini setting for unthrottle to frameskip - although I plan to change it in #12970.

-[Unknown]

@Leopard20
Copy link
Contributor Author

It was weird though, it was as if the emulator was skipping frames when I unthrottled. The audio was playing normally.

My apologies. It seems like I was mistaken. The culprit for this was the Render Duplicate Frames to 60 Hz option, not vsync.

I'd also like to report another problem which is probably related to frame pacing.
In every game I tested, I get a sudden lag every few seconds (like 10~15 s). However, the FPS counter showed the game was running at full speed; in fact, I noticed that my framerate was even higher that the maximum (e.g getting 61/60 101%), which makes me think it is related to frame pacing. Turning on vsync can alleviate the lag (vsync off: ~ 1s lag; vsync on: a few ms lag).
Using the Nvidia Control Panel vsync almost completely fixes the problem.
I was wondering if changing the vsync frequency to 59.94 instead of 60 (on a 60Hz monitor) could help?

@Leopard20 Leopard20 changed the title [Windows] Ignore Vsync when unthrottling [Windows] Ignore "Render Duplicate Frames to 60 Hz" when unthrottling May 26, 2020
@hrydgard
Copy link
Owner

We try to actually run the timing using the display and instead adjust the audio frequency to match so that should already be happening. That said, we also control game speed using the clock and it might be that it's a little too strict. There's definitely work to be done in this area.

@Anuskuss
Copy link
Contributor

Anuskuss commented Jun 28, 2020

Can confirm. Fast forwarding Vulkan+Vsync+DupeFrames does halve the frame rate instead of unthrottling it. I do hate how Dolphin flickers when fast forwarding Vulkan+Vsync so it would like to keep the current behaviour but just deactivate duplicate frames temporarily.

Edit: FrameSkipUnthrottle = True works. Hmm, that should've been the case already according to #12659.

@Anuskuss
Copy link
Contributor

Can you guys replace g_Config.bFrameSkipUnthrottle here

if (g_Config.iRenderingMode != FB_NON_BUFFERED_MODE && !(g_Config.bFrameSkipUnthrottle && !FrameTimingThrottled())) {
if (shaderInfo) {
postEffectRequiresFlip = (shaderInfo->requires60fps || duplicateFrames);
} else {
postEffectRequiresFlip = duplicateFrames;
}
}
with unthrottleNeedsSkip from here
bool unthrottleNeedsSkip = g_Config.bFrameSkipUnthrottle;
if (g_Config.bVSync && GetGPUBackend() == GPUBackend::VULKAN) {
// Vulkan doesn't support the interval setting, so we force frameskip.
unthrottleNeedsSkip = true;
to make it work in Vulkan+Vsync+DuplicateFrames?

@hrydgard
Copy link
Owner

@Anuskuss Looking at it, I've decided that I want to fix it properly instead and allow Vulkan to change vsync mode as you throttle/unthrottle, so we can remove the hack. It's not that hard to do actually (just gotta be careful and not destroy the whole surface, just recreate the swapchain ... it's a little involved).

@Anuskuss
Copy link
Contributor

@hrydgard That will make it flicker (like Dolphin) right? Probably should be configurable like #12970.

@hrydgard
Copy link
Owner

Ideally it shouldn't flicker if implemented correctly. I know early VK drivers had trouble with this though, don't know if it's still an issue.

@hrydgard
Copy link
Owner

Decided to try your fix in the meantime, included it in #13164 . After that's merged, let me know if it works.

@Anuskuss
Copy link
Contributor

Yep, it works. One tiny difference between Vsync off and on is that it shows 60/30 when untrottling instead of an useful value (count the skipped frames?) but that's by design right? You can see the performance in percent right next to FPS and one could argue that you shouldn't use Vsync for bechmarking anyway so it'd say it's not worth it to "fix" that.

@unknownbrackets
Copy link
Collaborator

The 60/30 is correct in that it is drawing 60 frames per second, and skipping the others. The FPS and speed indicators measure different things.

When you see 300/30 it means 300 frames rendered per second, which does also mean 1000%.

But when you see 1000% it just means speed is keeping up with real time, more or less, but could be 15/30, 30/30, 60/30, etc.

-[Unknown]

@Anuskuss
Copy link
Contributor

Anuskuss commented Feb 8, 2021

This can be closed, right?

@hrydgard hrydgard closed this as completed Feb 8, 2021
@unknownbrackets unknownbrackets added this to the v1.11.0 milestone Feb 8, 2021
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

No branches or pull requests

4 participants