summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2014-05-15 16:56:13 -0700
committerMatt Turner <[email protected]>2014-05-24 23:03:22 -0700
commit9976294e867785ea480f52178a3d3dc67ac72d32 (patch)
treec24ea147fb901057dddb440de53700e3244dc0b5 /src/mesa/drivers/dri
parent2afdd2f40b64e34387b89430bf47ab863d6a8e43 (diff)
i965: Pass in start_offset to brw_compact_instructions().
Let's us avoid recompacting the SIMD8 instructions when we compact the SIMD16 program. Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r--src/mesa/drivers/dri/i965/brw_blorp_clear.cpp2
-rw-r--r--src/mesa/drivers/dri/i965/brw_clip.c2
-rw-r--r--src/mesa/drivers/dri/i965/brw_eu.h2
-rw-r--r--src/mesa/drivers/dri/i965/brw_eu_compact.c18
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_generator.cpp4
-rw-r--r--src/mesa/drivers/dri/i965/brw_gs.c2
-rw-r--r--src/mesa/drivers/dri/i965/brw_sf.c2
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_generator.cpp2
8 files changed, 17 insertions, 17 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
index 28c01c440bd..4b2c6672e0a 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
@@ -490,7 +490,7 @@ brw_blorp_const_color_program::compile(struct brw_context *brw,
fprintf(stderr, "\n");
}
- brw_compact_instructions(&func);
+ brw_compact_instructions(&func, 0);
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 11f0b6938f5..57c49f0235d 100644
--- a/src/mesa/drivers/dri/i965/brw_clip.c
+++ b/src/mesa/drivers/dri/i965/brw_clip.c
@@ -110,7 +110,7 @@ static void compile_clip_prog( struct brw_context *brw,
return;
}
- brw_compact_instructions(&c.func);
+ brw_compact_instructions(&c.func, 0);
/* get the program
*/
diff --git a/src/mesa/drivers/dri/i965/brw_eu.h b/src/mesa/drivers/dri/i965/brw_eu.h
index 51d5214ae89..65008a0513b 100644
--- a/src/mesa/drivers/dri/i965/brw_eu.h
+++ b/src/mesa/drivers/dri/i965/brw_eu.h
@@ -410,7 +410,7 @@ uint32_t brw_swap_cmod(uint32_t cmod);
/* brw_eu_compact.c */
void brw_init_compaction_tables(struct brw_context *brw);
-void brw_compact_instructions(struct brw_compile *p);
+void brw_compact_instructions(struct brw_compile *p, int start_offset);
void brw_uncompact_instruction(struct brw_context *brw,
struct brw_instruction *dst,
struct brw_compact_instruction *src);
diff --git a/src/mesa/drivers/dri/i965/brw_eu_compact.c b/src/mesa/drivers/dri/i965/brw_eu_compact.c
index c85bc89ea3d..c3a2ec31c74 100644
--- a/src/mesa/drivers/dri/i965/brw_eu_compact.c
+++ b/src/mesa/drivers/dri/i965/brw_eu_compact.c
@@ -661,18 +661,18 @@ brw_init_compaction_tables(struct brw_context *brw)
}
void
-brw_compact_instructions(struct brw_compile *p)
+brw_compact_instructions(struct brw_compile *p, int start_offset)
{
struct brw_context *brw = p->brw;
- void *store = p->store;
+ void *store = p->store + start_offset / 16;
/* For an instruction at byte offset 8*i before compaction, this is the number
* of compacted instructions that preceded it.
*/
- int compacted_counts[p->next_insn_offset / 8];
+ int compacted_counts[(p->next_insn_offset - start_offset) / 8];
/* For an instruction at byte offset 8*i after compaction, this is the
* 8-byte offset it was at before compaction.
*/
- int old_ip[p->next_insn_offset / 8];
+ int old_ip[(p->next_insn_offset - start_offset) / 8];
if (brw->gen < 6)
return;
@@ -680,7 +680,7 @@ brw_compact_instructions(struct brw_compile *p)
int src_offset;
int offset = 0;
int compacted_count = 0;
- for (src_offset = 0; src_offset < p->nr_insn * 16;) {
+ for (src_offset = 0; src_offset < p->next_insn_offset - start_offset;) {
struct brw_instruction *src = store + src_offset;
void *dst = store + offset;
@@ -734,8 +734,8 @@ brw_compact_instructions(struct brw_compile *p)
}
/* Fix up control flow offsets. */
- p->next_insn_offset = offset;
- for (offset = 0; offset < p->next_insn_offset;) {
+ p->next_insn_offset = start_offset + offset;
+ for (offset = 0; offset < p->next_insn_offset - start_offset;) {
struct brw_instruction *insn = store + offset;
int this_old_ip = old_ip[offset / 8];
int this_compacted_count = compacted_counts[this_old_ip];
@@ -786,10 +786,10 @@ brw_compact_instructions(struct brw_compile *p)
if (0) {
fprintf(stderr, "dumping compacted program\n");
- brw_disassemble(brw, p->store, 0, p->next_insn_offset, stderr);
+ brw_disassemble(brw, store, 0, p->next_insn_offset - start_offset, stderr);
int cmp = 0;
- for (offset = 0; offset < p->next_insn_offset;) {
+ for (offset = 0; offset < p->next_insn_offset - start_offset;) {
struct brw_instruction *insn = store + offset;
if (insn->header.cmpt_control) {
diff --git a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
index c61cc5cccad..9518e728ab7 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_generator.cpp
@@ -1852,7 +1852,7 @@ fs_generator::generate_assembly(exec_list *simd8_instructions,
if (simd8_instructions) {
dispatch_width = 8;
generate_code(simd8_instructions, dump_file);
- brw_compact_instructions(p);
+ brw_compact_instructions(p, 0);
}
if (simd16_instructions) {
@@ -1868,7 +1868,7 @@ fs_generator::generate_assembly(exec_list *simd8_instructions,
dispatch_width = 16;
generate_code(simd16_instructions, dump_file);
- brw_compact_instructions(p);
+ brw_compact_instructions(p, prog_data->prog_offset_16);
}
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 ec1e14a3594..18b09560c2c 100644
--- a/src/mesa/drivers/dri/i965/brw_gs.c
+++ b/src/mesa/drivers/dri/i965/brw_gs.c
@@ -128,7 +128,7 @@ static void compile_ff_gs_prog(struct brw_context *brw,
}
}
- brw_compact_instructions(&c.func);
+ brw_compact_instructions(&c.func, 0);
/* get the program
*/
diff --git a/src/mesa/drivers/dri/i965/brw_sf.c b/src/mesa/drivers/dri/i965/brw_sf.c
index 152d258cc2f..e11de264f2e 100644
--- a/src/mesa/drivers/dri/i965/brw_sf.c
+++ b/src/mesa/drivers/dri/i965/brw_sf.c
@@ -109,7 +109,7 @@ static void compile_sf_prog( struct brw_context *brw,
return;
}
- brw_compact_instructions(&c.func);
+ brw_compact_instructions(&c.func, 0);
/* get the program
*/
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
index 4e0fe52ae2c..e4bc6823ec9 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
@@ -1363,7 +1363,7 @@ vec4_generator::generate_assembly(exec_list *instructions,
{
brw_set_access_mode(p, BRW_ALIGN_16);
generate_code(instructions);
- brw_compact_instructions(p);
+ brw_compact_instructions(p, 0);
return brw_get_program(p, assembly_size);
}