[Mesa-dev] [PATCH 1/6] radeonsi: inline si_shader_binary_read_config into its only caller

Nicolai Hähnle nhaehnle at gmail.com
Sat May 4 13:39:17 UTC 2019


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

Since it can only be used for reading the config of an individual,
non-combined shader, it is not very reusable anyway.
---
 src/gallium/drivers/radeonsi/si_shader.c | 21 +++++++--------------
 src/gallium/drivers/radeonsi/si_shader.h |  2 --
 2 files changed, 7 insertions(+), 16 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index 757624c52f7..528c34aecba 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -5302,33 +5302,20 @@ void si_shader_dump(struct si_screen *sscreen, const struct si_shader *shader,
 		if (shader->epilog)
 			si_shader_dump_disassembly(&shader->epilog->binary,
 						   debug, "epilog", file);
 		fprintf(file, "\n");
 	}
 
 	si_shader_dump_stats(sscreen, shader, processor, file,
 			     check_debug_option);
 }
 
-bool si_shader_binary_read_config(struct si_shader_binary *binary,
-				  struct ac_shader_config *conf)
-{
-	struct ac_rtld_binary rtld;
-	if (!ac_rtld_open(&rtld, 1, &binary->elf_buffer, &binary->elf_size))
-		return false;
-
-	bool ok = ac_rtld_read_config(&rtld, conf);
-
-	ac_rtld_close(&rtld);
-	return ok;
-}
-
 static int si_compile_llvm(struct si_screen *sscreen,
 			   struct si_shader_binary *binary,
 			   struct ac_shader_config *conf,
 			   struct ac_llvm_compiler *compiler,
 			   LLVMModuleRef mod,
 			   struct pipe_debug_callback *debug,
 			   unsigned processor,
 			   const char *name,
 			   bool less_optimized)
 {
@@ -5350,21 +5337,27 @@ static int si_compile_llvm(struct si_screen *sscreen,
 		LLVMDisposeMessage(ir);
 	}
 
 	if (!si_replace_shader(count, binary)) {
 		unsigned r = si_llvm_compile(mod, binary, compiler, debug,
 					     less_optimized);
 		if (r)
 			return r;
 	}
 
-	if (!si_shader_binary_read_config(binary, conf))
+	struct ac_rtld_binary rtld;
+	if (!ac_rtld_open(&rtld, 1, &binary->elf_buffer, &binary->elf_size))
+		return -1;
+
+	bool ok = ac_rtld_read_config(&rtld, conf);
+	ac_rtld_close(&rtld);
+	if (!ok)
 		return -1;
 
 	/* Enable 64-bit and 16-bit denormals, because there is no performance
 	 * cost.
 	 *
 	 * If denormals are enabled, all floating-point output modifiers are
 	 * ignored.
 	 *
 	 * Don't enable denormals for 32-bit floats, because:
 	 * - Floating-point output modifiers would be ignored by the hw.
diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h
index 302de427c04..ef9f5c379d3 100644
--- a/src/gallium/drivers/radeonsi/si_shader.h
+++ b/src/gallium/drivers/radeonsi/si_shader.h
@@ -685,22 +685,20 @@ unsigned si_shader_io_get_unique_index(unsigned semantic_name, unsigned index,
 bool si_shader_binary_upload(struct si_screen *sscreen, struct si_shader *shader,
 			     uint64_t scratch_va);
 void si_shader_dump(struct si_screen *sscreen, const struct si_shader *shader,
 		    struct pipe_debug_callback *debug, unsigned processor,
 		    FILE *f, bool check_debug_option);
 void si_shader_dump_stats_for_shader_db(const struct si_shader *shader,
 					struct pipe_debug_callback *debug);
 void si_multiwave_lds_size_workaround(struct si_screen *sscreen,
 				      unsigned *lds_size);
 const char *si_get_shader_name(const struct si_shader *shader, unsigned processor);
-bool si_shader_binary_read_config(struct si_shader_binary *binary,
-				  struct ac_shader_config *conf);
 void si_shader_binary_clean(struct si_shader_binary *binary);
 
 /* si_shader_nir.c */
 void si_nir_scan_shader(const struct nir_shader *nir,
 			struct tgsi_shader_info *info);
 void si_nir_scan_tess_ctrl(const struct nir_shader *nir,
 			   struct tgsi_tessctrl_info *out);
 void si_lower_nir(struct si_shader_selector *sel);
 
 /* Inline helpers. */
-- 
2.20.1



More information about the mesa-dev mailing list