iris: Ignore aux for copy_region source if there's no unresolved color
authorKenneth Graunke <kenneth@whitecape.org>
Fri, 23 Sep 2022 05:50:37 +0000 (22:50 -0700)
committerMarge Bot <emma+marge@anholt.net>
Mon, 26 Sep 2022 20:37:09 +0000 (20:37 +0000)
This mirrors the behavior of iris_resource_texture_aux_usage(), which
bypasses the aux metadata when there's no advantage to using it.

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

src/gallium/drivers/iris/iris_blit.c

index 0b50526..a7bcfb2 100644 (file)
@@ -599,6 +599,18 @@ get_copy_region_aux_settings(struct iris_context *ice,
       FALLTHROUGH;
    case ISL_AUX_USAGE_CCS_E:
    case ISL_AUX_USAGE_GFX12_CCS_E: {
+      /* If our source doesn't have any unresolved color, report an aux
+       * usage of ISL_AUX_USAGE_NONE.  This way, texturing won't even look
+       * at the aux surface and we can save some bandwidth.
+       */
+      if (!is_dest &&
+          !iris_has_invalid_primary(res, level, 1,
+                                    0, INTEL_REMAINING_LAYERS)) {
+         *out_aux_usage = ISL_AUX_USAGE_NONE;
+         *out_clear_supported = false;
+         break;
+      }
+
       /* blorp_copy may reinterpret the surface format and has limited support
        * for adjusting the clear color, so clear support may only be enabled
        * in some cases: