mirror of
https://github.com/GreemDev/Ryujinx
synced 2024-11-22 01:43:23 +01:00
CPU: Add low-power PPTC load mode.
Specifically, this setting causes the translation load core count to get reduced by two-thirds, for lower-power but still fast loading, and for unstable CPUs.
This commit is contained in:
parent
4ee1dff497
commit
0faf3f5709
10 changed files with 60 additions and 32 deletions
|
@ -5,6 +5,9 @@ namespace ARMeilleure
|
||||||
|
|
||||||
public static class Optimizations
|
public static class Optimizations
|
||||||
{
|
{
|
||||||
|
// low-core count PPTC
|
||||||
|
public static bool EcoFriendly { get; set; } = false;
|
||||||
|
|
||||||
public static bool FastFP { get; set; } = true;
|
public static bool FastFP { get; set; } = true;
|
||||||
|
|
||||||
public static bool AllowLcqInFunctionTable { get; set; } = true;
|
public static bool AllowLcqInFunctionTable { get; set; } = true;
|
||||||
|
|
|
@ -795,10 +795,15 @@ namespace ARMeilleure.Translation.PTC
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int degreeOfParallelism = Environment.ProcessorCount;
|
int degreeOfParallelism = Environment.ProcessorCount;
|
||||||
|
|
||||||
|
if (Optimizations.EcoFriendly)
|
||||||
|
degreeOfParallelism /= 3;
|
||||||
|
|
||||||
// If there are enough cores lying around, we leave one alone for other tasks.
|
// If there are enough cores lying around, we leave one alone for other tasks.
|
||||||
if (degreeOfParallelism > 4)
|
if (degreeOfParallelism > 4 && !Optimizations.EcoFriendly)
|
||||||
{
|
{
|
||||||
degreeOfParallelism--;
|
degreeOfParallelism--;
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,9 +76,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal int FindSuitableMemoryTypeIndex(
|
internal int FindSuitableMemoryTypeIndex(uint memoryTypeBits, MemoryPropertyFlags flags)
|
||||||
uint memoryTypeBits,
|
|
||||||
MemoryPropertyFlags flags)
|
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _physicalDevice.PhysicalDeviceMemoryProperties.MemoryTypeCount; i++)
|
for (int i = 0; i < _physicalDevice.PhysicalDeviceMemoryProperties.MemoryTypeCount; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,23 +2,20 @@ using System;
|
||||||
|
|
||||||
namespace Ryujinx.Headless.SDL2
|
namespace Ryujinx.Headless.SDL2
|
||||||
{
|
{
|
||||||
class StatusUpdatedEventArgs : EventArgs
|
class StatusUpdatedEventArgs(
|
||||||
|
bool vSyncEnabled,
|
||||||
|
string dockedMode,
|
||||||
|
string aspectRatio,
|
||||||
|
string gameStatus,
|
||||||
|
string fifoStatus,
|
||||||
|
string gpuName)
|
||||||
|
: EventArgs
|
||||||
{
|
{
|
||||||
public bool VSyncEnabled;
|
public bool VSyncEnabled = vSyncEnabled;
|
||||||
public string DockedMode;
|
public string DockedMode = dockedMode;
|
||||||
public string AspectRatio;
|
public string AspectRatio = aspectRatio;
|
||||||
public string GameStatus;
|
public string GameStatus = gameStatus;
|
||||||
public string FifoStatus;
|
public string FifoStatus = fifoStatus;
|
||||||
public string GpuName;
|
public string GpuName = gpuName;
|
||||||
|
|
||||||
public StatusUpdatedEventArgs(bool vSyncEnabled, string dockedMode, string aspectRatio, string gameStatus, string fifoStatus, string gpuName)
|
|
||||||
{
|
|
||||||
VSyncEnabled = vSyncEnabled;
|
|
||||||
DockedMode = dockedMode;
|
|
||||||
AspectRatio = aspectRatio;
|
|
||||||
GameStatus = gameStatus;
|
|
||||||
FifoStatus = fifoStatus;
|
|
||||||
GpuName = gpuName;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,16 +12,9 @@ namespace Ryujinx.Input.SDL2
|
||||||
{
|
{
|
||||||
class SDL2Keyboard : IKeyboard
|
class SDL2Keyboard : IKeyboard
|
||||||
{
|
{
|
||||||
private class ButtonMappingEntry
|
private readonly record struct ButtonMappingEntry(GamepadButtonInputId To, Key From)
|
||||||
{
|
{
|
||||||
public readonly GamepadButtonInputId To;
|
public bool IsValid => To is not GamepadButtonInputId.Unbound && From is not Key.Unbound;
|
||||||
public readonly Key From;
|
|
||||||
|
|
||||||
public ButtonMappingEntry(GamepadButtonInputId to, Key from)
|
|
||||||
{
|
|
||||||
To = to;
|
|
||||||
From = from;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly object _userMappingLock = new();
|
private readonly object _userMappingLock = new();
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace Ryujinx.UI.Common.Configuration
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The current version of the file format
|
/// The current version of the file format
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const int CurrentVersion = 52;
|
public const int CurrentVersion = 53;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Version of the configuration file format
|
/// Version of the configuration file format
|
||||||
|
@ -207,6 +207,11 @@ namespace Ryujinx.UI.Common.Configuration
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool EnablePtc { get; set; }
|
public bool EnablePtc { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enables or disables low-power profiled translation cache persistency loading
|
||||||
|
/// </summary>
|
||||||
|
public bool EnableLowPowerPtc { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Enables or disables guest Internet access
|
/// Enables or disables guest Internet access
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -327,6 +327,11 @@ namespace Ryujinx.UI.Common.Configuration
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ReactiveObject<bool> EnablePtc { get; private set; }
|
public ReactiveObject<bool> EnablePtc { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enables or disables low-power profiled translation cache persistency loading
|
||||||
|
/// </summary>
|
||||||
|
public ReactiveObject<bool> EnableLowPowerPtc { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Enables or disables guest Internet access
|
/// Enables or disables guest Internet access
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -382,6 +387,8 @@ namespace Ryujinx.UI.Common.Configuration
|
||||||
EnableDockedMode.Event += static (sender, e) => LogValueChange(e, nameof(EnableDockedMode));
|
EnableDockedMode.Event += static (sender, e) => LogValueChange(e, nameof(EnableDockedMode));
|
||||||
EnablePtc = new ReactiveObject<bool>();
|
EnablePtc = new ReactiveObject<bool>();
|
||||||
EnablePtc.Event += static (sender, e) => LogValueChange(e, nameof(EnablePtc));
|
EnablePtc.Event += static (sender, e) => LogValueChange(e, nameof(EnablePtc));
|
||||||
|
EnableLowPowerPtc = new ReactiveObject<bool>();
|
||||||
|
EnableLowPowerPtc.Event += static (sender, e) => LogValueChange(e, nameof(EnableLowPowerPtc));
|
||||||
EnableInternetAccess = new ReactiveObject<bool>();
|
EnableInternetAccess = new ReactiveObject<bool>();
|
||||||
EnableInternetAccess.Event += static (sender, e) => LogValueChange(e, nameof(EnableInternetAccess));
|
EnableInternetAccess.Event += static (sender, e) => LogValueChange(e, nameof(EnableInternetAccess));
|
||||||
EnableFsIntegrityChecks = new ReactiveObject<bool>();
|
EnableFsIntegrityChecks = new ReactiveObject<bool>();
|
||||||
|
@ -706,6 +713,7 @@ namespace Ryujinx.UI.Common.Configuration
|
||||||
EnableMacroHLE = Graphics.EnableMacroHLE,
|
EnableMacroHLE = Graphics.EnableMacroHLE,
|
||||||
EnableColorSpacePassthrough = Graphics.EnableColorSpacePassthrough,
|
EnableColorSpacePassthrough = Graphics.EnableColorSpacePassthrough,
|
||||||
EnablePtc = System.EnablePtc,
|
EnablePtc = System.EnablePtc,
|
||||||
|
EnableLowPowerPtc = System.EnableLowPowerPtc,
|
||||||
EnableInternetAccess = System.EnableInternetAccess,
|
EnableInternetAccess = System.EnableInternetAccess,
|
||||||
EnableFsIntegrityChecks = System.EnableFsIntegrityChecks,
|
EnableFsIntegrityChecks = System.EnableFsIntegrityChecks,
|
||||||
FsGlobalAccessLogMode = System.FsGlobalAccessLogMode,
|
FsGlobalAccessLogMode = System.FsGlobalAccessLogMode,
|
||||||
|
@ -1495,6 +1503,15 @@ namespace Ryujinx.UI.Common.Configuration
|
||||||
configurationFileUpdated = true;
|
configurationFileUpdated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (configurationFileFormat.Version < 53)
|
||||||
|
{
|
||||||
|
Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 53.");
|
||||||
|
|
||||||
|
configurationFileFormat.EnableLowPowerPtc = false;
|
||||||
|
|
||||||
|
configurationFileUpdated = true;
|
||||||
|
}
|
||||||
|
|
||||||
Logger.EnableFileLog.Value = configurationFileFormat.EnableFileLog;
|
Logger.EnableFileLog.Value = configurationFileFormat.EnableFileLog;
|
||||||
Graphics.ResScale.Value = configurationFileFormat.ResScale;
|
Graphics.ResScale.Value = configurationFileFormat.ResScale;
|
||||||
Graphics.ResScaleCustom.Value = configurationFileFormat.ResScaleCustom;
|
Graphics.ResScaleCustom.Value = configurationFileFormat.ResScaleCustom;
|
||||||
|
@ -1534,6 +1551,7 @@ namespace Ryujinx.UI.Common.Configuration
|
||||||
Graphics.EnableMacroHLE.Value = configurationFileFormat.EnableMacroHLE;
|
Graphics.EnableMacroHLE.Value = configurationFileFormat.EnableMacroHLE;
|
||||||
Graphics.EnableColorSpacePassthrough.Value = configurationFileFormat.EnableColorSpacePassthrough;
|
Graphics.EnableColorSpacePassthrough.Value = configurationFileFormat.EnableColorSpacePassthrough;
|
||||||
System.EnablePtc.Value = configurationFileFormat.EnablePtc;
|
System.EnablePtc.Value = configurationFileFormat.EnablePtc;
|
||||||
|
System.EnableLowPowerPtc.Value = configurationFileFormat.EnableLowPowerPtc;
|
||||||
System.EnableInternetAccess.Value = configurationFileFormat.EnableInternetAccess;
|
System.EnableInternetAccess.Value = configurationFileFormat.EnableInternetAccess;
|
||||||
System.EnableFsIntegrityChecks.Value = configurationFileFormat.EnableFsIntegrityChecks;
|
System.EnableFsIntegrityChecks.Value = configurationFileFormat.EnableFsIntegrityChecks;
|
||||||
System.FsGlobalAccessLogMode.Value = configurationFileFormat.FsGlobalAccessLogMode;
|
System.FsGlobalAccessLogMode.Value = configurationFileFormat.FsGlobalAccessLogMode;
|
||||||
|
|
|
@ -406,6 +406,8 @@ namespace Ryujinx.Ava
|
||||||
|
|
||||||
public void Start()
|
public void Start()
|
||||||
{
|
{
|
||||||
|
ARMeilleure.Optimizations.EcoFriendly = ConfigurationState.Instance.System.EnableLowPowerPtc;
|
||||||
|
|
||||||
if (OperatingSystem.IsWindows())
|
if (OperatingSystem.IsWindows())
|
||||||
{
|
{
|
||||||
_windowsMultimediaTimerResolution = new WindowsMultimediaTimerResolution(1);
|
_windowsMultimediaTimerResolution = new WindowsMultimediaTimerResolution(1);
|
||||||
|
|
|
@ -150,6 +150,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||||
public bool EnableMouse { get; set; }
|
public bool EnableMouse { get; set; }
|
||||||
public bool EnableVsync { get; set; }
|
public bool EnableVsync { get; set; }
|
||||||
public bool EnablePptc { get; set; }
|
public bool EnablePptc { get; set; }
|
||||||
|
public bool EnableLowPowerPptc { get; set; }
|
||||||
public bool EnableInternetAccess { get; set; }
|
public bool EnableInternetAccess { get; set; }
|
||||||
public bool EnableFsIntegrityChecks { get; set; }
|
public bool EnableFsIntegrityChecks { get; set; }
|
||||||
public bool IgnoreMissingServices { get; set; }
|
public bool IgnoreMissingServices { get; set; }
|
||||||
|
@ -448,6 +449,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||||
|
|
||||||
// CPU
|
// CPU
|
||||||
EnablePptc = config.System.EnablePtc;
|
EnablePptc = config.System.EnablePtc;
|
||||||
|
EnableLowPowerPptc = config.System.EnableLowPowerPtc;
|
||||||
MemoryMode = (int)config.System.MemoryManagerMode.Value;
|
MemoryMode = (int)config.System.MemoryManagerMode.Value;
|
||||||
UseHypervisor = config.System.UseHypervisor;
|
UseHypervisor = config.System.UseHypervisor;
|
||||||
|
|
||||||
|
@ -548,6 +550,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||||
|
|
||||||
// CPU
|
// CPU
|
||||||
config.System.EnablePtc.Value = EnablePptc;
|
config.System.EnablePtc.Value = EnablePptc;
|
||||||
|
config.System.EnableLowPowerPtc.Value = EnableLowPowerPptc;
|
||||||
config.System.MemoryManagerMode.Value = (MemoryManagerMode)MemoryMode;
|
config.System.MemoryManagerMode.Value = (MemoryManagerMode)MemoryMode;
|
||||||
config.System.UseHypervisor.Value = UseHypervisor;
|
config.System.UseHypervisor.Value = UseHypervisor;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<UserControl
|
<UserControl
|
||||||
x:Class="Ryujinx.Ava.UI.Views.Settings.SettingsCPUView"
|
x:Class="Ryujinx.Ava.UI.Views.Settings.SettingsCPUView"
|
||||||
xmlns="https://github.com/avaloniaui"
|
xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
@ -32,6 +32,10 @@
|
||||||
<TextBlock Text="{locale:Locale SettingsTabSystemEnablePptc}"
|
<TextBlock Text="{locale:Locale SettingsTabSystemEnablePptc}"
|
||||||
ToolTip.Tip="{locale:Locale PptcToggleTooltip}" />
|
ToolTip.Tip="{locale:Locale PptcToggleTooltip}" />
|
||||||
</CheckBox>
|
</CheckBox>
|
||||||
|
<CheckBox IsChecked="{Binding EnableLowPowerPptc}">
|
||||||
|
<TextBlock Text="Low-power PPTC cache"
|
||||||
|
ToolTip.Tip="Load the PPTC cache using a third of the amount of cores." />
|
||||||
|
</CheckBox>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<Separator Height="1" />
|
<Separator Height="1" />
|
||||||
<TextBlock Classes="h1" Text="{locale:Locale SettingsTabCpuMemory}" />
|
<TextBlock Classes="h1" Text="{locale:Locale SettingsTabCpuMemory}" />
|
||||||
|
|
Loading…
Reference in a new issue