iris: Allow fast clears on compressed image load/store access
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 6 Oct 2022 07:14:35 +0000 (00:14 -0700)
committerMarge Bot <emma+marge@anholt.net>
Wed, 14 Dec 2022 13:01:27 +0000 (13:01 +0000)
While I haven't found documentation saying definitively that HDC
supports fast clear blocks, it seems to work just fine, even on
Tigerlake.  I have found several issues (atomics and HDC support
for linear compression) that both call out fast clears as an issue
in those corner cases, which suggests that fast clears do actually
work outside of those corners (which we already disable).

The previous commit implemented actual aux state updates for image
views.  With ISL_AUX_USAGE_GFX12_CCS_E, this means that we update
the aux state to COMPRESSED_CLEAR after writes.  But because we
weren't supporting fast clears, this meant that any such images
would need partial resolves to remove the clear color on next use.
Supporting fast clears allows us to drop all these resolves.

Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19060>

src/gallium/drivers/iris/iris_resolve.c

index f0ecb3a..b299b5b 100644 (file)
@@ -141,10 +141,20 @@ resolve_image_views(struct iris_context *ice,
          enum isl_aux_usage aux_usage =
             iris_image_view_aux_usage(ice, pview, info);
 
+         enum isl_format view_format = iris_image_view_get_format(ice, pview);
+
+         bool clear_supported = isl_aux_usage_has_fast_clears(aux_usage);
+
+         if (!iris_render_formats_color_compatible(view_format,
+                                                   res->surf.format,
+                                                   res->aux.clear_color,
+                                                   res->aux.clear_color_unknown))
+            clear_supported = false;
+
          iris_resource_prepare_access(ice, res,
                                       pview->u.tex.level, 1,
                                       pview->u.tex.first_layer, num_layers,
-                                      aux_usage, false);
+                                      aux_usage, clear_supported);
 
          shs->image_aux_usage[i] = aux_usage;
       } else {