aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Memory/Tracking/MemoryTracking.cs
diff options
context:
space:
mode:
authorriperiperi <rhy3756547@hotmail.com>2022-10-29 23:07:37 +0100
committerGitHub <noreply@github.com>2022-10-29 22:07:37 +0000
commit3d98e1361b2f1c3993aa7f1e9b1ac49fc5b6e512 (patch)
tree010767e20636e9837652a0133fc1ef40838c942e /Ryujinx.Memory/Tracking/MemoryTracking.cs
parent141cf61ff72224c394cab4e5e252907d0cdb797a (diff)
GPU: Use a bitmap to track buffer modified flags. (#3775)1.1.335
* Initial implementation * Some improvements. * Fix incorrect cast * Performance improvement and improved correctness * Add very fast path when all handles are checked. * Slightly faster * Add comment * De-virtualize region handle All region handles are now bitmap backed. * Remove non-bitmap tracking * Remove unused methods * Add docs, remove unused methods * Address Feedback * Rename file
Diffstat (limited to 'Ryujinx.Memory/Tracking/MemoryTracking.cs')
-rw-r--r--Ryujinx.Memory/Tracking/MemoryTracking.cs20
1 files changed, 20 insertions, 0 deletions
diff --git a/Ryujinx.Memory/Tracking/MemoryTracking.cs b/Ryujinx.Memory/Tracking/MemoryTracking.cs
index f2ac17ff..9aa7c7ff 100644
--- a/Ryujinx.Memory/Tracking/MemoryTracking.cs
+++ b/Ryujinx.Memory/Tracking/MemoryTracking.cs
@@ -177,6 +177,26 @@ namespace Ryujinx.Memory.Tracking
}
/// <summary>
+ /// Obtains a memory tracking handle for the given virtual region. This should be disposed when finished with.
+ /// </summary>
+ /// <param name="address">CPU virtual address of the region</param>
+ /// <param name="size">Size of the region</param>
+ /// <param name="bitmap">The bitmap owning the dirty flag for this handle</param>
+ /// <param name="bit">The bit of this handle within the dirty flag</param>
+ /// <returns>The memory tracking handle</returns>
+ internal RegionHandle BeginTrackingBitmap(ulong address, ulong size, ConcurrentBitmap bitmap, int bit)
+ {
+ (address, size) = PageAlign(address, size);
+
+ lock (TrackingLock)
+ {
+ RegionHandle handle = new RegionHandle(this, address, size, bitmap, bit, _memoryManager.IsRangeMapped(address, size));
+
+ return handle;
+ }
+ }
+
+ /// <summary>
/// Signal that a virtual memory event happened at the given location (one byte).
/// </summary>
/// <param name="address">Virtual address accessed</param>