i965/fs: allow unit tests to dump the final patched assembly
authorTopi Pohjolainen <topi.pohjolainen@intel.com>
Wed, 11 Dec 2013 08:58:38 +0000 (10:58 +0200)
committerTopi Pohjolainen <topi.pohjolainen@intel.com>
Thu, 23 Jan 2014 06:45:57 +0000 (08:45 +0200)
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).

v2 (Paul): dropped the redundant 'dump_enabled' argument

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
src/mesa/drivers/dri/i965/brw_fs.h
src/mesa/drivers/dri/i965/brw_fs_generator.cpp

index 715775040990c7d87e27286271177e584c05ccb3..126e8cec0ddb57df729fad96a423599238faffdb 100644 (file)
@@ -517,10 +517,11 @@ public:
 
    const unsigned *generate_assembly(exec_list *simd8_instructions,
                                      exec_list *simd16_instructions,
-                                     unsigned *assembly_size);
+                                     unsigned *assembly_size,
+                                     FILE *dump_file = NULL);
 
 private:
-   void generate_code(exec_list *instructions);
+   void generate_code(exec_list *instructions, 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,
index 87280d2c721dc575f0d9cab9504d65084906c711..17e66dda87767b4ca6ac443af7c790057c88845d 100644 (file)
@@ -1310,7 +1310,7 @@ 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, FILE *dump_file)
 {
    int last_native_insn_offset = p->next_insn_offset;
    const char *last_annotation_string = NULL;
@@ -1819,21 +1819,22 @@ 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_file) {
+      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,
+                                FILE *dump_file)
 {
    assert(simd8_instructions || simd16_instructions);
 
    if (simd8_instructions) {
       dispatch_width = 8;
-      generate_code(simd8_instructions);
+      generate_code(simd8_instructions, dump_file);
    }
 
    if (simd16_instructions) {
@@ -1854,7 +1855,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_file);
    }
 
    return brw_get_program(p, assembly_size);