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>
(cherry picked from commit f1af533b2c)
This commit is contained in:
Yiwei Zhang 2025-07-17 20:08:32 -07:00 committed by Eric Engestrom
parent c5aaeb3c4d
commit b3285b1212
2 changed files with 21 additions and 1 deletions

View file

@ -2384,7 +2384,7 @@
"description": "lavapipe: implement GetMemoryAndroidHardwareBufferANDROID",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "cebb2bf26623e31aa1fbab0e73c7e2a1e3cfe956",
"notes": null

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