i965: Stop disabling aux during texture preparation
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 24 Jan 2018 19:51:08 +0000 (11:51 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 25 Jan 2018 03:05:36 +0000 (19:05 -0800)
Previously, we were handling self-dependencies by marking the render
buffer and then passing disable_aux=true to prepare_texture so that it
would do a resolve.  This works but ends us up doing to much resolving
in some cases.  Specifically, if we're doing something such as mipmap
generation, this would cause us to resolve all levels of the texture if
even one of them is overlapping.

Instead, this commit makes us wait until we process the framebuffer to
do these resolves and we only resolve the slices needed for rendering.
Doing this resolve puts them into the pass-through state so, even if we
do texture using CCS_E, the CCS data will effectively be ignored and the
real surface contents read.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_draw.c
src/mesa/drivers/dri/i965/intel_mipmap_tree.c
src/mesa/drivers/dri/i965/intel_mipmap_tree.h

index 268c200f4a9658a7c1918bd3da384fc4aa64c7aa..50cf8b12c74e760c3dfb0e6c8db5190e1fdce363 100644 (file)
@@ -439,15 +439,15 @@ brw_predraw_resolve_inputs(struct brw_context *brw, bool rendering,
          num_layers = INTEL_REMAINING_LAYERS;
       }
 
-      const bool disable_aux = rendering &&
+      if (rendering) {
          intel_disable_rb_aux_buffer(brw, draw_aux_buffer_disabled,
                                      tex_obj->mt, min_level, num_levels,
                                      "for sampling");
+      }
 
       intel_miptree_prepare_texture(brw, tex_obj->mt, view_format,
                                     min_level, num_levels,
-                                    min_layer, num_layers,
-                                    disable_aux);
+                                    min_layer, num_layers);
 
       /* If any programs are using it with texelFetch, we may need to also do
        * a prepare with an sRGB format to ensure texelFetch works "properly".
@@ -458,8 +458,7 @@ brw_predraw_resolve_inputs(struct brw_context *brw, bool rendering,
          if (txf_format != view_format) {
             intel_miptree_prepare_texture(brw, tex_obj->mt, txf_format,
                                           min_level, num_levels,
-                                          min_layer, num_layers,
-                                          disable_aux);
+                                          min_layer, num_layers);
          }
       }
 
@@ -531,8 +530,7 @@ brw_predraw_resolve_framebuffer(struct brw_context *brw,
          if (irb) {
             intel_miptree_prepare_texture(brw, irb->mt, irb->mt->surf.format,
                                           irb->mt_level, 1,
-                                          irb->mt_layer, irb->layer_count,
-                                          false);
+                                          irb->mt_layer, irb->layer_count);
          }
       }
    }
index c8081ee1095b797b2c3dcafe69d5f18e93f9551f..c480eade93bd8f48568c9a30206df4917ec67363 100644 (file)
@@ -2649,10 +2649,9 @@ intel_miptree_prepare_texture(struct brw_context *brw,
                               struct intel_mipmap_tree *mt,
                               enum isl_format view_format,
                               uint32_t start_level, uint32_t num_levels,
-                              uint32_t start_layer, uint32_t num_layers,
-                              bool disable_aux)
+                              uint32_t start_layer, uint32_t num_layers)
 {
-   enum isl_aux_usage aux_usage = disable_aux ? ISL_AUX_USAGE_NONE :
+   enum isl_aux_usage aux_usage =
       intel_miptree_texture_aux_usage(brw, mt, view_format);
    bool clear_supported = aux_usage != ISL_AUX_USAGE_NONE;
 
index 6135af1452849547da808a2b550c37f03780f0e7..7fcf09f118af9cd85b93731650dbaeaccbf9f064 100644 (file)
@@ -642,8 +642,7 @@ intel_miptree_prepare_texture(struct brw_context *brw,
                               struct intel_mipmap_tree *mt,
                               enum isl_format view_format,
                               uint32_t start_level, uint32_t num_levels,
-                              uint32_t start_layer, uint32_t num_layers,
-                              bool disable_aux);
+                              uint32_t start_layer, uint32_t num_layers);
 void
 intel_miptree_prepare_image(struct brw_context *brw,
                             struct intel_mipmap_tree *mt);