diff options
author | Jason Ekstrand <[email protected]> | 2017-03-13 17:20:15 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2017-04-27 20:08:46 -0700 |
commit | 818b8579145196c7a8d4095bd5e65367e02a8fef (patch) | |
tree | 9392d3ef4b103adc00a1c69f68349453d2ce9947 /src/intel/vulkan/anv_intel.c | |
parent | 494d6f65a7c5138bd3bda062afd6a1c4adadc1e8 (diff) |
anv: Use the BO cache for DeviceMemory allocations
Reviewed-by: Chad Versace <[email protected]>
Diffstat (limited to 'src/intel/vulkan/anv_intel.c')
-rw-r--r-- | src/intel/vulkan/anv_intel.c | 15 |
1 files changed, 6 insertions, 9 deletions
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); |