Mesa (master): ilo: make toy_compiler_disassemble() more useful

Chia-I Wu olv at kemper.freedesktop.org
Tue Sep 9 05:33:15 UTC 2014


Module: Mesa
Branch: master
Commit: 43bf14eaeb3e93bb9f69966331d001922954acab
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=43bf14eaeb3e93bb9f69966331d001922954acab

Author: Chia-I Wu <olvaffe at gmail.com>
Date:   Fri Sep  5 12:01:34 2014 +0800

ilo: make toy_compiler_disassemble() more useful

Do not require a toy_compiler so that it can be used in other places, such as
state dumping.  Add a bool to control whether the raw instruction words are
shown.

---

 src/gallium/drivers/ilo/shader/ilo_shader_fs.c       |    2 +-
 src/gallium/drivers/ilo/shader/ilo_shader_gs.c       |    4 ++--
 src/gallium/drivers/ilo/shader/ilo_shader_vs.c       |    2 +-
 src/gallium/drivers/ilo/shader/toy_compiler.h        |    4 +++-
 src/gallium/drivers/ilo/shader/toy_compiler_disasm.c |    8 ++++----
 5 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/gallium/drivers/ilo/shader/ilo_shader_fs.c b/src/gallium/drivers/ilo/shader/ilo_shader_fs.c
index c7a6ff9..c5bdf75 100644
--- a/src/gallium/drivers/ilo/shader/ilo_shader_fs.c
+++ b/src/gallium/drivers/ilo/shader/ilo_shader_fs.c
@@ -1425,7 +1425,7 @@ fs_compile(struct fs_compile_context *fcc)
 
    if (ilo_debug & ILO_DEBUG_FS) {
       ilo_printf("disassembly:\n");
-      toy_compiler_disassemble(tc, sh->kernel, sh->kernel_size);
+      toy_compiler_disassemble(tc->dev, sh->kernel, sh->kernel_size, false);
       ilo_printf("\n");
    }
 
diff --git a/src/gallium/drivers/ilo/shader/ilo_shader_gs.c b/src/gallium/drivers/ilo/shader/ilo_shader_gs.c
index 91c300b..2814662 100644
--- a/src/gallium/drivers/ilo/shader/ilo_shader_gs.c
+++ b/src/gallium/drivers/ilo/shader/ilo_shader_gs.c
@@ -902,7 +902,7 @@ gs_compile(struct gs_compile_context *gcc)
 
    if (ilo_debug & ILO_DEBUG_GS) {
       ilo_printf("disassembly:\n");
-      toy_compiler_disassemble(tc, sh->kernel, sh->kernel_size);
+      toy_compiler_disassemble(tc->dev, sh->kernel, sh->kernel_size, false);
       ilo_printf("\n");
    }
 
@@ -986,7 +986,7 @@ gs_compile_passthrough(struct gs_compile_context *gcc)
 
    if (ilo_debug & ILO_DEBUG_GS) {
       ilo_printf("disassembly:\n");
-      toy_compiler_disassemble(tc, sh->kernel, sh->kernel_size);
+      toy_compiler_disassemble(tc->dev, sh->kernel, sh->kernel_size, false);
       ilo_printf("\n");
    }
 
diff --git a/src/gallium/drivers/ilo/shader/ilo_shader_vs.c b/src/gallium/drivers/ilo/shader/ilo_shader_vs.c
index c8a59e4..838a29e 100644
--- a/src/gallium/drivers/ilo/shader/ilo_shader_vs.c
+++ b/src/gallium/drivers/ilo/shader/ilo_shader_vs.c
@@ -789,7 +789,7 @@ vs_compile(struct vs_compile_context *vcc)
 
    if (ilo_debug & ILO_DEBUG_VS) {
       ilo_printf("disassembly:\n");
-      toy_compiler_disassemble(tc, sh->kernel, sh->kernel_size);
+      toy_compiler_disassemble(tc->dev, sh->kernel, sh->kernel_size, false);
       ilo_printf("\n");
    }
 
diff --git a/src/gallium/drivers/ilo/shader/toy_compiler.h b/src/gallium/drivers/ilo/shader/toy_compiler.h
index c23d7fc..74004ed 100644
--- a/src/gallium/drivers/ilo/shader/toy_compiler.h
+++ b/src/gallium/drivers/ilo/shader/toy_compiler.h
@@ -470,6 +470,8 @@ void *
 toy_compiler_assemble(struct toy_compiler *tc, int *size);
 
 void
-toy_compiler_disassemble(struct toy_compiler *tc, const void *kernel, int size);
+toy_compiler_disassemble(const struct ilo_dev_info *dev,
+                         const void *kernel, int size,
+                         bool dump_hex);
 
 #endif /* TOY_COMPILER_H */
diff --git a/src/gallium/drivers/ilo/shader/toy_compiler_disasm.c b/src/gallium/drivers/ilo/shader/toy_compiler_disasm.c
index 0a90c3d..1028940 100644
--- a/src/gallium/drivers/ilo/shader/toy_compiler_disasm.c
+++ b/src/gallium/drivers/ilo/shader/toy_compiler_disasm.c
@@ -40,10 +40,10 @@ static int brw_disasm (FILE *file, struct brw_instruction *inst, int gen);
 #include "toy_compiler.h"
 
 void
-toy_compiler_disassemble(struct toy_compiler *tc, const void *kernel, int size)
+toy_compiler_disassemble(const struct ilo_dev_info *dev,
+                         const void *kernel, int size,
+                         bool dump_hex)
 {
-   /* set this to true to dump the hex */
-   const bool dump_hex = false;
    const struct brw_instruction *instructions = kernel;
    int i;
 
@@ -55,7 +55,7 @@ toy_compiler_disassemble(struct toy_compiler *tc, const void *kernel, int size)
       }
 
       brw_disasm(stderr, (struct brw_instruction *) &instructions[i],
-            ILO_GEN_GET_MAJOR(tc->dev->gen));
+            ILO_GEN_GET_MAJOR(dev->gen));
    }
 }
 




More information about the mesa-commit mailing list