summaryrefslogtreecommitdiffstats
path: root/src/intel/vulkan/anv_intel.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-03-13 17:20:15 -0700
committerJason Ekstrand <[email protected]>2017-04-27 20:08:46 -0700
commit818b8579145196c7a8d4095bd5e65367e02a8fef (patch)
tree9392d3ef4b103adc00a1c69f68349453d2ce9947 /src/intel/vulkan/anv_intel.c
parent494d6f65a7c5138bd3bda062afd6a1c4adadc1e8 (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.c15
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);