From 67cb55ad118fec14651cba9f27bbbe6f76d7603f Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Wed, 24 Apr 2019 02:21:01 -0500 Subject: [PATCH] anv: Add a ralloc context to anv_pipeline Reviewed-by: Lionel Landwerlin --- src/intel/vulkan/anv_pipeline.c | 5 +++++ src/intel/vulkan/anv_private.h | 2 ++ src/intel/vulkan/genX_pipeline.c | 2 ++ 3 files changed, 9 insertions(+) diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c index 1d0226676f6..fc492844cce 100644 --- a/src/intel/vulkan/anv_pipeline.c +++ b/src/intel/vulkan/anv_pipeline.c @@ -297,6 +297,9 @@ void anv_DestroyPipeline( anv_reloc_list_finish(&pipeline->batch_relocs, pAllocator ? pAllocator : &device->alloc); + + ralloc_free(pipeline->mem_ctx); + if (pipeline->blend_state.map) anv_state_pool_free(&device->dynamic_state_pool, pipeline->blend_state); @@ -1794,6 +1797,7 @@ anv_pipeline_init(struct anv_pipeline *pipeline, pipeline->batch.relocs = &pipeline->batch_relocs; pipeline->batch.status = VK_SUCCESS; + pipeline->mem_ctx = ralloc_context(NULL); pipeline->flags = pCreateInfo->flags; copy_non_dynamic_state(pipeline, pCreateInfo); @@ -1822,6 +1826,7 @@ anv_pipeline_init(struct anv_pipeline *pipeline, result = anv_pipeline_compile_graphics(pipeline, cache, pCreateInfo); if (result != VK_SUCCESS) { + ralloc_free(pipeline->mem_ctx); anv_reloc_list_finish(&pipeline->batch_relocs, alloc); return result; } diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index ad2de7fae76..5682e838abf 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -2802,6 +2802,8 @@ struct anv_pipeline { anv_cmd_dirty_mask_t dynamic_state_mask; struct anv_dynamic_state dynamic_state; + void * mem_ctx; + VkPipelineCreateFlags flags; struct anv_subpass * subpass; diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c index 0fc25f8f9ff..e0e723c13a4 100644 --- a/src/intel/vulkan/genX_pipeline.c +++ b/src/intel/vulkan/genX_pipeline.c @@ -2226,6 +2226,7 @@ compute_pipeline_create( pipeline->batch.relocs = &pipeline->batch_relocs; pipeline->batch.status = VK_SUCCESS; + pipeline->mem_ctx = ralloc_context(NULL); pipeline->flags = pCreateInfo->flags; /* When we free the pipeline, we detect stages based on the NULL status @@ -2242,6 +2243,7 @@ compute_pipeline_create( pCreateInfo->stage.pName, pCreateInfo->stage.pSpecializationInfo); if (result != VK_SUCCESS) { + ralloc_free(pipeline->mem_ctx); vk_free2(&device->alloc, pAllocator, pipeline); return result; } -- 2.30.2