ppsspp icon indicating copy to clipboard operation
ppsspp copied to clipboard

some games lagging and stuttering

Open daniel229 opened this issue 11 years ago • 14 comments

Sword Art Online lagging when there are many persons in the street.FPS meter drops to 20/20.Set CPU speed to about 600 helps the problem,no more lagging. video http://youtu.be/I_Cwiz90YwE

Gebsou Suikoden 1&2,it is stuttering in spesific area,FPS meter showing 48/48.Set CPU speed to 2000,helps it,FPS meter showing 59/59. video http://youtu.be/e0QNKrIWiA8

daniel229 avatar Jun 29 '14 01:06 daniel229

I see it in Sword Art Online at one minute. Have either of these changed recently? Or are these existing problems?

I remember Sword Art Online definitely had this issue before, and it was related to gpu timing. It's possible it still is if it's affected by # of people on the street.

-[Unknown]

unknownbrackets avatar Jun 29 '14 01:06 unknownbrackets

Yes,Sword Art Online is alway happening.Gebsou Suikoden 1&2 before is speedup BGM when that happen.

daniel229 avatar Jun 29 '14 01:06 daniel229

Is there a trick to getting that many people in the same place in SAO? I can't make it happen.

What does "Cycles executed" say under Debug -> Show Debug Statistics when this happens? I only get it going as high as 1.7 million (frame budget should be 7.4 million including CPU.)

-[Unknown]

unknownbrackets avatar Jun 29 '14 02:06 unknownbrackets

I don't know a trick to do that,just acrossing the street over and over again to see if many people there,the area in the video may easy to do that. Cycles executed just about 1.7million when it lagging. 01

daniel229 avatar Jun 29 '14 02:06 daniel229

Or using the savestate.(rename jpg to rar) npjh50701_1 00_0

daniel229 avatar Jun 29 '14 03:06 daniel229

This game spends a ton of time in interp VV2Op (11%) during this time. Interesting. Also VecDo3 and VVectorInit. AFAICT it is actually cpu limited.

If I double every cpu instruction cost, it drops to 12 fps. If instead I make the GPU take 0 cycles, it still runs at 20 fps. If I make HLE stuff all completely free, it's still as 20 fps. If I make all instructions take half a cycle, it goes to 30 fps.

So, it seems like it's running too many CPU cycles. Either this really happens on a PSP, or somehow we are triggering it to do things on the CPU it otherwise shouldn't be doing. Or we're missing a 333, let me check the mhz...

-[Unknown]

unknownbrackets avatar Jun 30 '14 01:06 unknownbrackets

PSP drop to 20fps more often.3+3+2 people would drop,and drop more fps if more people,but the game doesn't slow down.PPSSPP need 3+3+3+2 people.

daniel229 avatar Jun 30 '14 02:06 daniel229

Ah. Well, with that in mind, it's definitely not GPU cycles. Even if I reduce them significantly, it's still sluggish.

Hmm. I guess we could try comparing with JpcspTrace? I tried making some HLE funcs eat more or less cycles but I can't seem to affect it significantly.

It seems to call sceKernelPollEventFlag once per frame. So during 20 fps that should be 20 times per second in a JpcspTrace log. That might show if something is wrong with the timing for psp_base.

It spends the lion's share of time there on that thread... the only other thing that could be affecting timing I can see is a GE interrupt. Doesn't seem like it, though...

Most interesting funcs: sceAtracLowLevelDecode (2x per frame it seems like) sceKernelGetSystemTimeLow (only called in GE handler, and beginning + end of frame) sceDisplayGetVcount (doesn't seem like used for timing...) sceAudioOutput2OutputBlocking (many times per frame) sceDisplayWaitVblankStartMultiCB (1x per frame)

I don't see anything obvious...

-[Unknown]

unknownbrackets avatar Jun 30 '14 04:06 unknownbrackets

sceKernelPollEventFlag seems no problem.

daniel229 avatar Jun 30 '14 05:06 daniel229

It seems like this is vfpu cycle timing related.

If I just double the estimate for all vfpu ops, it's still 20 fps, but there's no slowdown:

// TODO: Do something that makes sense here.
int MIPSGetInstructionCycleEstimate(MIPSOpcode op)
{
    MIPSInfo info = MIPSGetInfo(op);
    if (info & IS_VFPU)
        return 2;
    else if (info & DELAYSLOT)
        return 2;
    else
        return 1;
}

At least, in that particular scene.

-[Unknown]

unknownbrackets avatar Aug 06 '16 17:08 unknownbrackets

Sword Art Online uses 333 MHz. when I underclock the CPU to 222 MHz the game dips down to 20 fps when the too many NPCs on screen

Panderner avatar Mar 19 '20 14:03 Panderner

And this is why Sword Art Online runs horrible frame rate on a real PSP

Panderner avatar May 09 '20 14:05 Panderner

How about this now?

Gamemulatorer avatar Sep 27 '22 02:09 Gamemulatorer

Just to note, I did essentially double VFPU op timings in #14365. Should probably do more tests for more instructions, I think the matrix ones are generally slower too.

-[Unknown]

unknownbrackets avatar Sep 27 '22 02:09 unknownbrackets

This is a CPU Timing related? https://github.com/hrydgard/ppsspp/pull/16984 might help this?

ghost avatar Feb 21 '23 17:02 ghost

No, #16984 doesn't change timings.

hrydgard avatar Feb 21 '23 19:02 hrydgard

No, #16984 doesn't change timings.

Ah ok. But this still related to CPU Emulation?

ghost avatar Feb 22 '23 01:02 ghost

It's possible this might be better already. But yes, it's probably a good idea to time vsin/vcos as they might be slower than most other instructions.

This issue is about timing, which could be CPU emulation, HLE functions, or even graphics. I had seen in Sword Art Online specifically that vfpu timing affected it (although it was still 20 FPS, which I'm not sure if is correct or not), but that doesn't mean Gensou Suikoden is the same issue.

-[Unknown]

unknownbrackets avatar Feb 22 '23 04:02 unknownbrackets