diff options
| author | 2023-06-28 06:28:13 +0200 | |
|---|---|---|
| committer | 2023-06-28 19:34:21 +0200 | |
| commit | 47d0d292d5cc5f0404e126023279db7decd532ac (patch) | |
| tree | a43e59102a9db2a124c7473842fbf0d661ff628e /src/core/core.cpp | |
| parent | Merge pull request #10837 from liamwhite/mali-support (diff) | |
| download | yuzu-47d0d292d5cc5f0404e126023279db7decd532ac.tar.gz yuzu-47d0d292d5cc5f0404e126023279db7decd532ac.tar.xz yuzu-47d0d292d5cc5f0404e126023279db7decd532ac.zip | |
MemoryTracking: Initial setup of atomic writes.
Diffstat (limited to 'src/core/core.cpp')
| -rw-r--r-- | src/core/core.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp index b74fd0a58..deefeb301 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp | |||
| @@ -27,6 +27,7 @@ | |||
| 27 | #include "core/file_sys/savedata_factory.h" | 27 | #include "core/file_sys/savedata_factory.h" |
| 28 | #include "core/file_sys/vfs_concat.h" | 28 | #include "core/file_sys/vfs_concat.h" |
| 29 | #include "core/file_sys/vfs_real.h" | 29 | #include "core/file_sys/vfs_real.h" |
| 30 | #include "core/gpu_dirty_memory_manager.h" | ||
| 30 | #include "core/hid/hid_core.h" | 31 | #include "core/hid/hid_core.h" |
| 31 | #include "core/hle/kernel/k_memory_manager.h" | 32 | #include "core/hle/kernel/k_memory_manager.h" |
| 32 | #include "core/hle/kernel/k_process.h" | 33 | #include "core/hle/kernel/k_process.h" |
| @@ -54,6 +55,7 @@ | |||
| 54 | #include "video_core/renderer_base.h" | 55 | #include "video_core/renderer_base.h" |
| 55 | #include "video_core/video_core.h" | 56 | #include "video_core/video_core.h" |
| 56 | 57 | ||
| 58 | |||
| 57 | MICROPROFILE_DEFINE(ARM_CPU0, "ARM", "CPU 0", MP_RGB(255, 64, 64)); | 59 | MICROPROFILE_DEFINE(ARM_CPU0, "ARM", "CPU 0", MP_RGB(255, 64, 64)); |
| 58 | MICROPROFILE_DEFINE(ARM_CPU1, "ARM", "CPU 1", MP_RGB(255, 64, 64)); | 60 | MICROPROFILE_DEFINE(ARM_CPU1, "ARM", "CPU 1", MP_RGB(255, 64, 64)); |
| 59 | MICROPROFILE_DEFINE(ARM_CPU2, "ARM", "CPU 2", MP_RGB(255, 64, 64)); | 61 | MICROPROFILE_DEFINE(ARM_CPU2, "ARM", "CPU 2", MP_RGB(255, 64, 64)); |
| @@ -540,6 +542,9 @@ struct System::Impl { | |||
| 540 | 542 | ||
| 541 | std::array<u64, Core::Hardware::NUM_CPU_CORES> dynarmic_ticks{}; | 543 | std::array<u64, Core::Hardware::NUM_CPU_CORES> dynarmic_ticks{}; |
| 542 | std::array<MicroProfileToken, Core::Hardware::NUM_CPU_CORES> microprofile_cpu{}; | 544 | std::array<MicroProfileToken, Core::Hardware::NUM_CPU_CORES> microprofile_cpu{}; |
| 545 | |||
| 546 | std::array<Core::GPUDirtyMemoryManager, Core::Hardware::NUM_CPU_CORES> | ||
| 547 | gpu_dirty_memory_write_manager{}; | ||
| 543 | }; | 548 | }; |
| 544 | 549 | ||
| 545 | System::System() : impl{std::make_unique<Impl>(*this)} {} | 550 | System::System() : impl{std::make_unique<Impl>(*this)} {} |
| @@ -629,10 +634,31 @@ void System::PrepareReschedule(const u32 core_index) { | |||
| 629 | impl->kernel.PrepareReschedule(core_index); | 634 | impl->kernel.PrepareReschedule(core_index); |
| 630 | } | 635 | } |
| 631 | 636 | ||
| 637 | Core::GPUDirtyMemoryManager& System::CurrentGPUDirtyMemoryManager() { | ||
| 638 | const std::size_t core = impl->kernel.GetCurrentHostThreadID(); | ||
| 639 | return impl->gpu_dirty_memory_write_manager[core < Core::Hardware::NUM_CPU_CORES | ||
| 640 | ? core | ||
| 641 | : Core::Hardware::NUM_CPU_CORES - 1]; | ||
| 642 | } | ||
| 643 | |||
| 644 | /// Provides a constant reference to the current gou dirty memory manager. | ||
| 645 | const Core::GPUDirtyMemoryManager& System::CurrentGPUDirtyMemoryManager() const { | ||
| 646 | const std::size_t core = impl->kernel.GetCurrentHostThreadID(); | ||
| 647 | return impl->gpu_dirty_memory_write_manager[core < Core::Hardware::NUM_CPU_CORES | ||
| 648 | ? core | ||
| 649 | : Core::Hardware::NUM_CPU_CORES - 1]; | ||
| 650 | } | ||
| 651 | |||
| 632 | size_t System::GetCurrentHostThreadID() const { | 652 | size_t System::GetCurrentHostThreadID() const { |
| 633 | return impl->kernel.GetCurrentHostThreadID(); | 653 | return impl->kernel.GetCurrentHostThreadID(); |
| 634 | } | 654 | } |
| 635 | 655 | ||
| 656 | void System::GatherGPUDirtyMemory(std::function<void(VAddr, size_t)>& callback) { | ||
| 657 | for (auto& manager : impl->gpu_dirty_memory_write_manager) { | ||
| 658 | manager.Gather(callback); | ||
| 659 | } | ||
| 660 | } | ||
| 661 | |||
| 636 | PerfStatsResults System::GetAndResetPerfStats() { | 662 | PerfStatsResults System::GetAndResetPerfStats() { |
| 637 | return impl->GetAndResetPerfStats(); | 663 | return impl->GetAndResetPerfStats(); |
| 638 | } | 664 | } |