mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-07 15:10:12 +01:00
panvk: Pass PAN_BO_SHAREABLE when relevant
Check VkExportMemoryAllocateInfo to know if we might export the BO object at some point. Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26357>
This commit is contained in:
parent
aa6176ee1e
commit
30d6dfb861
1 changed files with 16 additions and 3 deletions
|
|
@ -1035,6 +1035,7 @@ panvk_AllocateMemory(VkDevice _device,
|
|||
{
|
||||
VK_FROM_HANDLE(panvk_device, device, _device);
|
||||
struct panvk_device_memory *mem;
|
||||
bool can_be_exported = false;
|
||||
|
||||
assert(pAllocateInfo->sType == VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO);
|
||||
|
||||
|
|
@ -1044,6 +1045,18 @@ panvk_AllocateMemory(VkDevice _device,
|
|||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
const VkExportMemoryAllocateInfo *export_info =
|
||||
vk_find_struct_const(pAllocateInfo->pNext, EXPORT_MEMORY_ALLOCATE_INFO);
|
||||
|
||||
if (export_info) {
|
||||
if (export_info->handleTypes &
|
||||
~(VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT |
|
||||
VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT))
|
||||
return vk_error(device, VK_ERROR_INVALID_EXTERNAL_HANDLE);
|
||||
else if (export_info->handleTypes)
|
||||
can_be_exported = true;
|
||||
}
|
||||
|
||||
mem = vk_object_alloc(&device->vk, pAllocator, sizeof(*mem),
|
||||
VK_OBJECT_TYPE_DEVICE_MEMORY);
|
||||
if (mem == NULL)
|
||||
|
|
@ -1069,9 +1082,9 @@ panvk_AllocateMemory(VkDevice _device,
|
|||
/* take ownership and close the fd */
|
||||
close(fd_info->fd);
|
||||
} else {
|
||||
mem->bo = panfrost_bo_create(&device->physical_device->pdev,
|
||||
pAllocateInfo->allocationSize, 0,
|
||||
"User-requested memory");
|
||||
mem->bo = panfrost_bo_create(
|
||||
&device->physical_device->pdev, pAllocateInfo->allocationSize,
|
||||
can_be_exported ? PAN_BO_SHAREABLE : 0, "User-requested memory");
|
||||
}
|
||||
|
||||
assert(mem->bo);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue