Android: Add "Synchronize GPU Thread" setting (SyncOnSkipIdle/SyncGPU)

Many Android users want to disable SyncOnSkipIdle as a performance
hack, to the point where it's often suggested as something to
paste into Dolphin.ini (if not to use a fork). If adding it as
a setting in the GUI gives us an opportunity to explain what the
setting actually does and stops people from pasting stuff they
don't understand into INI files, I think it can be worth adding
despite how it can make games unstable. It not being in the GUI
doesn't seem to be stopping people from disabling it anyway.

The added setting in the GUI is a three-way setting called
"Synchronize GPU Thread" with the following alternatives:

"Never":            SyncGPU = False, SyncOnIdleSkip = False
"On Idle Skipping": SyncGPU = False, SyncOnIdleSkip = True
"Always":           SyncGPU = True,  SyncOnIdleSkip = True
This commit is contained in:
JosJuice 2021-03-28 15:07:41 +02:00
parent 8d2b0fff8a
commit ed5e61a250
4 changed files with 83 additions and 0 deletions

View File

@ -11,6 +11,7 @@ public enum BooleanSetting implements AbstractBooleanSetting
MAIN_DSP_HLE(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "DSPHLE", true), MAIN_DSP_HLE(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "DSPHLE", true),
MAIN_FASTMEM(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "Fastmem", true), MAIN_FASTMEM(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "Fastmem", true),
MAIN_CPU_THREAD(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "CPUThread", true), MAIN_CPU_THREAD(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "CPUThread", true),
MAIN_SYNC_ON_SKIP_IDLE(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "SyncOnSkipIdle", true),
MAIN_OVERRIDE_REGION_SETTINGS(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, MAIN_OVERRIDE_REGION_SETTINGS(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE,
"OverrideRegionSettings", false), "OverrideRegionSettings", false),
MAIN_AUDIO_STRETCH(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "AudioStretch", false), MAIN_AUDIO_STRETCH(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "AudioStretch", false),
@ -19,6 +20,7 @@ public enum BooleanSetting implements AbstractBooleanSetting
"WiimoteContinuousScanning", false), "WiimoteContinuousScanning", false),
MAIN_WIIMOTE_ENABLE_SPEAKER(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, MAIN_WIIMOTE_ENABLE_SPEAKER(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE,
"WiimoteEnableSpeaker", false), "WiimoteEnableSpeaker", false),
MAIN_SYNC_GPU(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "SyncGPU", false),
MAIN_OVERCLOCK_ENABLE(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "OverclockEnable", false), MAIN_OVERCLOCK_ENABLE(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "OverclockEnable", false),
MAIN_AUTO_DISC_CHANGE(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "AutoDiscChange", false), MAIN_AUTO_DISC_CHANGE(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "AutoDiscChange", false),
MAIN_ALLOW_SD_WRITES(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "WiiSDCardAllowWrites", MAIN_ALLOW_SD_WRITES(Settings.FILE_DOLPHIN, Settings.SECTION_INI_CORE, "WiiSDCardAllowWrites",

View File

@ -434,6 +434,71 @@ public final class SettingsFragmentPresenter
private void addAdvancedSettings(ArrayList<SettingsItem> sl) private void addAdvancedSettings(ArrayList<SettingsItem> sl)
{ {
final int SYNC_GPU_NEVER = 0;
final int SYNC_GPU_ON_IDLE_SKIP = 1;
final int SYNC_GPU_ALWAYS = 2;
AbstractIntSetting synchronizeGpuThread = new AbstractIntSetting()
{
@Override
public int getInt(Settings settings)
{
if (BooleanSetting.MAIN_SYNC_GPU.getBoolean(settings))
{
return SYNC_GPU_ALWAYS;
}
else
{
boolean syncOnSkipIdle = BooleanSetting.MAIN_SYNC_ON_SKIP_IDLE.getBoolean(settings);
return syncOnSkipIdle ? SYNC_GPU_ON_IDLE_SKIP : SYNC_GPU_NEVER;
}
}
@Override
public void setInt(Settings settings, int newValue)
{
switch (newValue)
{
case SYNC_GPU_NEVER:
BooleanSetting.MAIN_SYNC_ON_SKIP_IDLE.setBoolean(settings, false);
BooleanSetting.MAIN_SYNC_GPU.setBoolean(settings, false);
break;
case SYNC_GPU_ON_IDLE_SKIP:
BooleanSetting.MAIN_SYNC_ON_SKIP_IDLE.setBoolean(settings, true);
BooleanSetting.MAIN_SYNC_GPU.setBoolean(settings, false);
break;
case SYNC_GPU_ALWAYS:
BooleanSetting.MAIN_SYNC_ON_SKIP_IDLE.setBoolean(settings, true);
BooleanSetting.MAIN_SYNC_GPU.setBoolean(settings, true);
break;
}
}
@Override
public boolean isOverridden(Settings settings)
{
return BooleanSetting.MAIN_SYNC_ON_SKIP_IDLE.isOverridden(settings) ||
BooleanSetting.MAIN_SYNC_GPU.isOverridden(settings);
}
@Override
public boolean isRuntimeEditable()
{
return BooleanSetting.MAIN_SYNC_ON_SKIP_IDLE.isRuntimeEditable() &&
BooleanSetting.MAIN_SYNC_GPU.isRuntimeEditable();
}
@Override
public boolean delete(Settings settings)
{
// Not short circuiting
return BooleanSetting.MAIN_SYNC_ON_SKIP_IDLE.delete(settings) &
BooleanSetting.MAIN_SYNC_GPU.delete(settings);
}
};
// TODO: Having different emuCoresEntries/emuCoresValues for each architecture is annoying. // TODO: Having different emuCoresEntries/emuCoresValues for each architecture is annoying.
// The proper solution would be to have one set of entries and one set of values // The proper solution would be to have one set of entries and one set of values
// and exclude the values that aren't present in PowerPC::AvailableCPUCores(). // and exclude the values that aren't present in PowerPC::AvailableCPUCores().
@ -461,6 +526,9 @@ public final class SettingsFragmentPresenter
R.string.overclock_enable_description)); R.string.overclock_enable_description));
sl.add(new PercentSliderSetting(FloatSetting.MAIN_OVERCLOCK, R.string.overclock_title, sl.add(new PercentSliderSetting(FloatSetting.MAIN_OVERCLOCK, R.string.overclock_title,
R.string.overclock_title_description, 0, 400, "%")); R.string.overclock_title_description, 0, 400, "%"));
sl.add(new SingleChoiceSetting(synchronizeGpuThread, R.string.synchronize_gpu_thread,
R.string.synchronize_gpu_thread_description, R.array.synchronizeGpuThreadEntries,
R.array.synchronizeGpuThreadValues));
} }
private void addGcPadSettings(ArrayList<SettingsItem> sl) private void addGcPadSettings(ArrayList<SettingsItem> sl)

View File

@ -447,6 +447,17 @@
<item>-1</item> <item>-1</item>
</integer-array> </integer-array>
<string-array name="synchronizeGpuThreadEntries">
<item>Never</item>
<item>On Idle Skipping</item>
<item>Always</item>
</string-array>
<integer-array name="synchronizeGpuThreadValues">
<item>0</item>
<item>1</item>
<item>2</item>
</integer-array>
<string-array name="motionControlsEntries"> <string-array name="motionControlsEntries">
<item>Use Device Sensors (With Pointer Emulation)</item> <item>Use Device Sensors (With Pointer Emulation)</item>
<item>Use Device Sensors (Without Pointer Emulation)</item> <item>Use Device Sensors (Without Pointer Emulation)</item>

View File

@ -286,6 +286,8 @@
<string name="overclock_enable_description">Higher values can make variable-framerate games run at a higher framerate, requiring a powerful device. Lower values make games run at a lower framerate, increasing emulation speed, but reducing the emulated console\'s performance.</string> <string name="overclock_enable_description">Higher values can make variable-framerate games run at a higher framerate, requiring a powerful device. Lower values make games run at a lower framerate, increasing emulation speed, but reducing the emulated console\'s performance.</string>
<string name="overclock_title">Emulated CPU Clock Speed</string> <string name="overclock_title">Emulated CPU Clock Speed</string>
<string name="overclock_title_description">Adjusts the emulated CPU\'s clock rate if \"Override Emulated CPU Clock Speed\" is enabled.</string> <string name="overclock_title_description">Adjusts the emulated CPU\'s clock rate if \"Override Emulated CPU Clock Speed\" is enabled.</string>
<string name="synchronize_gpu_thread">Synchronize GPU Thread</string>
<string name="synchronize_gpu_thread_description">Synchronizing the GPU thread reduces the risk of games crashing or becoming unstable with dual core enabled, but can also reduce the performance gain of dual core. If unsure, select \"On Idle Skipping\". Selecting \"Never\" is risky and not recommended!</string>
<!-- Log Configuration --> <!-- Log Configuration -->
<string name="log_submenu">Log</string> <string name="log_submenu">Log</string>