diff options
authorChad Versace <>2014-01-09 15:12:34 -0800
committerCarl Worth <>2014-01-31 12:21:25 -0800
commitf7848574b31c6a590f9dec6a1e704b7f99c2d90a (patch)
parent319d6d6067c6c617645ec1af875375c0d6d46a25 (diff)
i965/gen6/blorp: Emit more flushes to workaround hangs
This is a squash of three related cherry-picks from master. [PATCH 1/3] i965/gen6/blorp: Set need_workaround_flush immediately after primitive This patch makes the workaround code in gen6 blorp follow the pattern established in the regular draw path. It shouldn't result in any behavioral change. On gen6, there are two places where we emit 3D_CMD_PRIM: brw_emit_prim() and gen6_blorp_emit_primitive(). brw_emit_prim() sets need_workaround_flush immediately after emitting the primitive, but blorp does not. Blorp sets need_workaround_flush at the bottom of brw_blorp_exec(). This patch moves the need_workaround_flush from brw_blorp_exec() to gen6_blorp_emit_primitive(). There is no need to set need_workaround_flush in gen7_blorp_emit_primitive() because the workaround applies only to gen6. Reviewed-by: Paul Berry <> Signed-off-by: Chad Versace <> (cherry picked from commit 5e0cd58de4261e9dca7a15037192e7e9426a0207) [PATCH 2/3] i965/gen6/blorp: Set need_workaround_flush at top of blorp Unconditionally set brw->need_workaround_flush at the top of gen6 blorp state emission. The art of emitting workaround flushes on Sandybridge is mysterious and not fully understood. Ken and I believe that intel_emit_post_sync_nonzero_flush() may be required when switching from regular drawing to blorp. This is an extra safety measure to prevent undiscovered difficult-to-diagnose gpu hangs. I verified that on ChromeOS, pre-patch, need_workaround_flush was not set at the top of blorp, as Paul expected. To verify, I inserted the following debug code at the top of gen6_blorp_exec(), restarted the ui, and inspected the logs in /var/log/ui. The abort gets triggered so early that the browser never appears on the display. static void gen6_blorp_exec(...) { if (!brw->need_workaround_flush) { fprintf(stderr, "chadv: %s:%d\n", __FILE__, __LINE__); abort(); } ... } CC: Kenneth Graunke <> CC: St├ęphane Marchesin <> Reviewed-by: Paul Berry <> Signed-off-by: Chad Versace <> (cherry picked from commit 6a5c86f48675d2ca0975d69e0899e72afaab29e5) [PATCH 3/3] i965/gen6/blorp: Remove redundant HiZ workaround Commit 1a92881 added extra flushes to fix a HiZ hang in WebGL Google Maps. With the extra flushes emitted by the previous two patches, the flushes added by 1a92881 are redundant. Tested with the same criteria as in 1a92881: by zooming in and out continuously for 2 hours on Sandybridge Chrome OS (codename Stumpy) without a hang. CC: Kenneth Graunke <> CC: St├ęphane Marchesin <> Reviewed-by: Paul Berry <> Signed-off-by: Chad Versace <> (cherry picked from commit 90368875e733171350c64c8dda52f81bd0705dd0) Conflicts: src/mesa/drivers/dri/i965/gen6_blorp.cpp
2 files changed, 5 insertions, 15 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_blorp.cpp b/src/mesa/drivers/dri/i965/brw_blorp.cpp
index fda86f88798..13839e89e94 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp.cpp
@@ -266,7 +266,6 @@ retry:
brw->state.dirty.brw = ~0;
brw->state.dirty.cache = ~0;
- brw->batch.need_workaround_flush = true;
brw->ib.type = -1;
diff --git a/src/mesa/drivers/dri/i965/gen6_blorp.cpp b/src/mesa/drivers/dri/i965/gen6_blorp.cpp
index ccb09e7452a..a132234e1fa 100644
--- a/src/mesa/drivers/dri/i965/gen6_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/gen6_blorp.cpp
@@ -1010,20 +1010,9 @@ gen6_blorp_emit_primitive(struct brw_context *brw,
-static void
-gen6_emit_hiz_workaround(struct brw_context *brw, enum gen6_hiz_op hiz_op)
- /* This fixes a HiZ hang in WebGL Google Maps. A more minimal fix likely
- * exists, but this gets the job done.
- */
- if (hiz_op == GEN6_HIZ_OP_DEPTH_RESOLVE ||
- hiz_op == GEN6_HIZ_OP_HIZ_RESOLVE) {
- brw->batch.need_workaround_flush = true;
- intel_emit_post_sync_nonzero_flush(brw);
- intel_emit_depth_stall_flushes(brw);
- }
+ /* Only used on Sandybridge; harmless to set elsewhere. */
+ brw->batch.need_workaround_flush = true;
@@ -1048,7 +1037,9 @@ gen6_blorp_exec(struct brw_context *brw,
uint32_t prog_offset = params->get_wm_prog(brw, &prog_data);
- gen6_emit_hiz_workaround(brw, params->hiz_op);
+ /* Emit workaround flushes when we switch from drawing to blorping. */
+ brw->batch.need_workaround_flush = true;
gen6_emit_3dstate_multisample(brw, params->num_samples);
gen6_emit_3dstate_sample_mask(brw, params->num_samples, 1.0, false, ~0u);
gen6_blorp_emit_state_base_address(brw, params);