[Mesa-dev] [PATCH 09/22] anv/cmd_buffer: Don't partially fast-clear image layers

Nanley Chery nanleychery at gmail.com
Thu Apr 27 18:32:08 UTC 2017


Signed-off-by: Nanley Chery <nanley.g.chery at intel.com>
---
 src/intel/vulkan/genX_cmd_buffer.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c
index 0ea378fde2..a981b00f67 100644
--- a/src/intel/vulkan/genX_cmd_buffer.c
+++ b/src/intel/vulkan/genX_cmd_buffer.c
@@ -216,7 +216,7 @@ color_is_zero_one(VkClearColorValue value, enum isl_format format)
 }
 
 static void
-color_attachment_compute_aux_usage(struct anv_device *device,
+color_attachment_compute_aux_usage(struct anv_cmd_buffer * const cmd_buffer,
                                    struct anv_attachment_state *att_state,
                                    struct anv_image_view *iview,
                                    VkRect2D render_area,
@@ -249,7 +249,8 @@ color_attachment_compute_aux_usage(struct anv_device *device,
       att_state->input_aux_usage = ISL_AUX_USAGE_CCS_E;
    } else {
       att_state->aux_usage = ISL_AUX_USAGE_CCS_D;
-      if (isl_format_supports_ccs_e(&device->info, iview->isl.format)) {
+      if (isl_format_supports_ccs_e(&cmd_buffer->device->info,
+                                    iview->isl.format)) {
          /* SKL can sample from CCS with one restriction.
           *
           * From the Sky Lake PRM, RENDER_SURFACE_STATE::AuxiliarySurfaceMode:
@@ -305,6 +306,17 @@ color_attachment_compute_aux_usage(struct anv_device *device,
       if (GEN_GEN <= 8 && !att_state->clear_color_is_zero_one)
          att_state->fast_clear = false;
 
+      /* We can't fast clear a proper subset of a layered image. See
+       * add_clear_values() for more information.
+       */
+      const uint32_t fb_layers = cmd_buffer->state.framebuffer->layers;
+      const uint32_t aux_layers = anv_color_aux_layers(iview->image,
+                                                       iview->isl.base_level);
+      if (fb_layers != aux_layers) {
+         assert(fb_layers < aux_layers);
+         att_state->fast_clear = false;
+      }
+
       if (att_state->fast_clear) {
          memcpy(fast_clear_color->u32, att_state->clear_value.color.uint32,
                 sizeof(fast_clear_color->u32));
@@ -498,7 +510,7 @@ genX(cmd_buffer_setup_attachments)(struct anv_cmd_buffer *cmd_buffer,
 
          union isl_color_value clear_color = { .u32 = { 0, } };
          if (att_aspects == VK_IMAGE_ASPECT_COLOR_BIT) {
-            color_attachment_compute_aux_usage(cmd_buffer->device,
+            color_attachment_compute_aux_usage(cmd_buffer,
                                                &state->attachments[i],
                                                iview, begin->renderArea,
                                                &clear_color);
-- 
2.12.2



More information about the mesa-dev mailing list