i965/miptree: Return NONE from texture_aux_usage when fully resolved
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 17 Aug 2017 22:27:25 +0000 (15:27 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Sat, 19 Aug 2017 00:31:02 +0000 (17:31 -0700)
This little optimization improves the performance of SynMark v7
TexFilterTri by almost 10% on Sky Lake GT4 among other improvements.
We've been doing it for some time but somehow it got dropped during
the miptree refactoring.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Bugzilla: https://bugs.freedesktop.org/102258
Cc: "17.2" <mesa-stable@lists.freedesktop.org>
src/mesa/drivers/dri/i965/intel_mipmap_tree.c

index dab60c4b0455d4b0a6238d14694752aadf3b7866..2d6a0a3ab7c5807b44bbf58e6363c11294dc17a6 100644 (file)
@@ -2571,7 +2571,20 @@ intel_miptree_texture_aux_usage(struct brw_context *brw,
 
    case ISL_AUX_USAGE_CCS_D:
    case ISL_AUX_USAGE_CCS_E:
-      if (mt->mcs_buf && can_texture_with_ccs(brw, mt, view_format))
+      if (!mt->mcs_buf) {
+         assert(mt->aux_usage == ISL_AUX_USAGE_CCS_D);
+         return ISL_AUX_USAGE_NONE;
+      }
+
+      /* If we don'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 (!intel_miptree_has_color_unresolved(mt, 0, INTEL_REMAINING_LEVELS,
+                                              0, INTEL_REMAINING_LAYERS))
+         return ISL_AUX_USAGE_NONE;
+
+      if (can_texture_with_ccs(brw, mt, view_format))
          return ISL_AUX_USAGE_CCS_E;
       break;