mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-07 02:10:12 +01:00
radv: add address binding report support for BOs imported with a fd
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
caa6ccd7d6
commit
723cbc95d8
4 changed files with 25 additions and 2 deletions
|
|
@ -637,7 +637,7 @@ radv_import_ahb_memory(struct radv_device *device, struct radv_device_memory *me
|
|||
return VK_ERROR_INVALID_EXTERNAL_HANDLE;
|
||||
|
||||
uint64_t alloc_size = 0;
|
||||
VkResult result = device->ws->buffer_from_fd(device->ws, dma_buf, priority, &mem->bo, &alloc_size);
|
||||
VkResult result = radv_bo_from_fd(device, dma_buf, priority, mem, &alloc_size);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
|
|
|
|||
|
|
@ -321,3 +321,22 @@ radv_bo_virtual_bind(struct radv_device *device, struct vk_object_base *object,
|
|||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VkResult
|
||||
radv_bo_from_fd(struct radv_device *device, int fd, unsigned priority, struct radv_device_memory *mem,
|
||||
uint64_t *alloc_size)
|
||||
{
|
||||
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_fd(ws, fd, priority, &mem->bo, alloc_size);
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
#include "vk_buffer.h"
|
||||
|
||||
struct radv_device;
|
||||
struct radv_device_memory;
|
||||
|
||||
struct radv_buffer {
|
||||
struct vk_buffer vk;
|
||||
|
|
@ -46,4 +47,7 @@ VkResult radv_bo_virtual_bind(struct radv_device *device, struct vk_object_base
|
|||
|
||||
void radv_bo_destroy(struct radv_device *device, struct vk_object_base *object, struct radeon_winsys_bo *bo);
|
||||
|
||||
VkResult radv_bo_from_fd(struct radv_device *device, int fd, unsigned priority, struct radv_device_memory *mem,
|
||||
uint64_t *alloc_size);
|
||||
|
||||
#endif /* RADV_BUFFER_H */
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ radv_alloc_memory(struct radv_device *device, const VkMemoryAllocateInfo *pAlloc
|
|||
} else if (import_info) {
|
||||
assert(import_info->handleType == VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT ||
|
||||
import_info->handleType == VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT);
|
||||
result = device->ws->buffer_from_fd(device->ws, import_info->fd, priority, &mem->bo, NULL);
|
||||
result = radv_bo_from_fd(device, import_info->fd, priority, mem, NULL);
|
||||
if (result != VK_SUCCESS) {
|
||||
goto fail;
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue