return VK_SUCCESS;
}
-VkResult
-nvk_allocate_memory(struct nvk_device *dev,
- const VkMemoryAllocateInfo *pAllocateInfo,
- const struct nvk_memory_tiling_info *tile_info,
- const VkAllocationCallbacks *pAllocator,
- struct nvk_device_memory **mem_out)
+VKAPI_ATTR VkResult VKAPI_CALL
+nvk_AllocateMemory(VkDevice device,
+ const VkMemoryAllocateInfo *pAllocateInfo,
+ const VkAllocationCallbacks *pAllocator,
+ VkDeviceMemory *pMem)
{
+ VK_FROM_HANDLE(nvk_device, dev, device);
struct nvk_physical_device *pdev = nvk_device_physical(dev);
struct nvk_device_memory *mem;
VkResult result = VK_SUCCESS;
goto fail_alloc;
}
assert(!(flags & ~mem->bo->flags));
- } else if (tile_info) {
- mem->bo = nouveau_ws_bo_new_tiled(dev->ws_dev,
- pAllocateInfo->allocationSize, 0,
- tile_info->pte_kind,
- tile_info->tile_mode,
- flags);
- if (!mem->bo) {
- result = vk_error(dev, VK_ERROR_OUT_OF_DEVICE_MEMORY);
- goto fail_alloc;
- }
} else {
mem->bo = nouveau_ws_bo_new(dev->ws_dev, aligned_size, alignment, flags);
if (!mem->bo) {
close(fd_info->fd);
}
- *mem_out = mem;
+ *pMem = nvk_device_memory_to_handle(mem);
return VK_SUCCESS;
return result;
}
-void
-nvk_free_memory(struct nvk_device *dev,
- struct nvk_device_memory *mem,
- const VkAllocationCallbacks *pAllocator)
-{
- if (mem->map)
- nouveau_ws_bo_unmap(mem->bo, mem->map);
-
- nouveau_ws_bo_destroy(mem->bo);
-
- vk_device_memory_destroy(&dev->vk, pAllocator, &mem->vk);
-}
-
-VKAPI_ATTR VkResult VKAPI_CALL
-nvk_AllocateMemory(VkDevice device,
- const VkMemoryAllocateInfo *pAllocateInfo,
- const VkAllocationCallbacks *pAllocator,
- VkDeviceMemory *pMem)
-{
- VK_FROM_HANDLE(nvk_device, dev, device);
- struct nvk_device_memory *mem;
- VkResult result;
-
-
- struct nvk_memory_tiling_info *p_tile_info = NULL;
-
-
- result = nvk_allocate_memory(dev, pAllocateInfo, p_tile_info,
- pAllocator, &mem);
- if (result != VK_SUCCESS)
- return result;
-
-
- *pMem = nvk_device_memory_to_handle(mem);
-
- return VK_SUCCESS;
-}
-
VKAPI_ATTR void VKAPI_CALL
nvk_FreeMemory(VkDevice device,
VkDeviceMemory _mem,
if (!mem)
return;
- nvk_free_memory(dev, mem, pAllocator);
+ if (mem->map)
+ nouveau_ws_bo_unmap(mem->bo, mem->map);
+
+ nouveau_ws_bo_destroy(mem->bo);
+
+ vk_device_memory_destroy(&dev->vk, pAllocator, &mem->vk);
}
VKAPI_ATTR VkResult VKAPI_CALL
VK_DEFINE_NONDISP_HANDLE_CASTS(nvk_device_memory, vk.base, VkDeviceMemory, VK_OBJECT_TYPE_DEVICE_MEMORY)
-struct nvk_memory_tiling_info {
- uint16_t tile_mode;
- uint8_t pte_kind;
-};
-
-VkResult nvk_allocate_memory(struct nvk_device *dev,
- const VkMemoryAllocateInfo *pAllocateInfo,
- const struct nvk_memory_tiling_info *tile_info,
- const VkAllocationCallbacks *pAllocator,
- struct nvk_device_memory **mem_out);
-
-void nvk_free_memory(struct nvk_device *dev,
- struct nvk_device_memory *mem,
- const VkAllocationCallbacks *pAllocator);
-
extern const VkExternalMemoryProperties nvk_opaque_fd_mem_props;
extern const VkExternalMemoryProperties nvk_dma_buf_mem_props;