diff options
| author | 2023-12-29 07:53:52 +0100 | |
|---|---|---|
| committer | 2024-01-18 21:12:30 -0500 | |
| commit | 34a8d0cc8e04b4b9d8e5a75e552f0adb31b5d718 (patch) | |
| tree | afa899bb63e97df9c80e5de49395495143799dbd /src/core/hle/service/nvdrv | |
| parent | SMMU: Initial adaptation to video_core. (diff) | |
| download | yuzu-34a8d0cc8e04b4b9d8e5a75e552f0adb31b5d718.tar.gz yuzu-34a8d0cc8e04b4b9d8e5a75e552f0adb31b5d718.tar.xz yuzu-34a8d0cc8e04b4b9d8e5a75e552f0adb31b5d718.zip | |
SMMU: Implement physical memory mirroring
Diffstat (limited to 'src/core/hle/service/nvdrv')
| -rw-r--r-- | src/core/hle/service/nvdrv/core/container.cpp | 6 | ||||
| -rw-r--r-- | src/core/hle/service/nvdrv/core/nvmap.cpp | 7 | ||||
| -rw-r--r-- | src/core/hle/service/nvdrv/core/nvmap.h | 6 |
3 files changed, 13 insertions, 6 deletions
diff --git a/src/core/hle/service/nvdrv/core/container.cpp b/src/core/hle/service/nvdrv/core/container.cpp index 7c2231fe6..e12ce05c1 100644 --- a/src/core/hle/service/nvdrv/core/container.cpp +++ b/src/core/hle/service/nvdrv/core/container.cpp | |||
| @@ -16,8 +16,8 @@ | |||
| 16 | namespace Service::Nvidia::NvCore { | 16 | namespace Service::Nvidia::NvCore { |
| 17 | 17 | ||
| 18 | struct ContainerImpl { | 18 | struct ContainerImpl { |
| 19 | explicit ContainerImpl(Tegra::Host1x::Host1x& host1x_) | 19 | explicit ContainerImpl(Container& core, Tegra::Host1x::Host1x& host1x_) |
| 20 | : host1x{host1x_}, file{host1x_}, manager{host1x_}, device_file_data{} {} | 20 | : host1x{host1x_}, file{core, host1x_}, manager{host1x_}, device_file_data{} {} |
| 21 | Tegra::Host1x::Host1x& host1x; | 21 | Tegra::Host1x::Host1x& host1x; |
| 22 | NvMap file; | 22 | NvMap file; |
| 23 | SyncpointManager manager; | 23 | SyncpointManager manager; |
| @@ -29,7 +29,7 @@ struct ContainerImpl { | |||
| 29 | }; | 29 | }; |
| 30 | 30 | ||
| 31 | Container::Container(Tegra::Host1x::Host1x& host1x_) { | 31 | Container::Container(Tegra::Host1x::Host1x& host1x_) { |
| 32 | impl = std::make_unique<ContainerImpl>(host1x_); | 32 | impl = std::make_unique<ContainerImpl>(*this, host1x_); |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | Container::~Container() = default; | 35 | Container::~Container() = default; |
diff --git a/src/core/hle/service/nvdrv/core/nvmap.cpp b/src/core/hle/service/nvdrv/core/nvmap.cpp index 7879c6f04..e4168a37c 100644 --- a/src/core/hle/service/nvdrv/core/nvmap.cpp +++ b/src/core/hle/service/nvdrv/core/nvmap.cpp | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | #include "common/alignment.h" | 7 | #include "common/alignment.h" |
| 8 | #include "common/assert.h" | 8 | #include "common/assert.h" |
| 9 | #include "common/logging/log.h" | 9 | #include "common/logging/log.h" |
| 10 | #include "core/hle/service/nvdrv/core/container.h" | ||
| 10 | #include "core/hle/service/nvdrv/core/nvmap.h" | 11 | #include "core/hle/service/nvdrv/core/nvmap.h" |
| 11 | #include "core/memory.h" | 12 | #include "core/memory.h" |
| 12 | #include "video_core/host1x/host1x.h" | 13 | #include "video_core/host1x/host1x.h" |
| @@ -64,7 +65,7 @@ NvResult NvMap::Handle::Duplicate(bool internal_session) { | |||
| 64 | return NvResult::Success; | 65 | return NvResult::Success; |
| 65 | } | 66 | } |
| 66 | 67 | ||
| 67 | NvMap::NvMap(Tegra::Host1x::Host1x& host1x_) : host1x{host1x_} {} | 68 | NvMap::NvMap(Container& core_, Tegra::Host1x::Host1x& host1x_) : host1x{host1x_}, core{core_} {} |
| 68 | 69 | ||
| 69 | void NvMap::AddHandle(std::shared_ptr<Handle> handle_description) { | 70 | void NvMap::AddHandle(std::shared_ptr<Handle> handle_description) { |
| 70 | std::scoped_lock lock(handles_lock); | 71 | std::scoped_lock lock(handles_lock); |
| @@ -160,6 +161,8 @@ DAddr NvMap::PinHandle(NvMap::Handle::Id handle, size_t session_id, bool low_are | |||
| 160 | // If not then allocate some space and map it | 161 | // If not then allocate some space and map it |
| 161 | DAddr address{}; | 162 | DAddr address{}; |
| 162 | auto& smmu = host1x.MemoryManager(); | 163 | auto& smmu = host1x.MemoryManager(); |
| 164 | auto* session = core.GetSession(session_id); | ||
| 165 | |||
| 163 | auto allocate = std::bind(&Tegra::MaxwellDeviceMemoryManager::Allocate, &smmu, _1); | 166 | auto allocate = std::bind(&Tegra::MaxwellDeviceMemoryManager::Allocate, &smmu, _1); |
| 164 | //: std::bind(&Tegra::MaxwellDeviceMemoryManager::Allocate, &smmu, _1); | 167 | //: std::bind(&Tegra::MaxwellDeviceMemoryManager::Allocate, &smmu, _1); |
| 165 | while ((address = allocate(static_cast<size_t>(handle_description->aligned_size))) == 0) { | 168 | while ((address = allocate(static_cast<size_t>(handle_description->aligned_size))) == 0) { |
| @@ -179,7 +182,7 @@ DAddr NvMap::PinHandle(NvMap::Handle::Id handle, size_t session_id, bool low_are | |||
| 179 | handle_description->d_address = address; | 182 | handle_description->d_address = address; |
| 180 | 183 | ||
| 181 | smmu.Map(address, handle_description->address, handle_description->aligned_size, | 184 | smmu.Map(address, handle_description->address, handle_description->aligned_size, |
| 182 | session_id); | 185 | session->smmu_id); |
| 183 | } | 186 | } |
| 184 | 187 | ||
| 185 | handle_description->pins++; | 188 | handle_description->pins++; |
diff --git a/src/core/hle/service/nvdrv/core/nvmap.h b/src/core/hle/service/nvdrv/core/nvmap.h index e9e9e8b5b..7dd6d26c3 100644 --- a/src/core/hle/service/nvdrv/core/nvmap.h +++ b/src/core/hle/service/nvdrv/core/nvmap.h | |||
| @@ -25,6 +25,8 @@ class Host1x; | |||
| 25 | } // namespace Tegra | 25 | } // namespace Tegra |
| 26 | 26 | ||
| 27 | namespace Service::Nvidia::NvCore { | 27 | namespace Service::Nvidia::NvCore { |
| 28 | |||
| 29 | class Container; | ||
| 28 | /** | 30 | /** |
| 29 | * @brief The nvmap core class holds the global state for nvmap and provides methods to manage | 31 | * @brief The nvmap core class holds the global state for nvmap and provides methods to manage |
| 30 | * handles | 32 | * handles |
| @@ -109,7 +111,7 @@ public: | |||
| 109 | bool can_unlock; //!< If the address region is ready to be unlocked | 111 | bool can_unlock; //!< If the address region is ready to be unlocked |
| 110 | }; | 112 | }; |
| 111 | 113 | ||
| 112 | explicit NvMap(Tegra::Host1x::Host1x& host1x); | 114 | explicit NvMap(Container& core, Tegra::Host1x::Host1x& host1x); |
| 113 | 115 | ||
| 114 | /** | 116 | /** |
| 115 | * @brief Creates an unallocated handle of the given size | 117 | * @brief Creates an unallocated handle of the given size |
| @@ -173,5 +175,7 @@ private: | |||
| 173 | * @return If the handle was removed from the map | 175 | * @return If the handle was removed from the map |
| 174 | */ | 176 | */ |
| 175 | bool TryRemoveHandle(const Handle& handle_description); | 177 | bool TryRemoveHandle(const Handle& handle_description); |
| 178 | |||
| 179 | Container& core; | ||
| 176 | }; | 180 | }; |
| 177 | } // namespace Service::Nvidia::NvCore | 181 | } // namespace Service::Nvidia::NvCore |