Blame SOURCES/0002-anv-blorp-Add-a-device-parameter-to-blorp_surf_for_a.patch

e17c1f
From ee170635c5be54cf644ef5c8d4574f30764e244f Mon Sep 17 00:00:00 2001
e17c1f
From: Jason Ekstrand <jason.ekstrand@intel.com>
e17c1f
Date: Fri, 3 Nov 2017 15:18:45 -0700
e17c1f
Subject: [PATCH 2/5] anv/blorp: Add a device parameter to
e17c1f
 blorp_surf_for_anv_image
e17c1f
e17c1f
Cc: "17.3" <mesa-stable@lists.freedesktop.org>
e17c1f
Tested-by: Lyude Paul <lyude@redhat.com>
e17c1f
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
e17c1f
Signed-off-by: Lyude <lyude@redhat.com>
e17c1f
---
e17c1f
 src/intel/vulkan/anv_blorp.c | 54 ++++++++++++++++++++++++++++----------------
e17c1f
 1 file changed, 34 insertions(+), 20 deletions(-)
e17c1f
e17c1f
diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c
e17c1f
index 79f5234c55..c00d38b52c 100644
e17c1f
--- a/src/intel/vulkan/anv_blorp.c
e17c1f
+++ b/src/intel/vulkan/anv_blorp.c
e17c1f
@@ -176,7 +176,8 @@ get_blorp_surf_for_anv_buffer(struct anv_device *device,
e17c1f
 }
e17c1f
 
e17c1f
 static void
e17c1f
-get_blorp_surf_for_anv_image(const struct anv_image *image,
e17c1f
+get_blorp_surf_for_anv_image(const struct anv_device *device,
e17c1f
+                             const struct anv_image *image,
e17c1f
                              VkImageAspectFlags aspect,
e17c1f
                              enum isl_aux_usage aux_usage,
e17c1f
                              struct blorp_surf *blorp_surf)
e17c1f
@@ -257,9 +258,11 @@ void anv_CmdCopyImage(
e17c1f
          VkImageAspectFlagBits aspect = (1 << a);
e17c1f
 
e17c1f
          struct blorp_surf src_surf, dst_surf;
e17c1f
-         get_blorp_surf_for_anv_image(src_image, aspect, src_image->aux_usage,
e17c1f
+         get_blorp_surf_for_anv_image(cmd_buffer->device,
e17c1f
+                                      src_image, aspect, src_image->aux_usage,
e17c1f
                                       &src_surf);
e17c1f
-         get_blorp_surf_for_anv_image(dst_image, aspect, dst_image->aux_usage,
e17c1f
+         get_blorp_surf_for_anv_image(cmd_buffer->device,
e17c1f
+                                      dst_image, aspect, dst_image->aux_usage,
e17c1f
                                       &dst_surf);
e17c1f
 
e17c1f
          for (unsigned i = 0; i < layer_count; i++) {
e17c1f
@@ -308,8 +311,8 @@ copy_buffer_to_image(struct anv_cmd_buffer *cmd_buffer,
e17c1f
    for (unsigned r = 0; r < regionCount; r++) {
e17c1f
       const VkImageAspectFlags aspect = pRegions[r].imageSubresource.aspectMask;
e17c1f
 
e17c1f
-      get_blorp_surf_for_anv_image(anv_image, aspect, anv_image->aux_usage,
e17c1f
-                                   &image.surf);
e17c1f
+      get_blorp_surf_for_anv_image(cmd_buffer->device, anv_image, aspect,
e17c1f
+                                   anv_image->aux_usage, &image.surf);
e17c1f
       image.offset =
e17c1f
          anv_sanitize_image_offset(anv_image->type, pRegions[r].imageOffset);
e17c1f
       image.level = pRegions[r].imageSubresource.mipLevel;
e17c1f
@@ -454,9 +457,11 @@ void anv_CmdBlitImage(
e17c1f
       const VkImageSubresourceLayers *src_res = &pRegions[r].srcSubresource;
e17c1f
       const VkImageSubresourceLayers *dst_res = &pRegions[r].dstSubresource;
e17c1f
 
e17c1f
-      get_blorp_surf_for_anv_image(src_image, src_res->aspectMask,
e17c1f
+      get_blorp_surf_for_anv_image(cmd_buffer->device,
e17c1f
+                                   src_image, src_res->aspectMask,
e17c1f
                                    src_image->aux_usage, &src;;
e17c1f
-      get_blorp_surf_for_anv_image(dst_image, dst_res->aspectMask,
e17c1f
+      get_blorp_surf_for_anv_image(cmd_buffer->device,
e17c1f
+                                   dst_image, dst_res->aspectMask,
e17c1f
                                    dst_image->aux_usage, &dst);
e17c1f
 
e17c1f
       struct anv_format src_format =
e17c1f
@@ -832,7 +837,8 @@ void anv_CmdClearColorImage(
e17c1f
    blorp_batch_init(&cmd_buffer->device->blorp, &batch, cmd_buffer, 0);
e17c1f
 
e17c1f
    struct blorp_surf surf;
e17c1f
-   get_blorp_surf_for_anv_image(image, VK_IMAGE_ASPECT_COLOR_BIT,
e17c1f
+   get_blorp_surf_for_anv_image(cmd_buffer->device,
e17c1f
+                                image, VK_IMAGE_ASPECT_COLOR_BIT,
e17c1f
                                 image->aux_usage, &surf);
e17c1f
 
e17c1f
    for (unsigned r = 0; r < rangeCount; r++) {
e17c1f
@@ -885,14 +891,16 @@ void anv_CmdClearDepthStencilImage(
e17c1f
 
e17c1f
    struct blorp_surf depth, stencil;
e17c1f
    if (image->aspects & VK_IMAGE_ASPECT_DEPTH_BIT) {
e17c1f
-      get_blorp_surf_for_anv_image(image, VK_IMAGE_ASPECT_DEPTH_BIT,
e17c1f
+      get_blorp_surf_for_anv_image(cmd_buffer->device,
e17c1f
+                                   image, VK_IMAGE_ASPECT_DEPTH_BIT,
e17c1f
                                    ISL_AUX_USAGE_NONE, &depth);
e17c1f
    } else {
e17c1f
       memset(&depth, 0, sizeof(depth));
e17c1f
    }
e17c1f
 
e17c1f
    if (image->aspects & VK_IMAGE_ASPECT_STENCIL_BIT) {
e17c1f
-      get_blorp_surf_for_anv_image(image, VK_IMAGE_ASPECT_STENCIL_BIT,
e17c1f
+      get_blorp_surf_for_anv_image(cmd_buffer->device,
e17c1f
+                                   image, VK_IMAGE_ASPECT_STENCIL_BIT,
e17c1f
                                    ISL_AUX_USAGE_NONE, &stencil);
e17c1f
    } else {
e17c1f
       memset(&stencil, 0, sizeof(stencil));
e17c1f
@@ -1212,7 +1220,8 @@ anv_cmd_buffer_clear_subpass(struct anv_cmd_buffer *cmd_buffer)
e17c1f
       struct anv_image_view *iview = fb->attachments[a];
e17c1f
       const struct anv_image *image = iview->image;
e17c1f
       struct blorp_surf surf;
e17c1f
-      get_blorp_surf_for_anv_image(image, VK_IMAGE_ASPECT_COLOR_BIT,
e17c1f
+      get_blorp_surf_for_anv_image(cmd_buffer->device, image,
e17c1f
+                                   VK_IMAGE_ASPECT_COLOR_BIT,
e17c1f
                                    att_state->aux_usage, &surf);
e17c1f
 
e17c1f
       if (att_state->fast_clear) {
e17c1f
@@ -1359,7 +1368,8 @@ anv_cmd_buffer_clear_subpass(struct anv_cmd_buffer *cmd_buffer)
e17c1f
 }
e17c1f
 
e17c1f
 static void
e17c1f
-resolve_image(struct blorp_batch *batch,
e17c1f
+resolve_image(struct anv_device *device,
e17c1f
+              struct blorp_batch *batch,
e17c1f
               const struct anv_image *src_image,
e17c1f
               enum isl_aux_usage src_aux_usage,
e17c1f
               uint32_t src_level, uint32_t src_layer,
e17c1f
@@ -1380,9 +1390,9 @@ resolve_image(struct blorp_batch *batch,
e17c1f
       VkImageAspectFlagBits aspect = 1 << a;
e17c1f
 
e17c1f
       struct blorp_surf src_surf, dst_surf;
e17c1f
-      get_blorp_surf_for_anv_image(src_image, aspect,
e17c1f
+      get_blorp_surf_for_anv_image(device, src_image, aspect,
e17c1f
                                    src_aux_usage, &src_surf);
e17c1f
-      get_blorp_surf_for_anv_image(dst_image, aspect,
e17c1f
+      get_blorp_surf_for_anv_image(device, dst_image, aspect,
e17c1f
                                    dst_aux_usage, &dst_surf);
e17c1f
 
e17c1f
       blorp_blit(batch,
e17c1f
@@ -1422,7 +1432,7 @@ void anv_CmdResolveImage(
e17c1f
          anv_get_layerCount(dst_image, &pRegions[r].dstSubresource);
e17c1f
 
e17c1f
       for (uint32_t layer = 0; layer < layer_count; layer++) {
e17c1f
-         resolve_image(&batch,
e17c1f
+         resolve_image(cmd_buffer->device, &batch,
e17c1f
                        src_image, src_image->aux_usage,
e17c1f
                        pRegions[r].srcSubresource.mipLevel,
e17c1f
                        pRegions[r].srcSubresource.baseArrayLayer + layer,
e17c1f
@@ -1456,7 +1466,8 @@ anv_image_fast_clear(struct anv_cmd_buffer *cmd_buffer,
e17c1f
    blorp_batch_init(&cmd_buffer->device->blorp, &batch, cmd_buffer, 0);
e17c1f
 
e17c1f
    struct blorp_surf surf;
e17c1f
-   get_blorp_surf_for_anv_image(image, VK_IMAGE_ASPECT_COLOR_BIT,
e17c1f
+   get_blorp_surf_for_anv_image(cmd_buffer->device, image,
e17c1f
+                                VK_IMAGE_ASPECT_COLOR_BIT,
e17c1f
                                 image->aux_usage == ISL_AUX_USAGE_NONE ?
e17c1f
                                 ISL_AUX_USAGE_CCS_D : image->aux_usage,
e17c1f
                                 &surf);
e17c1f
@@ -1553,7 +1564,8 @@ anv_cmd_buffer_resolve_subpass(struct anv_cmd_buffer *cmd_buffer)
e17c1f
 
e17c1f
          assert(src_iview->aspect_mask == dst_iview->aspect_mask);
e17c1f
 
e17c1f
-         resolve_image(&batch, src_iview->image, src_aux_usage,
e17c1f
+         resolve_image(cmd_buffer->device, &batch,
e17c1f
+                       src_iview->image, src_aux_usage,
e17c1f
                        src_iview->isl.base_level,
e17c1f
                        src_iview->isl.base_array_layer,
e17c1f
                        dst_iview->image, dst_aux_usage,
e17c1f
@@ -1590,8 +1602,9 @@ anv_gen8_hiz_op_resolve(struct anv_cmd_buffer *cmd_buffer,
e17c1f
    blorp_batch_init(&cmd_buffer->device->blorp, &batch, cmd_buffer, 0);
e17c1f
 
e17c1f
    struct blorp_surf surf;
e17c1f
-   get_blorp_surf_for_anv_image(image, VK_IMAGE_ASPECT_DEPTH_BIT,
e17c1f
-                                ISL_AUX_USAGE_NONE, &surf);
e17c1f
+   get_blorp_surf_for_anv_image(cmd_buffer->device, image,
e17c1f
+                                VK_IMAGE_ASPECT_DEPTH_BIT, ISL_AUX_USAGE_NONE,
e17c1f
+                                &surf);
e17c1f
 
e17c1f
    /* Manually add the aux HiZ surf */
e17c1f
    surf.aux_surf = &image->aux_surface.isl,
e17c1f
@@ -1634,7 +1647,8 @@ anv_ccs_resolve(struct anv_cmd_buffer * const cmd_buffer,
e17c1f
                     BLORP_BATCH_PREDICATE_ENABLE);
e17c1f
 
e17c1f
    struct blorp_surf surf;
e17c1f
-   get_blorp_surf_for_anv_image(image, VK_IMAGE_ASPECT_COLOR_BIT,
e17c1f
+   get_blorp_surf_for_anv_image(cmd_buffer->device, image,
e17c1f
+                                VK_IMAGE_ASPECT_COLOR_BIT,
e17c1f
                                 image->aux_usage == ISL_AUX_USAGE_CCS_E ?
e17c1f
                                 ISL_AUX_USAGE_CCS_E : ISL_AUX_USAGE_CCS_D,
e17c1f
                                 &surf);
e17c1f
-- 
e17c1f
2.14.3
e17c1f