vk/device: explain why a flush is necessary
authorConnor Abbott <connor.w.abbott@intel.com>
Wed, 15 Jul 2015 05:59:27 +0000 (22:59 -0700)
committerConnor Abbott <connor.w.abbott@intel.com>
Wed, 15 Jul 2015 06:03:19 +0000 (23:03 -0700)
Jason found this from experimenting, but the docs give a reasonable
explanation of why it's necessary.

src/vulkan/device.c

index 1de60d4fc8eecc994a4f6a19269538ef50ea29d8..51d729a6f492fbe59cab5180499d752441a45d72 100644 (file)
@@ -3044,9 +3044,16 @@ anv_cmd_buffer_new_surface_state_bo(struct anv_cmd_buffer *cmd_buffer)
     */
    anv_cmd_buffer_emit_state_base_address(cmd_buffer);
 
-   /* It seems like just changing the state base addresses isn't enough.
-    * Invalidating the cache seems to be enough to cause things to
-    * propagate.  However, I'm not 100% sure what we're supposed to do.
+   /* The sampler unit caches SURFACE_STATE and RENDER_SURFACE_STATE entries,
+    * and the data port uses the same cache. When changing the Surface State
+    * Base Address, we need to flush the texture cache so that it can pick up
+    * on the new SURFACE_STATE's. From the Broadwell PRM,
+    * Shared Function > 3D Sampler > State > State Caching (page 96):
+    *
+    *     Whenever the value of the Dynamic_State_Base_Addr,
+    *     Surface_State_Base_Addr are altered, the L1 state cache
+    *     must be invalidated to ensure the new surface or sampler state is
+    *     fetched from system memory.
     */
    anv_batch_emit(&cmd_buffer->batch, GEN8_PIPE_CONTROL,
                   .TextureCacheInvalidationEnable = true);