From 818b8579145196c7a8d4095bd5e65367e02a8fef Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Mon, 13 Mar 2017 17:20:15 -0700 Subject: anv: Use the BO cache for DeviceMemory allocations Reviewed-by: Chad Versace --- src/intel/vulkan/anv_intel.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'src/intel/vulkan/anv_intel.c') diff --git a/src/intel/vulkan/anv_intel.c b/src/intel/vulkan/anv_intel.c index eda474e62ec..991a93542d2 100644 --- a/src/intel/vulkan/anv_intel.c +++ b/src/intel/vulkan/anv_intel.c @@ -49,18 +49,15 @@ VkResult anv_CreateDmaBufImageINTEL( if (mem == NULL) return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); - uint32_t gem_handle = anv_gem_fd_to_handle(device, pCreateInfo->fd); - if (!gem_handle) { - result = vk_error(VK_ERROR_OUT_OF_DEVICE_MEMORY); - goto fail; - } - uint64_t size = (uint64_t)pCreateInfo->strideInBytes * pCreateInfo->extent.height; - anv_bo_init(&mem->bo, gem_handle, size); + result = anv_bo_cache_import(device, &device->bo_cache, + pCreateInfo->fd, size, &mem->bo); + if (result != VK_SUCCESS) + goto fail; if (device->instance->physicalDevice.supports_48bit_addresses) - mem->bo.flags |= EXEC_OBJECT_SUPPORTS_48B_ADDRESS; + mem->bo->flags |= EXEC_OBJECT_SUPPORTS_48B_ADDRESS; anv_image_create(_device, &(struct anv_image_create_info) { @@ -83,7 +80,7 @@ VkResult anv_CreateDmaBufImageINTEL( pAllocator, &image_h); image = anv_image_from_handle(image_h); - image->bo = &mem->bo; + image->bo = mem->bo; image->offset = 0; assert(image->extent.width > 0); -- cgit v1.2.3