lavapipe: implement GetMemoryAndroidHardwareBufferANDROID

lvp hasn't used common device memory obj, and it allocates and imports
ahb on its own. Thus it has to implement the AHB export api itself.

- before: total 116, skip 66, pass 24, fail 26
- after:  total 116, skip 66, pass 36, fail 14

Fixes: cebb2bf266 ("lavapipe: Add AHB extension")
Reviewed-by: Lucas Fryzek <lfryzek@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36204>
This commit is contained in:
Yiwei Zhang 2025-07-17 20:08:32 -07:00 committed by Marge Bot
parent 3167e30ee2
commit f1af533b2c

View file

@ -155,3 +155,23 @@ lvp_create_ahb_memory(struct lvp_device *device, struct lvp_device_memory *mem,
return result;
}
#if ANDROID_API_LEVEL >= 26
VkResult
lvp_GetMemoryAndroidHardwareBufferANDROID(
VkDevice device,
const VkMemoryGetAndroidHardwareBufferInfoANDROID *pInfo,
struct AHardwareBuffer **pBuffer)
{
LVP_FROM_HANDLE(lvp_device_memory, mem, pInfo->memory);
if (mem->android_hardware_buffer) {
*pBuffer = mem->android_hardware_buffer;
/* Increase refcount. */
AHardwareBuffer_acquire(*pBuffer);
return VK_SUCCESS;
}
return VK_ERROR_INVALID_EXTERNAL_HANDLE;
}
#endif