nvk: only unmap heap bos that were mapped

Otherwise we munmap(0, size) and remove the cts binary maps

Also add an assert, though NULL is legal for munmap in theory,
nothing should be using it in practice on Linux.

Fixes: e6f137e9ed ("nvk: Only map heaps that explicitly request maps")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28006>
This commit is contained in:
Dave Airlie 2024-03-06 14:39:01 +10:00
parent 2feb3c6e30
commit ac391536eb

View file

@ -55,7 +55,10 @@ nvk_heap_finish(struct nvk_device *dev, struct nvk_heap *heap)
nouveau_ws_bo_unbind_vma(dev->ws_dev, heap->bos[bo_idx].addr,
heap->bos[bo_idx].bo->size);
}
nouveau_ws_bo_unmap(heap->bos[bo_idx].bo, heap->bos[bo_idx].map);
if (heap->map_flags) {
assert(heap->bos[bo_idx].map);
nouveau_ws_bo_unmap(heap->bos[bo_idx].bo, heap->bos[bo_idx].map);
}
nouveau_ws_bo_destroy(heap->bos[bo_idx].bo);
}