[Mesa-dev] [PATCH 2/6] radeon/ac: switch from radeon_shader_binary to ac_shader_binary

Timothy Arceri tarceri at itsqueeze.com
Mon Feb 27 00:49:51 UTC 2017


---
 src/gallium/drivers/r600/evergreen_compute.c       |  4 +-
 .../drivers/r600/evergreen_compute_internal.h      |  2 +-
 src/gallium/drivers/radeon/r600_pipe_common.c      |  4 +-
 src/gallium/drivers/radeon/r600_pipe_common.h      | 43 ++--------------------
 src/gallium/drivers/radeon/radeon_elf_util.c       | 12 +++---
 src/gallium/drivers/radeon/radeon_elf_util.h       |  7 ++--
 src/gallium/drivers/radeonsi/si_debug.c            |  2 +-
 src/gallium/drivers/radeonsi/si_pipe.h             |  2 +-
 src/gallium/drivers/radeonsi/si_shader.c           | 16 ++++----
 src/gallium/drivers/radeonsi/si_shader.h           | 11 +++---
 src/gallium/drivers/radeonsi/si_shader_internal.h  |  4 +-
 .../drivers/radeonsi/si_shader_tgsi_setup.c        |  2 +-
 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 f66c9f6..cf56d04 100644
--- a/src/gallium/drivers/r600/evergreen_compute.c
+++ b/src/gallium/drivers/r600/evergreen_compute.c
@@ -173,21 +173,21 @@ static void evergreen_cs_set_constant_buffer(struct r600_context *rctx,
 }
 
 /* We need to define these R600 registers here, because we can't include
  * evergreend.h and r600d.h.
  */
 #define R_028868_SQ_PGM_RESOURCES_VS                 0x028868
 #define R_028850_SQ_PGM_RESOURCES_PS                 0x028850
 
 #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)
 {
        unsigned i;
        const unsigned char *config =
                radeon_shader_binary_config_start(binary, symbol_offset);
 
        for (i = 0; i < binary->config_size_per_symbol; i+= 8) {
                unsigned reg =
@@ -209,21 +209,21 @@ static void r600_shader_binary_read_config(const struct radeon_shader_binary *bi
                        *use_kill = G_02880C_KILL_ENABLE(value);
                        break;
                case R_0288E8_SQ_LDS_ALLOC:
                        bc->nlds_dw = value;
                        break;
                }
        }
 }
 
 static unsigned r600_create_shader(struct r600_bytecode *bc,
-				   const struct radeon_shader_binary *binary,
+				   const struct ac_shader_binary *binary,
 				   boolean *use_kill)
 
 {
 	assert(binary->code_size % 4 == 0);
 	bc->bytecode = CALLOC(1, binary->code_size);
 	memcpy(bc->bytecode, binary->code, binary->code_size);
 	bc->ndw = binary->code_size / 4;
 
 	r600_shader_binary_read_config(binary, bc, 0, use_kill);
 	return 0;
diff --git a/src/gallium/drivers/r600/evergreen_compute_internal.h b/src/gallium/drivers/r600/evergreen_compute_internal.h
index 34d96f6..6f4be3e 100644
--- a/src/gallium/drivers/r600/evergreen_compute_internal.h
+++ b/src/gallium/drivers/r600/evergreen_compute_internal.h
@@ -26,21 +26,21 @@
 #define EVERGREEN_COMPUTE_INTERNAL_H
 
 #include "r600_asm.h"
 #ifdef HAVE_OPENCL
 #include <llvm-c/Core.h>
 #endif
 
 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;
 
 	unsigned local_size;
 	unsigned private_size;
 	unsigned input_size;
 	struct r600_resource *kernel_param;
 
 #ifdef HAVE_OPENCL
 	LLVMContextRef llvm_ctx;
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
index 9a514e3..5a6f960 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -59,26 +59,26 @@ struct r600_multi_fence {
 	/* If the context wasn't flushed at fence creation, this is non-NULL. */
 	struct {
 		struct r600_common_context *ctx;
 		unsigned ib_index;
 	} gfx_unflushed;
 };
 
 /*
  * 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;
 	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/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h
index 94cf0fc..55d2d0b 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -27,20 +27,22 @@
 /**
  * This file contains common screen and context structures and functions
  * for r600g and radeonsi.
  */
 
 #ifndef R600_PIPE_COMMON_H
 #define R600_PIPE_COMMON_H
 
 #include <stdio.h>
 
+#include "amd/common/ac_binary.h"
+
 #include "radeon/radeon_winsys.h"
 
 #include "util/disk_cache.h"
 #include "util/u_blitter.h"
 #include "util/list.h"
 #include "util/u_range.h"
 #include "util/slab.h"
 #include "util/u_suballoc.h"
 #include "util/u_transfer.h"
 
@@ -121,59 +123,22 @@ enum r600_coherency {
 #define R600_BIG_ENDIAN 1
 #else
 #define R600_BIG_ENDIAN 0
 #endif
 
 struct r600_common_context;
 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.
  */
 struct r600_resource {
 	struct u_resource		b;
 
 	/* Winsys objects. */
 	struct pb_buffer		*buf;
 	uint64_t			gpu_address;
diff --git a/src/gallium/drivers/radeon/radeon_elf_util.c b/src/gallium/drivers/radeon/radeon_elf_util.c
index 8aaa85d..21a7ed5 100644
--- a/src/gallium/drivers/radeon/radeon_elf_util.c
+++ b/src/gallium/drivers/radeon/radeon_elf_util.c
@@ -28,21 +28,21 @@
 #include "r600_pipe_common.h"
 
 #include "util/u_memory.h"
 
 #include <gelf.h>
 #include <libelf.h>
 #include <stdio.h>
 
 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;
 	unsigned symbol_count =
 		symbol_table_header->sh_size / symbol_table_header->sh_entsize;
 
 	/* We are over allocating this list, because symbol_count gives the
  	 * total number of symbols, and we will only be filling the list
  	 * with offsets of global symbols.  The memory savings from
  	 * allocating the correct size of this list will be small, and
@@ -71,47 +71,47 @@ static void parse_symbol_table(Elf_Data *symbol_table_data,
 			}
 			binary->global_symbol_offsets[i] = lhs;
 			binary->global_symbol_offsets[i - 1] = rhs;
 		}
 		++binary->global_symbol_count;
 	}
 }
 
 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;
 
 	if (!relocs || !symbols || !binary->reloc_count) {
 		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);
 		symbol_name = elf_strptr(elf, symbol_sh_link, symbol.st_name);
 
 		reloc->offset = rel.r_offset;
 		strncpy(reloc->name, symbol_name, sizeof(reloc->name)-1);
 		reloc->name[sizeof(reloc->name)-1] = 0;
 	}
 }
 
 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;
 	Elf_Scn *section = NULL;
 	Elf_Data *symbols = NULL, *relocs = NULL;
 	size_t section_str_index;
 	unsigned symbol_sh_link = 0;
 
 	/* One of the libelf implementations
 	 * (http://www.mr511.de/software/english.htm) requires calling
@@ -176,21 +176,21 @@ void radeon_elf_read(const char *elf_data, unsigned elf_size,
 	if (binary->global_symbol_count) {
 		binary->config_size_per_symbol =
 			binary->config_size / binary->global_symbol_count;
 	} else {
 		binary->global_symbol_count = 1;
 		binary->config_size_per_symbol = binary->config_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;
 	for (i = 0; i < binary->global_symbol_count; ++i) {
 		if (binary->global_symbol_offsets[i] == symbol_offset) {
 			unsigned offset = i * binary->config_size_per_symbol;
 			return binary->config + offset;
 		}
 	}
 	return binary->config;
diff --git a/src/gallium/drivers/radeon/radeon_elf_util.h b/src/gallium/drivers/radeon/radeon_elf_util.h
index c2af9e0..4d8318c 100644
--- a/src/gallium/drivers/radeon/radeon_elf_util.h
+++ b/src/gallium/drivers/radeon/radeon_elf_util.h
@@ -22,29 +22,28 @@
  *
  * Authors: Tom Stellard <thomas.stellard at amd.com>
  *
  */
 
 #ifndef RADEON_ELF_UTIL_H
 #define RADEON_ELF_UTIL_H
 
 #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 1f154c2..f04b8fa 100644
--- a/src/gallium/drivers/radeonsi/si_debug.c
+++ b/src/gallium/drivers/radeonsi/si_debug.c
@@ -46,21 +46,21 @@ static void si_dump_shader(struct si_screen *sscreen,
 		fwrite(current->shader_log, current->shader_log_size, 1, f);
 	else
 		si_shader_dump(sscreen, state->current, NULL,
 			       state->cso->info.processor, f, false);
 }
 
 /**
  * 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;
 	char *copy = NULL;
 	FILE *f;
 	long filesize, nread;
 	char *buf = NULL;
 	bool replaced = false;
 
 	if (!p)
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h
index 5b9a5a1..ec7cf30 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -412,21 +412,21 @@ void si_copy_buffer(struct si_context *sctx,
 		    uint64_t dst_offset, uint64_t src_offset, unsigned size,
 		    unsigned user_flags);
 void cik_prefetch_TC_L2_async(struct si_context *sctx, struct pipe_resource *buf,
 			      uint64_t offset, unsigned size);
 void si_init_cp_dma_functions(struct si_context *sctx);
 
 /* si_debug.c */
 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);
 
 /* si_hw_context.c */
 void si_context_gfx_flush(void *context, unsigned flags,
 			  struct pipe_fence_handle **fence);
 void si_begin_new_cs(struct si_context *ctx);
 void si_need_cs_space(struct si_context *ctx);
 
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index f9eaea2..e51b7c9 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -5743,34 +5743,34 @@ static void si_llvm_emit_polygon_stipple(struct si_shader_context *ctx,
 	row = LLVMBuildBitCast(builder, row, ctx->i32, "");
 	bit = LLVMBuildLShr(builder, row, address[0], "");
 	bit = LLVMBuildTrunc(builder, bit, ctx->i1, "");
 
 	/* The intrinsic kills the thread if arg < 0. */
 	bit = LLVMBuildSelect(builder, bit, LLVMConstReal(ctx->f32, 0),
 			      LLVMConstReal(ctx->f32, -1), "");
 	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)
 {
 	unsigned i;
 	const unsigned char *config =
 		radeon_shader_binary_config_start(binary, symbol_offset);
 	bool really_needs_scratch = false;
 
 	/* LLVM adds SGPR spills to the scratch size.
 	 * 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)) {
 			really_needs_scratch = true;
 			break;
 		}
 	}
 
 	/* XXX: We may be able to emit some of these values directly rather than
 	 * extracting fields to be emitted later.
@@ -5846,21 +5846,21 @@ void si_shader_apply_scratch_relocs(struct si_context *sctx,
 	/* Enable scratch coalescing if LLVM sets ELEMENT_SIZE & INDEX_STRIDE
 	 * correctly.
 	 */
 	if (HAVE_LLVM >= 0x0309)
 		scratch_rsrc_dword1 |= S_008F04_SWIZZLE_ENABLE(1);
 	else
 		scratch_rsrc_dword1 |=
 			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,
 			&scratch_rsrc_dword0, 4);
 		} else if (!strcmp(scratch_rsrc_dword1_symbol, reloc->name)) {
 			util_memcpy_cpu_to_le32(shader->binary.code + reloc->offset,
 			&scratch_rsrc_dword1, 4);
 		}
 	}
 }
@@ -5871,25 +5871,25 @@ static unsigned si_get_shader_binary_size(struct si_shader *shader)
 
 	if (shader->prolog)
 		size += shader->prolog->binary.code_size;
 	if (shader->epilog)
 		size += shader->epilog->binary.code_size;
 	return size;
 }
 
 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;
 
 	assert(!prolog || !prolog->rodata_size);
 	assert((!prolog && !epilog) || !mainb->rodata_size);
 	assert(!epilog || !epilog->rodata_size);
 
 	r600_resource_reference(&shader->bo, NULL);
 	shader->bo = (struct r600_resource*)
@@ -5913,21 +5913,21 @@ int si_shader_binary_upload(struct si_screen *sscreen, struct si_shader *shader)
 
 	if (epilog)
 		util_memcpy_cpu_to_le32(ptr, epilog->code, epilog->code_size);
 	else if (mainb->rodata_size > 0)
 		util_memcpy_cpu_to_le32(ptr, mainb->rodata, mainb->rodata_size);
 
 	sscreen->b.ws->buffer_unmap(shader->bo->buf);
 	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)
 {
 	char *line, *p;
 	unsigned i, count;
 
 	if (binary->disasm_string) {
 		fprintf(file, "Shader %s disassembly:\n", name);
 		fprintf(file, "%s", binary->disasm_string);
 
@@ -6121,21 +6121,21 @@ void si_shader_dump(struct si_screen *sscreen, struct si_shader *shader,
 			si_shader_dump_disassembly(&shader->epilog->binary,
 						   debug, "epilog", file);
 		fprintf(file, "\n");
 	}
 
 	si_shader_dump_stats(sscreen, shader, debug, processor, file,
 			     check_debug_option);
 }
 
 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,
 		    struct pipe_debug_callback *debug,
 		    unsigned processor,
 		    const char *name)
 {
 	int r = 0;
 	unsigned count = p_atomic_inc_return(&sscreen->b.num_compilations);
 
diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h
index fda8cc6..c38e7f5 100644
--- a/src/gallium/drivers/radeonsi/si_shader.h
+++ b/src/gallium/drivers/radeonsi/si_shader.h
@@ -67,22 +67,21 @@
 
 #ifndef SI_SHADER_H
 #define SI_SHADER_H
 
 #include <llvm-c/Core.h> /* LLVMModuleRef */
 #include <llvm-c/TargetMachine.h>
 #include "tgsi/tgsi_scan.h"
 #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
 
 /* SGPR user data indices */
 enum {
 	SI_SGPR_RW_BUFFERS,  /* rings (& stream-out, VS only) */
 	SI_SGPR_RW_BUFFERS_HI,
 	SI_SGPR_CONST_BUFFERS,
 	SI_SGPR_CONST_BUFFERS_HI,
 	SI_SGPR_SAMPLERS,  /* images & sampler states interleaved */
@@ -522,74 +521,74 @@ struct si_shader {
 	struct r600_resource		*scratch_bo;
 	struct si_shader_key		key;
 	struct util_queue_fence		optimized_ready;
 	bool				compilation_failed;
 	bool				is_monolithic;
 	bool				is_optimized;
 	bool				is_binary_shared;
 	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;
 
 	/* Shader key + LLVM IR + disassembly + statistics.
 	 * Generated for debug contexts only.
 	 */
 	char				*shader_log;
 	size_t				shader_log_size;
 };
 
 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;
 };
 
 /* si_shader.c */
 struct si_shader *
 si_generate_gs_copy_shader(struct si_screen *sscreen,
 			   LLVMTargetMachineRef tm,
 			   struct si_shader_selector *gs_selector,
 			   struct pipe_debug_callback *debug);
 int si_compile_tgsi_shader(struct si_screen *sscreen,
 			   LLVMTargetMachineRef tm,
 			   struct si_shader *shader,
 			   bool is_monolithic,
 			   struct pipe_debug_callback *debug);
 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,
 		    struct pipe_debug_callback *debug,
 		    unsigned processor,
 		    const char *name);
 void si_shader_destroy(struct si_shader *shader);
 unsigned si_shader_io_get_unique_index(unsigned semantic_name, unsigned index);
 unsigned si_shader_io_get_unique_index2(unsigned name, unsigned index);
 int si_shader_binary_upload(struct si_screen *sscreen, struct si_shader *shader);
 void si_shader_dump(struct si_screen *sscreen, struct si_shader *shader,
 		    struct pipe_debug_callback *debug, unsigned processor,
 		    FILE *f, bool check_debug_option);
 void si_multiwave_lds_size_workaround(struct si_screen *sscreen,
 				      unsigned *lds_size);
 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,
 				    bool writes_samplemask);
 const char *si_get_shader_name(struct si_shader *shader, unsigned processor);
 
 /* Inline helpers. */
 
 /* Return the pointer to the main shader part's pointer. */
 static inline struct si_shader **
diff --git a/src/gallium/drivers/radeonsi/si_shader_internal.h b/src/gallium/drivers/radeonsi/si_shader_internal.h
index a8ef523..47aeb5d 100644
--- a/src/gallium/drivers/radeonsi/si_shader_internal.h
+++ b/src/gallium/drivers/radeonsi/si_shader_internal.h
@@ -28,21 +28,21 @@
 #include "gallivm/lp_bld_init.h"
 #include "gallivm/lp_bld_tgsi.h"
 #include "tgsi/tgsi_parse.h"
 #include "ac_llvm_util.h"
 #include "ac_llvm_build.h"
 
 #include <llvm-c/Core.h>
 #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
 #define RADEON_LLVM_MAX_OUTPUTS 32 * 4
 
 #define RADEON_LLVM_INITIAL_CF_DEPTH 4
 
 #define RADEON_LLVM_MAX_SYSTEM_VALUES 4
 #define RADEON_LLVM_MAX_ADDRS 16
 
@@ -159,21 +159,21 @@ static inline struct si_shader_context *
 si_shader_context(struct lp_build_tgsi_context *bld_base)
 {
 	return (struct si_shader_context*)bld_base;
 }
 
 void si_llvm_add_attribute(LLVMValueRef F, const char *name, int value);
 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);
 
 LLVMTypeRef tgsi2llvmtype(struct lp_build_tgsi_context *bld_base,
 			  enum tgsi_opcode_type type);
 
 LLVMValueRef bitcast(struct lp_build_tgsi_context *bld_base,
 		     enum tgsi_opcode_type type, LLVMValueRef value);
 
 LLVMValueRef si_llvm_bound_index(struct si_shader_context *ctx,
diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
index 4601ca9..1ae17af 100644
--- a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
+++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
@@ -193,21 +193,21 @@ static void si_diagnostic_handler(LLVMDiagnosticInfoRef di, void *context)
 	}
 
 	LLVMDisposeMessage(description);
 }
 
 /**
  * Compile an LLVM module to machine code.
  *
  * @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)
 {
 	struct si_llvm_diagnostics diag;
 	char *err;
 	LLVMContextRef llvm_ctx;
 	LLVMMemoryBufferRef out_buffer;
 	unsigned buffer_size;
 	const char *buffer_data;
 	LLVMBool mem_err;
-- 
2.9.3



More information about the mesa-dev mailing list