freedreno/ir3: add ir3_compiler_destroy()

Use ir3_compiler_destroy() rather than open-coding ralloc_free().  This
will give us a place to add more compiler related cleanup code in the
following patches.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5372>
This commit is contained in:
Rob Clark 2020-06-04 12:55:41 -07:00
parent f1ab57359c
commit c0f22c3d94
4 changed files with 14 additions and 4 deletions

View File

@ -52,7 +52,14 @@ DEBUG_GET_ONCE_FLAGS_OPTION(ir3_shader_debug, "IR3_SHADER_DEBUG", shader_debug_o
enum ir3_shader_debug ir3_shader_debug = 0;
struct ir3_compiler * ir3_compiler_create(struct fd_device *dev, uint32_t gpu_id)
void
ir3_compiler_destroy(struct ir3_compiler *compiler)
{
ralloc_free(compiler);
}
struct ir3_compiler *
ir3_compiler_create(struct fd_device *dev, uint32_t gpu_id)
{
struct ir3_compiler *compiler = rzalloc(NULL, struct ir3_compiler);

View File

@ -95,6 +95,7 @@ struct ir3_compiler {
uint32_t const_upload_unit;
};
void ir3_compiler_destroy(struct ir3_compiler *compiler);
struct ir3_compiler * ir3_compiler_create(struct fd_device *dev, uint32_t gpu_id);
int ir3_compile_shader_nir(struct ir3_compiler *compiler,

View File

@ -1346,8 +1346,7 @@ tu_DestroyDevice(VkDevice _device, const VkAllocationCallbacks *pAllocator)
tu_bo_finish(device, &device->scratch_bos[i].bo);
}
/* the compiler does not use pAllocator */
ralloc_free(device->compiler);
ir3_compiler_destroy(device->compiler);
VkPipelineCache pc = tu_pipeline_cache_to_handle(device->mem_cache);
tu_DestroyPipelineCache(tu_device_to_handle(device), pc, NULL);

View File

@ -59,6 +59,7 @@
#include "ir3/ir3_nir.h"
#include "ir3/ir3_compiler.h"
#include "a2xx/ir2.h"
static const struct debug_named_value debug_options[] = {
@ -159,7 +160,9 @@ fd_screen_destroy(struct pipe_screen *pscreen)
simple_mtx_destroy(&screen->lock);
ralloc_free(screen->compiler);
if (screen->compiler)
ir3_compiler_destroy(screen->compiler);
ralloc_free(screen->live_batches);
free(screen->perfcntr_queries);