[Mesa-dev] [PATCH 13/14] anv/blorp: Add an mcs_partial_resolve helper

Jason Ekstrand jason at jlekstrand.net
Mon Nov 13 16:12:53 UTC 2017


---
 src/intel/vulkan/anv_blorp.c   | 31 +++++++++++++++++++++++++++++++
 src/intel/vulkan/anv_private.h |  6 ++++++
 2 files changed, 37 insertions(+)

diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c
index 27320c2..266cb9a 100644
--- a/src/intel/vulkan/anv_blorp.c
+++ b/src/intel/vulkan/anv_blorp.c
@@ -1696,3 +1696,34 @@ anv_ccs_resolve(struct anv_cmd_buffer * const cmd_buffer,
 
    blorp_batch_finish(&batch);
 }
+
+void
+anv_mcs_partial_resolve(struct anv_cmd_buffer * const cmd_buffer,
+                        const struct anv_image * const image,
+                        VkImageAspectFlagBits aspect,
+                        const uint32_t start_layer, const uint32_t layer_count)
+{
+   assert(cmd_buffer && image);
+
+   uint32_t plane = anv_image_aspect_to_plane(image->aspects, aspect);
+
+   /* The resolved subresource range must have a CCS buffer. */
+   assert(aspect == VK_IMAGE_ASPECT_COLOR_BIT);
+   assert(start_layer + layer_count <= anv_image_aux_layers(image, aspect, 0));
+   assert(image->samples > 1);
+
+   struct blorp_batch batch;
+   blorp_batch_init(&cmd_buffer->device->blorp, &batch, cmd_buffer,
+                    BLORP_BATCH_PREDICATE_ENABLE);
+
+   struct blorp_surf surf;
+   get_blorp_surf_for_anv_image(image, aspect, ISL_AUX_USAGE_MCS, &surf);
+   surf.clear_color_addr = anv_to_blorp_address(
+      anv_image_get_clear_color_addr(cmd_buffer->device, image, aspect, 0));
+
+   blorp_mcs_partial_resolve(&batch, &surf,
+                             image->planes[plane].surface.isl.format,
+                             start_layer, layer_count);
+
+   blorp_batch_finish(&batch);
+}
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index a1b1d48..6be7e58 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -2534,6 +2534,12 @@ anv_ccs_resolve(struct anv_cmd_buffer * const cmd_buffer,
                 const enum blorp_fast_clear_op op);
 
 void
+anv_mcs_partial_resolve(struct anv_cmd_buffer * const cmd_buffer,
+                        const struct anv_image * const image,
+                        VkImageAspectFlagBits aspect,
+                        const uint32_t start_layer, const uint32_t layer_count);
+
+void
 anv_image_fast_clear(struct anv_cmd_buffer *cmd_buffer,
                      const struct anv_image *image,
                      VkImageAspectFlagBits aspect,
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list