summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar GPUCode2023-11-17 22:23:48 +0200
committerGravatar t8952023-11-25 00:46:47 -0500
commit48388376206aaa7d887b41030019035a06203867 (patch)
tree6dc27b3fc69d7ec4a1d4247fd0a00b7542ef72d4
parentexternals: Add oaknut submodule (diff)
downloadyuzu-48388376206aaa7d887b41030019035a06203867.tar.gz
yuzu-48388376206aaa7d887b41030019035a06203867.tar.xz
yuzu-48388376206aaa7d887b41030019035a06203867.zip
device_memory: Enable direct mapped addresses for nce
Diffstat (limited to '')
-rw-r--r--src/common/settings.cpp10
-rw-r--r--src/common/settings.h3
-rw-r--r--src/core/core.cpp3
-rw-r--r--src/core/device_memory.cpp11
-rw-r--r--src/core/device_memory.h2
5 files changed, 21 insertions, 8 deletions
diff --git a/src/common/settings.cpp b/src/common/settings.cpp
index 19dfe08da..167e984a6 100644
--- a/src/common/settings.cpp
+++ b/src/common/settings.cpp
@@ -156,8 +156,14 @@ bool IsFastmemEnabled() {
156 return true; 156 return true;
157} 157}
158 158
159bool IsNceEnabled(bool is_64bit) { 159static bool is_nce_enabled = false;
160 return values.cpu_backend.GetValue() == CpuBackend::Nce && is_64bit; 160
161void SetNceEnabled(bool is_64bit) {
162 is_nce_enabled = values.cpu_backend.GetValue() == CpuBackend::Nce && is_64bit;
163}
164
165bool IsNceEnabled() {
166 return is_nce_enabled;
161} 167}
162 168
163bool IsDockedMode() { 169bool IsDockedMode() {
diff --git a/src/common/settings.h b/src/common/settings.h
index 389c747cb..fea639ee3 100644
--- a/src/common/settings.h
+++ b/src/common/settings.h
@@ -573,7 +573,8 @@ bool IsGPULevelExtreme();
573bool IsGPULevelHigh(); 573bool IsGPULevelHigh();
574 574
575bool IsFastmemEnabled(); 575bool IsFastmemEnabled();
576bool IsNceEnabled(bool is_64bit = true); 576void SetNceEnabled(bool is_64bit);
577bool IsNceEnabled();
577 578
578bool IsDockedMode(); 579bool IsDockedMode();
579 580
diff --git a/src/core/core.cpp b/src/core/core.cpp
index 14d6c8c27..1d557fb43 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -136,7 +136,8 @@ struct System::Impl {
136 } 136 }
137 137
138 void Initialize(System& system) { 138 void Initialize(System& system) {
139 device_memory = std::make_unique<Core::DeviceMemory>(); 139 const bool direct_mapped_address = Settings::IsNceEnabled();
140 device_memory = std::make_unique<Core::DeviceMemory>(direct_mapped_address);
140 141
141 is_multicore = Settings::values.use_multi_core.GetValue(); 142 is_multicore = Settings::values.use_multi_core.GetValue();
142 extended_memory_layout = 143 extended_memory_layout =
diff --git a/src/core/device_memory.cpp b/src/core/device_memory.cpp
index de3f8ef8f..0528a8e3b 100644
--- a/src/core/device_memory.cpp
+++ b/src/core/device_memory.cpp
@@ -6,15 +6,20 @@
6 6
7namespace Core { 7namespace Core {
8 8
9#ifdef ANDROID 9#ifdef ARCHITECTURE_arm64
10constexpr size_t VirtualReserveSize = 1ULL << 38; 10constexpr size_t VirtualReserveSize = 1ULL << 38;
11#else 11#else
12constexpr size_t VirtualReserveSize = 1ULL << 39; 12constexpr size_t VirtualReserveSize = 1ULL << 39;
13#endif 13#endif
14 14
15DeviceMemory::DeviceMemory() 15DeviceMemory::DeviceMemory(bool direct_mapped_address)
16 : buffer{Kernel::Board::Nintendo::Nx::KSystemControl::Init::GetIntendedMemorySize(), 16 : buffer{Kernel::Board::Nintendo::Nx::KSystemControl::Init::GetIntendedMemorySize(),
17 VirtualReserveSize} {} 17 VirtualReserveSize} {
18 if (direct_mapped_address) {
19 buffer.EnableDirectMappedAddress();
20 }
21}
22
18DeviceMemory::~DeviceMemory() = default; 23DeviceMemory::~DeviceMemory() = default;
19 24
20} // namespace Core 25} // namespace Core
diff --git a/src/core/device_memory.h b/src/core/device_memory.h
index 13388b73e..368f19e86 100644
--- a/src/core/device_memory.h
+++ b/src/core/device_memory.h
@@ -18,7 +18,7 @@ enum : u64 {
18 18
19class DeviceMemory { 19class DeviceMemory {
20public: 20public:
21 explicit DeviceMemory(); 21 explicit DeviceMemory(bool direct_mapped_address);
22 ~DeviceMemory(); 22 ~DeviceMemory();
23 23
24 DeviceMemory& operator=(const DeviceMemory&) = delete; 24 DeviceMemory& operator=(const DeviceMemory&) = delete;