[Mesa-dev] [PATCH 24/26] i965: Disable aux buffers with non-compatible copies

Topi Pohjolainen topi.pohjolainen at gmail.com
Tue Oct 11 19:26:56 UTC 2016


Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
 src/intel/blorp/blorp.h               |  2 ++
 src/intel/blorp/blorp_blit.c          |  6 ++++++
 src/mesa/drivers/dri/i965/brw_blorp.c | 25 ++++++++++++++++++++-----
 3 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/src/intel/blorp/blorp.h b/src/intel/blorp/blorp.h
index f69e99e..721322c 100644
--- a/src/intel/blorp/blorp.h
+++ b/src/intel/blorp/blorp.h
@@ -94,6 +94,8 @@ struct blorp_surf
    union isl_color_value clear_color;
 };
 
+bool blorp_copy_needs_format_override(enum isl_format fmt);
+
 void
 blorp_blit(struct blorp_batch *batch,
            const struct blorp_surf *src_surf,
diff --git a/src/intel/blorp/blorp_blit.c b/src/intel/blorp/blorp_blit.c
index 0c3ee72..bbeabd9 100644
--- a/src/intel/blorp/blorp_blit.c
+++ b/src/intel/blorp/blorp_blit.c
@@ -1742,6 +1742,12 @@ get_copy_format_for_bpb(unsigned bpb)
    }
 }
 
+bool
+blorp_copy_needs_format_override(enum isl_format fmt)
+{
+   return fmt != get_copy_format_for_bpb(isl_format_get_layout(fmt)->bpb);
+}
+
 static void
 surf_convert_to_uncompressed(const struct isl_device *isl_dev,
                              struct brw_blorp_surface_info *info,
diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c b/src/mesa/drivers/dri/i965/brw_blorp.c
index d937c5c..4e3359c 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.c
+++ b/src/mesa/drivers/dri/i965/brw_blorp.c
@@ -407,12 +407,18 @@ brw_blorp_copy_miptrees(struct brw_context *brw,
                         unsigned dst_x, unsigned dst_y,
                         unsigned src_width, unsigned src_height)
 {
-   /* Get ready to blit.  This includes depth resolving the src and dst
-    * buffers if necessary.  Note: it's not necessary to do a color resolve on
-    * the destination buffer because we use the standard render path to render
-    * to destination color buffers, and the standard render path is
-    * fast-color-aware.
+   /* Get ready to blit.  This includes color/depth resolving the src and dst
+    * buffers if necessary.
     */
+   const enum isl_format dst_format =
+      translate_tex_format(brw, dst_mt->format, false);
+   const bool disable_dst_aux =
+      dst_mt->mcs_mt && intel_miptree_is_lossless_compressed(brw, dst_mt) &&
+      blorp_copy_needs_format_override(dst_format);
+
+   if (disable_dst_aux)
+      intel_miptree_resolve_color(brw, dst_mt, dst_level, dst_layer, 0);
+
    intel_miptree_resolve_color(brw, src_mt, src_level, src_layer,
                                INTEL_MIPTREE_IGNORE_CCS_E);
    intel_miptree_slice_resolve_depth(brw, src_mt, src_level, src_layer);
@@ -437,6 +443,15 @@ brw_blorp_copy_miptrees(struct brw_context *brw,
    blorp_surf_for_miptree(brw, &dst_surf, dst_mt, true,
                           &dst_level, dst_layer, &tmp_surfs[2]);
 
+   /* Copy uses fixed formats that are guaranteed to agree with real surface
+    * formats only with respect to size. Semantics may differ which will
+    * confuse the hardware if any compression scheme is used. Therefore the
+    * copy is performed target compression disabled unless the real format
+    * matches exactly the fixed copy format.
+    */
+   if (disable_dst_aux)
+      dst_surf.aux_usage = ISL_AUX_USAGE_NONE;
+
    struct blorp_batch batch;
    blorp_batch_init(&brw->blorp, &batch, brw);
    blorp_copy(&batch, &src_surf, src_level, src_layer,
-- 
2.5.5



More information about the mesa-dev mailing list