From: Marek Olšák Date: Sat, 25 Nov 2017 21:35:27 +0000 (+0100) Subject: radeonsi: move/remove ac_shader_binary helpers X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=757ea3e613fffbf7f5ac2bd0d6949fffc8380c4a;p=mesa.git radeonsi: move/remove ac_shader_binary helpers Reviewed-by: Nicolai Hähnle --- diff --git a/src/amd/common/ac_binary.c b/src/amd/common/ac_binary.c index 6ad60468949..fabeb15a204 100644 --- a/src/amd/common/ac_binary.c +++ b/src/amd/common/ac_binary.c @@ -298,3 +298,16 @@ void ac_shader_binary_read_config(struct ac_shader_binary *binary, conf->scratch_bytes_per_wave = G_00B860_WAVESIZE(wavesize) * 256 * 4; } } + +void ac_shader_binary_clean(struct ac_shader_binary *b) +{ + if (!b) + return; + FREE(b->code); + FREE(b->config); + FREE(b->rodata); + FREE(b->global_symbol_offsets); + FREE(b->relocs); + FREE(b->disasm_string); + FREE(b->llvm_ir_string); +} diff --git a/src/amd/common/ac_binary.h b/src/amd/common/ac_binary.h index 24c9ba5f216..4bd86b939f1 100644 --- a/src/amd/common/ac_binary.h +++ b/src/amd/common/ac_binary.h @@ -96,5 +96,6 @@ void ac_shader_binary_read_config(struct ac_shader_binary *binary, struct ac_shader_config *conf, unsigned symbol_offset, bool supports_spill); +void ac_shader_binary_clean(struct ac_shader_binary *b); #endif /* AC_BINARY_H */ diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c index b4e76a39921..a72d2d46e4e 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.c +++ b/src/gallium/drivers/radeon/r600_pipe_common.c @@ -39,28 +39,6 @@ #include - -/* - * shader binary helpers. - */ -void si_radeon_shader_binary_init(struct ac_shader_binary *b) -{ - memset(b, 0, sizeof(*b)); -} - -void si_radeon_shader_binary_clean(struct ac_shader_binary *b) -{ - if (!b) - return; - FREE(b->code); - FREE(b->config); - FREE(b->rodata); - FREE(b->global_symbol_offsets); - FREE(b->relocs); - FREE(b->disasm_string); - FREE(b->llvm_ir_string); -} - /* * pipe_context */ diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h index c052a54eb67..0597af49803 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.h +++ b/src/gallium/drivers/radeon/r600_pipe_common.h @@ -127,9 +127,6 @@ struct r600_perfcounters; struct tgsi_shader_info; struct r600_qbo_state; -void si_radeon_shader_binary_init(struct ac_shader_binary *b); -void si_radeon_shader_binary_clean(struct ac_shader_binary *b); - /* Only 32-bit buffer allocations are supported, gallium doesn't support more * at the moment. */ diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c index dfb35ed82ee..fd09d78b204 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.c +++ b/src/gallium/drivers/radeonsi/si_pipe.c @@ -433,7 +433,7 @@ static void si_destroy_screen(struct pipe_screen* pscreen) struct si_shader_part *part = parts[i]; parts[i] = part->next; - si_radeon_shader_binary_clean(&part->binary); + ac_shader_binary_clean(&part->binary); FREE(part); } } diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index fc4bab8c9cf..0340133a8af 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -7813,7 +7813,7 @@ void si_shader_destroy(struct si_shader *shader) r600_resource_reference(&shader->bo, NULL); if (!shader->is_binary_shared) - si_radeon_shader_binary_clean(&shader->binary); + ac_shader_binary_clean(&shader->binary); free(shader->shader_log); }