anv/gen8: Do a render cache flush prior to changing state base address
authorJason Ekstrand <jason.ekstrand@intel.com>
Mon, 28 Sep 2015 22:29:28 +0000 (15:29 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Mon, 28 Sep 2015 23:01:14 +0000 (16:01 -0700)
src/vulkan/gen8_cmd_buffer.c

index 5018b6775d92d6fb7bc6c961519bca1af0d2d384..0e830b4427df797dbc7f6e97fa2ada20973aacd2 100644 (file)
@@ -817,6 +817,16 @@ gen8_cmd_buffer_emit_state_base_address(struct anv_cmd_buffer *cmd_buffer)
    if (cmd_buffer->state.scratch_size > 0)
       scratch_bo = &device->scratch_block_pool.bo;
 
+   /* Emit a render target cache flush.
+    *
+    * This isn't documented anywhere in the PRM.  However, it seems to be
+    * necessary prior to changing the surface state base adress.  Without
+    * this, we get GPU hangs when using multi-level command buffers which
+    * clear depth, reset state base address, and then go render stuff.
+    */
+   anv_batch_emit(&cmd_buffer->batch, GEN8_PIPE_CONTROL,
+                  .RenderTargetCacheFlushEnable = true);
+
    anv_batch_emit(&cmd_buffer->batch, GEN8_STATE_BASE_ADDRESS,
                   .GeneralStateBaseAddress = { scratch_bo, 0 },
                   .GeneralStateMemoryObjectControlState = GEN8_MOCS,