Remove 63 Hz cap for > 60 FPS streams

This commit is contained in:
Cameron Gutman 2018-11-30 19:49:14 -08:00
parent 795f0a013b
commit 4930087c4d

View File

@ -497,8 +497,7 @@ public class Game extends Activity implements SurfaceHolder.Callback,
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
Display.Mode bestMode = display.getMode(); Display.Mode bestMode = display.getMode();
for (Display.Mode candidate : display.getSupportedModes()) { for (Display.Mode candidate : display.getSupportedModes()) {
boolean refreshRateOk = candidate.getRefreshRate() >= bestMode.getRefreshRate() && boolean refreshRateOk = candidate.getRefreshRate() >= bestMode.getRefreshRate();
candidate.getRefreshRate() < 63;
boolean resolutionOk = candidate.getPhysicalWidth() >= bestMode.getPhysicalWidth() && boolean resolutionOk = candidate.getPhysicalWidth() >= bestMode.getPhysicalWidth() &&
candidate.getPhysicalHeight() >= bestMode.getPhysicalHeight() && candidate.getPhysicalHeight() >= bestMode.getPhysicalHeight() &&
candidate.getPhysicalWidth() <= 4096; candidate.getPhysicalWidth() <= 4096;
@ -514,6 +513,13 @@ public class Game extends Activity implements SurfaceHolder.Callback,
} }
} }
// Ensure the frame rate stays around 60 Hz for <= 60 FPS streams
if (prefConfig.fps <= 60) {
if (candidate.getRefreshRate() >= 63) {
continue;
}
}
// Make sure the refresh rate doesn't regress // Make sure the refresh rate doesn't regress
if (!refreshRateOk) { if (!refreshRateOk) {
continue; continue;
@ -531,12 +537,20 @@ public class Game extends Activity implements SurfaceHolder.Callback,
windowLayoutParams.preferredDisplayModeId = bestMode.getModeId(); windowLayoutParams.preferredDisplayModeId = bestMode.getModeId();
displayRefreshRate = bestMode.getRefreshRate(); displayRefreshRate = bestMode.getRefreshRate();
} }
// On L, we can at least tell the OS that we want 60 Hz // On L, we can at least tell the OS that we want a refresh rate
else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
float bestRefreshRate = display.getRefreshRate(); float bestRefreshRate = display.getRefreshRate();
for (float candidate : display.getSupportedRefreshRates()) { for (float candidate : display.getSupportedRefreshRates()) {
if (candidate > bestRefreshRate && candidate < 63) { if (candidate > bestRefreshRate) {
LimeLog.info("Examining refresh rate: "+candidate); LimeLog.info("Examining refresh rate: "+candidate);
// Ensure the frame rate stays around 60 Hz for <= 60 FPS streams
if (prefConfig.fps <= 60) {
if (candidate >= 63) {
continue;
}
}
bestRefreshRate = candidate; bestRefreshRate = candidate;
} }
} }