Mesa (main): anv: Pass correct aux usage while filling out surface state

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Oct 27 18:19:47 UTC 2021


Module: Mesa
Branch: main
Commit: 64ea7e5e338750c8e7c33ddcd969b60af1645ada
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=64ea7e5e338750c8e7c33ddcd969b60af1645ada

Author: Sagar Ghuge <sagar.ghuge at intel.com>
Date:   Tue Jan 28 14:19:08 2020 -0800

anv: Pass correct aux usage while filling out surface state

While filling out surface state, pass correct aux usage for storage
images as we support compression on XeHPG.

v2: (Jason Ekstrand)
- Move assertion down a bit
- Use general layout aux usage

Signed-off-by: Sagar Ghuge <sagar.ghuge at intel.com>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Reviewed-by: Nanley Chery <nanley.g.chery at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3606>

---

 src/intel/vulkan/anv_image.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
index 179f1559a2f..cb4ef3b9b38 100644
--- a/src/intel/vulkan/anv_image.c
+++ b/src/intel/vulkan/anv_image.c
@@ -2412,9 +2412,16 @@ anv_image_fill_surface_state(struct anv_device *device,
           * image formats.  Translate it into the closest format the hardware
           * supports.
           */
-         assert(aux_usage == ISL_AUX_USAGE_NONE);
-         view.format = isl_lower_storage_image_format(&device->info,
-                                                      view.format);
+         enum isl_format lower_format =
+            isl_lower_storage_image_format(&device->info, view.format);
+         if (aux_usage != ISL_AUX_USAGE_NONE) {
+            assert(device->info.verx10 >= 125);
+            assert(aux_usage == ISL_AUX_USAGE_CCS_E);
+            assert(isl_formats_are_ccs_e_compatible(&device->info,
+                                                    view.format,
+                                                    lower_format));
+         }
+         view.format = lower_format;
       }
 
       const struct isl_surf *isl_surf = &surface->isl;
@@ -2628,11 +2635,15 @@ anv_CreateImageView(VkDevice _device,
 
       /* NOTE: This one needs to go last since it may stomp isl_view.format */
       if (iview->vk.usage & VK_IMAGE_USAGE_STORAGE_BIT) {
+         enum isl_aux_usage general_aux_usage =
+            anv_layout_to_aux_usage(&device->info, image, 1UL << iaspect_bit,
+                                    VK_IMAGE_USAGE_STORAGE_BIT,
+                                    VK_IMAGE_LAYOUT_GENERAL);
          iview->planes[vplane].storage_surface_state.state = alloc_surface_state(device);
          anv_image_fill_surface_state(device, image, 1ULL << iaspect_bit,
                                       &iview->planes[vplane].isl,
                                       ISL_SURF_USAGE_STORAGE_BIT,
-                                      ISL_AUX_USAGE_NONE, NULL,
+                                      general_aux_usage, NULL,
                                       0,
                                       &iview->planes[vplane].storage_surface_state,
                                       NULL);
@@ -2644,7 +2655,7 @@ anv_CreateImageView(VkDevice _device,
             anv_image_fill_surface_state(device, image, 1ULL << iaspect_bit,
                                          &iview->planes[vplane].isl,
                                          ISL_SURF_USAGE_STORAGE_BIT,
-                                         ISL_AUX_USAGE_NONE, NULL,
+                                         general_aux_usage, NULL,
                                          ANV_IMAGE_VIEW_STATE_STORAGE_LOWERED,
                                          &iview->planes[vplane].lowered_storage_surface_state,
                                          &iview->planes[vplane].lowered_storage_image_param);



More information about the mesa-commit mailing list