turnip: free up hwvulkan_device_t upon driver unloading

Per <hardware/hwvulkan.h>, the hw_device_t::close() function is called
upon driver unloading. The behavior has been like this since Android 10.

Acked-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35561>
This commit is contained in:
Yiwei Zhang
2025-06-16 01:42:35 -07:00
committed by Marge Bot
parent ba48380260
commit 818464f443
+8 -2
View File
@@ -76,7 +76,13 @@ tu_hal_open(const struct hw_module_t *mod,
static int
tu_hal_close(struct hw_device_t *dev)
{
/* hwvulkan.h claims that hw_device_t::close() is never called. */
/* the hw_device_t::close() function is called upon driver unloading */
assert(dev->version == HWVULKAN_DEVICE_API_VERSION_0_1);
assert(dev->module == &HAL_MODULE_INFO_SYM.common);
vk_android_destroy_ugralloc();
return -1;
hwvulkan_device_t *hal_dev = container_of(dev, hwvulkan_device_t, common);
free(hal_dev);
return 0;
}