anv: Add allocator support for client-visible addresses

When a BO is flagged as having a client visible address, we put it in
its own heap.  We also support the client explicitly specifying an
address in said heap.  If an address collision happens, we return false
from anv_vma_alloc which turns into a VK_ERROR_OUT_OF_DEVICE_MEMORY.

Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
This commit is contained in:
Jason Ekstrand
2019-12-02 16:03:56 -06:00
parent 96e3328ac2
commit a8e59b3708
6 changed files with 107 additions and 10 deletions

View File

@@ -307,7 +307,9 @@ anv_import_ahw_memory(VkDevice device_h,
if (dma_buf < 0)
return VK_ERROR_INVALID_EXTERNAL_HANDLE;
VkResult result = anv_device_import_bo(device, dma_buf, 0, &mem->bo);
VkResult result = anv_device_import_bo(device, dma_buf, 0,
0 /* client_address */,
&mem->bo);
assert(VK_SUCCESS);
/* "If the vkAllocateMemory command succeeds, the implementation must
@@ -468,6 +470,7 @@ anv_image_from_gralloc(VkDevice device_h,
result = anv_device_import_bo(device, dma_buf,
ANV_BO_ALLOC_IMPLICIT_SYNC |
ANV_BO_ALLOC_IMPLICIT_WRITE,
0 /* client_address */,
&bo);
if (result != VK_SUCCESS) {
return vk_errorf(device->instance, device, result,