diff --git a/src/ARMeilleure/Common/AddressTablePresets.cs b/src/ARMeilleure/Common/AddressTablePresets.cs index 629e55e9c..977e84a36 100644 --- a/src/ARMeilleure/Common/AddressTablePresets.cs +++ b/src/ARMeilleure/Common/AddressTablePresets.cs @@ -50,6 +50,9 @@ namespace ARMeilleure.Common new( 1, 30), }; + //high power will run worse on DDR3 systems and some DDR4 systems due to the higher ram utilization + //low power will never run worse than non-sparse, but for most systems it won't be necessary + //high power is always used, but I've left low power in here for future reference public static AddressTableLevel[] GetArmPreset(bool for64Bits, bool sparse, bool lowPower = false) { if (sparse) diff --git a/src/Ryujinx.Cpu/AddressTable.cs b/src/Ryujinx.Cpu/AddressTable.cs index bf2dd38e7..d87b12ab0 100644 --- a/src/Ryujinx.Cpu/AddressTable.cs +++ b/src/Ryujinx.Cpu/AddressTable.cs @@ -137,7 +137,7 @@ namespace ARMeilleure.Common /// True if the bottom page should be sparsely mapped /// is null /// Length of is less than 2 - public AddressTable(AddressTableLevel[] levels, bool sparse, bool lowPower) + public AddressTable(AddressTableLevel[] levels, bool sparse) { ArgumentNullException.ThrowIfNull(levels); @@ -157,7 +157,7 @@ namespace ARMeilleure.Common { // If the address table is sparse, allocate a fill block - _sparseFill = new MemoryBlock(lowPower ? 65536ul : 268435456ul, MemoryAllocationFlags.Mirrorable); + _sparseFill = new MemoryBlock(268435456ul, MemoryAllocationFlags.Mirrorable); //low Power TC uses size: 65536ul ulong bottomLevelSize = (1ul << levels.Last().Length) * (ulong)sizeof(TEntry); @@ -178,12 +178,12 @@ namespace ARMeilleure.Common /// True if the guest is A64, false otherwise /// Memory manager type /// An for ARM function lookup - public static AddressTable CreateForArm(bool for64Bits, MemoryManagerType type, bool lowPower) + public static AddressTable CreateForArm(bool for64Bits, MemoryManagerType type) { // Assume software memory means that we don't want to use any signal handlers. bool sparse = type != MemoryManagerType.SoftwareMmu && type != MemoryManagerType.SoftwarePageTable; - return new AddressTable(AddressTablePresets.GetArmPreset(for64Bits, sparse, lowPower), sparse, lowPower); + return new AddressTable(AddressTablePresets.GetArmPreset(for64Bits, sparse), sparse); } /// diff --git a/src/Ryujinx.Cpu/AppleHv/HvCpuContext.cs b/src/Ryujinx.Cpu/AppleHv/HvCpuContext.cs index 9c761bfce..784949441 100644 --- a/src/Ryujinx.Cpu/AppleHv/HvCpuContext.cs +++ b/src/Ryujinx.Cpu/AppleHv/HvCpuContext.cs @@ -9,7 +9,7 @@ namespace Ryujinx.Cpu.AppleHv private readonly ITickSource _tickSource; private readonly HvMemoryManager _memoryManager; - public HvCpuContext(ITickSource tickSource, IMemoryManager memory, bool for64Bit, bool lowPower) + public HvCpuContext(ITickSource tickSource, IMemoryManager memory, bool for64Bit) { _tickSource = tickSource; _memoryManager = (HvMemoryManager)memory; diff --git a/src/Ryujinx.Cpu/AppleHv/HvEngine.cs b/src/Ryujinx.Cpu/AppleHv/HvEngine.cs index 97e2ca953..c3c1a4484 100644 --- a/src/Ryujinx.Cpu/AppleHv/HvEngine.cs +++ b/src/Ryujinx.Cpu/AppleHv/HvEngine.cs @@ -14,9 +14,9 @@ namespace Ryujinx.Cpu.AppleHv } /// - public ICpuContext CreateCpuContext(IMemoryManager memoryManager, bool for64Bit, bool lowPower) + public ICpuContext CreateCpuContext(IMemoryManager memoryManager, bool for64Bit) { - return new HvCpuContext(_tickSource, memoryManager, for64Bit, lowPower); + return new HvCpuContext(_tickSource, memoryManager, for64Bit); } } } diff --git a/src/Ryujinx.Cpu/ICpuEngine.cs b/src/Ryujinx.Cpu/ICpuEngine.cs index e3b8cca74..b53b23a8c 100644 --- a/src/Ryujinx.Cpu/ICpuEngine.cs +++ b/src/Ryujinx.Cpu/ICpuEngine.cs @@ -13,6 +13,6 @@ namespace Ryujinx.Cpu /// Memory manager for the address space of the context /// Indicates if the context will be used to run 64-bit or 32-bit Arm code /// CPU context - ICpuContext CreateCpuContext(IMemoryManager memoryManager, bool for64Bit, bool lowPower); + ICpuContext CreateCpuContext(IMemoryManager memoryManager, bool for64Bit); } } diff --git a/src/Ryujinx.Cpu/Jit/JitCpuContext.cs b/src/Ryujinx.Cpu/Jit/JitCpuContext.cs index aaa0bc87c..0793f382d 100644 --- a/src/Ryujinx.Cpu/Jit/JitCpuContext.cs +++ b/src/Ryujinx.Cpu/Jit/JitCpuContext.cs @@ -12,10 +12,10 @@ namespace Ryujinx.Cpu.Jit private readonly Translator _translator; private readonly AddressTable _functionTable; - public JitCpuContext(ITickSource tickSource, IMemoryManager memory, bool for64Bit, bool lowPower) + public JitCpuContext(ITickSource tickSource, IMemoryManager memory, bool for64Bit) { _tickSource = tickSource; - _functionTable = AddressTable.CreateForArm(for64Bit, memory.Type, lowPower); + _functionTable = AddressTable.CreateForArm(for64Bit, memory.Type); _translator = new Translator(new JitMemoryAllocator(forJit: true), memory, _functionTable); if (memory.Type.IsHostMappedOrTracked()) diff --git a/src/Ryujinx.Cpu/Jit/JitEngine.cs b/src/Ryujinx.Cpu/Jit/JitEngine.cs index e70b863ff..deebb8b9e 100644 --- a/src/Ryujinx.Cpu/Jit/JitEngine.cs +++ b/src/Ryujinx.Cpu/Jit/JitEngine.cs @@ -12,9 +12,9 @@ namespace Ryujinx.Cpu.Jit } /// - public ICpuContext CreateCpuContext(IMemoryManager memoryManager, bool for64Bit, bool lowPower) + public ICpuContext CreateCpuContext(IMemoryManager memoryManager, bool for64Bit) { - return new JitCpuContext(_tickSource, memoryManager, for64Bit, lowPower); + return new JitCpuContext(_tickSource, memoryManager, for64Bit); } } } diff --git a/src/Ryujinx.Cpu/LightningJit/LightningJitCpuContext.cs b/src/Ryujinx.Cpu/LightningJit/LightningJitCpuContext.cs index 1a17d744b..0f47ffb15 100644 --- a/src/Ryujinx.Cpu/LightningJit/LightningJitCpuContext.cs +++ b/src/Ryujinx.Cpu/LightningJit/LightningJitCpuContext.cs @@ -11,11 +11,11 @@ namespace Ryujinx.Cpu.LightningJit private readonly Translator _translator; private readonly AddressTable _functionTable; - public LightningJitCpuContext(ITickSource tickSource, IMemoryManager memory, bool for64Bit, bool lowPower) + public LightningJitCpuContext(ITickSource tickSource, IMemoryManager memory, bool for64Bit) { _tickSource = tickSource; - _functionTable = AddressTable.CreateForArm(for64Bit, memory.Type, lowPower); + _functionTable = AddressTable.CreateForArm(for64Bit, memory.Type); _translator = new Translator(memory, _functionTable); diff --git a/src/Ryujinx.Cpu/LightningJit/LightningJitEngine.cs b/src/Ryujinx.Cpu/LightningJit/LightningJitEngine.cs index 607e69969..c97ddc7c7 100644 --- a/src/Ryujinx.Cpu/LightningJit/LightningJitEngine.cs +++ b/src/Ryujinx.Cpu/LightningJit/LightningJitEngine.cs @@ -12,9 +12,9 @@ namespace Ryujinx.Cpu.LightningJit } /// - public ICpuContext CreateCpuContext(IMemoryManager memoryManager, bool for64Bit, bool lowPower) + public ICpuContext CreateCpuContext(IMemoryManager memoryManager, bool for64Bit) { - return new LightningJitCpuContext(_tickSource, memoryManager, for64Bit, lowPower); + return new LightningJitCpuContext(_tickSource, memoryManager, for64Bit); } } } diff --git a/src/Ryujinx.HLE/HOS/ArmProcessContext.cs b/src/Ryujinx.HLE/HOS/ArmProcessContext.cs index f873c3deb..09a721644 100644 --- a/src/Ryujinx.HLE/HOS/ArmProcessContext.cs +++ b/src/Ryujinx.HLE/HOS/ArmProcessContext.cs @@ -34,8 +34,7 @@ namespace Ryujinx.HLE.HOS GpuContext gpuContext, T memoryManager, ulong addressSpaceSize, - bool for64Bit, - bool lowPower) + bool for64Bit) { if (memoryManager is IRefCounted rc) { @@ -46,7 +45,7 @@ namespace Ryujinx.HLE.HOS _pid = pid; _gpuContext = gpuContext; - _cpuContext = cpuEngine.CreateCpuContext(memoryManager, for64Bit, lowPower); + _cpuContext = cpuEngine.CreateCpuContext(memoryManager, for64Bit); _memoryManager = memoryManager; AddressSpaceSize = addressSpaceSize; diff --git a/src/Ryujinx.HLE/HOS/ArmProcessContextFactory.cs b/src/Ryujinx.HLE/HOS/ArmProcessContextFactory.cs index 41f98768d..9eb340c39 100644 --- a/src/Ryujinx.HLE/HOS/ArmProcessContextFactory.cs +++ b/src/Ryujinx.HLE/HOS/ArmProcessContextFactory.cs @@ -48,13 +48,12 @@ namespace Ryujinx.HLE.HOS IArmProcessContext processContext; bool isArm64Host = RuntimeInformation.ProcessArchitecture == Architecture.Arm64; - bool isLowPower = context.Device.Configuration.LowPowerPtc; if (OperatingSystem.IsMacOS() && isArm64Host && for64Bit && context.Device.Configuration.UseHypervisor) { var cpuEngine = new HvEngine(_tickSource); var memoryManager = new HvMemoryManager(context.Memory, addressSpaceSize, invalidAccessHandler); - processContext = new ArmProcessContext(pid, cpuEngine, _gpu, memoryManager, addressSpaceSize, for64Bit, isLowPower); + processContext = new ArmProcessContext(pid, cpuEngine, _gpu, memoryManager, addressSpaceSize, for64Bit); } else { @@ -88,7 +87,7 @@ namespace Ryujinx.HLE.HOS { case MemoryManagerMode.SoftwarePageTable: var memoryManager = new MemoryManager(context.Memory, addressSpaceSize, invalidAccessHandler); - processContext = new ArmProcessContext(pid, cpuEngine, _gpu, memoryManager, addressSpaceSize, for64Bit, isLowPower); + processContext = new ArmProcessContext(pid, cpuEngine, _gpu, memoryManager, addressSpaceSize, for64Bit); break; case MemoryManagerMode.HostMapped: @@ -96,7 +95,7 @@ namespace Ryujinx.HLE.HOS if (addressSpace == null) { var memoryManagerHostTracked = new MemoryManagerHostTracked(context.Memory, addressSpaceSize, mode == MemoryManagerMode.HostMappedUnsafe, invalidAccessHandler); - processContext = new ArmProcessContext(pid, cpuEngine, _gpu, memoryManagerHostTracked, addressSpaceSize, for64Bit, isLowPower); + processContext = new ArmProcessContext(pid, cpuEngine, _gpu, memoryManagerHostTracked, addressSpaceSize, for64Bit); } else { @@ -106,7 +105,7 @@ namespace Ryujinx.HLE.HOS } var memoryManagerHostMapped = new MemoryManagerHostMapped(addressSpace, mode == MemoryManagerMode.HostMappedUnsafe, invalidAccessHandler); - processContext = new ArmProcessContext(pid, cpuEngine, _gpu, memoryManagerHostMapped, addressSpace.AddressSpaceSize, for64Bit, isLowPower); + processContext = new ArmProcessContext(pid, cpuEngine, _gpu, memoryManagerHostMapped, addressSpace.AddressSpaceSize, for64Bit); } break; @@ -115,7 +114,7 @@ namespace Ryujinx.HLE.HOS } } - DiskCacheLoadState = processContext.Initialize(_titleIdText, _displayVersion, _diskCacheEnabled, _codeAddress, _codeSize, isLowPower ? "LowPower" : "HighPower"); + DiskCacheLoadState = processContext.Initialize(_titleIdText, _displayVersion, _diskCacheEnabled, _codeAddress, _codeSize, "HighPower"); //Ready for exefs profiles return processContext; } diff --git a/src/Ryujinx.Tests/Cpu/CpuContext.cs b/src/Ryujinx.Tests/Cpu/CpuContext.cs index b896ea53f..81e8ba8c9 100644 --- a/src/Ryujinx.Tests/Cpu/CpuContext.cs +++ b/src/Ryujinx.Tests/Cpu/CpuContext.cs @@ -11,9 +11,9 @@ namespace Ryujinx.Tests.Cpu { private readonly Translator _translator; - public CpuContext(IMemoryManager memory, bool for64Bit, bool lowPower) + public CpuContext(IMemoryManager memory, bool for64Bit) { - _translator = new Translator(new JitMemoryAllocator(), memory, AddressTable.CreateForArm(for64Bit, memory.Type, lowPower)); + _translator = new Translator(new JitMemoryAllocator(), memory, AddressTable.CreateForArm(for64Bit, memory.Type)); memory.UnmapEvent += UnmapHandler; } diff --git a/src/Ryujinx.Tests/Cpu/CpuTest.cs b/src/Ryujinx.Tests/Cpu/CpuTest.cs index 193966782..da0f03e6b 100644 --- a/src/Ryujinx.Tests/Cpu/CpuTest.cs +++ b/src/Ryujinx.Tests/Cpu/CpuTest.cs @@ -62,7 +62,7 @@ namespace Ryujinx.Tests.Cpu _context = CpuContext.CreateExecutionContext(); - _cpuContext = new CpuContext(_memory, for64Bit: true, lowPower: false); + _cpuContext = new CpuContext(_memory, for64Bit: true); // Prevent registering LCQ functions in the FunctionTable to avoid initializing and populating the table, // which improves test durations. diff --git a/src/Ryujinx.Tests/Cpu/CpuTest32.cs b/src/Ryujinx.Tests/Cpu/CpuTest32.cs index ac059a3ac..6a690834f 100644 --- a/src/Ryujinx.Tests/Cpu/CpuTest32.cs +++ b/src/Ryujinx.Tests/Cpu/CpuTest32.cs @@ -57,7 +57,7 @@ namespace Ryujinx.Tests.Cpu _context = CpuContext.CreateExecutionContext(); _context.IsAarch32 = true; - _cpuContext = new CpuContext(_memory, for64Bit: false, lowPower: false); + _cpuContext = new CpuContext(_memory, for64Bit: false); // Prevent registering LCQ functions in the FunctionTable to avoid initializing and populating the table, // which improves test durations. diff --git a/src/Ryujinx.Tests/Cpu/EnvironmentTests.cs b/src/Ryujinx.Tests/Cpu/EnvironmentTests.cs index 0e8b93b65..43c84c193 100644 --- a/src/Ryujinx.Tests/Cpu/EnvironmentTests.cs +++ b/src/Ryujinx.Tests/Cpu/EnvironmentTests.cs @@ -22,7 +22,7 @@ namespace Ryujinx.Tests.Cpu _translator ??= new Translator( new JitMemoryAllocator(), new MockMemoryManager(), - AddressTable.CreateForArm(true, MemoryManagerType.SoftwarePageTable, lowPower: false)); + AddressTable.CreateForArm(true, MemoryManagerType.SoftwarePageTable)); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] diff --git a/src/Ryujinx.Tests/Memory/PartialUnmaps.cs b/src/Ryujinx.Tests/Memory/PartialUnmaps.cs index 51df00a8d..3e5b47423 100644 --- a/src/Ryujinx.Tests/Memory/PartialUnmaps.cs +++ b/src/Ryujinx.Tests/Memory/PartialUnmaps.cs @@ -58,7 +58,7 @@ namespace Ryujinx.Tests.Memory _translator ??= new Translator( new JitMemoryAllocator(), new MockMemoryManager(), - AddressTable.CreateForArm(true, MemoryManagerType.SoftwarePageTable, lowPower: false)); + AddressTable.CreateForArm(true, MemoryManagerType.SoftwarePageTable)); } [Test]