Mesa (master): anv: Flush caches in anv_image_copy_to_shadow

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 19 22:31:53 UTC 2019


Module: Mesa
Branch: master
Commit: 215f9f83f53c5a374c32424378c640ce8181e542
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=215f9f83f53c5a374c32424378c640ce8181e542

Author: Jason Ekstrand <jason at jlekstrand.net>
Date:   Wed Jun 19 14:14:20 2019 -0500

anv: Flush caches in anv_image_copy_to_shadow

Copies to a shadow image happen during a VkCmdPipelineBarrier or at
subpass transitions.  We could potentially be a bit more conservative
but these transitions shouldn't happen often and it's better to have our
bases covered.

Fixes: f3ea0cf828 "anv: Add stencil texturing support for gen7"

---

 src/intel/vulkan/anv_blorp.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c
index 1539ae1d298..e4b1448c6cd 100644
--- a/src/intel/vulkan/anv_blorp.c
+++ b/src/intel/vulkan/anv_blorp.c
@@ -1409,6 +1409,15 @@ anv_image_copy_to_shadow(struct anv_cmd_buffer *cmd_buffer,
    struct blorp_batch batch;
    blorp_batch_init(&cmd_buffer->device->blorp, &batch, cmd_buffer, 0);
 
+   /* We don't know who touched the main surface last so flush a bunch of
+    * caches to ensure we get good data.
+    */
+   cmd_buffer->state.pending_pipe_bits |=
+      ANV_PIPE_DEPTH_CACHE_FLUSH_BIT |
+      ANV_PIPE_DATA_CACHE_FLUSH_BIT |
+      ANV_PIPE_RENDER_TARGET_CACHE_FLUSH_BIT |
+      ANV_PIPE_TEXTURE_CACHE_INVALIDATE_BIT;
+
    struct blorp_surf surf;
    get_blorp_surf_for_anv_image(cmd_buffer->device,
                                 image, aspect,
@@ -1441,6 +1450,10 @@ anv_image_copy_to_shadow(struct anv_cmd_buffer *cmd_buffer,
       }
    }
 
+   /* We just wrote to the buffer with the render cache.  Flush it. */
+   cmd_buffer->state.pending_pipe_bits |=
+      ANV_PIPE_RENDER_TARGET_CACHE_FLUSH_BIT;
+
    blorp_batch_finish(&batch);
 }
 




More information about the mesa-commit mailing list