diff options
Diffstat (limited to '')
| -rw-r--r-- | src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp | 5 | ||||
| -rw-r--r-- | src/core/hle/service/nvdrv/devices/nvmap.cpp | 13 | ||||
| -rw-r--r-- | src/core/hle/service/nvdrv/devices/nvmap.h | 2 |
3 files changed, 16 insertions, 4 deletions
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp index c1eea861d..7d8ed6920 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp | |||
| @@ -8,6 +8,8 @@ | |||
| 8 | #include "core/core.h" | 8 | #include "core/core.h" |
| 9 | #include "core/hle/service/nvdrv/devices/nvhost_as_gpu.h" | 9 | #include "core/hle/service/nvdrv/devices/nvhost_as_gpu.h" |
| 10 | #include "core/hle/service/nvdrv/devices/nvmap.h" | 10 | #include "core/hle/service/nvdrv/devices/nvmap.h" |
| 11 | #include "video_core/renderer_base.h" | ||
| 12 | #include "video_core/video_core.h" | ||
| 11 | 13 | ||
| 12 | namespace Service::Nvidia::Devices { | 14 | namespace Service::Nvidia::Devices { |
| 13 | 15 | ||
| @@ -154,6 +156,9 @@ u32 nvhost_as_gpu::UnmapBuffer(const std::vector<u8>& input, std::vector<u8>& ou | |||
| 154 | 156 | ||
| 155 | ASSERT_MSG(itr != buffer_mappings.end(), "Tried to unmap invalid mapping"); | 157 | ASSERT_MSG(itr != buffer_mappings.end(), "Tried to unmap invalid mapping"); |
| 156 | 158 | ||
| 159 | // Remove this memory region from the rasterizer cache. | ||
| 160 | VideoCore::g_renderer->Rasterizer()->FlushAndInvalidateRegion(params.offset, itr->second.size); | ||
| 161 | |||
| 157 | params.offset = gpu.memory_manager->UnmapBuffer(params.offset, itr->second.size); | 162 | params.offset = gpu.memory_manager->UnmapBuffer(params.offset, itr->second.size); |
| 158 | 163 | ||
| 159 | buffer_mappings.erase(itr->second.offset); | 164 | buffer_mappings.erase(itr->second.offset); |
diff --git a/src/core/hle/service/nvdrv/devices/nvmap.cpp b/src/core/hle/service/nvdrv/devices/nvmap.cpp index 23fe98190..2fc7c87e0 100644 --- a/src/core/hle/service/nvdrv/devices/nvmap.cpp +++ b/src/core/hle/service/nvdrv/devices/nvmap.cpp | |||
| @@ -148,6 +148,7 @@ u32 nvmap::IocParam(const std::vector<u8>& input, std::vector<u8>& output) { | |||
| 148 | } | 148 | } |
| 149 | 149 | ||
| 150 | u32 nvmap::IocFree(const std::vector<u8>& input, std::vector<u8>& output) { | 150 | u32 nvmap::IocFree(const std::vector<u8>& input, std::vector<u8>& output) { |
| 151 | // TODO(Subv): These flags are unconfirmed. | ||
| 151 | enum FreeFlags { | 152 | enum FreeFlags { |
| 152 | Freed = 0, | 153 | Freed = 0, |
| 153 | NotFreedYet = 1, | 154 | NotFreedYet = 1, |
| @@ -161,15 +162,21 @@ u32 nvmap::IocFree(const std::vector<u8>& input, std::vector<u8>& output) { | |||
| 161 | auto itr = handles.find(params.handle); | 162 | auto itr = handles.find(params.handle); |
| 162 | ASSERT(itr != handles.end()); | 163 | ASSERT(itr != handles.end()); |
| 163 | 164 | ||
| 165 | ASSERT(itr->second->refcount > 0); | ||
| 166 | |||
| 164 | itr->second->refcount--; | 167 | itr->second->refcount--; |
| 165 | 168 | ||
| 166 | params.refcount = itr->second->refcount; | ||
| 167 | params.size = itr->second->size; | 169 | params.size = itr->second->size; |
| 168 | 170 | ||
| 169 | if (itr->second->refcount == 0) | 171 | if (itr->second->refcount == 0) { |
| 170 | params.flags = Freed; | 172 | params.flags = Freed; |
| 171 | else | 173 | // The address of the nvmap is written to the output if we're finally freeing it, otherwise |
| 174 | // 0 is written. | ||
| 175 | params.address = itr->second->addr; | ||
| 176 | } else { | ||
| 172 | params.flags = NotFreedYet; | 177 | params.flags = NotFreedYet; |
| 178 | params.address = 0; | ||
| 179 | } | ||
| 173 | 180 | ||
| 174 | handles.erase(params.handle); | 181 | handles.erase(params.handle); |
| 175 | 182 | ||
diff --git a/src/core/hle/service/nvdrv/devices/nvmap.h b/src/core/hle/service/nvdrv/devices/nvmap.h index 39fafaa7c..f2eec6409 100644 --- a/src/core/hle/service/nvdrv/devices/nvmap.h +++ b/src/core/hle/service/nvdrv/devices/nvmap.h | |||
| @@ -94,7 +94,7 @@ private: | |||
| 94 | struct IocFreeParams { | 94 | struct IocFreeParams { |
| 95 | u32_le handle; | 95 | u32_le handle; |
| 96 | INSERT_PADDING_BYTES(4); | 96 | INSERT_PADDING_BYTES(4); |
| 97 | u64_le refcount; | 97 | u64_le address; |
| 98 | u32_le size; | 98 | u32_le size; |
| 99 | u32_le flags; | 99 | u32_le flags; |
| 100 | }; | 100 | }; |