summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2019-03-21 04:12:28 +0100
committerbunnei <bunneidev@gmail.com>2019-03-21 04:12:28 +0100
commit2117edd0f848cd7bc35bdbb1495ca10649715625 (patch)
tree6befcf08e4457543fc3fab9b9fc1deb2a76d6783
parentmemory_manager: Use Common::AlignUp in public interface as needed. (diff)
downloadyuzu-2117edd0f848cd7bc35bdbb1495ca10649715625.tar
yuzu-2117edd0f848cd7bc35bdbb1495ca10649715625.tar.gz
yuzu-2117edd0f848cd7bc35bdbb1495ca10649715625.tar.bz2
yuzu-2117edd0f848cd7bc35bdbb1495ca10649715625.tar.lz
yuzu-2117edd0f848cd7bc35bdbb1495ca10649715625.tar.xz
yuzu-2117edd0f848cd7bc35bdbb1495ca10649715625.tar.zst
yuzu-2117edd0f848cd7bc35bdbb1495ca10649715625.zip
-rw-r--r--src/video_core/memory_manager.cpp14
-rw-r--r--src/video_core/memory_manager.h4
2 files changed, 6 insertions, 12 deletions
diff --git a/src/video_core/memory_manager.cpp b/src/video_core/memory_manager.cpp
index 6dc133c93..e76b59842 100644
--- a/src/video_core/memory_manager.cpp
+++ b/src/video_core/memory_manager.cpp
@@ -30,8 +30,7 @@ MemoryManager::MemoryManager() {
GPUVAddr MemoryManager::AllocateSpace(u64 size, u64 align) {
const u64 aligned_size{Common::AlignUp(size, page_size)};
- const GPUVAddr gpu_addr{
- FindFreeRegion(address_space_base, aligned_size, align, VirtualMemoryArea::Type::Unmapped)};
+ const GPUVAddr gpu_addr{FindFreeRegion(address_space_base, aligned_size)};
AllocateMemory(gpu_addr, 0, aligned_size);
@@ -48,8 +47,7 @@ GPUVAddr MemoryManager::AllocateSpace(GPUVAddr gpu_addr, u64 size, u64 align) {
GPUVAddr MemoryManager::MapBufferEx(VAddr cpu_addr, u64 size) {
const u64 aligned_size{Common::AlignUp(size, page_size)};
- const GPUVAddr gpu_addr{FindFreeRegion(address_space_base, aligned_size, page_size,
- VirtualMemoryArea::Type::Unmapped)};
+ const GPUVAddr gpu_addr{FindFreeRegion(address_space_base, aligned_size)};
MapBackingMemory(gpu_addr, Memory::GetPointer(cpu_addr), aligned_size, cpu_addr);
@@ -79,14 +77,10 @@ GPUVAddr MemoryManager::UnmapBuffer(GPUVAddr gpu_addr, u64 size) {
return gpu_addr;
}
-GPUVAddr MemoryManager::FindFreeRegion(GPUVAddr region_start, u64 size, u64 align,
- VirtualMemoryArea::Type vma_type) {
-
- align = (align + page_mask) & ~page_mask;
-
+GPUVAddr MemoryManager::FindFreeRegion(GPUVAddr region_start, u64 size) {
// Find the first Free VMA.
const VMAHandle vma_handle{std::find_if(vma_map.begin(), vma_map.end(), [&](const auto& vma) {
- if (vma.second.type != vma_type) {
+ if (vma.second.type != VirtualMemoryArea::Type::Unmapped) {
return false;
}
diff --git a/src/video_core/memory_manager.h b/src/video_core/memory_manager.h
index 60ba6b858..34744bb27 100644
--- a/src/video_core/memory_manager.h
+++ b/src/video_core/memory_manager.h
@@ -126,8 +126,8 @@ private:
/// Updates the pages corresponding to this VMA so they match the VMA's attributes.
void UpdatePageTableForVMA(const VirtualMemoryArea& vma);
- GPUVAddr FindFreeRegion(GPUVAddr region_start, u64 size, u64 align,
- VirtualMemoryArea::Type vma_type);
+ /// Finds a free (unmapped region) of the specified size starting at the specified address.
+ GPUVAddr FindFreeRegion(GPUVAddr region_start, u64 size);
private:
static constexpr u64 page_bits{16};