aboutsummaryrefslogtreecommitdiff
path: root/src/video_core/macro.cpp
diff options
context:
space:
mode:
authorTakoroka <137927095+Takoroka@users.noreply.github.com>2026-10-29 05:46:59 -0400
committerTakoroka <137927095+Takoroka@users.noreply.github.com>2026-10-29 20:49:47 -0400
commitb905580202f0da5ca0a6268b176b4591e347fd8d (patch)
tree679fdd043eee8f437b988a652b4c6e18aa9da186 /src/video_core/macro.cpp
parenta99484f3cb6a78eed8563ac67551ab1ea0d0c0c3 (diff)
video_core: compact the macro memo arena; download profiling counters
Calls stored again with another shape leave their old record in the memo's arena; title 1 filled its 16 MiB every ~2 s and clearing it made the next ~20,000 calls interpret again. The live records are now copied to a new arena (a clear only when they alone fill three quarters of it). The memo statistics count hits on the last call's slot and compactions. With EDEN_NX2_GPU_PROFILE the GPU thread also reports how much downloaded buffer data lands on pages the native MME has DMA-read.
Diffstat (limited to 'src/video_core/macro.cpp')
-rw-r--r--src/video_core/macro.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/video_core/macro.cpp b/src/video_core/macro.cpp
index 3422cb16fa..50e32ce999 100644
--- a/src/video_core/macro.cpp
+++ b/src/video_core/macro.cpp
@@ -1420,6 +1420,14 @@ void MacroEngine::Execute(Core::System& system, Engines::Maxwell3D& maxwell3d, u
// from a culling dispatch) and still be only in host buffers: flush them first,
// or the macro draws with an older frame's arguments (objects pop in and out).
const size_t read_bytes = size_t{std::min<u32>(value, 0x1000)} * 4;
+ if (VideoCommon::Nx2Profile::Enabled()) {
+ VideoCommon::Nx2Profile::Add(VideoCommon::Nx2Profile::Counter::DmaReadBytes, read_bytes);
+ for (GPUVAddr page = source & ~GPUVAddr{0xfff}; page < source + read_bytes; page += 0x1000) {
+ if (const auto device = memory.GpuToCpuAddress(page)) {
+ VideoCommon::Nx2Profile::DmaReadPages().insert(*device >> 12);
+ }
+ }
+ }
if (memory.IsMemoryDirty(source, read_bytes, VideoCommon::CacheType::BufferCache)) {
memory.FlushRegion(source, read_bytes, VideoCommon::CacheType::BufferCache);
static u64 flushes{};
@@ -1462,10 +1470,11 @@ void MacroEngine::Execute(Core::System& system, Engines::Maxwell3D& maxwell3d, u
memo_stats && (++native_calls & 0xffffff) == 0) {
const auto& stats = native_memo.GetStatistics();
LOG_INFO(HW_GPU,
- "Macro memo: {} hits, {} misses, {} guard failures, {} stores ({} in "
- "place), {} clears; {} entries, {} KiB",
- stats.hits, stats.misses, stats.guard_failures, stats.stores,
- stats.overwrites, stats.clears, native_memo.Size(),
+ "Macro memo: {} hits ({} on the last call's slot), {} misses, {} guard "
+ "failures, {} stores ({} in place), {} compactions, {} clears; {} entries, "
+ "{} KiB",
+ stats.hits, stats.slot_hits, stats.misses, stats.guard_failures, stats.stores,
+ stats.overwrites, stats.compactions, stats.clears, native_memo.Size(),
native_memo.ArenaWords() * 4 / 1024);
}
native_memo.Synchronize(native_code_generation);