summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Liam2023-08-25 09:39:18 -0400
committerGravatar Liam2023-08-25 09:39:18 -0400
commit9e134c3da2b34d2945c6e2e54e3f43cfd901caaf (patch)
tree4a61e1e9cb341e0355e8d203aa602ac5bacca8d4
parentMerge pull request #11327 from liamwhite/skyline-2 (diff)
downloadyuzu-9e134c3da2b34d2945c6e2e54e3f43cfd901caaf.tar.gz
yuzu-9e134c3da2b34d2945c6e2e54e3f43cfd901caaf.tar.xz
yuzu-9e134c3da2b34d2945c6e2e54e3f43cfd901caaf.zip
nvhost_as_gpu: ensure mappings are aligned to big page size when deallocated
-rw-r--r--src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp4
1 files changed, 3 insertions, 1 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 07e570a9f..7d7bb8687 100644
--- a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp
@@ -204,9 +204,11 @@ void nvhost_as_gpu::FreeMappingLocked(u64 offset) {
204 if (!mapping->fixed) { 204 if (!mapping->fixed) {
205 auto& allocator{mapping->big_page ? *vm.big_page_allocator : *vm.small_page_allocator}; 205 auto& allocator{mapping->big_page ? *vm.big_page_allocator : *vm.small_page_allocator};
206 u32 page_size_bits{mapping->big_page ? vm.big_page_size_bits : VM::PAGE_SIZE_BITS}; 206 u32 page_size_bits{mapping->big_page ? vm.big_page_size_bits : VM::PAGE_SIZE_BITS};
207 u32 page_size{mapping->big_page ? vm.big_page_size : VM::YUZU_PAGESIZE};
208 u64 aligned_size{Common::AlignUp(mapping->size, page_size)};
207 209
208 allocator.Free(static_cast<u32>(mapping->offset >> page_size_bits), 210 allocator.Free(static_cast<u32>(mapping->offset >> page_size_bits),
209 static_cast<u32>(mapping->size >> page_size_bits)); 211 static_cast<u32>(aligned_size >> page_size_bits));
210 } 212 }
211 213
212 // Sparse mappings shouldn't be fully unmapped, just returned to their sparse state 214 // Sparse mappings shouldn't be fully unmapped, just returned to their sparse state