[Mesa-dev] [PATCH 38/42] i965/fs: allow unit tests to dump the final patched assembly

Topi Pohjolainen topi.pohjolainen at intel.com
Fri Dec 20 06:39:07 PST 2013


Unit tests comparing generated blorp programs to known good need
to have the dump in designated file instead of in default
standard output. The comparison also expects the jump counters
of if-else-instructions to be correctly set and hence the dump
needs to be taken _after_ 'patch_IF_ELSE()' is run (the default
dump of the fs_generator does this before).

Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
 src/mesa/drivers/dri/i965/brw_fs.h             |  7 +++++--
 src/mesa/drivers/dri/i965/brw_fs_generator.cpp | 15 +++++++++------
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index 9bef07c..d40d0a8 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -510,10 +510,13 @@ public:
 
    const unsigned *generate_assembly(exec_list *simd8_instructions,
                                      exec_list *simd16_instructions,
-                                     unsigned *assembly_size);
+                                     unsigned *assembly_size,
+                                     bool dump_enabled = false,
+                                     FILE *dump_file = stdout);
 
 private:
-   void generate_code(exec_list *instructions);
+   void generate_code(exec_list *instructions, bool dump_enabled,
+                      FILE *dump_file);
    void generate_fb_write(fs_inst *inst);
    void generate_pixel_xy(struct brw_reg dst, bool is_x);
    void generate_linterp(fs_inst *inst, struct brw_reg dst,
diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
index 982fcd0..df91235 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
@@ -1298,7 +1298,8 @@ fs_generator::generate_untyped_surface_read(fs_inst *inst, struct brw_reg dst,
 }
 
 void
-fs_generator::generate_code(exec_list *instructions)
+fs_generator::generate_code(exec_list *instructions, bool dump_enabled,
+                            FILE *dump_file)
 {
    int last_native_insn_offset = p->next_insn_offset;
    const char *last_annotation_string = NULL;
@@ -1807,21 +1808,23 @@ fs_generator::generate_code(exec_list *instructions)
     * which is often something we want to debug.  So this is here in
     * case you're doing that.
     */
-   if (0) {
-      brw_dump_compile(p, stdout, 0, p->next_insn_offset);
+   if (dump_enabled) {
+      brw_dump_compile(p, dump_file, 0, p->next_insn_offset);
    }
 }
 
 const unsigned *
 fs_generator::generate_assembly(exec_list *simd8_instructions,
                                 exec_list *simd16_instructions,
-                                unsigned *assembly_size)
+                                unsigned *assembly_size,
+                                bool dump_enabled,
+                                FILE *dump_file)
 {
    assert(simd8_instructions || simd16_instructions);
 
    if (simd8_instructions) {
       dispatch_width = 8;
-      generate_code(simd8_instructions);
+      generate_code(simd8_instructions, dump_enabled, dump_file);
    }
 
    if (simd16_instructions) {
@@ -1842,7 +1845,7 @@ fs_generator::generate_assembly(exec_list *simd8_instructions,
       brw_set_compression_control(p, BRW_COMPRESSION_COMPRESSED);
 
       dispatch_width = 16;
-      generate_code(simd16_instructions);
+      generate_code(simd16_instructions, dump_enabled, dump_file);
    }
 
    return brw_get_program(p, assembly_size);
-- 
1.8.3.1



More information about the mesa-dev mailing list