[Mesa-dev] [PATCH 07/10] i965: Pull brw_compact_instructions() out of brw_get_program().

Matt Turner mattst88 at gmail.com
Tue May 13 14:52:11 PDT 2014


---
 src/mesa/drivers/dri/i965/brw_blorp_clear.cpp    | 2 ++
 src/mesa/drivers/dri/i965/brw_clip.c             | 2 +-
 src/mesa/drivers/dri/i965/brw_eu.c               | 2 --
 src/mesa/drivers/dri/i965/brw_fs_generator.cpp   | 8 ++------
 src/mesa/drivers/dri/i965/brw_gs.c               | 2 ++
 src/mesa/drivers/dri/i965/brw_sf.c               | 2 ++
 src/mesa/drivers/dri/i965/brw_vec4_generator.cpp | 1 +
 7 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
index b6bb4b3..9f0f514 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
@@ -489,6 +489,8 @@ brw_blorp_const_color_program::compile(struct brw_context *brw,
       brw_dump_compile(&func, stderr, 0, func.next_insn_offset);
       fprintf(stderr, "\n");
    }
+
+   brw_compact_instructions(&func);
    return brw_get_program(&func, program_size);
 }
 
diff --git a/src/mesa/drivers/dri/i965/brw_clip.c b/src/mesa/drivers/dri/i965/brw_clip.c
index d1815f2..1c54b91 100644
--- a/src/mesa/drivers/dri/i965/brw_clip.c
+++ b/src/mesa/drivers/dri/i965/brw_clip.c
@@ -111,7 +111,7 @@ static void compile_clip_prog( struct brw_context *brw,
       return;
    }
 
-	
+   brw_compact_instructions(&c.func);
 
    /* get the program
     */
diff --git a/src/mesa/drivers/dri/i965/brw_eu.c b/src/mesa/drivers/dri/i965/brw_eu.c
index 15105c2..d8a3543 100644
--- a/src/mesa/drivers/dri/i965/brw_eu.c
+++ b/src/mesa/drivers/dri/i965/brw_eu.c
@@ -249,8 +249,6 @@ brw_init_compile(struct brw_context *brw, struct brw_compile *p, void *mem_ctx)
 const unsigned *brw_get_program( struct brw_compile *p,
 			       unsigned *sz )
 {
-   brw_compact_instructions(p);
-
    *sz = p->next_insn_offset;
    return (const unsigned *)p->store;
 }
diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
index ff85171..a9a16ee 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
@@ -1852,15 +1852,10 @@ fs_generator::generate_assembly(exec_list *simd8_instructions,
    if (simd8_instructions) {
       dispatch_width = 8;
       generate_code(simd8_instructions, dump_file);
+      brw_compact_instructions(p);
    }
 
    if (simd16_instructions) {
-      /* We have to do a compaction pass now, or the one at the end of
-       * execution will squash down where our prog_offset start needs
-       * to be.
-       */
-      brw_compact_instructions(p);
-
       /* align to 64 byte boundary. */
       while ((p->nr_insn * sizeof(struct brw_instruction)) % 64) {
          brw_NOP(p);
@@ -1873,6 +1868,7 @@ fs_generator::generate_assembly(exec_list *simd8_instructions,
 
       dispatch_width = 16;
       generate_code(simd16_instructions, dump_file);
+      brw_compact_instructions(p);
    }
 
    return brw_get_program(p, assembly_size);
diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c
index 866d298..eaa527f 100644
--- a/src/mesa/drivers/dri/i965/brw_gs.c
+++ b/src/mesa/drivers/dri/i965/brw_gs.c
@@ -128,6 +128,8 @@ static void compile_ff_gs_prog(struct brw_context *brw,
       }
    }
 
+   brw_compact_instructions(&c.func);
+
    /* get the program
     */
    program = brw_get_program(&c.func, &program_size);
diff --git a/src/mesa/drivers/dri/i965/brw_sf.c b/src/mesa/drivers/dri/i965/brw_sf.c
index 61d308a..401fa7b 100644
--- a/src/mesa/drivers/dri/i965/brw_sf.c
+++ b/src/mesa/drivers/dri/i965/brw_sf.c
@@ -110,6 +110,8 @@ static void compile_sf_prog( struct brw_context *brw,
       return;
    }
 
+   brw_compact_instructions(&c.func);
+
    /* get the program
     */
    program = brw_get_program(&c.func, &program_size);
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
index bcacde9..305a94c 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
@@ -1363,6 +1363,7 @@ vec4_generator::generate_assembly(exec_list *instructions,
 {
    brw_set_access_mode(p, BRW_ALIGN_16);
    generate_code(instructions);
+   brw_compact_instructions(p);
    return brw_get_program(p, assembly_size);
 }
 
-- 
1.8.3.2



More information about the mesa-dev mailing list