From 1f4a9fc84e8d59e7911c3a6c39aaa191bb3e6ebb Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Mon, 3 Feb 2014 13:50:09 -0500 Subject: [PATCH] radeon: Rename struct radeon_llvm_binary to radeon_shader_binary v2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit And move its definition into r600_pipe_common.h; This struct is a just a container for shader code and has nothing to do with LLVM. v2: - Drop unrelated Makefile change Reviewed-by: Michel Dänzer --- src/gallium/drivers/r600/r600_llvm.c | 4 ++-- src/gallium/drivers/radeon/r600_pipe_common.h | 16 ++++++++++++++++ src/gallium/drivers/radeon/radeon_llvm_emit.c | 3 ++- src/gallium/drivers/radeon/radeon_llvm_emit.h | 10 ++-------- src/gallium/drivers/radeonsi/si_shader.c | 2 +- 5 files changed, 23 insertions(+), 12 deletions(-) diff --git a/src/gallium/drivers/r600/r600_llvm.c b/src/gallium/drivers/r600/r600_llvm.c index e395bf6359b..4fcca697741 100644 --- a/src/gallium/drivers/r600/r600_llvm.c +++ b/src/gallium/drivers/r600/r600_llvm.c @@ -827,11 +827,11 @@ unsigned r600_llvm_compile( unsigned dump) { unsigned r; - struct radeon_llvm_binary binary; + struct radeon_shader_binary binary; const char * gpu_family = r600_get_llvm_processor_name(family); unsigned i; - memset(&binary, 0, sizeof(struct radeon_llvm_binary)); + memset(&binary, 0, sizeof(struct radeon_shader_binary)); r = radeon_llvm_compile(mod, &binary, gpu_family, dump); assert(binary.code_size % 4 == 0); diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h index cf5aa08cad2..cbd3f0e8c64 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.h +++ b/src/gallium/drivers/radeon/r600_pipe_common.h @@ -91,6 +91,22 @@ struct r600_common_context; +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; + + /** Set to 1 if the disassembly for this binary has been dumped to + * stderr. */ + int disassembled; +}; + struct r600_resource { struct u_resource b; diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.c b/src/gallium/drivers/radeon/radeon_llvm_emit.c index 92e7dbc7756..4e0aaea0ebc 100644 --- a/src/gallium/drivers/radeon/radeon_llvm_emit.c +++ b/src/gallium/drivers/radeon/radeon_llvm_emit.c @@ -24,6 +24,7 @@ * */ #include "radeon_llvm_emit.h" +#include "r600_pipe_common.h" #include "util/u_memory.h" #include @@ -85,7 +86,7 @@ static LLVMTargetRef get_r600_target() { * * @returns 0 for success, 1 for failure */ -unsigned radeon_llvm_compile(LLVMModuleRef M, struct radeon_llvm_binary *binary, +unsigned radeon_llvm_compile(LLVMModuleRef M, struct radeon_shader_binary *binary, const char * gpu_family, unsigned dump) { LLVMTargetRef target; diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.h b/src/gallium/drivers/radeon/radeon_llvm_emit.h index 532b7b843f0..780ff5f67f2 100644 --- a/src/gallium/drivers/radeon/radeon_llvm_emit.h +++ b/src/gallium/drivers/radeon/radeon_llvm_emit.h @@ -29,19 +29,13 @@ #include -struct radeon_llvm_binary { - unsigned char *code; - unsigned code_size; - unsigned char *config; - unsigned config_size; - int disassembled; -}; +struct radeon_shader_binary; void radeon_llvm_shader_type(LLVMValueRef F, unsigned type); unsigned radeon_llvm_compile( LLVMModuleRef M, - struct radeon_llvm_binary *binary, + struct radeon_shader_binary *binary, const char * gpu_family, unsigned dump); diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 3a441f94909..e4390eeac1f 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -2295,7 +2295,7 @@ int si_compile_llvm(struct si_context *sctx, struct si_pipe_shader *shader, { unsigned i; uint32_t *ptr; - struct radeon_llvm_binary binary; + struct radeon_shader_binary binary; bool dump = r600_can_dump_shader(&sctx->screen->b, shader->selector ? shader->selector->tokens : NULL); memset(&binary, 0, sizeof(binary)); -- 2.30.2