summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-02-27 10:50:29 +1100
committerTimothy Arceri <[email protected]>2017-02-28 13:20:31 +1100
commit69a687189e0381d0ff8c2f079698b8adfbb0a7b1 (patch)
tree58a4cbd9d508aa5e52c3a46ff9b177f6f4f5d86b /src/gallium
parentaffc8314cb7580414c6ed72aac40997b952b3694 (diff)
radeon/ac: switch from radeon_shader_binary to ac_shader_binary
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/r600/evergreen_compute.c4
-rw-r--r--src/gallium/drivers/r600/evergreen_compute_internal.h2
-rw-r--r--src/gallium/drivers/radeon/r600_pipe_common.c4
-rw-r--r--src/gallium/drivers/radeon/r600_pipe_common.h43
-rw-r--r--src/gallium/drivers/radeon/radeon_elf_util.c12
-rw-r--r--src/gallium/drivers/radeon/radeon_elf_util.h7
-rw-r--r--src/gallium/drivers/radeonsi/si_debug.c2
-rw-r--r--src/gallium/drivers/radeonsi/si_pipe.h2
-rw-r--r--src/gallium/drivers/radeonsi/si_shader.c16
-rw-r--r--src/gallium/drivers/radeonsi/si_shader.h11
-rw-r--r--src/gallium/drivers/radeonsi/si_shader_internal.h4
-rw-r--r--src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c2
12 files changed, 36 insertions, 73 deletions
diff --git a/src/gallium/drivers/r600/evergreen_compute.c b/src/gallium/drivers/r600/evergreen_compute.c
index f66c9f6de28..cf56d048b15 100644
--- a/src/gallium/drivers/r600/evergreen_compute.c
+++ b/src/gallium/drivers/r600/evergreen_compute.c
@@ -180,7 +180,7 @@ static void evergreen_cs_set_constant_buffer(struct r600_context *rctx,
#ifdef HAVE_OPENCL
-static void r600_shader_binary_read_config(const struct radeon_shader_binary *binary,
+static void r600_shader_binary_read_config(const struct ac_shader_binary *binary,
struct r600_bytecode *bc,
uint64_t symbol_offset,
boolean *use_kill)
@@ -216,7 +216,7 @@ static void r600_shader_binary_read_config(const struct radeon_shader_binary *bi
}
static unsigned r600_create_shader(struct r600_bytecode *bc,
- const struct radeon_shader_binary *binary,
+ const struct ac_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 34d96f6d239..6f4be3ea57f 100644
--- a/src/gallium/drivers/r600/evergreen_compute_internal.h
+++ b/src/gallium/drivers/r600/evergreen_compute_internal.h
@@ -33,7 +33,7 @@
struct r600_pipe_compute {
struct r600_context *ctx;
- struct radeon_shader_binary binary;
+ struct ac_shader_binary binary;
struct r600_resource *code_bo;
struct r600_bytecode bc;
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
index 9a514e34b3f..5a6f9606b71 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -66,12 +66,12 @@ struct r600_multi_fence {
/*
* shader binary helpers.
*/
-void radeon_shader_binary_init(struct radeon_shader_binary *b)
+void radeon_shader_binary_init(struct ac_shader_binary *b)
{
memset(b, 0, sizeof(*b));
}
-void radeon_shader_binary_clean(struct radeon_shader_binary *b)
+void radeon_shader_binary_clean(struct ac_shader_binary *b)
{
if (!b)
return;
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h
index 94cf0fcc055..55d2d0bd5ff 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -34,6 +34,8 @@
#include <stdio.h>
+#include "amd/common/ac_binary.h"
+
#include "radeon/radeon_winsys.h"
#include "util/disk_cache.h"
@@ -128,45 +130,8 @@ struct r600_perfcounters;
struct tgsi_shader_info;
struct r600_qbo_state;
-struct radeon_shader_reloc {
- char name[32];
- uint64_t offset;
-};
-
-struct radeon_shader_binary {
- /** Shader code */
- unsigned char *code;
- unsigned code_size;
-
- /** 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;
- unsigned config_size;
-
- /** The number of bytes of config information for each global symbol.
- */
- unsigned config_size_per_symbol;
-
- /** Constant data accessed by the shader. This will be uploaded
- * into a constant buffer. */
- unsigned char *rodata;
- unsigned rodata_size;
-
- /** List of symbol offsets for the shader */
- uint64_t *global_symbol_offsets;
- unsigned global_symbol_count;
-
- struct radeon_shader_reloc *relocs;
- unsigned reloc_count;
-
- /** Disassembled shader in a string. */
- char *disasm_string;
- char *llvm_ir_string;
-};
-
-void radeon_shader_binary_init(struct radeon_shader_binary *b);
-void radeon_shader_binary_clean(struct radeon_shader_binary *b);
+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.
diff --git a/src/gallium/drivers/radeon/radeon_elf_util.c b/src/gallium/drivers/radeon/radeon_elf_util.c
index 8aaa85d02f6..21a7ed5c87e 100644
--- a/src/gallium/drivers/radeon/radeon_elf_util.c
+++ b/src/gallium/drivers/radeon/radeon_elf_util.c
@@ -35,7 +35,7 @@
static void parse_symbol_table(Elf_Data *symbol_table_data,
const GElf_Shdr *symbol_table_header,
- struct radeon_shader_binary *binary)
+ struct ac_shader_binary *binary)
{
GElf_Sym symbol;
unsigned i = 0;
@@ -78,7 +78,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 radeon_shader_binary *binary)
+ struct ac_shader_binary *binary)
{
unsigned i;
@@ -86,12 +86,12 @@ static void parse_relocs(Elf *elf, Elf_Data *relocs, Elf_Data *symbols,
return;
}
binary->relocs = CALLOC(binary->reloc_count,
- sizeof(struct radeon_shader_reloc));
+ sizeof(struct ac_shader_reloc));
for (i = 0; i < binary->reloc_count; i++) {
GElf_Sym symbol;
GElf_Rel rel;
char *symbol_name;
- struct radeon_shader_reloc *reloc = &binary->relocs[i];
+ struct ac_shader_reloc *reloc = &binary->relocs[i];
gelf_getrel(relocs, i, &rel);
gelf_getsym(symbols, GELF_R_SYM(rel.r_info), &symbol);
@@ -104,7 +104,7 @@ static void parse_relocs(Elf *elf, Elf_Data *relocs, Elf_Data *symbols,
}
void radeon_elf_read(const char *elf_data, unsigned elf_size,
- struct radeon_shader_binary *binary)
+ struct ac_shader_binary *binary)
{
char *elf_buffer;
Elf *elf;
@@ -183,7 +183,7 @@ void radeon_elf_read(const char *elf_data, unsigned elf_size,
}
const unsigned char *radeon_shader_binary_config_start(
- const struct radeon_shader_binary *binary,
+ const struct ac_shader_binary *binary,
uint64_t symbol_offset)
{
unsigned i;
diff --git a/src/gallium/drivers/radeon/radeon_elf_util.h b/src/gallium/drivers/radeon/radeon_elf_util.h
index c2af9e0dfe0..4d8318c68f3 100644
--- a/src/gallium/drivers/radeon/radeon_elf_util.h
+++ b/src/gallium/drivers/radeon/radeon_elf_util.h
@@ -29,22 +29,21 @@
#include <stdint.h>
-struct radeon_shader_binary;
-struct radeon_shader_reloc;
+struct ac_shader_binary;
/*
* Parse the elf binary stored in \p elf_data and create a
* radeon_shader_binary object.
*/
void radeon_elf_read(const char *elf_data, unsigned elf_size,
- struct radeon_shader_binary *binary);
+ struct ac_shader_binary *binary);
/**
* @returns A pointer to the start of the configuration information for
* the function starting at \p symbol_offset of the binary.
*/
const unsigned char *radeon_shader_binary_config_start(
- const struct radeon_shader_binary *binary,
+ const struct ac_shader_binary *binary,
uint64_t symbol_offset);
#endif /* RADEON_ELF_UTIL_H */
diff --git a/src/gallium/drivers/radeonsi/si_debug.c b/src/gallium/drivers/radeonsi/si_debug.c
index 1f154c2591e..f04b8fa155e 100644
--- a/src/gallium/drivers/radeonsi/si_debug.c
+++ b/src/gallium/drivers/radeonsi/si_debug.c
@@ -53,7 +53,7 @@ static void si_dump_shader(struct si_screen *sscreen,
* Shader compiles can be overridden with arbitrary ELF objects by setting
* the environment variable RADEON_REPLACE_SHADERS=num1:filename1[;num2:filename2]
*/
-bool si_replace_shader(unsigned num, struct radeon_shader_binary *binary)
+bool si_replace_shader(unsigned num, struct ac_shader_binary *binary)
{
const char *p = debug_get_option_replace_shaders();
const char *semicolon;
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h
index 5b9a5a18cd6..ec7cf30ef7e 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -419,7 +419,7 @@ void si_init_cp_dma_functions(struct si_context *sctx);
void si_init_debug_functions(struct si_context *sctx);
void si_check_vm_faults(struct r600_common_context *ctx,
struct radeon_saved_cs *saved, enum ring_type ring);
-bool si_replace_shader(unsigned num, struct radeon_shader_binary *binary);
+bool si_replace_shader(unsigned num, struct ac_shader_binary *binary);
/* si_dma.c */
void si_init_dma_functions(struct si_context *sctx);
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index f9eaea2d42a..e51b7c9f978 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -5750,7 +5750,7 @@ static void si_llvm_emit_polygon_stipple(struct si_shader_context *ctx,
lp_build_intrinsic(builder, "llvm.AMDGPU.kill", ctx->voidt, &bit, 1, 0);
}
-void si_shader_binary_read_config(struct radeon_shader_binary *binary,
+void si_shader_binary_read_config(struct ac_shader_binary *binary,
struct si_shader_config *conf,
unsigned symbol_offset)
{
@@ -5763,7 +5763,7 @@ void si_shader_binary_read_config(struct radeon_shader_binary *binary,
* Find out if we really need the scratch buffer.
*/
for (i = 0; i < binary->reloc_count; i++) {
- const struct radeon_shader_reloc *reloc = &binary->relocs[i];
+ const struct ac_shader_reloc *reloc = &binary->relocs[i];
if (!strcmp(scratch_rsrc_dword0_symbol, reloc->name) ||
!strcmp(scratch_rsrc_dword1_symbol, reloc->name)) {
@@ -5853,7 +5853,7 @@ void si_shader_apply_scratch_relocs(struct si_context *sctx,
S_008F04_STRIDE(config->scratch_bytes_per_wave / 64);
for (i = 0 ; i < shader->binary.reloc_count; i++) {
- const struct radeon_shader_reloc *reloc =
+ const struct ac_shader_reloc *reloc =
&shader->binary.relocs[i];
if (!strcmp(scratch_rsrc_dword0_symbol, reloc->name)) {
util_memcpy_cpu_to_le32(shader->binary.code + reloc->offset,
@@ -5878,11 +5878,11 @@ static unsigned si_get_shader_binary_size(struct si_shader *shader)
int si_shader_binary_upload(struct si_screen *sscreen, struct si_shader *shader)
{
- const struct radeon_shader_binary *prolog =
+ const struct ac_shader_binary *prolog =
shader->prolog ? &shader->prolog->binary : NULL;
- const struct radeon_shader_binary *epilog =
+ const struct ac_shader_binary *epilog =
shader->epilog ? &shader->epilog->binary : NULL;
- const struct radeon_shader_binary *mainb = &shader->binary;
+ const struct ac_shader_binary *mainb = &shader->binary;
unsigned bo_size = si_get_shader_binary_size(shader) +
(!epilog ? mainb->rodata_size : 0);
unsigned char *ptr;
@@ -5920,7 +5920,7 @@ int si_shader_binary_upload(struct si_screen *sscreen, struct si_shader *shader)
return 0;
}
-static void si_shader_dump_disassembly(const struct radeon_shader_binary *binary,
+static void si_shader_dump_disassembly(const struct ac_shader_binary *binary,
struct pipe_debug_callback *debug,
const char *name, FILE *file)
{
@@ -6128,7 +6128,7 @@ void si_shader_dump(struct si_screen *sscreen, struct si_shader *shader,
}
int si_compile_llvm(struct si_screen *sscreen,
- struct radeon_shader_binary *binary,
+ struct ac_shader_binary *binary,
struct si_shader_config *conf,
LLVMTargetMachineRef tm,
LLVMModuleRef mod,
diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h
index fda8cc65085..c38e7f560b6 100644
--- a/src/gallium/drivers/radeonsi/si_shader.h
+++ b/src/gallium/drivers/radeonsi/si_shader.h
@@ -74,8 +74,7 @@
#include "util/u_queue.h"
#include "si_state.h"
-struct radeon_shader_binary;
-struct radeon_shader_reloc;
+struct ac_shader_binary;
#define SI_MAX_VS_OUTPUTS 40
@@ -529,7 +528,7 @@ struct si_shader {
bool is_gs_copy_shader;
/* The following data is all that's needed for binary shaders. */
- struct radeon_shader_binary binary;
+ struct ac_shader_binary binary;
struct si_shader_config config;
struct si_shader_info info;
@@ -543,7 +542,7 @@ struct si_shader {
struct si_shader_part {
struct si_shader_part *next;
union si_shader_part_key key;
- struct radeon_shader_binary binary;
+ struct ac_shader_binary binary;
struct si_shader_config config;
};
@@ -562,7 +561,7 @@ int si_shader_create(struct si_screen *sscreen, LLVMTargetMachineRef tm,
struct si_shader *shader,
struct pipe_debug_callback *debug);
int si_compile_llvm(struct si_screen *sscreen,
- struct radeon_shader_binary *binary,
+ struct ac_shader_binary *binary,
struct si_shader_config *conf,
LLVMTargetMachineRef tm,
LLVMModuleRef mod,
@@ -582,7 +581,7 @@ void si_shader_apply_scratch_relocs(struct si_context *sctx,
struct si_shader *shader,
struct si_shader_config *config,
uint64_t scratch_va);
-void si_shader_binary_read_config(struct radeon_shader_binary *binary,
+void si_shader_binary_read_config(struct ac_shader_binary *binary,
struct si_shader_config *conf,
unsigned symbol_offset);
unsigned si_get_spi_shader_z_format(bool writes_z, bool writes_stencil,
diff --git a/src/gallium/drivers/radeonsi/si_shader_internal.h b/src/gallium/drivers/radeonsi/si_shader_internal.h
index a8ef523dd16..47aeb5d3b82 100644
--- a/src/gallium/drivers/radeonsi/si_shader_internal.h
+++ b/src/gallium/drivers/radeonsi/si_shader_internal.h
@@ -35,7 +35,7 @@
#include <llvm-c/TargetMachine.h>
struct pipe_debug_callback;
-struct radeon_shader_binary;
+struct ac_shader_binary;
#define RADEON_LLVM_MAX_INPUT_SLOTS 32
#define RADEON_LLVM_MAX_INPUTS 32 * 4
@@ -166,7 +166,7 @@ void si_llvm_shader_type(LLVMValueRef F, unsigned type);
LLVMTargetRef si_llvm_get_amdgpu_target(const char *triple);
-unsigned si_llvm_compile(LLVMModuleRef M, struct radeon_shader_binary *binary,
+unsigned si_llvm_compile(LLVMModuleRef M, struct ac_shader_binary *binary,
LLVMTargetMachineRef tm,
struct pipe_debug_callback *debug);
diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
index 4601ca9ec94..1ae17afbb2d 100644
--- a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
+++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
@@ -200,7 +200,7 @@ static void si_diagnostic_handler(LLVMDiagnosticInfoRef di, void *context)
*
* @returns 0 for success, 1 for failure
*/
-unsigned si_llvm_compile(LLVMModuleRef M, struct radeon_shader_binary *binary,
+unsigned si_llvm_compile(LLVMModuleRef M, struct ac_shader_binary *binary,
LLVMTargetMachineRef tm,
struct pipe_debug_callback *debug)
{