From cb07f91489d164f15bdd43e174cc4d8a65be4cc0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nicolai=20H=C3=A4hnle?= Date: Mon, 1 Jul 2019 17:26:09 +0200 Subject: [PATCH] amd/common: move ac_shader_{binary,reloc} into r600 and rename MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit They are no longer used by radeonsi or radv. Reviewed-by: Bas Nieuwenhuizen Reviewed-by: Samuel Pitoiset Reviewed-by: Marek Olšák --- src/amd/common/ac_binary.h | 38 ------------------ src/amd/common/ac_llvm_util.h | 1 - src/gallium/drivers/r600/evergreen_compute.c | 35 +++++++++++++---- .../drivers/r600/evergreen_compute_internal.h | 39 ++++++++++++++++++- src/gallium/drivers/r600/r600_pipe_common.c | 21 ---------- src/gallium/drivers/r600/r600_pipe_common.h | 6 --- 6 files changed, 65 insertions(+), 75 deletions(-) diff --git a/src/amd/common/ac_binary.h b/src/amd/common/ac_binary.h index 3ac8562024d..53138f11810 100644 --- a/src/amd/common/ac_binary.h +++ b/src/amd/common/ac_binary.h @@ -32,44 +32,6 @@ extern "C" { #endif -struct ac_shader_reloc { - char name[32]; - uint64_t offset; -}; - -struct ac_shader_binary { - unsigned code_size; - unsigned config_size; - /** The number of bytes of config information for each global symbol. - */ - unsigned config_size_per_symbol; - unsigned rodata_size; - unsigned global_symbol_count; - unsigned reloc_count; - - /** Shader code */ - unsigned char *code; - - /** Config/Context register state that accompanies this shader. - * This is a stream of dword pairs. First dword contains the - * register address, the second dword contains the value.*/ - unsigned char *config; - - - /** Constant data accessed by the shader. This will be uploaded - * into a constant buffer. */ - unsigned char *rodata; - - /** List of symbol offsets for the shader */ - uint64_t *global_symbol_offsets; - - struct ac_shader_reloc *relocs; - - /** Disassembled shader in a string. */ - char *disasm_string; - char *llvm_ir_string; -}; - struct ac_shader_config { unsigned num_sgprs; unsigned num_vgprs; diff --git a/src/amd/common/ac_llvm_util.h b/src/amd/common/ac_llvm_util.h index b0f8fc6b8cc..0c900885de5 100644 --- a/src/amd/common/ac_llvm_util.h +++ b/src/amd/common/ac_llvm_util.h @@ -35,7 +35,6 @@ extern "C" { #endif -struct ac_shader_binary; struct ac_compiler_passes; enum ac_func_attr { diff --git a/src/gallium/drivers/r600/evergreen_compute.c b/src/gallium/drivers/r600/evergreen_compute.c index 1536210c7ef..dea01e48505 100644 --- a/src/gallium/drivers/r600/evergreen_compute.c +++ b/src/gallium/drivers/r600/evergreen_compute.c @@ -84,6 +84,25 @@ writable images will consume TEX slots, VTX slots too because of linear indexing */ +MAYBE_UNUSED +static void radeon_shader_binary_init(struct r600_shader_binary *b) +{ + memset(b, 0, sizeof(*b)); +} + +MAYBE_UNUSED +static void radeon_shader_binary_clean(struct r600_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); +} + struct r600_resource *r600_compute_buffer_alloc_vram(struct r600_screen *screen, unsigned size) { @@ -186,7 +205,7 @@ static void evergreen_cs_set_constant_buffer(struct r600_context *rctx, #ifdef HAVE_OPENCL static void parse_symbol_table(Elf_Data *symbol_table_data, const GElf_Shdr *symbol_table_header, - struct ac_shader_binary *binary) + struct r600_shader_binary *binary) { GElf_Sym symbol; unsigned i = 0; @@ -230,7 +249,7 @@ static void parse_symbol_table(Elf_Data *symbol_table_data, static void parse_relocs(Elf *elf, Elf_Data *relocs, Elf_Data *symbols, unsigned symbol_sh_link, - struct ac_shader_binary *binary) + struct r600_shader_binary *binary) { unsigned i; @@ -238,12 +257,12 @@ static void parse_relocs(Elf *elf, Elf_Data *relocs, Elf_Data *symbols, return; } binary->relocs = CALLOC(binary->reloc_count, - sizeof(struct ac_shader_reloc)); + sizeof(struct r600_shader_reloc)); for (i = 0; i < binary->reloc_count; i++) { GElf_Sym symbol; GElf_Rel rel; char *symbol_name; - struct ac_shader_reloc *reloc = &binary->relocs[i]; + struct r600_shader_reloc *reloc = &binary->relocs[i]; gelf_getrel(relocs, i, &rel); gelf_getsym(symbols, GELF_R_SYM(rel.r_info), &symbol); @@ -256,7 +275,7 @@ static void parse_relocs(Elf *elf, Elf_Data *relocs, Elf_Data *symbols, } static void r600_elf_read(const char *elf_data, unsigned elf_size, - struct ac_shader_binary *binary) + struct r600_shader_binary *binary) { char *elf_buffer; Elf *elf; @@ -335,7 +354,7 @@ static void r600_elf_read(const char *elf_data, unsigned elf_size, } static const unsigned char *r600_shader_binary_config_start( - const struct ac_shader_binary *binary, + const struct r600_shader_binary *binary, uint64_t symbol_offset) { unsigned i; @@ -348,7 +367,7 @@ static const unsigned char *r600_shader_binary_config_start( return binary->config; } -static void r600_shader_binary_read_config(const struct ac_shader_binary *binary, +static void r600_shader_binary_read_config(const struct r600_shader_binary *binary, struct r600_bytecode *bc, uint64_t symbol_offset, boolean *use_kill) @@ -384,7 +403,7 @@ static void r600_shader_binary_read_config(const struct ac_shader_binary *binary } static unsigned r600_create_shader(struct r600_bytecode *bc, - const struct ac_shader_binary *binary, + const struct r600_shader_binary *binary, boolean *use_kill) { diff --git a/src/gallium/drivers/r600/evergreen_compute_internal.h b/src/gallium/drivers/r600/evergreen_compute_internal.h index db3f24d3822..4f3ba564fd0 100644 --- a/src/gallium/drivers/r600/evergreen_compute_internal.h +++ b/src/gallium/drivers/r600/evergreen_compute_internal.h @@ -30,10 +30,47 @@ #include #endif +struct r600_shader_reloc { + char name[32]; + uint64_t offset; +}; + +struct r600_shader_binary { + unsigned code_size; + unsigned config_size; + /** The number of bytes of config information for each global symbol. + */ + unsigned config_size_per_symbol; + unsigned rodata_size; + unsigned global_symbol_count; + unsigned reloc_count; + + /** Shader code */ + unsigned char *code; + + /** Config/Context register state that accompanies this shader. + * This is a stream of dword pairs. First dword contains the + * register address, the second dword contains the value.*/ + unsigned char *config; + + + /** Constant data accessed by the shader. This will be uploaded + * into a constant buffer. */ + unsigned char *rodata; + + /** List of symbol offsets for the shader */ + uint64_t *global_symbol_offsets; + + struct r600_shader_reloc *relocs; + + /** Disassembled shader in a string. */ + char *disasm_string; +}; + struct r600_pipe_compute { struct r600_context *ctx; - struct ac_shader_binary binary; + struct r600_shader_binary binary; enum pipe_shader_ir ir_type; diff --git a/src/gallium/drivers/r600/r600_pipe_common.c b/src/gallium/drivers/r600/r600_pipe_common.c index 566c63cc4d8..9eee322a28b 100644 --- a/src/gallium/drivers/r600/r600_pipe_common.c +++ b/src/gallium/drivers/r600/r600_pipe_common.c @@ -59,27 +59,6 @@ struct r600_multi_fence { } gfx_unflushed; }; -/* - * shader binary helpers. - */ -void radeon_shader_binary_init(struct ac_shader_binary *b) -{ - memset(b, 0, sizeof(*b)); -} - -void 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/r600/r600_pipe_common.h b/src/gallium/drivers/r600/r600_pipe_common.h index b43b7eecd10..c5929c24fb0 100644 --- a/src/gallium/drivers/r600/r600_pipe_common.h +++ b/src/gallium/drivers/r600/r600_pipe_common.h @@ -34,8 +34,6 @@ #include -#include "amd/common/ac_binary.h" - #include "radeon/radeon_winsys.h" #include "util/disk_cache.h" @@ -48,7 +46,6 @@ #include "util/u_threaded_context.h" struct u_log_context; - #define ATI_VENDOR_ID 0x1002 #define R600_RESOURCE_FLAG_TRANSFER (PIPE_RESOURCE_FLAG_DRV_PRIV << 0) @@ -132,9 +129,6 @@ struct r600_perfcounters; struct tgsi_shader_info; struct r600_qbo_state; -void radeon_shader_binary_init(struct ac_shader_binary *b); -void radeon_shader_binary_clean(struct ac_shader_binary *b); - /* Only 32-bit buffer allocations are supported, gallium doesn't support more * at the moment. */ -- 2.30.2