summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2011-08-30 17:56:33 -0700
committerEric Anholt <[email protected]>2011-09-06 18:01:57 -0700
commit9367960ea64a087895caaadbd0353080c14b4bab (patch)
tree5db142475bde3afc4fa763e2434ce701ac50c55b /src
parent838bfe0c46969c359be8f5d02e2b41bb7ff044e1 (diff)
i965/vs: Use write commits on scratch writes in pre-gen6.
This is required to ensure ordering between reads and writes within a thread. Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_emit.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp b/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
index ac1ef0d8781..30bb0f67631 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
@@ -431,6 +431,7 @@ vec4_visitor::generate_scratch_write(vec4_instruction *inst,
struct brw_reg index)
{
struct brw_reg header = brw_vec8_grf(0, 0);
+ bool write_commit;
/* If the instruction is predicated, we'll predicate the send, not
* the header setup.
@@ -455,6 +456,25 @@ vec4_visitor::generate_scratch_write(vec4_instruction *inst,
brw_set_predicate_control(p, inst->predicate);
+ /* Pre-gen6, we have to specify write commits to ensure ordering
+ * between reads and writes within a thread. Afterwards, that's
+ * guaranteed and write commits only matter for inter-thread
+ * synchronization.
+ */
+ if (intel->gen >= 6) {
+ write_commit = false;
+ } else {
+ /* The visitor set up our destination register to be g0. This
+ * means that when the next read comes along, we will end up
+ * reading from g0 and causing a block on the write commit. For
+ * write-after-read, we are relying on the value of the previous
+ * read being used (and thus blocking on completion) before our
+ * write is executed. This means we have to be careful in
+ * instruction scheduling to not violate this assumption.
+ */
+ write_commit = true;
+ }
+
/* Each of the 8 channel enables is considered for whether each
* dword is written.
*/
@@ -470,9 +490,9 @@ vec4_visitor::generate_scratch_write(vec4_instruction *inst,
3, /* mlen */
true, /* header present */
false, /* pixel scoreboard */
- 0, /* rlen */
+ write_commit, /* rlen */
false, /* eot */
- false /* commit */);
+ write_commit);
}
void