i965/blorp: Take an explicit fast clear op in resolve_color
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 25 May 2017 23:59:12 +0000 (16:59 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 8 Jun 2017 05:18:53 +0000 (22:18 -0700)
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
src/mesa/drivers/dri/i965/brw_blorp.c
src/mesa/drivers/dri/i965/brw_blorp.h
src/mesa/drivers/dri/i965/intel_mipmap_tree.c

index d9592c571f63852863f220331095dc4fd8ab39f7..67b9fde302693e024f5f45e48890aa591b992f69 100644 (file)
@@ -924,7 +924,8 @@ brw_blorp_clear_color(struct brw_context *brw, struct gl_framebuffer *fb,
 
 void
 brw_blorp_resolve_color(struct brw_context *brw, struct intel_mipmap_tree *mt,
-                        unsigned level, unsigned layer)
+                        unsigned level, unsigned layer,
+                        enum blorp_fast_clear_op resolve_op)
 {
    DBG("%s to mt %p level %u layer %u\n", __FUNCTION__, mt, level, layer);
 
@@ -938,18 +939,6 @@ brw_blorp_resolve_color(struct brw_context *brw, struct intel_mipmap_tree *mt,
                           &level, layer, 1 /* num_layers */,
                           isl_tmp);
 
-   enum blorp_fast_clear_op resolve_op;
-   if (brw->gen >= 9) {
-      if (surf.aux_usage == ISL_AUX_USAGE_CCS_E)
-         resolve_op = BLORP_FAST_CLEAR_OP_RESOLVE_FULL;
-      else
-         resolve_op = BLORP_FAST_CLEAR_OP_RESOLVE_PARTIAL;
-   } else {
-      assert(surf.aux_usage == ISL_AUX_USAGE_CCS_D);
-      /* Broadwell and earlier do not have a partial resolve */
-      resolve_op = BLORP_FAST_CLEAR_OP_RESOLVE_FULL;
-   }
-
    /* Ivybrigde PRM Vol 2, Part 1, "11.7 MCS Buffer for Render Target(s)":
     *
     *    "Any transition from any value in {Clear, Render, Resolve} to a
index 91a2d41279f48d0816dd5c6ff3063a029e1be723..0de352edefbd2f60f0816e1b00633023708d8f73 100644 (file)
@@ -66,7 +66,8 @@ brw_blorp_clear_color(struct brw_context *brw, struct gl_framebuffer *fb,
 void
 brw_blorp_resolve_color(struct brw_context *brw,
                         struct intel_mipmap_tree *mt,
-                        unsigned level, unsigned layer);
+                        unsigned level, unsigned layer,
+                        enum blorp_fast_clear_op resolve_op);
 
 void
 intel_hiz_exec(struct brw_context *brw, struct intel_mipmap_tree *mt,
index 2532cbd0342468c306091d6475a8f731153228eb..42df708b31635cd2109602ade1827310139e644e 100644 (file)
@@ -2174,6 +2174,19 @@ intel_miptree_resolve_color(struct brw_context *brw,
    if (!intel_miptree_needs_color_resolve(brw, mt, flags))
       return false;
 
+   enum blorp_fast_clear_op resolve_op;
+   if (brw->gen >= 9) {
+      if (intel_miptree_is_lossless_compressed(brw, mt)) {
+         resolve_op = BLORP_FAST_CLEAR_OP_RESOLVE_FULL;
+      } else {
+         resolve_op = BLORP_FAST_CLEAR_OP_RESOLVE_PARTIAL;
+      }
+   } else {
+      /* Broadwell and earlier do not have a partial resolve */
+      assert(!intel_miptree_is_lossless_compressed(brw, mt));
+      resolve_op = BLORP_FAST_CLEAR_OP_RESOLVE_FULL;
+   }
+
    bool resolved = false;
    foreach_list_typed_safe(struct intel_resolve_map, map, link,
                            &mt->color_resolve_map) {
@@ -2190,7 +2203,7 @@ intel_miptree_resolve_color(struct brw_context *brw,
 
       assert(map->fast_clear_state != INTEL_FAST_CLEAR_STATE_RESOLVED);
 
-      brw_blorp_resolve_color(brw, mt, map->level, map->layer);
+      brw_blorp_resolve_color(brw, mt, map->level, map->layer, resolve_op);
       intel_resolve_map_remove(map);
       resolved = true;
    }