mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-27 04:08:37 +01:00
Don't eat extra cycles when idling.
Rescheduling between threads takes about 3000 cycles, but that's not true for both sides of e.g. a delay. Fixes #6409 (assuming 60fps is what a PSP gets.)
This commit is contained in:
1 parent
cc269488b2
commit
118736ff75
1 file changed
+9
-3
@@ -3216,9 +3216,9 @@ void __KernelSwitchContext(Thread *target, const char *reason)
|
||||
else
|
||||
__SetCurrentThread(NULL, 0, NULL);
|
||||
|
||||
const bool fromIdle = oldUID == threadIdleID[0] || oldUID == threadIdleID[1];
|
||||
const bool toIdle = currentThread == threadIdleID[0] || currentThread == threadIdleID[1];
|
||||
#if DEBUG_LEVEL <= MAX_LOGLEVEL || DEBUG_LOG == NOTICE_LOG
|
||||
bool fromIdle = oldUID == threadIdleID[0] || oldUID == threadIdleID[1];
|
||||
bool toIdle = currentThread == threadIdleID[0] || currentThread == threadIdleID[1];
|
||||
if (!(fromIdle && toIdle))
|
||||
{
|
||||
u64 nowCycles = CoreTiming::GetTicks();
|
||||
@@ -3235,7 +3235,13 @@ void __KernelSwitchContext(Thread *target, const char *reason)
|
||||
#endif
|
||||
|
||||
// Switching threads eats some cycles. This is a low approximation.
|
||||
currentMIPS->downcount -= 3000;
|
||||
if (fromIdle && toIdle) {
|
||||
// Don't eat any cycles going between idle.
|
||||
} else if (fromIdle || toIdle) {
|
||||
currentMIPS->downcount -= 1500;
|
||||
} else {
|
||||
currentMIPS->downcount -= 3000;
|
||||
}
|
||||
|
||||
if (target)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user