mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-25 21:06:58 -05:00
video_core/memory_manager: Make FindFreeRegion() a const member function
This doesn't modify internal state, so it can be made a const member function.
This commit is contained in:
parent
9dec087fca
commit
085b388a7a
2 changed files with 10 additions and 9 deletions
|
@ -77,16 +77,17 @@ GPUVAddr MemoryManager::UnmapBuffer(GPUVAddr gpu_addr, u64 size) {
|
||||||
return gpu_addr;
|
return gpu_addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
GPUVAddr MemoryManager::FindFreeRegion(GPUVAddr region_start, u64 size) {
|
GPUVAddr MemoryManager::FindFreeRegion(GPUVAddr region_start, u64 size) const {
|
||||||
// Find the first Free VMA.
|
// Find the first Free VMA.
|
||||||
const VMAHandle vma_handle{std::find_if(vma_map.begin(), vma_map.end(), [&](const auto& vma) {
|
const VMAHandle vma_handle{
|
||||||
if (vma.second.type != VirtualMemoryArea::Type::Unmapped) {
|
std::find_if(vma_map.begin(), vma_map.end(), [region_start, size](const auto& vma) {
|
||||||
return false;
|
if (vma.second.type != VirtualMemoryArea::Type::Unmapped) {
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const VAddr vma_end{vma.second.base + vma.second.size};
|
const VAddr vma_end{vma.second.base + vma.second.size};
|
||||||
return vma_end > region_start && vma_end >= region_start + size;
|
return vma_end > region_start && vma_end >= region_start + size;
|
||||||
})};
|
})};
|
||||||
|
|
||||||
if (vma_handle == vma_map.end()) {
|
if (vma_handle == vma_map.end()) {
|
||||||
return {};
|
return {};
|
||||||
|
|
|
@ -127,7 +127,7 @@ private:
|
||||||
void UpdatePageTableForVMA(const VirtualMemoryArea& vma);
|
void UpdatePageTableForVMA(const VirtualMemoryArea& vma);
|
||||||
|
|
||||||
/// Finds a free (unmapped region) of the specified size starting at the specified address.
|
/// Finds a free (unmapped region) of the specified size starting at the specified address.
|
||||||
GPUVAddr FindFreeRegion(GPUVAddr region_start, u64 size);
|
GPUVAddr FindFreeRegion(GPUVAddr region_start, u64 size) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static constexpr u64 page_bits{16};
|
static constexpr u64 page_bits{16};
|
||||||
|
|
Loading…
Reference in a new issue