Mesa (staging/20.3): lavapipe: fixup device allocate + enable private data

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Nov 25 06:16:17 UTC 2020


Module: Mesa
Branch: staging/20.3
Commit: 6e3894d52d18e3e5ac8029d260168ed9c33693b3
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6e3894d52d18e3e5ac8029d260168ed9c33693b3

Author: Dave Airlie <airlied at redhat.com>
Date:   Mon Nov 16 08:55:16 2020 +1000

lavapipe: fixup device allocate + enable private data

I'd only half ported private memory support, finish the job.

Cc: "20.3" <mesa-stable at lists.freedesktop.org>
Reviewed-by: Adam Jackson <ajax at redhat.com>
Reviewed-by: Roland Scheidegger <sroland at vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7705>
(cherry picked from commit 0d90c7cbc4d005fe6245d0a19985784940792403)

---

 .pick_status.json                                  |  2 +-
 src/gallium/frontends/lavapipe/lvp_cmd_buffer.c    |  6 +--
 .../frontends/lavapipe/lvp_descriptor_set.c        | 18 ++++-----
 src/gallium/frontends/lavapipe/lvp_device.c        | 44 ++++++++++++----------
 src/gallium/frontends/lavapipe/lvp_image.c         | 18 ++++-----
 src/gallium/frontends/lavapipe/lvp_pass.c          | 10 ++---
 src/gallium/frontends/lavapipe/lvp_pipeline.c      | 18 ++++-----
 .../frontends/lavapipe/lvp_pipeline_cache.c        |  6 +--
 src/gallium/frontends/lavapipe/lvp_private.h       |  2 -
 src/gallium/frontends/lavapipe/lvp_query.c         |  4 +-
 src/gallium/frontends/lavapipe/lvp_wsi.c           |  4 +-
 11 files changed, 67 insertions(+), 65 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 1475e69f559..9569b5321a2 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -643,7 +643,7 @@
         "description": "lavapipe: fixup device allocate + enable private data",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": null
     },
diff --git a/src/gallium/frontends/lavapipe/lvp_cmd_buffer.c b/src/gallium/frontends/lavapipe/lvp_cmd_buffer.c
index 71a28205aee..64bd862fa98 100644
--- a/src/gallium/frontends/lavapipe/lvp_cmd_buffer.c
+++ b/src/gallium/frontends/lavapipe/lvp_cmd_buffer.c
@@ -184,7 +184,7 @@ VkResult lvp_CreateCommandPool(
    LVP_FROM_HANDLE(lvp_device, device, _device);
    struct lvp_cmd_pool *pool;
 
-   pool = vk_alloc2(&device->alloc, pAllocator, sizeof(*pool), 8,
+   pool = vk_alloc2(&device->vk.alloc, pAllocator, sizeof(*pool), 8,
                     VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
    if (pool == NULL)
       return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
@@ -194,7 +194,7 @@ VkResult lvp_CreateCommandPool(
    if (pAllocator)
       pool->alloc = *pAllocator;
    else
-      pool->alloc = device->alloc;
+      pool->alloc = device->vk.alloc;
 
    list_inithead(&pool->cmd_buffers);
    list_inithead(&pool->free_cmd_buffers);
@@ -226,7 +226,7 @@ void lvp_DestroyCommandPool(
    }
 
    vk_object_base_finish(&pool->base);
-   vk_free2(&device->alloc, pAllocator, pool);
+   vk_free2(&device->vk.alloc, pAllocator, pool);
 }
 
 VkResult lvp_ResetCommandPool(
diff --git a/src/gallium/frontends/lavapipe/lvp_descriptor_set.c b/src/gallium/frontends/lavapipe/lvp_descriptor_set.c
index 58eeac335d2..68c6a8df42b 100644
--- a/src/gallium/frontends/lavapipe/lvp_descriptor_set.c
+++ b/src/gallium/frontends/lavapipe/lvp_descriptor_set.c
@@ -47,7 +47,7 @@ VkResult lvp_CreateDescriptorSetLayout(
                  (max_binding + 1) * sizeof(set_layout->binding[0]) +
                  immutable_sampler_count * sizeof(struct lvp_sampler *);
 
-   set_layout = vk_zalloc2(&device->alloc, pAllocator, size, 8,
+   set_layout = vk_zalloc2(&device->vk.alloc, pAllocator, size, 8,
                            VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
    if (!set_layout)
       return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
@@ -167,7 +167,7 @@ void lvp_DestroyDescriptorSetLayout(
    if (!_set_layout)
      return;
    vk_object_base_finish(&set_layout->base);
-   vk_free2(&device->alloc, pAllocator, set_layout);
+   vk_free2(&device->vk.alloc, pAllocator, set_layout);
 }
 
 VkResult lvp_CreatePipelineLayout(
@@ -181,7 +181,7 @@ VkResult lvp_CreatePipelineLayout(
 
    assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO);
 
-   layout = vk_alloc2(&device->alloc, pAllocator, sizeof(*layout), 8,
+   layout = vk_alloc2(&device->vk.alloc, pAllocator, sizeof(*layout), 8,
                        VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
    if (layout == NULL)
       return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
@@ -219,7 +219,7 @@ void lvp_DestroyPipelineLayout(
    if (!_pipelineLayout)
      return;
    vk_object_base_finish(&pipeline_layout->base);
-   vk_free2(&device->alloc, pAllocator, pipeline_layout);
+   vk_free2(&device->vk.alloc, pAllocator, pipeline_layout);
 }
 
 VkResult
@@ -230,7 +230,7 @@ lvp_descriptor_set_create(struct lvp_device *device,
    struct lvp_descriptor_set *set;
    size_t size = sizeof(*set) + layout->size * sizeof(set->descriptors[0]);
 
-   set = vk_alloc(&device->alloc /* XXX: Use the pool */, size, 8,
+   set = vk_alloc(&device->vk.alloc /* XXX: Use the pool */, size, 8,
                    VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
    if (!set)
       return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
@@ -264,7 +264,7 @@ lvp_descriptor_set_destroy(struct lvp_device *device,
                            struct lvp_descriptor_set *set)
 {
    vk_object_base_finish(&set->base);
-   vk_free(&device->alloc, set);
+   vk_free(&device->vk.alloc, set);
 }
 
 VkResult lvp_AllocateDescriptorSets(
@@ -442,7 +442,7 @@ VkResult lvp_CreateDescriptorPool(
    LVP_FROM_HANDLE(lvp_device, device, _device);
    struct lvp_descriptor_pool *pool;
    size_t size = sizeof(struct lvp_descriptor_pool);
-   pool = vk_zalloc2(&device->alloc, pAllocator, size, 8,
+   pool = vk_zalloc2(&device->vk.alloc, pAllocator, size, 8,
                      VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
    if (!pool)
       return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
@@ -461,7 +461,7 @@ static void lvp_reset_descriptor_pool(struct lvp_device *device,
    struct lvp_descriptor_set *set, *tmp;
    LIST_FOR_EACH_ENTRY_SAFE(set, tmp, &pool->sets, link) {
       list_del(&set->link);
-      vk_free(&device->alloc, set);
+      vk_free(&device->vk.alloc, set);
    }
 }
 
@@ -478,7 +478,7 @@ void lvp_DestroyDescriptorPool(
 
    lvp_reset_descriptor_pool(device, pool);
    vk_object_base_finish(&pool->base);
-   vk_free2(&device->alloc, pAllocator, pool);
+   vk_free2(&device->vk.alloc, pAllocator, pool);
 }
 
 VkResult lvp_ResetDescriptorPool(
diff --git a/src/gallium/frontends/lavapipe/lvp_device.c b/src/gallium/frontends/lavapipe/lvp_device.c
index 5401db9ad99..0c1a65abbdd 100644
--- a/src/gallium/frontends/lavapipe/lvp_device.c
+++ b/src/gallium/frontends/lavapipe/lvp_device.c
@@ -366,6 +366,12 @@ void lvp_GetPhysicalDeviceFeatures2(
          features->storageInputOutput16 = false;
          break;
       }
+      case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIVATE_DATA_FEATURES_EXT: {
+         VkPhysicalDevicePrivateDataFeaturesEXT *features =
+            (VkPhysicalDevicePrivateDataFeaturesEXT *)ext;
+         features->privateData = true;
+         break;
+      }
       default:
          break;
       }
@@ -840,19 +846,17 @@ VkResult lvp_CreateDevice(
    if (!device)
       return vk_error(physical_device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
 
+   vk_device_init(&device->vk, pCreateInfo,
+                  &physical_device->instance->alloc, pAllocator);
+
    device->instance = physical_device->instance;
    device->physical_device = physical_device;
 
-   if (pAllocator)
-      device->alloc = *pAllocator;
-   else
-      device->alloc = physical_device->instance->alloc;
-
    for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) {
       const char *ext_name = pCreateInfo->ppEnabledExtensionNames[i];
       int index = lvp_get_device_extension_index(ext_name);
       if (index < 0 || !physical_device->supported_extensions.extensions[index]) {
-         vk_free(&device->alloc, device);
+         vk_free(&device->vk.alloc, device);
          return vk_error(physical_device->instance, VK_ERROR_EXTENSION_NOT_PRESENT);
       }
 
@@ -878,7 +882,7 @@ void lvp_DestroyDevice(
    LVP_FROM_HANDLE(lvp_device, device, _device);
 
    lvp_queue_finish(&device->queue);
-   vk_free(&device->alloc, device);
+   vk_free(&device->vk.alloc, device);
 }
 
 VkResult lvp_EnumerateInstanceExtensionProperties(
@@ -1073,7 +1077,7 @@ VkResult lvp_AllocateMemory(
       return VK_SUCCESS;
    }
 
-   mem = vk_alloc2(&device->alloc, pAllocator, sizeof(*mem), 8,
+   mem = vk_alloc2(&device->vk.alloc, pAllocator, sizeof(*mem), 8,
                    VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
    if (mem == NULL)
       return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
@@ -1082,7 +1086,7 @@ VkResult lvp_AllocateMemory(
                        VK_OBJECT_TYPE_DEVICE_MEMORY);
    mem->pmem = device->pscreen->allocate_memory(device->pscreen, pAllocateInfo->allocationSize);
    if (!mem->pmem) {
-      vk_free2(&device->alloc, pAllocator, mem);
+      vk_free2(&device->vk.alloc, pAllocator, mem);
       return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
    }
 
@@ -1106,7 +1110,7 @@ void lvp_FreeMemory(
 
    device->pscreen->free_memory(device->pscreen, mem->pmem);
    vk_object_base_finish(&mem->base);
-   vk_free2(&device->alloc, pAllocator, mem);
+   vk_free2(&device->vk.alloc, pAllocator, mem);
 
 }
 
@@ -1352,7 +1356,7 @@ VkResult lvp_CreateFence(
    LVP_FROM_HANDLE(lvp_device, device, _device);
    struct lvp_fence *fence;
 
-   fence = vk_alloc2(&device->alloc, pAllocator, sizeof(*fence), 8,
+   fence = vk_alloc2(&device->vk.alloc, pAllocator, sizeof(*fence), 8,
                      VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
    if (fence == NULL)
       return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
@@ -1380,7 +1384,7 @@ void lvp_DestroyFence(
       device->pscreen->fence_reference(device->pscreen, &fence->handle, NULL);
 
    vk_object_base_finish(&fence->base);
-   vk_free2(&device->alloc, pAllocator, fence);
+   vk_free2(&device->vk.alloc, pAllocator, fence);
 }
 
 VkResult lvp_ResetFences(
@@ -1443,7 +1447,7 @@ VkResult lvp_CreateFramebuffer(
 
    size_t size = sizeof(*framebuffer) +
       sizeof(struct lvp_image_view *) * pCreateInfo->attachmentCount;
-   framebuffer = vk_alloc2(&device->alloc, pAllocator, size, 8,
+   framebuffer = vk_alloc2(&device->vk.alloc, pAllocator, size, 8,
                            VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
    if (framebuffer == NULL)
       return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
@@ -1476,7 +1480,7 @@ void lvp_DestroyFramebuffer(
    if (!fb)
       return;
    vk_object_base_finish(&fb->base);
-   vk_free2(&device->alloc, pAllocator, fb);
+   vk_free2(&device->vk.alloc, pAllocator, fb);
 }
 
 VkResult lvp_WaitForFences(
@@ -1527,7 +1531,7 @@ VkResult lvp_CreateSemaphore(
 {
    LVP_FROM_HANDLE(lvp_device, device, _device);
 
-   struct lvp_semaphore *sema = vk_alloc2(&device->alloc, pAllocator,
+   struct lvp_semaphore *sema = vk_alloc2(&device->vk.alloc, pAllocator,
                                           sizeof(*sema), 8,
                                           VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
 
@@ -1551,7 +1555,7 @@ void lvp_DestroySemaphore(
    if (!_semaphore)
       return;
    vk_object_base_finish(&semaphore->base);
-   vk_free2(&device->alloc, pAllocator, semaphore);
+   vk_free2(&device->vk.alloc, pAllocator, semaphore);
 }
 
 VkResult lvp_CreateEvent(
@@ -1561,7 +1565,7 @@ VkResult lvp_CreateEvent(
    VkEvent*                                    pEvent)
 {
    LVP_FROM_HANDLE(lvp_device, device, _device);
-   struct lvp_event *event = vk_alloc2(&device->alloc, pAllocator,
+   struct lvp_event *event = vk_alloc2(&device->vk.alloc, pAllocator,
                                        sizeof(*event), 8,
                                        VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
 
@@ -1586,7 +1590,7 @@ void lvp_DestroyEvent(
       return;
 
    vk_object_base_finish(&event->base);
-   vk_free2(&device->alloc, pAllocator, event);
+   vk_free2(&device->vk.alloc, pAllocator, event);
 }
 
 VkResult lvp_GetEventStatus(
@@ -1630,7 +1634,7 @@ VkResult lvp_CreateSampler(
 
    assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO);
 
-   sampler = vk_alloc2(&device->alloc, pAllocator, sizeof(*sampler), 8,
+   sampler = vk_alloc2(&device->vk.alloc, pAllocator, sizeof(*sampler), 8,
                        VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
    if (!sampler)
       return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
@@ -1654,7 +1658,7 @@ void lvp_DestroySampler(
    if (!_sampler)
       return;
    vk_object_base_finish(&sampler->base);
-   vk_free2(&device->alloc, pAllocator, sampler);
+   vk_free2(&device->vk.alloc, pAllocator, sampler);
 }
 
 VkResult lvp_CreatePrivateDataSlotEXT(
diff --git a/src/gallium/frontends/lavapipe/lvp_image.c b/src/gallium/frontends/lavapipe/lvp_image.c
index d8569f12223..0e9554dc43c 100644
--- a/src/gallium/frontends/lavapipe/lvp_image.c
+++ b/src/gallium/frontends/lavapipe/lvp_image.c
@@ -38,7 +38,7 @@ lvp_image_create(VkDevice _device,
 
    assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO);
 
-   image = vk_zalloc2(&device->alloc, alloc, sizeof(*image), 8,
+   image = vk_zalloc2(&device->vk.alloc, alloc, sizeof(*image), 8,
                        VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
    if (image == NULL)
       return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
@@ -112,7 +112,7 @@ lvp_DestroyImage(VkDevice _device, VkImage _image,
      return;
    pipe_resource_reference(&image->bo, NULL);
    vk_object_base_finish(&image->base);
-   vk_free2(&device->alloc, pAllocator, image);
+   vk_free2(&device->vk.alloc, pAllocator, image);
 }
 
 VkResult
@@ -125,7 +125,7 @@ lvp_CreateImageView(VkDevice _device,
    LVP_FROM_HANDLE(lvp_image, image, pCreateInfo->image);
    struct lvp_image_view *view;
 
-   view = vk_alloc2(&device->alloc, pAllocator, sizeof(*view), 8,
+   view = vk_alloc2(&device->vk.alloc, pAllocator, sizeof(*view), 8,
                      VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
    if (view == NULL)
       return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
@@ -156,7 +156,7 @@ lvp_DestroyImageView(VkDevice _device, VkImageView _iview,
 
    pipe_surface_reference(&iview->surface, NULL);
    vk_object_base_finish(&iview->base);
-   vk_free2(&device->alloc, pAllocator, iview);
+   vk_free2(&device->vk.alloc, pAllocator, iview);
 }
 
 void lvp_GetImageSubresourceLayout(
@@ -236,7 +236,7 @@ VkResult lvp_CreateBuffer(
    if (pCreateInfo->size > UINT32_MAX)
       return VK_ERROR_OUT_OF_DEVICE_MEMORY;
 
-   buffer = vk_alloc2(&device->alloc, pAllocator, sizeof(*buffer), 8,
+   buffer = vk_alloc2(&device->vk.alloc, pAllocator, sizeof(*buffer), 8,
                        VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
    if (buffer == NULL)
       return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
@@ -261,7 +261,7 @@ VkResult lvp_CreateBuffer(
                                                              &template,
                                                              &buffer->total_size);
       if (!buffer->bo) {
-         vk_free2(&device->alloc, pAllocator, buffer);
+         vk_free2(&device->vk.alloc, pAllocator, buffer);
          return vk_error(device->instance, VK_ERROR_OUT_OF_DEVICE_MEMORY);
       }
    }
@@ -283,7 +283,7 @@ void lvp_DestroyBuffer(
 
    pipe_resource_reference(&buffer->bo, NULL);
    vk_object_base_finish(&buffer->base);
-   vk_free2(&device->alloc, pAllocator, buffer);
+   vk_free2(&device->vk.alloc, pAllocator, buffer);
 }
 
 VkResult
@@ -295,7 +295,7 @@ lvp_CreateBufferView(VkDevice _device,
    LVP_FROM_HANDLE(lvp_device, device, _device);
    LVP_FROM_HANDLE(lvp_buffer, buffer, pCreateInfo->buffer);
    struct lvp_buffer_view *view;
-   view = vk_alloc2(&device->alloc, pAllocator, sizeof(*view), 8,
+   view = vk_alloc2(&device->vk.alloc, pAllocator, sizeof(*view), 8,
                      VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
    if (!view)
       return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
@@ -322,5 +322,5 @@ lvp_DestroyBufferView(VkDevice _device, VkBufferView bufferView,
    if (!bufferView)
      return;
    vk_object_base_finish(&view->base);
-   vk_free2(&device->alloc, pAllocator, view);
+   vk_free2(&device->vk.alloc, pAllocator, view);
 }
diff --git a/src/gallium/frontends/lavapipe/lvp_pass.c b/src/gallium/frontends/lavapipe/lvp_pass.c
index 83f671d575a..3669189574b 100644
--- a/src/gallium/frontends/lavapipe/lvp_pass.c
+++ b/src/gallium/frontends/lavapipe/lvp_pass.c
@@ -160,7 +160,7 @@ VkResult lvp_CreateRenderPass(
    attachments_offset = size;
    size += pCreateInfo->attachmentCount * sizeof(pass->attachments[0]);
 
-   pass = vk_alloc2(&device->alloc, pAllocator, size, 8,
+   pass = vk_alloc2(&device->vk.alloc, pAllocator, size, 8,
                     VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
    if (pass == NULL)
       return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
@@ -194,11 +194,11 @@ VkResult lvp_CreateRenderPass(
 
    if (subpass_attachment_count) {
       pass->subpass_attachments =
-         vk_alloc2(&device->alloc, pAllocator,
+         vk_alloc2(&device->vk.alloc, pAllocator,
                    subpass_attachment_count * sizeof(struct lvp_subpass_attachment), 8,
                    VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
       if (pass->subpass_attachments == NULL) {
-         vk_free2(&device->alloc, pAllocator, pass);
+         vk_free2(&device->vk.alloc, pAllocator, pass);
          return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
       }
    } else
@@ -277,8 +277,8 @@ void lvp_DestroyRenderPass(
    if (!_pass)
       return;
    vk_object_base_finish(&pass->base);
-   vk_free2(&device->alloc, pAllocator, pass->subpass_attachments);
-   vk_free2(&device->alloc, pAllocator, pass);
+   vk_free2(&device->vk.alloc, pAllocator, pass->subpass_attachments);
+   vk_free2(&device->vk.alloc, pAllocator, pass);
 }
 
 void lvp_GetRenderAreaGranularity(
diff --git a/src/gallium/frontends/lavapipe/lvp_pipeline.c b/src/gallium/frontends/lavapipe/lvp_pipeline.c
index fb9a8918a4b..89a665d2af9 100644
--- a/src/gallium/frontends/lavapipe/lvp_pipeline.c
+++ b/src/gallium/frontends/lavapipe/lvp_pipeline.c
@@ -44,7 +44,7 @@ VkResult lvp_CreateShaderModule(
    assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO);
    assert(pCreateInfo->flags == 0);
 
-   module = vk_alloc2(&device->alloc, pAllocator,
+   module = vk_alloc2(&device->vk.alloc, pAllocator,
                       sizeof(*module) + pCreateInfo->codeSize, 8,
                       VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
    if (module == NULL)
@@ -72,7 +72,7 @@ void lvp_DestroyShaderModule(
    if (!_module)
       return;
    vk_object_base_finish(&module->base);
-   vk_free2(&device->alloc, pAllocator, module);
+   vk_free2(&device->vk.alloc, pAllocator, module);
 }
 
 void lvp_DestroyPipeline(
@@ -130,7 +130,7 @@ void lvp_DestroyPipeline(
       if (pipeline->compute_create_info.stage.pSpecializationInfo)
          free((void *)pipeline->compute_create_info.stage.pSpecializationInfo);
    vk_object_base_finish(&pipeline->base);
-   vk_free2(&device->alloc, pAllocator, pipeline);
+   vk_free2(&device->vk.alloc, pAllocator, pipeline);
 }
 
 static VkResult
@@ -747,7 +747,7 @@ lvp_graphics_pipeline_init(struct lvp_pipeline *pipeline,
                            const VkAllocationCallbacks *alloc)
 {
    if (alloc == NULL)
-      alloc = &device->alloc;
+      alloc = &device->vk.alloc;
    pipeline->device = device;
    pipeline->layout = lvp_pipeline_layout_from_handle(pCreateInfo->layout);
    pipeline->force_min_sample = false;
@@ -818,7 +818,7 @@ lvp_graphics_pipeline_create(
 
    assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO);
 
-   pipeline = vk_zalloc2(&device->alloc, pAllocator, sizeof(*pipeline), 8,
+   pipeline = vk_zalloc2(&device->vk.alloc, pAllocator, sizeof(*pipeline), 8,
                          VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
    if (pipeline == NULL)
       return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
@@ -828,7 +828,7 @@ lvp_graphics_pipeline_create(
    result = lvp_graphics_pipeline_init(pipeline, device, cache, pCreateInfo,
                                        pAllocator);
    if (result != VK_SUCCESS) {
-      vk_free2(&device->alloc, pAllocator, pipeline);
+      vk_free2(&device->vk.alloc, pAllocator, pipeline);
       return result;
    }
 
@@ -873,7 +873,7 @@ lvp_compute_pipeline_init(struct lvp_pipeline *pipeline,
    LVP_FROM_HANDLE(lvp_shader_module, module,
                    pCreateInfo->stage.module);
    if (alloc == NULL)
-      alloc = &device->alloc;
+      alloc = &device->vk.alloc;
    pipeline->device = device;
    pipeline->layout = lvp_pipeline_layout_from_handle(pCreateInfo->layout);
    pipeline->force_min_sample = false;
@@ -904,7 +904,7 @@ lvp_compute_pipeline_create(
 
    assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO);
 
-   pipeline = vk_zalloc2(&device->alloc, pAllocator, sizeof(*pipeline), 8,
+   pipeline = vk_zalloc2(&device->vk.alloc, pAllocator, sizeof(*pipeline), 8,
                          VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
    if (pipeline == NULL)
       return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
@@ -914,7 +914,7 @@ lvp_compute_pipeline_create(
    result = lvp_compute_pipeline_init(pipeline, device, cache, pCreateInfo,
                                       pAllocator);
    if (result != VK_SUCCESS) {
-      vk_free2(&device->alloc, pAllocator, pipeline);
+      vk_free2(&device->vk.alloc, pAllocator, pipeline);
       return result;
    }
 
diff --git a/src/gallium/frontends/lavapipe/lvp_pipeline_cache.c b/src/gallium/frontends/lavapipe/lvp_pipeline_cache.c
index 1f48186ff46..1975bfe8307 100644
--- a/src/gallium/frontends/lavapipe/lvp_pipeline_cache.c
+++ b/src/gallium/frontends/lavapipe/lvp_pipeline_cache.c
@@ -35,7 +35,7 @@ VkResult lvp_CreatePipelineCache(
    assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO);
    assert(pCreateInfo->flags == 0);
 
-   cache = vk_alloc2(&device->alloc, pAllocator,
+   cache = vk_alloc2(&device->vk.alloc, pAllocator,
                        sizeof(*cache), 8,
                        VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
    if (cache == NULL)
@@ -46,7 +46,7 @@ VkResult lvp_CreatePipelineCache(
    if (pAllocator)
      cache->alloc = *pAllocator;
    else
-     cache->alloc = device->alloc;
+     cache->alloc = device->vk.alloc;
 
    cache->device = device;
    *pPipelineCache = lvp_pipeline_cache_to_handle(cache);
@@ -66,7 +66,7 @@ void lvp_DestroyPipelineCache(
       return;
 //   lvp_pipeline_cache_finish(cache);
    vk_object_base_finish(&cache->base);
-   vk_free2(&device->alloc, pAllocator, cache);
+   vk_free2(&device->vk.alloc, pAllocator, cache);
 }
 
 VkResult lvp_GetPipelineCacheData(
diff --git a/src/gallium/frontends/lavapipe/lvp_private.h b/src/gallium/frontends/lavapipe/lvp_private.h
index ff1edcddd4a..e4300875bca 100644
--- a/src/gallium/frontends/lavapipe/lvp_private.h
+++ b/src/gallium/frontends/lavapipe/lvp_private.h
@@ -272,8 +272,6 @@ struct lvp_pipeline_cache {
 struct lvp_device {
    struct vk_device vk;
 
-   VkAllocationCallbacks                       alloc;
-
    struct lvp_queue queue;
    struct lvp_instance *                       instance;
    struct lvp_physical_device *physical_device;
diff --git a/src/gallium/frontends/lavapipe/lvp_query.c b/src/gallium/frontends/lavapipe/lvp_query.c
index bdcd2a069d7..f549fe1b89e 100644
--- a/src/gallium/frontends/lavapipe/lvp_query.c
+++ b/src/gallium/frontends/lavapipe/lvp_query.c
@@ -46,7 +46,7 @@ VkResult lvp_CreateQueryPool(
    struct lvp_query_pool *pool;
    uint32_t pool_size = sizeof(*pool) + pCreateInfo->queryCount * sizeof(struct pipe_query *);
 
-   pool = vk_zalloc2(&device->alloc, pAllocator,
+   pool = vk_zalloc2(&device->vk.alloc, pAllocator,
                     pool_size, 8,
                     VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
    if (!pool)
@@ -77,7 +77,7 @@ void lvp_DestroyQueryPool(
       if (pool->queries[i])
          device->queue.ctx->destroy_query(device->queue.ctx, pool->queries[i]);
    vk_object_base_finish(&pool->base);
-   vk_free2(&device->alloc, pAllocator, pool);
+   vk_free2(&device->vk.alloc, pAllocator, pool);
 }
 
 VkResult lvp_GetQueryPoolResults(
diff --git a/src/gallium/frontends/lavapipe/lvp_wsi.c b/src/gallium/frontends/lavapipe/lvp_wsi.c
index 5ed131bc171..95aad8ce532 100644
--- a/src/gallium/frontends/lavapipe/lvp_wsi.c
+++ b/src/gallium/frontends/lavapipe/lvp_wsi.c
@@ -145,7 +145,7 @@ VkResult lvp_CreateSwapchainKHR(
    if (pAllocator)
       alloc = pAllocator;
    else
-      alloc = &device->alloc;
+      alloc = &device->vk.alloc;
 
    return wsi_common_create_swapchain(&device->physical_device->wsi_device,
                                       lvp_device_to_handle(device),
@@ -165,7 +165,7 @@ void lvp_DestroySwapchainKHR(
    if (pAllocator)
       alloc = pAllocator;
    else
-      alloc = &device->alloc;
+      alloc = &device->vk.alloc;
 
    wsi_common_destroy_swapchain(_device, swapchain, alloc);
 }



More information about the mesa-commit mailing list