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
10.81k stars 2.12k forks source link

Unexpected performance drop [Corpse Party] #15348

Open Nabokov86 opened 2 years ago

Nabokov86 commented 2 years ago

Game or games this happens in

ULJM05704 - コープスパーティー ブラッドカバー リピーティッドフィアー

What area of the game

The game runs very fast, but sometimes there is a big drop in performance. Especially when you go from one location to another. This causes the sound to stutter for a moment, which is annoying.

Speed seen in PPSSPP

With unlimited speed - 800%, when dropped - 30-60%.

GE frame capture and debug statistics

ULJM05704_00006

Platform

Android

Mobile phone model or graphics card

Mali-G31 GPU

PPSSPP version affected

v1.12.3-776-g1c18c172a V1.12.3 V1.11.3 V1.10.3

Last working version

No response

Graphics backend (3D API)

OpenGL / GLES Vulkan

Any other notes or things you've tried

I tried resetting the settings, tried other android devices, same issue.

Checklist

Nabokov86 commented 2 years ago

These peaks occur every time you enter a different area. ULJM05704_00011

hrydgard commented 2 years ago

Hm, those peaks look quite nasty indeed..

unknownbrackets commented 2 years ago

Do the same peaks, just with a presumably lower amplitude, occur on PC? I want to make sure this isn't IO related - I know Android recently made IO much slower.

It's interesting that LockLwMutex is so hot, it's probably some sort of tight loop, I guess. I don't think that has timings yet.

-[Unknown]

Nabokov86 commented 2 years ago

@unknownbrackets The desktop computer handles it better, but I think the peaks are relatively the same. ULJM05704_00002

And with unlimited speed: ULJM05704_00001

hrydgard commented 2 years ago

@Nabokov86 Does it work better in the latest builds (829, for example?)

Nabokov86 commented 2 years ago

@hrydgard It looks the same, no difference

Oh, no! It definitely got better!

Nabokov86 commented 2 years ago

Look at this!

Android: ULJM05704_00013

hrydgard commented 2 years ago

Still not great, but looks better indeed! Do you still get audio glitches?

I wonder if this happens to any degree on the real PSP, or if there are more related timing issues somehow.

Nabokov86 commented 2 years ago

@hrydgard Audio glitches are still present, but they are shorter and much less annoying.

Still sometimes the sound is noticeably interrupted, especially in certain areas.

unknownbrackets commented 2 years ago

Do the debug statistics show anything different now?

-[Unknown]

Nabokov86 commented 2 years ago

@unknownbrackets No :( ULJM05704_00035_1

unknownbrackets commented 2 years ago

Strange. I'd be less surprised if sceAtracDecodeData was maybe the cuplrit, but I wonder why it's locking mutexes enough that it's noticeably slow... I wonder if unlock is just behind it in slowness...?

When #15368 is merged, it may be easier to catch these blips using frame advance, and especially see if there's interesting stats right before or right after. I'm also interested in whether the time taken is significantly different when frame advancing.

-[Unknown]

Nabokov86 commented 2 years ago

@unknownbrackets I apologize for the late response.

15368 is merged, right?

I can't find the frame advance option. Could you please help me with that?

unknownbrackets commented 2 years ago

You can map a button in control mapping to frame advance. Then when you press that button, it will pause, and you can keep pressing it to step forward one frame at a time. To stop frame advance, press whatever button is mapped to fast-forward.

-[Unknown]

Nabokov86 commented 2 years ago

@unknownbrackets Thanks for the quick reply!

Checked twice, I definitely don't have that button. Could this option be unavailable on android? I will try it on Windows later.

Nabokov86 commented 2 years ago

@unknownbrackets Yes, frame advance is not available on android.

I recorded two videos: using frame advance and 5% speed. The result is quite different.

5% speed: https://user-images.githubusercontent.com/26260168/152365423-6d69079d-c202-4f1a-9dcf-c82da5a703d5.mp4 Here you can clearly see the lag and LockLwMutexCB.

Frame advance: https://user-images.githubusercontent.com/26260168/152367211-570ae50b-dbf8-442e-a191-459d4eb96cf5.mp4

Hope this will be useful.

Nabokov86 commented 2 years ago

Android:

https://user-images.githubusercontent.com/26260168/152378315-1a9bb0d7-e2b7-4c3f-b4a0-7e93b047e68d.mp4

unknownbrackets commented 2 years ago

Has anything improved in the very latest git builds? We made another change, which might help.

-[Unknown]

Nabokov86 commented 2 years ago

@unknownbrackets No, nothing.

unknownbrackets commented 2 years ago

There was another recent change, has this improved on Android?

-[Unknown]

Nabokov86 commented 2 years ago

@unknownbrackets Same, nothing has changed :(

Peaks on the graph look the same. A very short image lag is noticeable during peaks as before. ULJM05704_00059

Nabokov86 commented 2 years ago

In other locations there are even bigger peaks. ULJM05704_00053 ULJM05704_00057

Nabokov86 commented 2 years ago

I discovered a new thing. Bluetooth-friendly buffer reduces audio glitches a lot in this game.

hrydgard commented 2 years ago

Yeah well that means that we still have stalls, just that the buffer is large enough with that setting to cover for it..

unknownbrackets commented 2 years ago

I have been thinking of putting atrac decode on a thread, which might help this. I suspect the game is decoding the entire background music for the next area during the scene transition.

-[Unknown]

Nabokov86 commented 2 years ago

I suspect the game is decoding the entire background music for the next area during the scene transition

I don't think so. The background music does not change during scene transitions.

For example, there is a dead end in this scene. The background music does not change, there seems to be no new sounds at all. The only new content is textures and a text note. The textures are loaded before this peak on the graph. Every time you enter this location causes this. Looks like something is loaded/decoded every time for this particular scene.

ULJM05704_00051_1

ghost commented 2 years ago

Cache full ISO in RAM doesn't help this if you enable? IMG_20220411_114848

Nabokov86 commented 2 years ago

@EternalsDarkhole No, it didn't help.

ghost commented 2 years ago

Can you upload save state of this area/stage of this game where it lag.

Nabokov86 commented 2 years ago

@EternalsDarkhole Sure.

1) ULJM05704_1.03_0.zip Go up here. 2) ULJM05704_1.03_1.zip Go left here.

It lags almost everywhere more or less, though.

ghost commented 2 years ago

@EternalsDarkhole Sure.

  1. ULJM05704_1.03_0.zip Go up here.
  2. ULJM05704_1.03_1.zip Go left here.

It lags almost everywhere more or less, though.

Thanks! BTW is NPUH-10117 is the usa version?

Nabokov86 commented 2 years ago

NPUH-10117 is the usa version

Yeah, I think so. But I have the Japanese version ULJM-05704

ghost commented 2 years ago

Android:

Android_debug.mp4

I cannot reproduce this kind of issue on the usa version of this game on my phone using ppsspp latest build.

https://user-images.githubusercontent.com/37603562/163184231-ef382dca-23f1-45fa-a067-f718d359744b.mp4

ghost commented 2 years ago

Maybe this issue is similar to KoF Orochi Collection https://github.com/hrydgard/ppsspp/issues/12543 where the USA version is smooth while the JAP version is slow.

Nabokov86 commented 2 years ago

Yes, I confirm. Looks like it's only related to the Japanese version.

NPUH-10117: NPUH10117_00003_1

ghost commented 2 years ago

Yes, I confirm. Looks like it's only related to the Japanese version.

NPUH-10117: NPUH10117_00003_1

Can you try software rendering?