goto fail_bo;
}
memset(map, 0, mem->bo->size);
- munmap(map, mem->bo->size);
+ nouveau_ws_bo_unmap(mem->bo, map);
} else {
VkResult result = zero_vram(device, mem->bo);
if (result != VK_SUCCESS)
const VkAllocationCallbacks *pAllocator)
{
if (mem->map)
- munmap(mem->map, mem->bo->size);
+ nouveau_ws_bo_unmap(mem->bo, mem->map);
simple_mtx_lock(&device->memory_objects_lock);
list_del(&mem->link);
if (mem == NULL)
return;
- munmap(mem->map, mem->bo->size);
+ nouveau_ws_bo_unmap(mem->bo, mem->map);
mem->map = NULL;
}
#include "nouveau_device.h"
+#include <sys/mman.h>
+
enum nouveau_ws_bo_flags {
/* vram or gart depending on GPU */
NOUVEAU_WS_BO_LOCAL = 0 << 0,
bo->refcnt++;
}
+static inline void
+nouveau_ws_bo_unmap(struct nouveau_ws_bo *bo, void *ptr)
+{
+ munmap(ptr, bo->size);
+}
+
#endif
return push;
fail_alloc:
- munmap(map, bo->size);
+ nouveau_ws_bo_unmap(bo, map);
fail_map:
nouveau_ws_bo_destroy(bo);
fail_bo:
{
util_dynarray_fini(&push->bos);
if (push->bo) {
- munmap(push->orig_map, push->bo->size);
+ nouveau_ws_bo_unmap(push->bo, push->orig_map);
nouveau_ws_bo_destroy(push->bo);
}
}