Revert the link to the Low Power PPTC cache setting

The emulator now always uses GiantBlock.
TinyBlock has been left in, but is unused.
This commit is contained in:
LotP1 2024-11-20 15:52:21 +01:00 committed by LotP1
parent 08520812d4
commit ba0a65078d
16 changed files with 32 additions and 31 deletions

View File

@ -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)

View File

@ -137,7 +137,7 @@ namespace ARMeilleure.Common
/// <param name="sparse">True if the bottom page should be sparsely mapped</param>
/// <exception cref="ArgumentNullException"><paramref name="levels"/> is null</exception>
/// <exception cref="ArgumentException">Length of <paramref name="levels"/> is less than 2</exception>
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
/// <param name="for64Bits">True if the guest is A64, false otherwise</param>
/// <param name="type">Memory manager type</param>
/// <returns>An <see cref="AddressTable{TEntry}"/> for ARM function lookup</returns>
public static AddressTable<TEntry> CreateForArm(bool for64Bits, MemoryManagerType type, bool lowPower)
public static AddressTable<TEntry> 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<TEntry>(AddressTablePresets.GetArmPreset(for64Bits, sparse, lowPower), sparse, lowPower);
return new AddressTable<TEntry>(AddressTablePresets.GetArmPreset(for64Bits, sparse), sparse);
}
/// <summary>

View File

@ -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;

View File

@ -14,9 +14,9 @@ namespace Ryujinx.Cpu.AppleHv
}
/// <inheritdoc/>
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);
}
}
}

View File

@ -13,6 +13,6 @@ namespace Ryujinx.Cpu
/// <param name="memoryManager">Memory manager for the address space of the context</param>
/// <param name="for64Bit">Indicates if the context will be used to run 64-bit or 32-bit Arm code</param>
/// <returns>CPU context</returns>
ICpuContext CreateCpuContext(IMemoryManager memoryManager, bool for64Bit, bool lowPower);
ICpuContext CreateCpuContext(IMemoryManager memoryManager, bool for64Bit);
}
}

View File

@ -12,10 +12,10 @@ namespace Ryujinx.Cpu.Jit
private readonly Translator _translator;
private readonly AddressTable<ulong> _functionTable;
public JitCpuContext(ITickSource tickSource, IMemoryManager memory, bool for64Bit, bool lowPower)
public JitCpuContext(ITickSource tickSource, IMemoryManager memory, bool for64Bit)
{
_tickSource = tickSource;
_functionTable = AddressTable<ulong>.CreateForArm(for64Bit, memory.Type, lowPower);
_functionTable = AddressTable<ulong>.CreateForArm(for64Bit, memory.Type);
_translator = new Translator(new JitMemoryAllocator(forJit: true), memory, _functionTable);
if (memory.Type.IsHostMappedOrTracked())

View File

@ -12,9 +12,9 @@ namespace Ryujinx.Cpu.Jit
}
/// <inheritdoc/>
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);
}
}
}

View File

@ -11,11 +11,11 @@ namespace Ryujinx.Cpu.LightningJit
private readonly Translator _translator;
private readonly AddressTable<ulong> _functionTable;
public LightningJitCpuContext(ITickSource tickSource, IMemoryManager memory, bool for64Bit, bool lowPower)
public LightningJitCpuContext(ITickSource tickSource, IMemoryManager memory, bool for64Bit)
{
_tickSource = tickSource;
_functionTable = AddressTable<ulong>.CreateForArm(for64Bit, memory.Type, lowPower);
_functionTable = AddressTable<ulong>.CreateForArm(for64Bit, memory.Type);
_translator = new Translator(memory, _functionTable);

View File

@ -12,9 +12,9 @@ namespace Ryujinx.Cpu.LightningJit
}
/// <inheritdoc/>
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);
}
}
}

View File

@ -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;

View File

@ -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<HvMemoryManager>(pid, cpuEngine, _gpu, memoryManager, addressSpaceSize, for64Bit, isLowPower);
processContext = new ArmProcessContext<HvMemoryManager>(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<MemoryManager>(pid, cpuEngine, _gpu, memoryManager, addressSpaceSize, for64Bit, isLowPower);
processContext = new ArmProcessContext<MemoryManager>(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<MemoryManagerHostTracked>(pid, cpuEngine, _gpu, memoryManagerHostTracked, addressSpaceSize, for64Bit, isLowPower);
processContext = new ArmProcessContext<MemoryManagerHostTracked>(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<MemoryManagerHostMapped>(pid, cpuEngine, _gpu, memoryManagerHostMapped, addressSpace.AddressSpaceSize, for64Bit, isLowPower);
processContext = new ArmProcessContext<MemoryManagerHostMapped>(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;
}

View File

@ -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<ulong>.CreateForArm(for64Bit, memory.Type, lowPower));
_translator = new Translator(new JitMemoryAllocator(), memory, AddressTable<ulong>.CreateForArm(for64Bit, memory.Type));
memory.UnmapEvent += UnmapHandler;
}

View File

@ -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.

View File

@ -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.

View File

@ -22,7 +22,7 @@ namespace Ryujinx.Tests.Cpu
_translator ??= new Translator(
new JitMemoryAllocator(),
new MockMemoryManager(),
AddressTable<ulong>.CreateForArm(true, MemoryManagerType.SoftwarePageTable, lowPower: false));
AddressTable<ulong>.CreateForArm(true, MemoryManagerType.SoftwarePageTable));
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]

View File

@ -58,7 +58,7 @@ namespace Ryujinx.Tests.Memory
_translator ??= new Translator(
new JitMemoryAllocator(),
new MockMemoryManager(),
AddressTable<ulong>.CreateForArm(true, MemoryManagerType.SoftwarePageTable, lowPower: false));
AddressTable<ulong>.CreateForArm(true, MemoryManagerType.SoftwarePageTable));
}
[Test]