[Mesa-dev] [PATCH 7/9] radeonsi: move si_shader_binary_upload out of si_shader_binary_read

Marek Olšák maraeo at gmail.com
Fri Jan 1 06:14:00 PST 2016


From: Marek Olšák <marek.olsak at amd.com>

---
 src/gallium/drivers/radeonsi/si_compute.c |  1 +
 src/gallium/drivers/radeonsi/si_shader.c  | 15 +++++++--------
 src/gallium/drivers/radeonsi/si_shader.h  |  4 ++--
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_compute.c b/src/gallium/drivers/radeonsi/si_compute.c
index ebe248c..939c7c2 100644
--- a/src/gallium/drivers/radeonsi/si_compute.c
+++ b/src/gallium/drivers/radeonsi/si_compute.c
@@ -138,6 +138,7 @@ static void *si_create_compute_state(
 	init_scratch_buffer(sctx, program);
 	si_shader_binary_read(sctx->screen, &program->shader,
 			      TGSI_PROCESSOR_COMPUTE);
+	si_shader_binary_upload(sctx->screen, &program->shader);
 
 #endif
 	program->input_buffer =	si_resource_create_custom(sctx->b.b.screen,
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index 8051cbde..df67ea3 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -3840,17 +3840,13 @@ int si_shader_binary_upload(struct si_screen *sscreen, struct si_shader *shader)
 	return 0;
 }
 
-int si_shader_binary_read(struct si_screen *sscreen, struct si_shader *shader,
-			  unsigned processor)
+void si_shader_binary_read(struct si_screen *sscreen, struct si_shader *shader,
+			   unsigned processor)
 {
 	const struct radeon_shader_binary *binary = &shader->binary;
 	unsigned i;
-	int r;
 
 	si_shader_binary_read_config(sscreen, shader, 0);
-	r = si_shader_binary_upload(sscreen, shader);
-	if (r)
-		return r;
 
 	if (r600_can_dump_shader(&sscreen->b, processor)) {
 		if (!(sscreen->b.debug_flags & DBG_NO_ASM)) {
@@ -3873,7 +3869,6 @@ int si_shader_binary_read(struct si_screen *sscreen, struct si_shader *shader,
 			shader->num_sgprs, shader->num_vgprs, binary->code_size,
 			shader->lds_size, shader->scratch_bytes_per_wave);
 	}
-	return 0;
 }
 
 int si_compile_llvm(struct si_screen *sscreen, struct si_shader *shader,
@@ -3890,7 +3885,11 @@ int si_compile_llvm(struct si_screen *sscreen, struct si_shader *shader,
 	if (r)
 		return r;
 
-	r = si_shader_binary_read(sscreen, shader, processor);
+	si_shader_binary_read(sscreen, shader, processor);
+
+	r = si_shader_binary_upload(sscreen, shader);
+	if (r)
+		return r;
 
 	FREE(shader->binary.config);
 	FREE(shader->binary.rodata);
diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h
index 7129bcc..3ed4b49 100644
--- a/src/gallium/drivers/radeonsi/si_shader.h
+++ b/src/gallium/drivers/radeonsi/si_shader.h
@@ -334,8 +334,8 @@ int si_compile_llvm(struct si_screen *sscreen, struct si_shader *shader,
 void si_shader_destroy(struct si_shader *shader);
 unsigned si_shader_io_get_unique_index(unsigned semantic_name, unsigned index);
 int si_shader_binary_upload(struct si_screen *sscreen, struct si_shader *shader);
-int si_shader_binary_read(struct si_screen *sscreen, struct si_shader *shader,
-			  unsigned processor);
+void si_shader_binary_read(struct si_screen *sscreen, struct si_shader *shader,
+			   unsigned processor);
 void si_shader_apply_scratch_relocs(struct si_context *sctx,
 			struct si_shader *shader,
 			uint64_t scratch_va);
-- 
2.1.4



More information about the mesa-dev mailing list