mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Reduce refresh rate checks.
These turned out to be unexpectedly expensive, so cache the value and also try to check it a bit less.
This commit is contained in:
parent
008055d242
commit
e39980fc73
2 changed files with 18 additions and 13 deletions
|
@ -207,8 +207,6 @@ void UpdateRunLoop(GraphicsContext *ctx) {
|
|||
|
||||
// Note: not used on Android.
|
||||
void Core_RunLoop(GraphicsContext *ctx) {
|
||||
float refreshRate = System_GetPropertyFloat(SYSPROP_DISPLAY_REFRESH_RATE);
|
||||
|
||||
if (windowHidden && g_Config.bPauseWhenMinimized) {
|
||||
sleep_ms(16);
|
||||
return;
|
||||
|
@ -224,6 +222,7 @@ void Core_RunLoop(GraphicsContext *ctx) {
|
|||
NativeFrame(ctx);
|
||||
|
||||
if (menuThrottle) {
|
||||
float refreshRate = System_GetPropertyFloat(SYSPROP_DISPLAY_REFRESH_RATE);
|
||||
// Simple throttling to not burn the GPU in the menu.
|
||||
// TODO: This should move into NativeFrame. Also, it's only necessary in MAILBOX or IMMEDIATE presentation modes.
|
||||
double diffTime = time_now_d() - startTime;
|
||||
|
|
|
@ -283,22 +283,28 @@ static int ScreenDPI() {
|
|||
#endif
|
||||
|
||||
static int ScreenRefreshRateHz() {
|
||||
DEVMODE lpDevMode;
|
||||
memset(&lpDevMode, 0, sizeof(DEVMODE));
|
||||
lpDevMode.dmSize = sizeof(DEVMODE);
|
||||
lpDevMode.dmDriverExtra = 0;
|
||||
static int rate = 0;
|
||||
static double lastCheck = 0.0;
|
||||
double now = time_now_d();
|
||||
if (!rate || lastCheck < now - 10.0) {
|
||||
lastCheck = now;
|
||||
DEVMODE lpDevMode{};
|
||||
lpDevMode.dmSize = sizeof(DEVMODE);
|
||||
lpDevMode.dmDriverExtra = 0;
|
||||
|
||||
// TODO: Use QueryDisplayConfig instead (Win7+) so we can get fractional refresh rates correctly.
|
||||
// TODO: Use QueryDisplayConfig instead (Win7+) so we can get fractional refresh rates correctly.
|
||||
|
||||
if (EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &lpDevMode) == 0) {
|
||||
return 60; // default value
|
||||
} else {
|
||||
if (lpDevMode.dmFields & DM_DISPLAYFREQUENCY) {
|
||||
return lpDevMode.dmDisplayFrequency > 60 ? lpDevMode.dmDisplayFrequency : 60;
|
||||
if (EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &lpDevMode) == 0) {
|
||||
rate = 60; // default value
|
||||
} else {
|
||||
return 60;
|
||||
if (lpDevMode.dmFields & DM_DISPLAYFREQUENCY) {
|
||||
rate = lpDevMode.dmDisplayFrequency > 60 ? lpDevMode.dmDisplayFrequency : 60;
|
||||
} else {
|
||||
rate = 60;
|
||||
}
|
||||
}
|
||||
}
|
||||
return rate;
|
||||
}
|
||||
|
||||
int System_GetPropertyInt(SystemProperty prop) {
|
||||
|
|
Loading…
Add table
Reference in a new issue