Mesa (main): lavapipe: Use common default allocator.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jul 1 17:20:10 UTC 2021


Module: Mesa
Branch: main
Commit: 0556173918bf9b7dc3065017fb25a752bac221a6
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0556173918bf9b7dc3065017fb25a752bac221a6

Author: Georg Lehmann <dadschoorse at gmail.com>
Date:   Tue Jun  1 17:37:06 2021 +0200

lavapipe: Use common default allocator.

Signed-off-by: Georg Lehmann <dadschoorse at gmail.com>
Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11114>

---

 src/gallium/frontends/lavapipe/lvp_device.c | 29 +----------------------------
 1 file changed, 1 insertion(+), 28 deletions(-)

diff --git a/src/gallium/frontends/lavapipe/lvp_device.c b/src/gallium/frontends/lavapipe/lvp_device.c
index 46e17f275ef..4cf903f8687 100644
--- a/src/gallium/frontends/lavapipe/lvp_device.c
+++ b/src/gallium/frontends/lavapipe/lvp_device.c
@@ -188,33 +188,6 @@ lvp_physical_device_finish(struct lvp_physical_device *device)
    vk_physical_device_finish(&device->vk);
 }
 
-static void * VKAPI_CALL
-default_alloc_func(void *pUserData, size_t size, size_t align,
-                   VkSystemAllocationScope allocationScope)
-{
-   return os_malloc_aligned(size, align);
-}
-
-static void * VKAPI_CALL
-default_realloc_func(void *pUserData, void *pOriginal, size_t size,
-                     size_t align, VkSystemAllocationScope allocationScope)
-{
-   return realloc(pOriginal, size);
-}
-
-static void VKAPI_CALL
-default_free_func(void *pUserData, void *pMemory)
-{
-   os_free_aligned(pMemory);
-}
-
-static const VkAllocationCallbacks default_alloc = {
-   .pUserData = NULL,
-   .pfnAllocation = default_alloc_func,
-   .pfnReallocation = default_realloc_func,
-   .pfnFree = default_free_func,
-};
-
 VKAPI_ATTR VkResult VKAPI_CALL lvp_CreateInstance(
    const VkInstanceCreateInfo*                 pCreateInfo,
    const VkAllocationCallbacks*                pAllocator,
@@ -226,7 +199,7 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_CreateInstance(
    assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO);
 
    if (pAllocator == NULL)
-      pAllocator = &default_alloc;
+      pAllocator = vk_default_allocator();
 
    instance = vk_zalloc(pAllocator, sizeof(*instance), 8,
                         VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);



More information about the mesa-commit mailing list