|
|
|
@ -409,21 +409,19 @@ NvResult nvhost_as_gpu::MapBufferEx(IoctlMapBufferEx& params) { |
|
|
|
mapping_map[params.offset] = mapping; |
|
|
|
} |
|
|
|
|
|
|
|
map_buffer_offsets.insert(params.offset); |
|
|
|
|
|
|
|
return NvResult::Success; |
|
|
|
} |
|
|
|
|
|
|
|
NvResult nvhost_as_gpu::UnmapBuffer(IoctlUnmapBuffer& params) { |
|
|
|
if (map_buffer_offsets.find(params.offset) != map_buffer_offsets.end()) { |
|
|
|
LOG_DEBUG(Service_NVDRV, "called, offset={:#X}", params.offset); |
|
|
|
LOG_DEBUG(Service_NVDRV, "called, offset={:#X}", params.offset); |
|
|
|
|
|
|
|
std::scoped_lock lock(mutex); |
|
|
|
std::scoped_lock lock(mutex); |
|
|
|
|
|
|
|
if (!vm.initialised) { |
|
|
|
return NvResult::BadValue; |
|
|
|
} |
|
|
|
if (!vm.initialised) { |
|
|
|
return NvResult::BadValue; |
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
auto mapping{mapping_map.at(params.offset)}; |
|
|
|
|
|
|
|
if (!mapping->fixed) { |
|
|
|
@ -445,8 +443,10 @@ NvResult nvhost_as_gpu::UnmapBuffer(IoctlUnmapBuffer& params) { |
|
|
|
nvmap.UnpinHandle(mapping->handle); |
|
|
|
|
|
|
|
mapping_map.erase(params.offset); |
|
|
|
map_buffer_offsets.erase(params.offset); |
|
|
|
} catch (const std::out_of_range&) { |
|
|
|
LOG_WARNING(Service_NVDRV, "Couldn't find region to unmap at 0x{:X}", params.offset); |
|
|
|
} |
|
|
|
|
|
|
|
return NvResult::Success; |
|
|
|
} |
|
|
|
|
|
|
|
|