[Mesa-dev] [PATCH 3/6] radeon/ac: switch from radeon_elf_read() to ac_elf_read()

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


---
 src/gallium/drivers/r600/evergreen_compute.c        | 2 +-
 src/gallium/drivers/radeonsi/si_compute.c           | 3 +--
 src/gallium/drivers/radeonsi/si_debug.c             | 3 +--
 src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c | 2 +-
 4 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/r600/evergreen_compute.c b/src/gallium/drivers/r600/evergreen_compute.c
index cf56d04..2d5130f 100644
--- a/src/gallium/drivers/r600/evergreen_compute.c
+++ b/src/gallium/drivers/r600/evergreen_compute.c
@@ -244,21 +244,21 @@ static void *evergreen_create_compute_state(struct pipe_context *ctx,
 #ifdef HAVE_OPENCL
 	const struct pipe_llvm_program_header *header;
 	const char *code;
 	void *p;
 	boolean use_kill;
 
 	COMPUTE_DBG(rctx->screen, "*** evergreen_create_compute_state\n");
 	header = cso->prog;
 	code = cso->prog + sizeof(struct pipe_llvm_program_header);
 	radeon_shader_binary_init(&shader->binary);
-	radeon_elf_read(code, header->num_bytes, &shader->binary);
+	ac_elf_read(code, header->num_bytes, &shader->binary);
 	r600_create_shader(&shader->bc, &shader->binary, &use_kill);
 
 	/* Upload code + ROdata */
 	shader->code_bo = r600_compute_buffer_alloc_vram(rctx->screen,
 							shader->bc.ndw * 4);
 	p = r600_buffer_map_sync_with_rings(&rctx->b, shader->code_bo, PIPE_TRANSFER_WRITE);
 	//TODO: use util_memcpy_cpu_to_le32 ?
 	memcpy(p, shader->bc.bytecode, shader->bc.ndw * 4);
 	rctx->b.ws->buffer_unmap(shader->code_bo->buf);
 #endif
diff --git a/src/gallium/drivers/radeonsi/si_compute.c b/src/gallium/drivers/radeonsi/si_compute.c
index f4efb0d..5097c81 100644
--- a/src/gallium/drivers/radeonsi/si_compute.c
+++ b/src/gallium/drivers/radeonsi/si_compute.c
@@ -18,21 +18,20 @@
  * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  * USE OR OTHER DEALINGS IN THE SOFTWARE.
  *
  */
 
 #include "tgsi/tgsi_parse.h"
 #include "util/u_memory.h"
 #include "util/u_upload_mgr.h"
-#include "radeon/radeon_elf_util.h"
 
 #include "amd_kernel_code_t.h"
 #include "radeon/r600_cs.h"
 #include "si_pipe.h"
 #include "sid.h"
 
 #define MAX_GLOBAL_BUFFERS 22
 
 struct si_compute {
 	unsigned ir_type;
@@ -153,21 +152,21 @@ static void *si_create_compute_state(
 			sel.info.properties[TGSI_PROPERTY_CS_FIXED_BLOCK_WIDTH] == 0;
 
 		FREE(sel.tokens);
 		program->shader.selector = NULL;
 	} else {
 		const struct pipe_llvm_program_header *header;
 		const char *code;
 		header = cso->prog;
 		code = cso->prog + sizeof(struct pipe_llvm_program_header);
 
-		radeon_elf_read(code, header->num_bytes, &program->shader.binary);
+		ac_elf_read(code, header->num_bytes, &program->shader.binary);
 		if (program->use_code_object_v2) {
 			const amd_kernel_code_t *code_object =
 				si_compute_get_code_object(program, 0);
 			code_object_to_config(code_object, &program->shader.config);
 		} else {
 			si_shader_binary_read_config(&program->shader.binary,
 				     &program->shader.config, 0);
 		}
 		si_shader_dump(sctx->screen, &program->shader, &sctx->b.debug,
 			       PIPE_SHADER_COMPUTE, stderr, true);
diff --git a/src/gallium/drivers/radeonsi/si_debug.c b/src/gallium/drivers/radeonsi/si_debug.c
index f04b8fa..1092aa2 100644
--- a/src/gallium/drivers/radeonsi/si_debug.c
+++ b/src/gallium/drivers/radeonsi/si_debug.c
@@ -20,21 +20,20 @@
  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  * USE OR OTHER DEALINGS IN THE SOFTWARE.
  *
  * Authors:
  *      Marek Olšák <maraeo at gmail.com>
  */
 
 #include "si_pipe.h"
 #include "sid.h"
 #include "sid_tables.h"
-#include "radeon/radeon_elf_util.h"
 #include "ddebug/dd_util.h"
 #include "util/u_memory.h"
 #include "ac_debug.h"
 
 DEBUG_GET_ONCE_OPTION(replace_shaders, "RADEON_REPLACE_SHADERS", NULL)
 
 static void si_dump_shader(struct si_screen *sscreen,
 			   struct si_shader_ctx_state *state, FILE *f)
 {
 	struct si_shader *current = state->current;
@@ -119,21 +118,21 @@ bool si_replace_shader(unsigned num, struct ac_shader_binary *binary)
 	buf = MALLOC(filesize);
 	if (!buf) {
 		fprintf(stderr, "out of memory\n");
 		goto out_close;
 	}
 
 	nread = fread(buf, 1, filesize, f);
 	if (nread != filesize)
 		goto file_error;
 
-	radeon_elf_read(buf, filesize, binary);
+	ac_elf_read(buf, filesize, binary);
 	replaced = true;
 
 out_close:
 	fclose(f);
 out_free:
 	FREE(buf);
 	free(copy);
 	return replaced;
 
 file_error:
diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
index 1ae17af..f5c672e 100644
--- a/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
+++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_setup.c
@@ -231,21 +231,21 @@ unsigned si_llvm_compile(LLVMModuleRef M, struct ac_shader_binary *binary,
 				   "LLVM emit error: %s", err);
 		FREE(err);
 		diag.retval = 1;
 		goto out;
 	}
 
 	/* Extract Shader Code*/
 	buffer_size = LLVMGetBufferSize(out_buffer);
 	buffer_data = LLVMGetBufferStart(out_buffer);
 
-	radeon_elf_read(buffer_data, buffer_size, binary);
+	ac_elf_read(buffer_data, buffer_size, binary);
 
 	/* Clean up */
 	LLVMDisposeMemoryBuffer(out_buffer);
 
 out:
 	if (diag.retval != 0)
 		pipe_debug_message(debug, SHADER_INFO, "LLVM compile failed");
 	return diag.retval;
 }
 
-- 
2.9.3



More information about the mesa-dev mailing list