[Mesa-dev] [PATCH 2/2] radeonsi: cope with missing disassembly

Nicolai Hähnle nhaehnle at gmail.com
Thu Apr 13 18:23:33 UTC 2017


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

For robustness and testing purposes.
---
 src/gallium/drivers/radeonsi/si_state_shaders.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c
index 78c7495..c52ffd9 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.c
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
@@ -106,21 +106,22 @@ static uint32_t *read_chunk(uint32_t *ptr, void **data, unsigned *size)
 
 /**
  * Return the shader binary in a buffer. The first 4 bytes contain its size
  * as integer.
  */
 static void *si_get_shader_binary(struct si_shader *shader)
 {
 	/* There is always a size of data followed by the data itself. */
 	unsigned relocs_size = shader->binary.reloc_count *
 			       sizeof(shader->binary.relocs[0]);
-	unsigned disasm_size = strlen(shader->binary.disasm_string) + 1;
+	unsigned disasm_size = shader->binary.disasm_string ?
+			       strlen(shader->binary.disasm_string) + 1 : 0;
 	unsigned llvm_ir_size = shader->binary.llvm_ir_string ?
 				strlen(shader->binary.llvm_ir_string) + 1 : 0;
 	unsigned size =
 		4 + /* total size */
 		4 + /* CRC32 of the data below */
 		align(sizeof(shader->config), 4) +
 		align(sizeof(shader->info), 4) +
 		4 + align(shader->binary.code_size, 4) +
 		4 + align(shader->binary.rodata_size, 4) +
 		4 + align(relocs_size, 4) +
-- 
2.9.3



More information about the mesa-dev mailing list