From 867293dd1752881cb5c48b1bc8689da56da4ae8b Mon Sep 17 00:00:00 2001 From: LunaMoo Date: Mon, 15 Jan 2018 13:00:51 +0100 Subject: [PATCH] Add 60Hz sync option for testing(don't think it's required for AMD) Fix profiler merge messup. --- Core/Config.cpp | 1 + Core/Config.h | 1 + Core/HLE/sceDisplay.cpp | 4 ++++ UI/GameSettingsScreen.cpp | 1 + UI/ProfilerDraw.cpp | 8 +++++--- 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Core/Config.cpp b/Core/Config.cpp index 255870578d7e..a36c88615303 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -521,6 +521,7 @@ static ConfigSetting graphicsSettings[] = { ConfigSetting("RestartRequired", &g_Config.bRestartRequired, false, false), #endif ReportedConfigSetting("ForceMaxEmulatedFPS", &g_Config.iForceMaxEmulatedFPS, 60, true, true), + ConfigSetting("RefreshAt60Hz", &g_Config.bRefreshAt60Hz, false, true, true), // Most low-performance (and many high performance) mobile GPUs do not support aniso anyway so defaulting to 4 is fine. ConfigSetting("AnisotropyLevel", &g_Config.iAnisotropyLevel, 4, true, true), diff --git a/Core/Config.h b/Core/Config.h index 5bd7b8598f68..48567afab3db 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -202,6 +202,7 @@ struct Config { int iTexScalingType; // 0 = xBRZ, 1 = Hybrid bool bTexDeposterize; int iFpsLimit; + bool bRefreshAt60Hz; bool bUnToggleFpsLimit; int iForceMaxEmulatedFPS; int iMaxRecent; diff --git a/Core/HLE/sceDisplay.cpp b/Core/HLE/sceDisplay.cpp index 6addbee0ae98..5e4977479b5e 100644 --- a/Core/HLE/sceDisplay.cpp +++ b/Core/HLE/sceDisplay.cpp @@ -528,6 +528,8 @@ static void DoFrameTiming(bool &throttle, bool &skipFrame, float timestep) { time_update(); float scaledTimestep = timestep; + if (g_Config.bRefreshAt60Hz) + scaledTimestep = scaledTimestep * 1.001f; if (fpsLimiter == FPS_LIMIT_CUSTOM && g_Config.iFpsLimit != 0) { scaledTimestep *= 60.0f / g_Config.iFpsLimit; } @@ -601,6 +603,8 @@ static void DoFrameIdleTiming() { } float scaledVblank = timePerVblank; + if (g_Config.bRefreshAt60Hz) + scaledVblank = scaledVblank * 1.001f; if (PSP_CoreParameter().fpsLimit == FPS_LIMIT_CUSTOM) { // 0 is handled in FrameTimingThrottled(). scaledVblank *= 60.0f / g_Config.iFpsLimit; diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 4ecc1ffcfc87..8e4f6530df8d 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -1308,6 +1308,7 @@ void OtherSettingsScreen::CreateViews() { emulatedSpeed->SetZeroLabel(gr->T("Disabled")); list->Add(new CheckBox(&g_Config.bShowFrameProfiler, gr->T("Display frame profiler(heavy!)"))); list->Add(new CheckBox(&g_Config.bSimpleFrameStats, gr->T("Display simple frame stats(heavy!)"))); + list->Add(new CheckBox(&g_Config.bRefreshAt60Hz, gr->T("Refresh at 60Hz(might help some gpu's to avoid stutter)"))); } void OtherSettingsScreen::onFinish(DialogResult result) { diff --git a/UI/ProfilerDraw.cpp b/UI/ProfilerDraw.cpp index 6ffa3383a4aa..59fd2d71fc92 100644 --- a/UI/ProfilerDraw.cpp +++ b/UI/ProfilerDraw.cpp @@ -160,7 +160,7 @@ void DrawProfile(UIContext &ui) { if (catStatus[i] == PROFILE_CAT_IGNORE) { continue; } - Profiler_GetHistory(i, &history[0], historyLength); + Profiler_GetSlowestHistory(i, &slowestThread[0], &history[0], historyLength); float x = 10; uint32_t col = nice_colors[i % ARRAY_SIZE(nice_colors)]; @@ -191,7 +191,6 @@ void DrawProfile(UIContext &ui) { } } } - Profiler_GetSlowestHistory(i, &slowestThread[0], &history[0], historyLength); for (int n = 0; n < historyLength; n++) { if (total[n] > maxTotal) @@ -215,8 +214,11 @@ void DrawProfile(UIContext &ui) { float legendMinVal = lastMaxVal * (1.0f / 120.0f); std::vector history(historyLength); + std::vector slowestThread(historyLength); std::vector catStatus(numCategories); + Profiler_GetSlowestThreads(&slowestThread[0], historyLength); + float rowH = 30.0f; float legendHeight = 0.0f; float legendWidth = 80.0f; @@ -234,7 +236,7 @@ void DrawProfile(UIContext &ui) { int numberOfFrames = 30; for (int i = 0; i < numCategories; i++) { const char *name = Profiler_GetCategoryName(i); - Profiler_GetHistory(i, &history[0], numberOfFrames); + Profiler_GetSlowestHistory(i, &slowestThread[0], &history[0], historyLength); float val = 0; for (int n = 0; n < numberOfFrames; n++) { val += history[n];