Mesa (master): anv: disable baked in pipeline bits from dynamic emission path

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Apr 16 12:02:20 UTC 2021


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

Author: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Date:   Tue Apr 13 17:53:18 2021 +0300

anv: disable baked in pipeline bits from dynamic emission path

In 27ee40f4c9d86e ("anv: Add support for sample locations") we
introduced the ability to emit sample locations baked in as part of
the pipeline or dynamically.

This is different from the previous dynamic states that were always
removed from the pipeline batch and instead emitted dynamically all
the time.

The mistake in 27ee40f4c9d86e is that sample locations are now emitted
all the time, leading to bigger command buffers for unnecessary
reasons.

This change introduces a bit fields of what is baked in the pipeline
and doesn't need to be dynamically emitted.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Fixes: 4ad4cd89069bfc ("anv: Enabled the VK_EXT_sample_locations extension")
Cc: <mesa-stable>
Reviewed-by: Tapani Pälli <tapani.palli at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10282>

---

 src/intel/vulkan/anv_pipeline.c    |  5 +++++
 src/intel/vulkan/anv_private.h     | 10 ++++++++++
 src/intel/vulkan/genX_cmd_buffer.c |  5 +++++
 3 files changed, 20 insertions(+)

diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
index a8b30274c91..654611f8a12 100644
--- a/src/intel/vulkan/anv_pipeline.c
+++ b/src/intel/vulkan/anv_pipeline.c
@@ -2080,6 +2080,11 @@ copy_non_dynamic_state(struct anv_graphics_pipeline *pipeline,
    }
 
    pipeline->dynamic_state_mask = states;
+
+   /* For now that only state that can be either dynamic or baked in the
+    * pipeline is the sample location.
+    */
+   pipeline->static_state_mask = states & ANV_CMD_DIRTY_DYNAMIC_SAMPLE_LOCATIONS;
 }
 
 static void
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index d42773af999..3af9a80db6c 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -3338,7 +3338,17 @@ struct anv_graphics_pipeline {
 
    uint32_t                                     batch_data[512];
 
+   /* States that are part of batch_data and should be not emitted
+    * dynamically.
+    */
+   anv_cmd_dirty_mask_t                         static_state_mask;
+
+   /* States that need to be reemitted in cmd_buffer_flush_dynamic_state().
+    * This might cover more than the dynamic states specified at pipeline
+    * creation.
+    */
    anv_cmd_dirty_mask_t                         dynamic_state_mask;
+
    struct anv_dynamic_state                     dynamic_state;
 
    uint32_t                                     topology;
diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c
index 4a0d8b85f0e..11cde846a21 100644
--- a/src/intel/vulkan/genX_cmd_buffer.c
+++ b/src/intel/vulkan/genX_cmd_buffer.c
@@ -3565,6 +3565,11 @@ genX(cmd_buffer_flush_state)(struct anv_cmd_buffer *cmd_buffer)
    if (cmd_buffer->state.gfx.dirty & ANV_CMD_DIRTY_PIPELINE) {
       anv_batch_emit_batch(&cmd_buffer->batch, &pipeline->base.batch);
 
+      /* Remove from dynamic state emission all of stuff that is baked into
+       * the pipeline.
+       */
+      cmd_buffer->state.gfx.dirty &= ~pipeline->static_state_mask;
+
       /* If the pipeline changed, we may need to re-allocate push constant
        * space in the URB.
        */



More information about the mesa-commit mailing list