Don't reduce refresh rate by default in balanced mode

This commit is contained in:
Cameron Gutman
2022-09-06 20:21:53 -05:00
parent b653694860
commit 5ac0939731
4 changed files with 20 additions and 4 deletions
+9 -4
View File
@@ -719,6 +719,12 @@ public class Game extends Activity implements SurfaceHolder.Callback,
return false; return false;
} }
private boolean mayReduceRefreshRate() {
return prefConfig.framePacing == PreferenceConfiguration.FRAME_PACING_CAP_FPS ||
prefConfig.framePacing == PreferenceConfiguration.FRAME_PACING_MAX_SMOOTHNESS ||
(prefConfig.framePacing == PreferenceConfiguration.FRAME_PACING_BALANCED && prefConfig.reduceRefreshRate);
}
private float prepareDisplayForRendering() { private float prepareDisplayForRendering() {
Display display = getWindowManager().getDefaultDisplay(); Display display = getWindowManager().getDefaultDisplay();
WindowManager.LayoutParams windowLayoutParams = getWindow().getAttributes(); WindowManager.LayoutParams windowLayoutParams = getWindow().getAttributes();
@@ -763,8 +769,7 @@ public class Game extends Activity implements SurfaceHolder.Callback,
continue; continue;
} }
if (prefConfig.framePacing != PreferenceConfiguration.FRAME_PACING_MIN_LATENCY && if (mayReduceRefreshRate() && refreshRateIsEqual && !isRefreshRateEqualMatch(candidate.getRefreshRate())) {
refreshRateIsEqual && !isRefreshRateEqualMatch(candidate.getRefreshRate())) {
// If we had an equal refresh rate and this one is not, skip it. In min latency // If we had an equal refresh rate and this one is not, skip it. In min latency
// mode, we want to always prefer the highest frame rate even though it may cause // mode, we want to always prefer the highest frame rate even though it may cause
// microstuttering. // microstuttering.
@@ -778,9 +783,9 @@ public class Game extends Activity implements SurfaceHolder.Callback,
} }
// We don't want ever reduce our refresh rate unless we found an exact // We don't want ever reduce our refresh rate unless we found an exact
// match and we're not in min latency mode. // match and refresh rate reduction is allowed by user preferences
if (refreshRateReduced) { if (refreshRateReduced) {
if (prefConfig.framePacing == PreferenceConfiguration.FRAME_PACING_MIN_LATENCY) { if (!mayReduceRefreshRate()) {
continue; continue;
} }
else if (!isRefreshRateEqualMatch(candidate.getRefreshRate())) { else if (!isRefreshRateEqualMatch(candidate.getRefreshRate())) {
@@ -46,6 +46,7 @@ public class PreferenceConfiguration {
private static final String FRAME_PACING_PREF_STRING = "frame_pacing"; private static final String FRAME_PACING_PREF_STRING = "frame_pacing";
private static final String ABSOLUTE_MOUSE_MODE_PREF_STRING = "checkbox_absolute_mouse_mode"; private static final String ABSOLUTE_MOUSE_MODE_PREF_STRING = "checkbox_absolute_mouse_mode";
private static final String ENABLE_AUDIO_FX_PREF_STRING = "checkbox_enable_audiofx"; private static final String ENABLE_AUDIO_FX_PREF_STRING = "checkbox_enable_audiofx";
private static final String REDUCE_REFRESH_RATE_PREF_STRING = "checkbox_reduce_refresh_rate";
static final String DEFAULT_RESOLUTION = "1280x720"; static final String DEFAULT_RESOLUTION = "1280x720";
static final String DEFAULT_FPS = "60"; static final String DEFAULT_FPS = "60";
@@ -77,6 +78,7 @@ public class PreferenceConfiguration {
private static final String DEFAULT_FRAME_PACING = "latency"; private static final String DEFAULT_FRAME_PACING = "latency";
private static final boolean DEFAULT_ABSOLUTE_MOUSE_MODE = false; private static final boolean DEFAULT_ABSOLUTE_MOUSE_MODE = false;
private static final boolean DEFAULT_ENABLE_AUDIO_FX = false; private static final boolean DEFAULT_ENABLE_AUDIO_FX = false;
private static final boolean DEFAULT_REDUCE_REFRESH_RATE = false;
public static final int FORCE_H265_ON = -1; public static final int FORCE_H265_ON = -1;
public static final int AUTOSELECT_H265 = 0; public static final int AUTOSELECT_H265 = 0;
@@ -120,6 +122,7 @@ public class PreferenceConfiguration {
public int framePacing; public int framePacing;
public boolean absoluteMouseMode; public boolean absoluteMouseMode;
public boolean enableAudioFx; public boolean enableAudioFx;
public boolean reduceRefreshRate;
public static boolean isNativeResolution(int width, int height) { public static boolean isNativeResolution(int width, int height) {
// It's not a native resolution if it matches an existing resolution option // It's not a native resolution if it matches an existing resolution option
@@ -475,6 +478,7 @@ public class PreferenceConfiguration {
config.enableLatencyToast = prefs.getBoolean(LATENCY_TOAST_PREF_STRING, DEFAULT_LATENCY_TOAST); config.enableLatencyToast = prefs.getBoolean(LATENCY_TOAST_PREF_STRING, DEFAULT_LATENCY_TOAST);
config.absoluteMouseMode = prefs.getBoolean(ABSOLUTE_MOUSE_MODE_PREF_STRING, DEFAULT_ABSOLUTE_MOUSE_MODE); config.absoluteMouseMode = prefs.getBoolean(ABSOLUTE_MOUSE_MODE_PREF_STRING, DEFAULT_ABSOLUTE_MOUSE_MODE);
config.enableAudioFx = prefs.getBoolean(ENABLE_AUDIO_FX_PREF_STRING, DEFAULT_ENABLE_AUDIO_FX); config.enableAudioFx = prefs.getBoolean(ENABLE_AUDIO_FX_PREF_STRING, DEFAULT_ENABLE_AUDIO_FX);
config.reduceRefreshRate = prefs.getBoolean(REDUCE_REFRESH_RATE_PREF_STRING, DEFAULT_REDUCE_REFRESH_RATE);
return config; return config;
} }
+2
View File
@@ -216,6 +216,8 @@
<string name="category_advanced_settings">Advanced Settings</string> <string name="category_advanced_settings">Advanced Settings</string>
<string name="title_unlock_fps">Unlock all possible frame rates</string> <string name="title_unlock_fps">Unlock all possible frame rates</string>
<string name="summary_unlock_fps">Streaming at 90 or 120 FPS may reduce latency on high-end devices but can cause lag or instability on devices that can\'t support it</string> <string name="summary_unlock_fps">Streaming at 90 or 120 FPS may reduce latency on high-end devices but can cause lag or instability on devices that can\'t support it</string>
<string name="title_checkbox_reduce_refresh_rate">Allow refresh rate reduction</string>
<string name="summary_checkbox_reduce_refresh_rate">Lower display refresh rates can save power at the expense of some additional video latency</string>
<string name="title_checkbox_disable_warnings">Disable warning messages</string> <string name="title_checkbox_disable_warnings">Disable warning messages</string>
<string name="summary_checkbox_disable_warnings">Disable on-screen connection warning messages while streaming</string> <string name="summary_checkbox_disable_warnings">Disable on-screen connection warning messages while streaming</string>
<string name="title_disable_frame_drop">Never drop frames</string> <string name="title_disable_frame_drop">Never drop frames</string>
+5
View File
@@ -189,6 +189,11 @@
android:title="@string/title_unlock_fps" android:title="@string/title_unlock_fps"
android:summary="@string/summary_unlock_fps" android:summary="@string/summary_unlock_fps"
android:defaultValue="false" /> android:defaultValue="false" />
<CheckBoxPreference
android:key="checkbox_reduce_refresh_rate"
android:title="@string/title_checkbox_reduce_refresh_rate"
android:summary="@string/summary_checkbox_reduce_refresh_rate"
android:defaultValue="false" />
<CheckBoxPreference <CheckBoxPreference
android:key="checkbox_disable_warnings" android:key="checkbox_disable_warnings"
android:title="@string/title_checkbox_disable_warnings" android:title="@string/title_checkbox_disable_warnings"