<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Dec 20, 2013 at 7:56 AM, Paul Berry <span dir="ltr"><<a href="mailto:stereotype441@gmail.com" target="_blank">stereotype441@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="im">On 20 December 2013 04:47, 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><div class="gmail_extra"><div class="gmail_quote"><div class="im">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">We need to emit depth stall flushes before depth and hiz resolves.<br>
Placing them at the top of blorp's state emission fixes the hang.<br>
<br>
Fixes HiZ hang in the new WebGL Google maps on Sandybridge Chrome OS.<br>
Tested by zooming in and out continuously for 2 hours.<br>
<br>
This patch is based on<br>
<a href="https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/8bc07bb70163c3706fb4ba5f980e57dc942f56dd" target="_blank">https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/8bc07bb70163c3706fb4ba5f980e57dc942f56dd</a><br>
<br>
CC: <a href="mailto:mesa-stable@lists.freedesktop.org" target="_blank">mesa-stable@lists.freedesktop.org</a><br>
Bugzilla: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=70740Signed-off-by" target="_blank">https://bugs.freedesktop.org/show_bug.cgi?id=70740<br>
Signed-off-by</a>: Stéphane Marchesin <<a href="mailto:marcheu@chromium.org" target="_blank">marcheu@chromium.org</a>><br>
Signed-off-by: Chad Versace <<a href="mailto:chad.versace@linux.intel.com" target="_blank">chad.versace@linux.intel.com</a>><br>
---<br>
src/mesa/drivers/dri/i965/gen6_blorp.cpp | 12 ++++++++++++<br>
1 file changed, 12 insertions(+)<br></blockquote><div><br></div></div><div>Are you aware of any text in the bspec saying that these flushes are necessary? If so it would be nice to quote it in a comment. I searched for a while and wasn't able to find anything.<br>
</div><div class="im"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
diff --git a/src/mesa/drivers/dri/i965/gen6_blorp.cpp b/src/mesa/drivers/dri/i965/gen6_blorp.cpp<br>
index 6a5841f..3a0e7ec 100644<br>
--- a/src/mesa/drivers/dri/i965/gen6_blorp.cpp<br>
+++ b/src/mesa/drivers/dri/i965/gen6_blorp.cpp<br>
@@ -1012,6 +1012,16 @@ gen6_blorp_emit_primitive(struct brw_context *brw,<br>
ADVANCE_BATCH();<br>
}<br>
<br>
+static void<br>
+gen6_emit_hiz_workaround(struct brw_context *brw, enum gen6_hiz_op hiz_op)<br>
+{<br>
+ if (hiz_op == GEN6_HIZ_OP_DEPTH_RESOLVE ||<br>
+ hiz_op == GEN6_HIZ_OP_HIZ_RESOLVE) {<br></blockquote><div><br></div></div><div>Should we also include GEN6_HIZ_OP_DEPTH_CLEAR?</div></div></div></div></blockquote><div><br></div><div>I tried the different ops, and it didn't seem like it was needed. But that's only empirical testing using WebGL Maps; maybe another application would trigger this issue...</div>
<div><br></div><div>Stéphane</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">
<div> I found this text in the bspec that suggests maybe we should (Graphics BSpec: 3D-Media-GPGPU Engine > 3D Pipeline Stages > Pixel > Depth and Stencil > Hierarchical Depth Buffer > Depth Buffer Clear):<br>
<br><p>The following is required when performing a depth buffer clear with using the WM_STATE or 3DSTATE_WM:</p>
<ul><li value="1">If other rendering operations have preceded
this clear, a PIPE_CONTROL with depth cache flush enabled, Depth Stall
bit enabled must be issued before the rectangle primitive used for the
depth buffer clear operation.</li></ul><p><br></p><p>And later on the same page:</p><p><br></p><p>Depth buffer clear pass using any of the methods (WM_STATE, 3DSTATE_WM
or 3DSTATE_WM_HZ_OP) must be followed by a PIPE_CONTROL command with
DEPTH_STALL bit and Depth FLUSH bits “<b>set</b>” before starting to
render. DepthStall and DepthFlush are not needed between consecutive
depth clear passes nor is it required if the depth-clear pass was done
with “full_surf_clear” bit set in the 3DSTATE_WM_HZ_OP.</p><p><br></p><p>(Note, however that these depth clear flushes apply to all versions of the hardware, so perhaps we should handle them in a different patch and a different place in the code).</p>
<p><br></p><p>Regardless of whether you make any changes due to my comments above, the patch is:</p><p><br></p><p>Reviewed-by: Paul Berry <<a href="mailto:stereotype441@gmail.com" target="_blank">stereotype441@gmail.com</a>><br>
</p>
</div><div class="im"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+ brw->batch.need_workaround_flush = true;<br>
+ intel_emit_post_sync_nonzero_flush(brw);<br>
+ intel_emit_depth_stall_flushes(brw);<br>
+ }<br>
+}<br>
<br>
/**<br>
* \brief Execute a blit or render pass operation.<br>
@@ -1034,6 +1044,8 @@ gen6_blorp_exec(struct brw_context *brw,<br>
uint32_t wm_bind_bo_offset = 0;<br>
<br>
uint32_t prog_offset = params->get_wm_prog(brw, &prog_data);<br>
+<br>
+ gen6_emit_hiz_workaround(brw, params->hiz_op);<br>
gen6_emit_3dstate_multisample(brw, params->dst.num_samples);<br>
gen6_emit_3dstate_sample_mask(brw,<br>
params->dst.num_samples > 1 ?<br>
<span><font color="#888888">--<br>
1.8.4<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div></div><br></div></div>
<br>_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
<br></blockquote></div><br></div></div>