diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2019-12-25 20:28:17 -0300 |
|---|---|---|
| committer | Thog <thog@protonmail.com> | 2020-01-09 02:13:00 +0100 |
| commit | 647d0962df5b54334af965b88f784409afbf6223 (patch) | |
| tree | 3cd884099188341f869919c8235deecdea96be9b /Ryujinx.HLE/HOS | |
| parent | 6cf9a04d981a9e966cccb0dc90182e29aac7e270 (diff) | |
Initialize GPU physical memory accessor from KProcess, to allow homebrew that never maps anything on the GPU to work
Diffstat (limited to 'Ryujinx.HLE/HOS')
| -rw-r--r-- | Ryujinx.HLE/HOS/Kernel/Process/KProcess.cs | 4 | ||||
| -rw-r--r-- | Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/AddressSpaceContext.cs | 34 |
2 files changed, 4 insertions, 34 deletions
diff --git a/Ryujinx.HLE/HOS/Kernel/Process/KProcess.cs b/Ryujinx.HLE/HOS/Kernel/Process/KProcess.cs index c74f6fca..f987c83c 100644 --- a/Ryujinx.HLE/HOS/Kernel/Process/KProcess.cs +++ b/Ryujinx.HLE/HOS/Kernel/Process/KProcess.cs @@ -1115,6 +1115,10 @@ namespace Ryujinx.HLE.HOS.Kernel.Process Translator = new Translator(CpuMemory); + // TODO: This should eventually be removed. + // The GPU shouldn't depend on the CPU memory manager at all. + _system.Device.Gpu.SetVmm(CpuMemory); + MemoryManager = new KMemoryManager(_system, CpuMemory); } diff --git a/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/AddressSpaceContext.cs b/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/AddressSpaceContext.cs index bca9ba7c..951994ef 100644 --- a/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/AddressSpaceContext.cs +++ b/Ryujinx.HLE/HOS/Services/Nv/NvDrvServices/NvHostAsGpu/Types/AddressSpaceContext.cs @@ -40,44 +40,10 @@ namespace Ryujinx.HLE.HOS.Services.Nv.NvDrvServices.NvHostAsGpu.Types public MemoryManager Gmm { get; } - private class MemoryProxy : IPhysicalMemory - { - private ARMeilleure.Memory.MemoryManager _cpuMemory; - - public MemoryProxy(ARMeilleure.Memory.MemoryManager cpuMemory) - { - _cpuMemory = cpuMemory; - } - - public Span<byte> Read(ulong address, ulong size) - { - return _cpuMemory.ReadBytes((long)address, (long)size); - } - - public void Write(ulong address, Span<byte> data) - { - _cpuMemory.WriteBytes((long)address, data.ToArray()); - } - - public (ulong, ulong)[] GetModifiedRanges(ulong address, ulong size, ResourceName name) - { - return _cpuMemory.GetModifiedRanges(address, size, (int)name); - } - - public int GetPageSize() - { - return 4096; - } - } - public AddressSpaceContext(ServiceCtx context) { Gmm = context.Device.Gpu.MemoryManager; - var memoryProxy = new MemoryProxy(context.Process.CpuMemory); - - context.Device.Gpu.SetVmm(memoryProxy); - _maps = new SortedList<long, Range>(); _reservations = new SortedList<long, Range>(); } |
