2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

device_memory: Enable direct mapped addresses for nce

This commit is contained in:
GPUCode 2023-11-17 22:23:48 +02:00 committed by t895
parent 2e02efbdd0
commit 4838837620
5 changed files with 21 additions and 8 deletions

View file

@ -156,8 +156,14 @@ bool IsFastmemEnabled() {
return true; return true;
} }
bool IsNceEnabled(bool is_64bit) { static bool is_nce_enabled = false;
return values.cpu_backend.GetValue() == CpuBackend::Nce && is_64bit;
void SetNceEnabled(bool is_64bit) {
is_nce_enabled = values.cpu_backend.GetValue() == CpuBackend::Nce && is_64bit;
}
bool IsNceEnabled() {
return is_nce_enabled;
} }
bool IsDockedMode() { bool IsDockedMode() {

View file

@ -573,7 +573,8 @@ bool IsGPULevelExtreme();
bool IsGPULevelHigh(); bool IsGPULevelHigh();
bool IsFastmemEnabled(); bool IsFastmemEnabled();
bool IsNceEnabled(bool is_64bit = true); void SetNceEnabled(bool is_64bit);
bool IsNceEnabled();
bool IsDockedMode(); bool IsDockedMode();

View file

@ -136,7 +136,8 @@ struct System::Impl {
} }
void Initialize(System& system) { void Initialize(System& system) {
device_memory = std::make_unique<Core::DeviceMemory>(); const bool direct_mapped_address = Settings::IsNceEnabled();
device_memory = std::make_unique<Core::DeviceMemory>(direct_mapped_address);
is_multicore = Settings::values.use_multi_core.GetValue(); is_multicore = Settings::values.use_multi_core.GetValue();
extended_memory_layout = extended_memory_layout =

View file

@ -6,15 +6,20 @@
namespace Core { namespace Core {
#ifdef ANDROID #ifdef ARCHITECTURE_arm64
constexpr size_t VirtualReserveSize = 1ULL << 38; constexpr size_t VirtualReserveSize = 1ULL << 38;
#else #else
constexpr size_t VirtualReserveSize = 1ULL << 39; constexpr size_t VirtualReserveSize = 1ULL << 39;
#endif #endif
DeviceMemory::DeviceMemory() DeviceMemory::DeviceMemory(bool direct_mapped_address)
: buffer{Kernel::Board::Nintendo::Nx::KSystemControl::Init::GetIntendedMemorySize(), : buffer{Kernel::Board::Nintendo::Nx::KSystemControl::Init::GetIntendedMemorySize(),
VirtualReserveSize} {} VirtualReserveSize} {
if (direct_mapped_address) {
buffer.EnableDirectMappedAddress();
}
}
DeviceMemory::~DeviceMemory() = default; DeviceMemory::~DeviceMemory() = default;
} // namespace Core } // namespace Core

View file

@ -18,7 +18,7 @@ enum : u64 {
class DeviceMemory { class DeviceMemory {
public: public:
explicit DeviceMemory(); explicit DeviceMemory(bool direct_mapped_address);
~DeviceMemory(); ~DeviceMemory();
DeviceMemory& operator=(const DeviceMemory&) = delete; DeviceMemory& operator=(const DeviceMemory&) = delete;