This moves all the alloc/free in anv to the generic helpers.
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
}
list->relocs =
- anv_alloc(alloc, list->array_length * sizeof(*list->relocs), 8,
+ vk_alloc(alloc, list->array_length * sizeof(*list->relocs), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (list->relocs == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
list->reloc_bos =
- anv_alloc(alloc, list->array_length * sizeof(*list->reloc_bos), 8,
+ vk_alloc(alloc, list->array_length * sizeof(*list->reloc_bos), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (list->reloc_bos == NULL) {
- anv_free(alloc, list->relocs);
+ vk_free(alloc, list->relocs);
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
}
anv_reloc_list_finish(struct anv_reloc_list *list,
const VkAllocationCallbacks *alloc)
{
- anv_free(alloc, list->relocs);
- anv_free(alloc, list->reloc_bos);
+ vk_free(alloc, list->relocs);
+ vk_free(alloc, list->reloc_bos);
}
static VkResult
new_length *= 2;
struct drm_i915_gem_relocation_entry *new_relocs =
- anv_alloc(alloc, new_length * sizeof(*list->relocs), 8,
+ vk_alloc(alloc, new_length * sizeof(*list->relocs), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (new_relocs == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
struct anv_bo **new_reloc_bos =
- anv_alloc(alloc, new_length * sizeof(*list->reloc_bos), 8,
+ vk_alloc(alloc, new_length * sizeof(*list->reloc_bos), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (new_reloc_bos == NULL) {
- anv_free(alloc, new_relocs);
+ vk_free(alloc, new_relocs);
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
}
memcpy(new_reloc_bos, list->reloc_bos,
list->num_relocs * sizeof(*list->reloc_bos));
- anv_free(alloc, list->relocs);
- anv_free(alloc, list->reloc_bos);
+ vk_free(alloc, list->relocs);
+ vk_free(alloc, list->reloc_bos);
list->array_length = new_length;
list->relocs = new_relocs;
{
VkResult result;
- struct anv_batch_bo *bbo = anv_alloc(&cmd_buffer->pool->alloc, sizeof(*bbo),
+ struct anv_batch_bo *bbo = vk_alloc(&cmd_buffer->pool->alloc, sizeof(*bbo),
8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (bbo == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
fail_bo_alloc:
anv_bo_pool_free(&cmd_buffer->device->batch_bo_pool, &bbo->bo);
fail_alloc:
- anv_free(&cmd_buffer->pool->alloc, bbo);
+ vk_free(&cmd_buffer->pool->alloc, bbo);
return result;
}
{
VkResult result;
- struct anv_batch_bo *bbo = anv_alloc(&cmd_buffer->pool->alloc, sizeof(*bbo),
+ struct anv_batch_bo *bbo = vk_alloc(&cmd_buffer->pool->alloc, sizeof(*bbo),
8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (bbo == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
fail_bo_alloc:
anv_bo_pool_free(&cmd_buffer->device->batch_bo_pool, &bbo->bo);
fail_alloc:
- anv_free(&cmd_buffer->pool->alloc, bbo);
+ vk_free(&cmd_buffer->pool->alloc, bbo);
return result;
}
{
anv_reloc_list_finish(&bbo->relocs, &cmd_buffer->pool->alloc);
anv_bo_pool_free(&cmd_buffer->device->batch_bo_pool, &bbo->bo);
- anv_free(&cmd_buffer->pool->alloc, bbo);
+ vk_free(&cmd_buffer->pool->alloc, bbo);
}
static VkResult
anv_batch_bo_destroy(bbo, cmd_buffer);
}
- anv_free(&cmd_buffer->pool->alloc, cmd_buffer->execbuf2.objects);
- anv_free(&cmd_buffer->pool->alloc, cmd_buffer->execbuf2.bos);
+ vk_free(&cmd_buffer->pool->alloc, cmd_buffer->execbuf2.objects);
+ vk_free(&cmd_buffer->pool->alloc, cmd_buffer->execbuf2.bos);
}
void
cmd_buffer->execbuf2.array_length * 2 : 64;
struct drm_i915_gem_exec_object2 *new_objects =
- anv_alloc(&cmd_buffer->pool->alloc, new_len * sizeof(*new_objects),
+ vk_alloc(&cmd_buffer->pool->alloc, new_len * sizeof(*new_objects),
8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (new_objects == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
struct anv_bo **new_bos =
- anv_alloc(&cmd_buffer->pool->alloc, new_len * sizeof(*new_bos),
+ vk_alloc(&cmd_buffer->pool->alloc, new_len * sizeof(*new_bos),
8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (new_bos == NULL) {
- anv_free(&cmd_buffer->pool->alloc, new_objects);
+ vk_free(&cmd_buffer->pool->alloc, new_objects);
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
}
state->need_query_wa = true;
if (state->attachments != NULL) {
- anv_free(&cmd_buffer->pool->alloc, state->attachments);
+ vk_free(&cmd_buffer->pool->alloc, state->attachments);
state->attachments = NULL;
}
struct anv_cmd_state *state = &cmd_buffer->state;
ANV_FROM_HANDLE(anv_render_pass, pass, info->renderPass);
- anv_free(&cmd_buffer->pool->alloc, state->attachments);
+ vk_free(&cmd_buffer->pool->alloc, state->attachments);
if (pass->attachment_count == 0) {
state->attachments = NULL;
return;
}
- state->attachments = anv_alloc(&cmd_buffer->pool->alloc,
+ state->attachments = vk_alloc(&cmd_buffer->pool->alloc,
pass->attachment_count *
sizeof(state->attachments[0]),
8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
struct anv_push_constants **ptr = &cmd_buffer->state.push_constants[stage];
if (*ptr == NULL) {
- *ptr = anv_alloc(&cmd_buffer->pool->alloc, size, 8,
+ *ptr = vk_alloc(&cmd_buffer->pool->alloc, size, 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (*ptr == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
} else if ((*ptr)->size < size) {
- *ptr = anv_realloc(&cmd_buffer->pool->alloc, *ptr, size, 8,
+ *ptr = vk_realloc(&cmd_buffer->pool->alloc, *ptr, size, 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (*ptr == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
struct anv_cmd_buffer *cmd_buffer;
VkResult result;
- cmd_buffer = anv_alloc(&pool->alloc, sizeof(*cmd_buffer), 8,
+ cmd_buffer = vk_alloc(&pool->alloc, sizeof(*cmd_buffer), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (cmd_buffer == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
return VK_SUCCESS;
fail:
- anv_free(&cmd_buffer->pool->alloc, cmd_buffer);
+ vk_free(&cmd_buffer->pool->alloc, cmd_buffer);
return result;
}
anv_state_stream_finish(&cmd_buffer->surface_state_stream);
anv_state_stream_finish(&cmd_buffer->dynamic_state_stream);
- anv_free(&cmd_buffer->pool->alloc, cmd_buffer->state.attachments);
- anv_free(&cmd_buffer->pool->alloc, cmd_buffer);
+ vk_free(&cmd_buffer->pool->alloc, cmd_buffer->state.attachments);
+ vk_free(&cmd_buffer->pool->alloc, cmd_buffer);
}
void anv_FreeCommandBuffers(
ANV_FROM_HANDLE(anv_device, device, _device);
struct anv_cmd_pool *pool;
- pool = anv_alloc2(&device->alloc, pAllocator, sizeof(*pool), 8,
+ pool = vk_alloc2(&device->alloc, pAllocator, sizeof(*pool), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (pool == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
anv_cmd_buffer_destroy(cmd_buffer);
}
- anv_free2(&device->alloc, pAllocator, pool);
+ vk_free2(&device->alloc, pAllocator, pool);
}
VkResult anv_ResetCommandPool(
(max_binding + 1) * sizeof(set_layout->binding[0]) +
immutable_sampler_count * sizeof(struct anv_sampler *);
- set_layout = anv_alloc2(&device->alloc, pAllocator, size, 8,
+ set_layout = vk_alloc2(&device->alloc, pAllocator, size, 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (!set_layout)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
ANV_FROM_HANDLE(anv_device, device, _device);
ANV_FROM_HANDLE(anv_descriptor_set_layout, set_layout, _set_layout);
- anv_free2(&device->alloc, pAllocator, set_layout);
+ vk_free2(&device->alloc, pAllocator, set_layout);
}
static void
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO);
- layout = anv_alloc2(&device->alloc, pAllocator, sizeof(*layout), 8,
+ layout = vk_alloc2(&device->alloc, pAllocator, sizeof(*layout), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (layout == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
ANV_FROM_HANDLE(anv_device, device, _device);
ANV_FROM_HANDLE(anv_pipeline_layout, pipeline_layout, _pipelineLayout);
- anv_free2(&device->alloc, pAllocator, pipeline_layout);
+ vk_free2(&device->alloc, pAllocator, pipeline_layout);
}
/*
descriptor_count * sizeof(struct anv_descriptor) +
buffer_count * sizeof(struct anv_buffer_view);
- pool = anv_alloc2(&device->alloc, pAllocator, size, 8,
+ pool = vk_alloc2(&device->alloc, pAllocator, size, 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (!pool)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
ANV_FROM_HANDLE(anv_descriptor_pool, pool, _pool);
anv_state_stream_finish(&pool->surface_state_stream);
- anv_free2(&device->alloc, pAllocator, pool);
+ vk_free2(&device->alloc, pAllocator, pool);
}
VkResult anv_ResetDescriptorPool(
return vk_error(VK_ERROR_EXTENSION_NOT_PRESENT);
}
- instance = anv_alloc2(&default_alloc, pAllocator, sizeof(*instance), 8,
+ instance = vk_alloc2(&default_alloc, pAllocator, sizeof(*instance), 8,
VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
if (!instance)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
_mesa_locale_fini();
- anv_free(&instance->alloc, instance);
+ vk_free(&instance->alloc, instance);
}
VkResult anv_EnumeratePhysicalDevices(
return vk_error(VK_ERROR_EXTENSION_NOT_PRESENT);
}
- device = anv_alloc2(&physical_device->instance->alloc, pAllocator,
+ device = vk_alloc2(&physical_device->instance->alloc, pAllocator,
sizeof(*device), 8,
VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
if (!device)
fail_fd:
close(device->fd);
fail_device:
- anv_free(&device->alloc, device);
+ vk_free(&device->alloc, device);
return result;
}
pthread_mutex_destroy(&device->mutex);
- anv_free(&device->alloc, device);
+ vk_free(&device->alloc, device);
}
VkResult anv_EnumerateInstanceExtensionProperties(
/* FINISHME: Fail if allocation request exceeds heap size. */
- mem = anv_alloc2(&device->alloc, pAllocator, sizeof(*mem), 8,
+ mem = vk_alloc2(&device->alloc, pAllocator, sizeof(*mem), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (mem == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
return VK_SUCCESS;
fail:
- anv_free2(&device->alloc, pAllocator, mem);
+ vk_free2(&device->alloc, pAllocator, mem);
return result;
}
if (mem->bo.gem_handle != 0)
anv_gem_close(device, mem->bo.gem_handle);
- anv_free2(&device->alloc, pAllocator, mem);
+ vk_free2(&device->alloc, pAllocator, mem);
}
VkResult anv_MapMemory(
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO);
- buffer = anv_alloc2(&device->alloc, pAllocator, sizeof(*buffer), 8,
+ buffer = vk_alloc2(&device->alloc, pAllocator, sizeof(*buffer), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (buffer == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
ANV_FROM_HANDLE(anv_device, device, _device);
ANV_FROM_HANDLE(anv_buffer, buffer, _buffer);
- anv_free2(&device->alloc, pAllocator, buffer);
+ vk_free2(&device->alloc, pAllocator, buffer);
}
void
ANV_FROM_HANDLE(anv_device, device, _device);
ANV_FROM_HANDLE(anv_sampler, sampler, _sampler);
- anv_free2(&device->alloc, pAllocator, sampler);
+ vk_free2(&device->alloc, pAllocator, sampler);
}
VkResult anv_CreateFramebuffer(
size_t size = sizeof(*framebuffer) +
sizeof(struct anv_image_view *) * pCreateInfo->attachmentCount;
- framebuffer = anv_alloc2(&device->alloc, pAllocator, size, 8,
+ framebuffer = vk_alloc2(&device->alloc, pAllocator, size, 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (framebuffer == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
ANV_FROM_HANDLE(anv_device, device, _device);
ANV_FROM_HANDLE(anv_framebuffer, fb, _fb);
- anv_free2(&device->alloc, pAllocator, fb);
+ vk_free2(&device->alloc, pAllocator, fb);
}
anv_assert(pCreateInfo->extent.height > 0);
anv_assert(pCreateInfo->extent.depth > 0);
- image = anv_alloc2(&device->alloc, alloc, sizeof(*image), 8,
+ image = vk_alloc2(&device->alloc, alloc, sizeof(*image), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (!image)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
fail:
if (image)
- anv_free2(&device->alloc, alloc, image);
+ vk_free2(&device->alloc, alloc, image);
return r;
}
{
ANV_FROM_HANDLE(anv_device, device, _device);
- anv_free2(&device->alloc, pAllocator, anv_image_from_handle(_image));
+ vk_free2(&device->alloc, pAllocator, anv_image_from_handle(_image));
}
VkResult anv_BindImageMemory(
ANV_FROM_HANDLE(anv_image, image, pCreateInfo->image);
struct anv_image_view *iview;
- iview = anv_alloc2(&device->alloc, pAllocator, sizeof(*iview), 8,
+ iview = vk_alloc2(&device->alloc, pAllocator, sizeof(*iview), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (iview == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
iview->storage_surface_state);
}
- anv_free2(&device->alloc, pAllocator, iview);
+ vk_free2(&device->alloc, pAllocator, iview);
}
ANV_FROM_HANDLE(anv_buffer, buffer, pCreateInfo->buffer);
struct anv_buffer_view *view;
- view = anv_alloc2(&device->alloc, pAllocator, sizeof(*view), 8,
+ view = vk_alloc2(&device->alloc, pAllocator, sizeof(*view), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (!view)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
anv_state_pool_free(&device->surface_state_pool,
view->storage_surface_state);
- anv_free2(&device->alloc, pAllocator, view);
+ vk_free2(&device->alloc, pAllocator, view);
}
const struct anv_surface *
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_DMA_BUF_IMAGE_CREATE_INFO_INTEL);
- mem = anv_alloc2(&device->alloc, pAllocator, sizeof(*mem), 8,
+ mem = vk_alloc2(&device->alloc, pAllocator, sizeof(*mem), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (mem == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
return VK_SUCCESS;
fail:
- anv_free2(&device->alloc, pAllocator, mem);
+ vk_free2(&device->alloc, pAllocator, mem);
return result;
}
attachments_offset = size;
size += pCreateInfo->attachmentCount * sizeof(pass->attachments[0]);
- pass = anv_alloc2(&device->alloc, pAllocator, size, 8,
+ pass = vk_alloc2(&device->alloc, pAllocator, size, 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (pass == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
}
pass->subpass_attachments =
- anv_alloc2(&device->alloc, pAllocator,
+ vk_alloc2(&device->alloc, pAllocator,
subpass_attachment_count * sizeof(uint32_t), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (pass->subpass_attachments == NULL) {
- anv_free2(&device->alloc, pAllocator, pass);
+ vk_free2(&device->alloc, pAllocator, pass);
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
}
ANV_FROM_HANDLE(anv_device, device, _device);
ANV_FROM_HANDLE(anv_render_pass, pass, _pass);
- anv_free2(&device->alloc, pAllocator, pass->subpass_attachments);
- anv_free2(&device->alloc, pAllocator, pass);
+ vk_free2(&device->alloc, pAllocator, pass->subpass_attachments);
+ vk_free2(&device->alloc, pAllocator, pass);
}
void anv_GetRenderAreaGranularity(
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO);
assert(pCreateInfo->flags == 0);
- module = anv_alloc2(&device->alloc, pAllocator,
+ module = vk_alloc2(&device->alloc, pAllocator,
sizeof(*module) + pCreateInfo->codeSize, 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (module == NULL)
ANV_FROM_HANDLE(anv_device, device, _device);
ANV_FROM_HANDLE(anv_shader_module, module, _module);
- anv_free2(&device->alloc, pAllocator, module);
+ vk_free2(&device->alloc, pAllocator, module);
}
#define SPIR_V_MAGIC_NUMBER 0x07230203
anv_shader_bin_unref(device, pipeline->shaders[s]);
}
- anv_free2(&device->alloc, pAllocator, pipeline);
+ vk_free2(&device->alloc, pAllocator, pipeline);
}
static const uint32_t vk_to_gen_primitive_type[] = {
bind_map->surface_count, bind_map->sampler_count);
struct anv_shader_bin *shader =
- anv_alloc(&device->alloc, size, 8, VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
+ vk_alloc(&device->alloc, size, 8, VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
if (!shader)
return NULL;
{
assert(shader->ref_cnt == 0);
anv_state_pool_free(&device->instruction_state_pool, shader->kernel);
- anv_free(&device->alloc, shader);
+ vk_free(&device->alloc, shader);
}
static size_t
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO);
assert(pCreateInfo->flags == 0);
- cache = anv_alloc2(&device->alloc, pAllocator,
+ cache = vk_alloc2(&device->alloc, pAllocator,
sizeof(*cache), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (cache == NULL)
anv_pipeline_cache_finish(cache);
- anv_free2(&device->alloc, pAllocator, cache);
+ vk_free2(&device->alloc, pAllocator, cache);
}
VkResult anv_GetPipelineCacheData(
#include "util/macros.h"
#include "util/list.h"
#include "util/u_vector.h"
+#include "util/vk_alloc.h"
/* Pre-declarations needed for WSI entrypoints */
struct wl_surface;
extern struct anv_dispatch_table dtable;
-static inline void *
-anv_alloc(const VkAllocationCallbacks *alloc,
- size_t size, size_t align,
- VkSystemAllocationScope scope)
-{
- return alloc->pfnAllocation(alloc->pUserData, size, align, scope);
-}
-
-static inline void *
-anv_realloc(const VkAllocationCallbacks *alloc,
- void *ptr, size_t size, size_t align,
- VkSystemAllocationScope scope)
-{
- return alloc->pfnReallocation(alloc->pUserData, ptr, size, align, scope);
-}
-
-static inline void
-anv_free(const VkAllocationCallbacks *alloc, void *data)
-{
- alloc->pfnFree(alloc->pUserData, data);
-}
-
-static inline void *
-anv_alloc2(const VkAllocationCallbacks *parent_alloc,
- const VkAllocationCallbacks *alloc,
- size_t size, size_t align,
- VkSystemAllocationScope scope)
-{
- if (alloc)
- return anv_alloc(alloc, size, align, scope);
- else
- return anv_alloc(parent_alloc, size, align, scope);
-}
-
-static inline void
-anv_free2(const VkAllocationCallbacks *parent_alloc,
- const VkAllocationCallbacks *alloc,
- void *data)
-{
- if (alloc)
- anv_free(alloc, data);
- else
- anv_free(parent_alloc, data);
-}
-
struct anv_wsi_interaface;
#define VK_ICD_WSI_PLATFORM_MAX 5
}
slot_size = sizeof(struct anv_query_pool_slot);
- pool = anv_alloc2(&device->alloc, pAllocator, sizeof(*pool), 8,
+ pool = vk_alloc2(&device->alloc, pAllocator, sizeof(*pool), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (pool == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
return VK_SUCCESS;
fail:
- anv_free2(&device->alloc, pAllocator, pool);
+ vk_free2(&device->alloc, pAllocator, pool);
return result;
}
anv_gem_munmap(pool->bo.map, pool->bo.size);
anv_gem_close(device, pool->bo.gem_handle);
- anv_free2(&device->alloc, pAllocator, pool);
+ vk_free2(&device->alloc, pAllocator, pool);
}
VkResult anv_GetQueryPoolResults(
ANV_FROM_HANDLE(anv_instance, instance, _instance);
ANV_FROM_HANDLE(_VkIcdSurfaceBase, surface, _surface);
- anv_free2(&instance->alloc, pAllocator, surface);
+ vk_free2(&instance->alloc, pAllocator, surface);
}
VkResult anv_GetPhysicalDeviceSurfaceSupportKHR(
u_vector_finish(&display->formats);
if (display->drm)
wl_drm_destroy(display->drm);
- anv_free(&wsi->physical_device->instance->alloc, display);
+ vk_free(&wsi->physical_device->instance->alloc, display);
}
static struct wsi_wl_display *
wsi_wl_display_create(struct wsi_wayland *wsi, struct wl_display *wl_display)
{
struct wsi_wl_display *display =
- anv_alloc(&wsi->physical_device->instance->alloc, sizeof(*display), 8,
+ vk_alloc(&wsi->physical_device->instance->alloc, sizeof(*display), 8,
VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
if (!display)
return NULL;
VkIcdSurfaceWayland *surface;
- surface = anv_alloc2(&instance->alloc, pAllocator, sizeof *surface, 8,
+ surface = vk_alloc2(&instance->alloc, pAllocator, sizeof *surface, 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (surface == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
wsi_wl_image_finish(chain, &chain->images[i], pAllocator);
}
- anv_free2(&chain->base.device->alloc, pAllocator, chain);
+ vk_free2(&chain->base.device->alloc, pAllocator, chain);
return VK_SUCCESS;
}
num_images = MAX2(num_images, 4);
size_t size = sizeof(*chain) + num_images * sizeof(chain->images[0]);
- chain = anv_alloc2(&device->alloc, pAllocator, size, 8,
+ chain = vk_alloc2(&device->alloc, pAllocator, size, 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (chain == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
struct wsi_wayland *wsi;
VkResult result;
- wsi = anv_alloc(&device->instance->alloc, sizeof(*wsi), 8,
+ wsi = vk_alloc(&device->instance->alloc, sizeof(*wsi), 8,
VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
if (!wsi) {
result = vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
pthread_mutex_destroy(&wsi->mutex);
fail_alloc:
- anv_free(&device->instance->alloc, wsi);
+ vk_free(&device->instance->alloc, wsi);
fail:
device->wsi[VK_ICD_WSI_PLATFORM_WAYLAND] = NULL;
pthread_mutex_destroy(&wsi->mutex);
- anv_free(&device->instance->alloc, wsi);
+ vk_free(&device->instance->alloc, wsi);
}
}
xcb_query_extension_reply_t *dri3_reply, *pres_reply;
struct wsi_x11_connection *wsi_conn =
- anv_alloc(&device->instance->alloc, sizeof(*wsi_conn), 8,
+ vk_alloc(&device->instance->alloc, sizeof(*wsi_conn), 8,
VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
if (!wsi_conn)
return NULL;
if (dri3_reply == NULL || pres_reply == NULL) {
free(dri3_reply);
free(pres_reply);
- anv_free(&device->instance->alloc, wsi_conn);
+ vk_free(&device->instance->alloc, wsi_conn);
return NULL;
}
wsi_x11_connection_destroy(struct anv_physical_device *device,
struct wsi_x11_connection *conn)
{
- anv_free(&device->instance->alloc, conn);
+ vk_free(&device->instance->alloc, conn);
}
static struct wsi_x11_connection *
VkIcdSurfaceXcb *surface;
- surface = anv_alloc2(&instance->alloc, pAllocator, sizeof *surface, 8,
+ surface = vk_alloc2(&instance->alloc, pAllocator, sizeof *surface, 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (surface == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
VkIcdSurfaceXlib *surface;
- surface = anv_alloc2(&instance->alloc, pAllocator, sizeof *surface, 8,
+ surface = vk_alloc2(&instance->alloc, pAllocator, sizeof *surface, 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (surface == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
xcb_unregister_for_special_event(chain->conn, chain->special_event);
- anv_free2(&chain->base.device->alloc, pAllocator, chain);
+ vk_free2(&chain->base.device->alloc, pAllocator, chain);
return VK_SUCCESS;
}
num_images = MAX2(num_images, 4);
size_t size = sizeof(*chain) + num_images * sizeof(chain->images[0]);
- chain = anv_alloc2(&device->alloc, pAllocator, size, 8,
+ chain = vk_alloc2(&device->alloc, pAllocator, size, 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (chain == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
fail_register:
xcb_unregister_for_special_event(chain->conn, chain->special_event);
- anv_free2(&device->alloc, pAllocator, chain);
+ vk_free2(&device->alloc, pAllocator, chain);
return result;
}
struct wsi_x11 *wsi;
VkResult result;
- wsi = anv_alloc(&device->instance->alloc, sizeof(*wsi), 8,
+ wsi = vk_alloc(&device->instance->alloc, sizeof(*wsi), 8,
VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
if (!wsi) {
result = vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
fail_mutex:
pthread_mutex_destroy(&wsi->mutex);
fail_alloc:
- anv_free(&device->instance->alloc, wsi);
+ vk_free(&device->instance->alloc, wsi);
fail:
device->wsi[VK_ICD_WSI_PLATFORM_XCB] = NULL;
device->wsi[VK_ICD_WSI_PLATFORM_XLIB] = NULL;
pthread_mutex_destroy(&wsi->mutex);
- anv_free(&device->instance->alloc, wsi);
+ vk_free(&device->instance->alloc, wsi);
}
}
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO);
- pipeline = anv_alloc2(&device->alloc, pAllocator, sizeof(*pipeline), 8,
+ pipeline = vk_alloc2(&device->alloc, pAllocator, sizeof(*pipeline), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (pipeline == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
result = anv_pipeline_init(pipeline, device, cache,
pCreateInfo, pAllocator);
if (result != VK_SUCCESS) {
- anv_free2(&device->alloc, pAllocator, pipeline);
+ vk_free2(&device->alloc, pAllocator, pipeline);
return result;
}
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO);
- pipeline = anv_alloc2(&device->alloc, pAllocator, sizeof(*pipeline), 8,
+ pipeline = vk_alloc2(&device->alloc, pAllocator, sizeof(*pipeline), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (pipeline == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
result = anv_pipeline_init(pipeline, device, cache,
pCreateInfo, pAllocator);
if (result != VK_SUCCESS) {
- anv_free2(&device->alloc, pAllocator, pipeline);
+ vk_free2(&device->alloc, pAllocator, pipeline);
return result;
}
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO);
- pipeline = anv_alloc2(&device->alloc, pAllocator, sizeof(*pipeline), 8,
+ pipeline = vk_alloc2(&device->alloc, pAllocator, sizeof(*pipeline), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (pipeline == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
result = anv_reloc_list_init(&pipeline->batch_relocs,
pAllocator ? pAllocator : &device->alloc);
if (result != VK_SUCCESS) {
- anv_free2(&device->alloc, pAllocator, pipeline);
+ vk_free2(&device->alloc, pAllocator, pipeline);
return result;
}
pipeline->batch.next = pipeline->batch.start = pipeline->batch_data;
pCreateInfo->stage.pName,
pCreateInfo->stage.pSpecializationInfo);
if (result != VK_SUCCESS) {
- anv_free2(&device->alloc, pAllocator, pipeline);
+ vk_free2(&device->alloc, pAllocator, pipeline);
return result;
}
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO);
- sampler = anv_alloc2(&device->alloc, pAllocator, sizeof(*sampler), 8,
+ sampler = vk_alloc2(&device->alloc, pAllocator, sizeof(*sampler), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (!sampler)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);