mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 20:28:04 +02:00
lavapipe: do not short-circuit AHB export alloc (non-import)
Per spec VUID-VkMemoryAllocateInfo-pNext-01874: If the parameters do not define an import operation, and the pNext chain includes a VkExportMemoryAllocateInfo structure with VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID included in its handleTypes member, and the pNext chain includes a VkMemoryDedicatedAllocateInfo structure with image not equal to VK_NULL_HANDLE, then allocationSize must be 0 - before: total 116, skip 66, pass 36, fail 14 - after: total 116, skip 66, pass 50, fail 0 Fixes:cebb2bf266("lavapipe: Add AHB extension") Reviewed-by: Lucas Fryzek <lfryzek@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36204> (cherry picked from commit209e402720)
This commit is contained in:
parent
e88186b30f
commit
132471c61c
2 changed files with 17 additions and 9 deletions
|
|
@ -2344,7 +2344,7 @@
|
|||
"description": "lavapipe: do not short-circuit AHB export alloc (non-import)",
|
||||
"nominated": true,
|
||||
"nomination_type": 2,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "cebb2bf26623e31aa1fbab0e73c7e2a1e3cfe956",
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -1950,12 +1950,7 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_AllocateMemory(
|
|||
VkResult error = VK_ERROR_OUT_OF_DEVICE_MEMORY;
|
||||
assert(pAllocateInfo->sType == VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO);
|
||||
int priority = 0;
|
||||
|
||||
if (pAllocateInfo->allocationSize == 0) {
|
||||
/* Apparently, this is allowed */
|
||||
*pMem = VK_NULL_HANDLE;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
bool is_ahb_export_alloc = false;
|
||||
|
||||
vk_foreach_struct_const(ext, pAllocateInfo->pNext) {
|
||||
switch ((unsigned)ext->sType) {
|
||||
|
|
@ -1990,6 +1985,20 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_AllocateMemory(
|
|||
}
|
||||
}
|
||||
|
||||
#if DETECT_OS_ANDROID
|
||||
is_ahb_export_alloc = !ahb_import_info && export_info &&
|
||||
export_info->handleTypes & VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID;
|
||||
#endif
|
||||
|
||||
/* Can early return with size 0 if not AHB export alloc. See
|
||||
* VUID-VkMemoryAllocateInfo-pNext-01874 for details.
|
||||
*/
|
||||
if (pAllocateInfo->allocationSize == 0 && !is_ahb_export_alloc) {
|
||||
/* Apparently, this is allowed */
|
||||
*pMem = VK_NULL_HANDLE;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
#ifdef PIPE_MEMORY_FD
|
||||
if (import_info != NULL && import_info->fd < 0) {
|
||||
return vk_error(device->instance, VK_ERROR_INVALID_EXTERNAL_HANDLE);
|
||||
|
|
@ -2025,8 +2034,7 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_AllocateMemory(
|
|||
error = lvp_import_ahb_memory(device, mem, ahb_import_info);
|
||||
if (error != VK_SUCCESS)
|
||||
goto fail;
|
||||
} else if(export_info &&
|
||||
(export_info->handleTypes & VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID)) {
|
||||
} else if (is_ahb_export_alloc) {
|
||||
error = lvp_create_ahb_memory(device, mem, pAllocateInfo);
|
||||
if (error != VK_SUCCESS)
|
||||
goto fail;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue