VERY experimental Nintendo Switch 2 emulator
C++
nvdrv: clean up preallocation
Liam0bb66a7b2bec
diff --git a/src/core/hle/service/nvdrv/core/container.cpp b/src/core/hle/service/nvdrv/core/container.cppindex b5fd98a9d9..21ef57d277 100644--- a/src/core/hle/service/nvdrv/core/container.cpp+++ b/src/core/hle/service/nvdrv/core/container.cpp@@ -41,6 +41,8 @@ Container::Container(Tegra::Host1x::Host1x& host1x_) {Container::~Container() = default;SessionId Container::OpenSession(Kernel::KProcess* process) {+ using namespace Common::Literals;+std::scoped_lock lk(impl->session_guard);for (auto& session : impl->sessions) {if (!session.is_active) {@@ -79,7 +81,7 @@ SessionId Container::OpenSession(Kernel::KProcess* process) {cur_addr));auto svc_mem_info = mem_info.GetSvcMemoryInfo();- // check if this memory block is heap+ // Check if this memory block is heap.if (svc_mem_info.state == Kernel::Svc::MemoryState::Normal) {if (svc_mem_info.size > region_size) {region_size = svc_mem_info.size;@@ -96,13 +98,13 @@ SessionId Container::OpenSession(Kernel::KProcess* process) {cur_addr = next_address;}session.has_preallocated_area = false;- auto start_region = (region_size >> 15) >= 1024 ? smmu.Allocate(region_size) : 0;+ auto start_region = region_size >= 32_MiB ? smmu.Allocate(region_size) : 0;if (start_region != 0) {session.mapper = std::make_unique<HeapMapper>(region_start, start_region, region_size,asid, impl->host1x);smmu.TrackContinuity(start_region, region_start, region_size, asid);session.has_preallocated_area = true;- LOG_CRITICAL(Debug, "Preallocation created!");+ LOG_DEBUG(Debug, "Preallocation created!");}}return SessionId{new_id};