More flexible memory manager (#307)
* Keep track mapped buffers with fixed offsets * Started rewriting the memory manager * Initial support for MapPhysicalMemory and UnmapPhysicalMemory, other tweaks * MapPhysicalMemory/UnmapPhysicalMemory support, other tweaks * Rebased * Optimize the map/unmap physical memory svcs * Integrate shared font support * Fix address space reserve alignment * Some fixes related to gpu memory mapping * Some cleanup * Only try uploading const buffers that are really used * Check if memory region is contiguous * Rebased * Add missing count increment on IsRegionModified * Check for reads/writes outside of the address space, optimize translation with a tail call
This commit is contained in:
parent
76d95dee05
commit
c393cdf8e3
64 changed files with 3289 additions and 1852 deletions
|
@ -129,7 +129,8 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvMap
|
|||
{
|
||||
//When the address is zero, we need to allocate
|
||||
//our own backing memory for the NvMap.
|
||||
if (!Context.Ns.Os.Allocator.TryAllocate((uint)Size, out Address))
|
||||
//TODO: Is this allocation inside the transfer memory?
|
||||
if (!Context.Ns.Memory.Allocator.TryAllocate((uint)Size, out Address))
|
||||
{
|
||||
Result = NvResult.OutOfMemory;
|
||||
}
|
||||
|
@ -163,23 +164,22 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvMap
|
|||
return NvResult.InvalidInput;
|
||||
}
|
||||
|
||||
long OldRefCount = Map.DecrementRefCount();
|
||||
|
||||
if (OldRefCount <= 1)
|
||||
if (Map.DecrementRefCount() <= 0)
|
||||
{
|
||||
DeleteNvMap(Context, Args.Handle);
|
||||
|
||||
Context.Ns.Log.PrintInfo(LogClass.ServiceNv, $"Deleted map {Args.Handle}!");
|
||||
|
||||
Args.Flags = 0;
|
||||
Args.Address = Map.Address;
|
||||
Args.Flags = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Args.Flags = FlagNotFreedYet;
|
||||
Args.Address = 0;
|
||||
Args.Flags = FlagNotFreedYet;
|
||||
}
|
||||
|
||||
Args.RefCount = OldRefCount;
|
||||
Args.Size = Map.Size;
|
||||
Args.Size = Map.Size;
|
||||
|
||||
AMemoryHelper.Write(Context.Memory, OutputPosition, Args);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue