Mesa (staging/20.0): anv: Apply any needed PIPE_CONTROLs before emitting state

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 23 05:32:24 UTC 2020


Module: Mesa
Branch: staging/20.0
Commit: dde2cac42a163791181f96dad4520fd3a26f378c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=dde2cac42a163791181f96dad4520fd3a26f378c

Author: Jason Ekstrand <jason at jlekstrand.net>
Date:   Thu Apr 16 15:33:43 2020 -0500

anv: Apply any needed PIPE_CONTROLs before emitting state

Push constants in particular can get picked up by the hardware at weird
times that happen *before* 3DPRIMITIVE.  Therefore, we need to flush
before we emit all our state to ensure that any data they may pick up is
in memory in time.  This fixes an app which does vkCmdCopyBuffers
immediately followed by a vkCmdBeginRenderPass and vkCmdDraw which uses
the destination of the copy as a UBO which we push.

Cc: mesa-stable at lists.freedesktop.org
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4601>
(cherry picked from commit 969aeb6a93aefd037b130e4b37f58043fef493c3)

---

 .pick_status.json                  |  2 +-
 src/intel/vulkan/genX_cmd_buffer.c | 12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index 933ab9d4cd5..1f82998eed6 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1426,7 +1426,7 @@
         "description": "anv: Apply any needed PIPE_CONTROLs before emitting state",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": null
     },
diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c
index 97cc4ab0a6f..40db2eb2b15 100644
--- a/src/intel/vulkan/genX_cmd_buffer.c
+++ b/src/intel/vulkan/genX_cmd_buffer.c
@@ -3144,6 +3144,12 @@ genX(cmd_buffer_flush_state)(struct anv_cmd_buffer *cmd_buffer)
 
    genX(flush_pipeline_select_3d)(cmd_buffer);
 
+   /* Apply any pending pipeline flushes we may have.  We want to apply them
+    * now because, if any of those flushes are for things like push constants,
+    * the GPU will read the state at weird times.
+    */
+   genX(cmd_buffer_apply_pipe_flushes)(cmd_buffer);
+
    uint32_t vb_emit = cmd_buffer->state.gfx.vb_dirty & pipeline->vb_used;
    if (cmd_buffer->state.gfx.dirty & ANV_CMD_DIRTY_PIPELINE)
       vb_emit |= pipeline->vb_used;
@@ -4037,6 +4043,12 @@ genX(cmd_buffer_flush_compute_state)(struct anv_cmd_buffer *cmd_buffer)
 
    genX(flush_pipeline_select_gpgpu)(cmd_buffer);
 
+   /* Apply any pending pipeline flushes we may have.  We want to apply them
+    * now because, if any of those flushes are for things like push constants,
+    * the GPU will read the state at weird times.
+    */
+   genX(cmd_buffer_apply_pipe_flushes)(cmd_buffer);
+
    if (cmd_buffer->state.compute.pipeline_dirty) {
       /* From the Sky Lake PRM Vol 2a, MEDIA_VFE_STATE:
        *



More information about the mesa-commit mailing list