mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-06 08:50:09 +01:00
radv: add address binding report support for BOs imported with a ptr
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32403>
This commit is contained in:
parent
723cbc95d8
commit
f8af89aaa0
3 changed files with 23 additions and 2 deletions
|
|
@ -340,3 +340,22 @@ radv_bo_from_fd(struct radv_device *device, int fd, unsigned priority, struct ra
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
VkResult
|
||||
radv_bo_from_ptr(struct radv_device *device, void *host_ptr, uint64_t alloc_size, unsigned priority,
|
||||
struct radv_device_memory *mem)
|
||||
{
|
||||
struct radv_physical_device *pdev = radv_device_physical(device);
|
||||
struct radv_instance *instance = radv_physical_device_instance(pdev);
|
||||
struct radeon_winsys *ws = device->ws;
|
||||
VkResult result;
|
||||
|
||||
result = ws->buffer_from_ptr(ws, host_ptr, alloc_size, priority, &mem->bo);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
vk_address_binding_report(&instance->vk, &mem->base, radv_buffer_get_va(mem->bo), mem->bo->size,
|
||||
VK_DEVICE_ADDRESS_BINDING_TYPE_BIND_EXT);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,4 +50,7 @@ void radv_bo_destroy(struct radv_device *device, struct vk_object_base *object,
|
|||
VkResult radv_bo_from_fd(struct radv_device *device, int fd, unsigned priority, struct radv_device_memory *mem,
|
||||
uint64_t *alloc_size);
|
||||
|
||||
VkResult radv_bo_from_ptr(struct radv_device *device, void *host_ptr, uint64_t alloc_size, unsigned priority,
|
||||
struct radv_device_memory *mem);
|
||||
|
||||
#endif /* RADV_BUFFER_H */
|
||||
|
|
|
|||
|
|
@ -177,8 +177,7 @@ radv_alloc_memory(struct radv_device *device, const VkMemoryAllocateInfo *pAlloc
|
|||
}
|
||||
} else if (host_ptr_info) {
|
||||
assert(host_ptr_info->handleType == VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT);
|
||||
result = device->ws->buffer_from_ptr(device->ws, host_ptr_info->pHostPointer, pAllocateInfo->allocationSize,
|
||||
priority, &mem->bo);
|
||||
result = radv_bo_from_ptr(device, host_ptr_info->pHostPointer, pAllocateInfo->allocationSize, priority, mem);
|
||||
if (result != VK_SUCCESS) {
|
||||
goto fail;
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue