memory_manager: Make GpuToCpuAddress return an optional.

This commit is contained in:
bunnei
2018-04-21 12:31:30 -04:00
parent 9e11a76e92
commit 239ac8abe2
7 changed files with 37 additions and 28 deletions

View File

@ -73,9 +73,14 @@ boost::optional<GPUVAddr> MemoryManager::FindFreeBlock(u64 size, u64 align) {
return {};
}
VAddr MemoryManager::GpuToCpuAddress(GPUVAddr gpu_addr) {
boost::optional<VAddr> MemoryManager::GpuToCpuAddress(GPUVAddr gpu_addr) {
VAddr base_addr = PageSlot(gpu_addr);
ASSERT(base_addr != static_cast<u64>(PageStatus::Unmapped));
if (base_addr == static_cast<u64>(PageStatus::Allocated)) {
return {};
}
return base_addr + (gpu_addr & PAGE_MASK);
}