<div dir="ltr">On 6 January 2014 17:05, Chad Versace <span dir="ltr"><<a href="mailto:chad.versace@linux.intel.com" target="_blank">chad.versace@linux.intel.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Set brw->need_workaround_flush immediately after each 3D_CMD_PRIM. This<br>
may prevent undiscovered difficult-to-diagnose gpu hangs, according to<br>
Ken.<br>
<br>
The art of emitting workaround flushes on Sandybridge is mysterious and<br>
not fully understood. Ken's intuition says that<br>
intel_emit_post_sync_nonzero_flush() is required after each 3D_CMD_PRIM.<br>
<br>
On gen6, there are two places where we emit 3D_CMD_PRIM: brw_emit_prim()<br>
and gen6_blorp_emit_primitive(). The former already sets<br>
need_workaround_flush, so this patch needs only to change the latter.<br>
<br>
There is no need to set need_workaround_flush in<br>
gen7_blorp_emit_primitive() because the workaround applies only to gen6.<br>
<br>
CC: <a href="mailto:mesa-stable@lists.freedesktop.org">mesa-stable@lists.freedesktop.org</a><br>
CC: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br>
CC: Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>><br>
CC: Stéphane Marchesin <<a href="mailto:marcheu@chromium.org">marcheu@chromium.org</a>><br>
Signed-off-by: Chad Versace <<a href="mailto:chad.versace@linux.intel.com">chad.versace@linux.intel.com</a>><br>
---<br>
src/mesa/drivers/dri/i965/gen6_blorp.cpp | 3 +++<br>
1 file changed, 3 insertions(+)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/gen6_blorp.cpp b/src/mesa/drivers/dri/i965/gen6_blorp.cpp<br>
index 441d61f..929d7b5 100644<br>
--- a/src/mesa/drivers/dri/i965/gen6_blorp.cpp<br>
+++ b/src/mesa/drivers/dri/i965/gen6_blorp.cpp<br>
@@ -1010,6 +1010,9 @@ gen6_blorp_emit_primitive(struct brw_context *brw,<br>
OUT_BATCH(0);<br>
OUT_BATCH(0);<br>
ADVANCE_BATCH();<br>
+<br>
+ /* Only used on Sandybridge; harmless to set elsewhere. */<br>
+ brw->batch.need_workaround_flush = true;<br></blockquote><div><br></div><div>This is not strictly necessary, since we already set brw->batch.need_workaround_flush in brw_blorp_exec() after running the blorp operation. However, doing it here in gen6_blorp_emit_primitive() seems slightly better, since it makes the blorp codepath more similar to the non-blorp codepath.<br>
<br></div><div>My personal preference would be to go ahead with this patch, but squash in a removal of the code in brw_blorp_exec() that sets need_workaround_flush. But I don't have a strong preference. Either way the patch is:<br>
<br></div><div>Reviewed-by: Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>><br></div></div></div></div>