diff options
author | Jason Ekstrand <[email protected]> | 2017-06-05 11:49:24 -0700 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2017-06-14 10:40:22 +0100 |
commit | 4889bb6af3869d7363fb1993d3735f086be249dd (patch) | |
tree | 6713bc0b07e50422c8a8b02dae57012c84d2f35b | |
parent | 845c238ce28f367990c758677c9b5f3577280186 (diff) |
i965: Move the pre-depth-clear flush/stalls to intel_hiz_exec
Cc: "17.1" <[email protected]>
Reviewed-by: Topi Pohjolainen <[email protected]>
(cherry picked from commit acb9a2ef8f5d92002ed7eb7676c4a96db661ba3a)
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_blorp.c | 58 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_clear.c | 56 |
2 files changed, 58 insertions, 56 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c b/src/mesa/drivers/dri/i965/brw_blorp.c index b468b318f44..39d20ac0032 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp.c +++ b/src/mesa/drivers/dri/i965/brw_blorp.c @@ -1070,6 +1070,49 @@ intel_hiz_exec(struct brw_context *brw, struct intel_mipmap_tree *mt, DBG("%s %s to mt %p level %d layers %d-%d\n", __func__, opname, mt, level, start_layer, start_layer + num_layers - 1); + if (op == BLORP_HIZ_OP_DEPTH_CLEAR) { + if (brw->gen == 6) { + /* From the Sandy Bridge PRM, volume 2 part 1, page 313: + * + * "If other rendering operations have preceded this clear, a + * PIPE_CONTROL with write cache flush enabled and Z-inhibit + * disabled must be issued before the rectangle primitive used for + * the depth buffer clear operation. + */ + brw_emit_pipe_control_flush(brw, + PIPE_CONTROL_RENDER_TARGET_FLUSH | + PIPE_CONTROL_DEPTH_CACHE_FLUSH | + PIPE_CONTROL_CS_STALL); + } else if (brw->gen >= 7) { + /* + * From the Ivybridge PRM, volume 2, "Depth Buffer Clear": + * + * 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. + * + * Same applies for Gen8 and Gen9. + * + * In addition, from the Ivybridge PRM, volume 2, 1.10.4.1 + * PIPE_CONTROL, Depth Cache Flush Enable: + * + * This bit must not be set when Depth Stall Enable bit is set in + * this packet. + * + * This is confirmed to hold for real, HSW gets immediate gpu hangs. + * + * Therefore issue two pipe control flushes, one for cache flush and + * another for depth stall. + */ + brw_emit_pipe_control_flush(brw, + PIPE_CONTROL_DEPTH_CACHE_FLUSH | + PIPE_CONTROL_CS_STALL); + + brw_emit_pipe_control_flush(brw, PIPE_CONTROL_DEPTH_STALL); + } + } + if (brw->gen >= 8) { for (unsigned a = 0; a < num_layers; a++) gen8_hiz_exec(brw, mt, level, start_layer + a, op); @@ -1077,4 +1120,19 @@ intel_hiz_exec(struct brw_context *brw, struct intel_mipmap_tree *mt, for (unsigned a = 0; a < num_layers; a++) gen6_blorp_hiz_exec(brw, mt, level, start_layer + a, op); } + + if (brw->gen == 6 && op == BLORP_HIZ_OP_DEPTH_CLEAR) { + /* From the Sandy Bridge PRM, volume 2 part 1, page 314: + * + * "DevSNB, DevSNB-B{W/A}]: Depth buffer clear pass must be followed + * by a PIPE_CONTROL command with DEPTH_STALL bit set and Then + * followed by Depth FLUSH' + */ + brw_emit_pipe_control_flush(brw, + PIPE_CONTROL_DEPTH_STALL); + + brw_emit_pipe_control_flush(brw, + PIPE_CONTROL_DEPTH_CACHE_FLUSH | + PIPE_CONTROL_CS_STALL); + } } diff --git a/src/mesa/drivers/dri/i965/brw_clear.c b/src/mesa/drivers/dri/i965/brw_clear.c index 54a9f7692d5..2eac55522d4 100644 --- a/src/mesa/drivers/dri/i965/brw_clear.c +++ b/src/mesa/drivers/dri/i965/brw_clear.c @@ -175,47 +175,6 @@ brw_fast_clear_depth(struct gl_context *ctx) mt->depth_clear_value = depth_clear_value; } - if (brw->gen == 6) { - /* From the Sandy Bridge PRM, volume 2 part 1, page 313: - * - * "If other rendering operations have preceded this clear, a - * PIPE_CONTROL with write cache flush enabled and Z-inhibit disabled - * must be issued before the rectangle primitive used for the depth - * buffer clear operation. - */ - brw_emit_pipe_control_flush(brw, - PIPE_CONTROL_RENDER_TARGET_FLUSH | - PIPE_CONTROL_DEPTH_CACHE_FLUSH | - PIPE_CONTROL_CS_STALL); - } else if (brw->gen >= 7) { - /* - * From the Ivybridge PRM, volume 2, "Depth Buffer Clear": - * - * 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. - * - * Same applies for Gen8 and Gen9. - * - * In addition, from the Ivybridge PRM, volume 2, 1.10.4.1 PIPE_CONTROL, - * Depth Cache Flush Enable: - * - * This bit must not be set when Depth Stall Enable bit is set in - * this packet. - * - * This is confirmed to hold for real, HSW gets immediate gpu hangs. - * - * Therefore issue two pipe control flushes, one for cache flush and - * another for depth stall. - */ - brw_emit_pipe_control_flush(brw, - PIPE_CONTROL_DEPTH_CACHE_FLUSH | - PIPE_CONTROL_CS_STALL); - - brw_emit_pipe_control_flush(brw, PIPE_CONTROL_DEPTH_STALL); - } - if (fb->MaxNumLayers > 0) { intel_hiz_exec(brw, mt, depth_irb->mt_level, depth_irb->mt_layer, depth_irb->layer_count, @@ -225,21 +184,6 @@ brw_fast_clear_depth(struct gl_context *ctx) BLORP_HIZ_OP_DEPTH_CLEAR); } - if (brw->gen == 6) { - /* From the Sandy Bridge PRM, volume 2 part 1, page 314: - * - * "DevSNB, DevSNB-B{W/A}]: Depth buffer clear pass must be followed - * by a PIPE_CONTROL command with DEPTH_STALL bit set and Then - * followed by Depth FLUSH' - */ - brw_emit_pipe_control_flush(brw, - PIPE_CONTROL_DEPTH_STALL); - - brw_emit_pipe_control_flush(brw, - PIPE_CONTROL_DEPTH_CACHE_FLUSH | - PIPE_CONTROL_CS_STALL); - } - /* Now, the HiZ buffer contains data that needs to be resolved to the depth * buffer. */ |