From 3ca014858fccbe552eecb2c9fb4d0db83b1e036c Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 6 Aug 2016 16:32:57 -0700 Subject: [PATCH 1/2] Display: Flip at least once every 10 frames. If we don't do this, the FPS doesn't update, and on some platforms, we never read input. This can basically mean that PPSSPP will hang. --- Core/HLE/sceDisplay.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Core/HLE/sceDisplay.cpp b/Core/HLE/sceDisplay.cpp index 5500df8a86..b124b5a088 100644 --- a/Core/HLE/sceDisplay.cpp +++ b/Core/HLE/sceDisplay.cpp @@ -625,15 +625,16 @@ void hleEnterVblank(u64 userdata, int cyclesLate) { // We flip only if the framebuffer was dirty. This eliminates flicker when using // non-buffered rendering. The interaction with frame skipping seems to need // some work. - // But, let's flip at least once every 10 frames if possible, since there may be sound effects. - if (gpu->FramebufferDirty() || (g_Config.iRenderingMode != 0 && numVBlanksSinceFlip >= 10)) { + // But, let's flip at least once every 10 vblanks, to update fps, etc. + const bool noRecentFlip = g_Config.iRenderingMode != FB_NON_BUFFERED_MODE && numVBlanksSinceFlip >= 10; + if (gpu->FramebufferDirty() || noRecentFlip) { if (g_Config.iShowFPSCounter && g_Config.iShowFPSCounter < 4) { CalculateFPS(); } // Setting CORE_NEXTFRAME causes a swap. // Check first though, might've just quit / been paused. - if (gpu->FramebufferReallyDirty()) { + if (gpu->FramebufferReallyDirty() || noRecentFlip) { if (coreState == CORE_RUNNING) { coreState = CORE_NEXTFRAME; gpu->CopyDisplayToOutput(); From ee3c8b6ea59b1f9b55c1ca95b22ade44d443f57f Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 6 Aug 2016 16:47:33 -0700 Subject: [PATCH 2/2] Display: Don't count a forced NEXTFRAME as a flip. --- Core/HLE/sceDisplay.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Core/HLE/sceDisplay.cpp b/Core/HLE/sceDisplay.cpp index b124b5a088..57edab65b6 100644 --- a/Core/HLE/sceDisplay.cpp +++ b/Core/HLE/sceDisplay.cpp @@ -627,22 +627,28 @@ void hleEnterVblank(u64 userdata, int cyclesLate) { // some work. // But, let's flip at least once every 10 vblanks, to update fps, etc. const bool noRecentFlip = g_Config.iRenderingMode != FB_NON_BUFFERED_MODE && numVBlanksSinceFlip >= 10; - if (gpu->FramebufferDirty() || noRecentFlip) { + const bool fbDirty = gpu->FramebufferDirty(); + if (fbDirty || noRecentFlip) { if (g_Config.iShowFPSCounter && g_Config.iShowFPSCounter < 4) { CalculateFPS(); } // Setting CORE_NEXTFRAME causes a swap. // Check first though, might've just quit / been paused. - if (gpu->FramebufferReallyDirty() || noRecentFlip) { + const bool fbReallyDirty = gpu->FramebufferReallyDirty(); + if (fbReallyDirty || noRecentFlip) { if (coreState == CORE_RUNNING) { coreState = CORE_NEXTFRAME; gpu->CopyDisplayToOutput(); - actualFlips++; + if (fbReallyDirty) { + actualFlips++; + } } } - gpuStats.numFlips++; + if (fbDirty) { + gpuStats.numFlips++; + } bool throttle, skipFrame; DoFrameTiming(throttle, skipFrame, (float)numVBlanksSinceFlip * timePerVblank);