hrydgard / ppsspp

A PSP emulator for Android, Windows, Mac and Linux, written in C++. Want to contribute? Join us on Discord at https://discord.gg/5NJB6dD or just send pull requests / issues. For discussion use the forums at forums.ppsspp.org.
https://www.ppsspp.org
Other
11.43k stars 2.19k forks source link

Auto frameskip is broken in recent git builds #15525

Open Stizzie opened 2 years ago

Stizzie commented 2 years ago

In recent git builds frameskipping produces super choppy render, like 10-15fps it feels like.

anr2me commented 2 years ago

The devs will need more info, like what device are you using? which games were affected? And are you sure it only affected by auto-frameskipping and not a combination of other settings (ie. custom CPU clock, specific renderer backend, cheat/plugin, etc) ? Have you tried resetting the settings to default and only enable/disable auto-frameskipping?

PS: i personally couldn't understand why Auto-frameskipping is affected by "Frame skipping" number too, because i thought the word "auto" will automatically adjust the number of frames that need to be skipped (ie. depends on the hardware strength) instead of using a fixed value, but apparently it looked the same (ie. same choppy/jumpy-ness) regardless whether i Enable/Disable Auto-frameskipping if i set "Frame skipping" to 3 or 4 on Gran Turismo, even when my hardware is capable to get full speed without skipping (which "auto" should skip 0 frame in this case)

unknownbrackets commented 2 years ago

To me it makes sense, but maybe it should be explained better.

When "auto" is enabled, the frameskip setting is the maximum frameskip. When "auto" is not enabled, the frameskip setting scales down the desired FPS uniformly.

Examples:

  1. Let's say the game is a 60 FPS game. Auto frameskip is off, and # of frames is set to 2. For every 3 frames, 2 will be skipped always. The device is powerful enough to run at 70 FPS, but it doesn't matter because auto is off. Therefore the resulting target FPS is 20.
  2. Let's say the game is a 30 FPS game. Auto frameskip is on, and # of frames is set to 8. However, the device is powerful enough to run it at 60 FPS. Because it is unnecessary to skip any frames, the target FPS remains 30.
  3. Let's go with another 60 FPS example. Auto frameskip on this time, and # of frames set to 1. For every 2 frames, at most 1 may be skipped. The device cannot run this above 21 FPS, but scaling down to 20 FPS would exceed the maximum, so the target FPS is 30 (but the game performs sluggishly.)

Anyway, nothing has really changed about frameskip or auto frameskip in recent git builds. However:

  1. Some recent changes have increased the accuracy of uncommonly used graphical effects, some of which are slow. It could be that this is impacting performance. See #15515.
  2. Some changes have been made to speed up Vulkan, but it's possible these could have had a negative effect on your device.
  3. Recent Android updates (but before the last stable release) have made IO ridiculously slower, which may be having performance impacts especially if you're using texture replacement.

It would be helpful to have details about your device and which game you're seeing this in, as well as a GE frame dump (basically the questions asked in the normal templates, which you skipped.) Otherwise it's really hard to guess at anything.

-[Unknown]

anr2me commented 2 years ago

I was hoping i'm getting what no.2 is saying:

Let's say the game is a 30 FPS game. Auto frameskip is on, and # of frames is set to 8. However, the device is powerful enough to run it at 60 FPS. Because it is unnecessary to skip any frames, the target FPS remains 30.

But apparently, regardless whether i enable/disable auto-frameskipping, the same thing will be shown, the same skipping effect (jumpy movements), and the thing on FPS info too (set to both) if i set "Frame skipping" to a number. It's been like this (ie. auto-frameskip doesn't make a difference) for quite some times i think, not just recently, but since my hardware is capable to run full speed, it doesn't really bother me much (usually i just set Frame skipping to Off).

For example on GT Main menu, On dev builds with "Frame skipping" Off, and Auto-frameskipping Off, Movements are smooth image

With "Frame skipping" to 8, and Auto-frameskipping On/Off (doesn't matter), Movements are choppy/jumpy (to the point of unplayable/unbearable) image

This is on older version v1.9.3/v1.10.3/v1.11.3/v1.12.3, with "Frame skipping" to 8, and Auto-frameskipping On/Off (doesn't matter), Movements are choppy/jumpy, but not as bad as newer version where contiguous frames seems to be skipped making a large jump (where the game became unplayable/unbearable) instead of many smaller jumps (still playable/bearable in this case, on v1.9.3/v1.10.3/v1.11.3/v1.12.3) image Not sure which version it was where auto-frameskipping can actually make a difference when disabled/enabled tho

ghost commented 2 years ago

Maybe related to this https://github.com/hrydgard/ppsspp/issues/15276

anr2me commented 2 years ago

Maybe related to this #15276

That issue is related to flickering, while this issue is related to suspectedly broken frameskipping:

On dev builds "Frame skipping" 8 will cause the screen to be updated only once per second (ie. GTA VCS, Gran Turismo), causing it to looked like a slide show, while on v1.12.3 or older version frameskips are smoother (smaller skips instead of large skip). Unless it was a bug in the past causing it to be smoother (ie. skips less than what it should) where it shouldn't be that smooth, not sure what a 8 frame-skip should look like tho.

There is also an oddity where Auto-frameskipping not to have any difference being On/Off (only "Frame skipping" value being effective), which is suspected to be broken too. But Auto-frameskipping has been like this since a much older version, not sure whether it ever worked or not tho. v1.7.4 seems to have a working Auto-frameskipping, while v1.8.0 started to not working.

unknownbrackets commented 2 years ago

I'm guessing this must be related to some other setting, then. I don't experience this, though I don't have Gran Turismo I don't think.

Games I quickly checked with auto frameskip and frameskip set to 8:

Tried with OpenGL, Vulkan, and Direct3D 11. In all cases I get the same FPS generally that I would without frameskipping.

Note: I'm not using many settings that are non-default, for example I don't have Locked CPU Mhz or real time sync enabled, no upscaling, 1x PSP, WLAN off, default I/O timing mode.

Maybe there's something specific with detection of Gran Turismo (there definitely is with Danganronpa 2), but if you're seeing this widely it must be something else.

-[Unknown]

unknownbrackets commented 2 years ago

Don't have time to test now, but it seems likely that real time clock sync (which generally exists to slow things down so time lines up with emulation as much as possible) and frameskip could fight with each other. It probably doesn't make sense for them to be enabled concurrently. They're basically opposites.

Maybe that's what you're experiencing, and I do think that we fixed bugs in real time clock sync around the versions you noted.

-[Unknown]

anr2me commented 2 years ago

I tried to reset the setting to default, and you're right! Auto-frameskipping worked properly now with "real clock sync" disabled, didn't know that they can't be enabled together, this reminded me of a old issue on VBA-M where auto-frameskipping can't be enabled together with audio sync in the past.

But the issue where the screen only updated once per second like a slide show is still there in dev builds (ie. both auto-frameskip & real clock sync disabled), is this an intended behavior? because v1.12.3 release and older version wasn't like this. And yeah, Chain of Olympus didn't have this slide show effects, while Ridge Racer 2 & Fat Princess have the slide show effects (but not on the video playback)

unknownbrackets commented 2 years ago

In Fat Princess, ForceMax60FPS seems to be interacting poorly with frameskip. In theory, frameskip shouldn't change game timing so this probably is a bug, like #15276 or really #14315.

-[Unknown]

ghost commented 2 years ago

Not directly related to this issue but skip-buffer effects (non-buffered rendering) is broken since https://github.com/hrydgard/ppsspp/commit/1dead5f095987c812f6d104db5618e7658dcdf1b

https://user-images.githubusercontent.com/37603562/169637634-9e7ef4b7-8718-47da-a079-bf41d9406449.mp4

RomRider commented 2 years ago

Same issue on pi4, used to run most of the games quite smoothly with auto frameskip (most of the time 60fps and skipping when required), now it's super choppy, auto frameskip enabled makes a game render at 7 fps when it can actually render at 60fps when number of frame skip is set to off (eg: wipeout pure)

anr2me commented 2 years ago

Same issue on pi4, used to run most of the games quite smoothly with auto frameskip (most of the time 60fps and skipping when required), now it's super choppy, auto frameskip enabled makes a game render at 7 fps when it can actually render at 60fps when number of frame skip is set to off (eg: wipeout pure)

Make sure "real clock sync" is disabled on System setting when using Auto-frameskipping

unknownbrackets commented 2 years ago

It'd really help if you could try different builds of PPSSPP and find the first build with the problem, and the last build without it.

If you're compiling, you can use this: https://github.com/hrydgard/ppsspp/wiki/How-to-bisect-to-find-what-broke-a-game

-[Unknown]

RomRider commented 2 years ago

Make sure "real clock sync" is disabled on System setting when using Auto-frameskipping

It is, it's even grayed out.

It'd really help if you could try different builds of PPSSPP and find the first build with the problem, and the last build without it.

I'm running Batocera so kind of hard to do that.

It's somewhere between v1.12.3 and commit 221976ff4057e7d9a7a00e4bb94e9656e9f8695a

unknownbrackets commented 2 years ago

It's somewhere between v1.12.3 and commit 221976f

There's 1200 changes between those two, so unfortunately it's just a big haystack of possibilities.

-[Unknown]

hrydgard commented 2 years ago

I am struggling to reproduce this... Can you supply your ppsspp.ini, or very specific settings?

ghost commented 2 years ago

Yes auto frameskip is not smooth as before that stable in fps 50/60,55/60,60/60 for example in Tekken 6 Screenshot_2022-07-11-20-49-56-238_org ppsspp ppsspp

hrydgard commented 2 years ago

OK I've messed around with autoframeskip and Wipeout on my Rasp 4 (desktop mode), and yeah, it's indeed very strangely choppy. Frame times are ridiculously uneven, first two frames in quick succession, then a gap until the next one. Also when running with much lower frameskip or no frameskip, it's like every other frame is much faster than the other, which might have strange downstream effects.

Either way, now that I have some kind of repro, I'm can bisect to see if this broke since 1.12, and I will soon give it a shot.

hrydgard commented 2 years ago

Hm, went all the way back to 1.12.3 and the rasp4 is similary choppy, so that problem seems unrelated (maybe it's throttling up and down or something due to my possibly inadequate phone charger as a power supply).

Gonna have to try Tekken on some underpowered phones, I think...

hrydgard commented 2 years ago

Alright, I've tried Tekken on a Samsung Galaxy S3, and at 8 autoframeskip it actually runs full speed although extremely choppy. It's just as choppy in both 1.12.3 and the current version though, I really can't tease out any substantial difference that I can try to find the cause of...

LunaMoo commented 2 years ago

Tried disabling ForceMax60FPS for it? It's supposedly interacting badly with frameskip as [Unknown] mentioned https://github.com/hrydgard/ppsspp/issues/15525#issuecomment-1123042869

hrydgard commented 2 years ago

And now GT as well. I'm seriously struggling to find a reproduction of a case where auto frameskip behaves worse in the latest builds than in 1.12.3.

Please, anybody who cares about this, make a reproducible comparison where 1.12.3 is obviously better, and I'll try to get something in. Otherwise the release is gonna be as-is, and any issues will be fixed afterwards.

ghost commented 2 years ago

Hrydgard I cannot reproduce this issue anymore after updating my phone.

@Stizzie can you still reproduce this issue?

anr2me commented 2 years ago

Apparently auto-frameskip 8 doesn't worked well with IR interpreter :( it rarely gets 60 FPS on this screen image While it get a stable 60 FPS without frameskip

PS: i have TurboBoost disabled, thus my CPU clock is capped at 1.8 ghz

unknownbrackets commented 2 years ago

I don't think we've seen anything about auto frameskip being broken for some months now. Is it possible whatever issue has been fixed? I've never reproduced any issue with it.

Interpreter and IR interpreter will naturally make frameskip or auto frameskip not work as well, because frameskip only skips drawing. The CPU still has to run, so if the CPU emulation is the slowest thing - FPS won't be any better by skipping drawing.

-[Unknown]