[Mesa-dev] [PATCH] i965: Don't reset aux_state on buffers without modifiers

Jason Ekstrand jason at jlekstrand.net
Mon Sep 18 22:43:12 UTC 2017


On gen7-8 where we use CCS_D, we were setting AUX_STATE_AUX_INVALID
because that's the obvious aux state when there is no modifier.
However, this doesn't work because that aux state isn't compatible with
CCS_D.

Cc: Chad Versace <chadversary at chromium.org>
---
 src/intel/isl/isl.h                           |  4 +++-
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 17 +++++++++++++++--
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/src/intel/isl/isl.h b/src/intel/isl/isl.h
index df275f8..c01c983 100644
--- a/src/intel/isl/isl.h
+++ b/src/intel/isl/isl.h
@@ -1555,7 +1555,9 @@ isl_drm_modifier_get_info(uint64_t modifier);
 static inline bool
 isl_drm_modifier_has_aux(uint64_t modifier)
 {
-   return isl_drm_modifier_get_info(modifier)->aux_usage != ISL_AUX_USAGE_NONE;
+   const struct isl_drm_modifier_info *mod_info =
+      isl_drm_modifier_get_info(modifier);
+   return mod_info && mod_info->aux_usage != ISL_AUX_USAGE_NONE;
 }
 
 /** Returns the default isl_aux_state for the given modifier.
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index 5740f03..9e3dd45 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -2829,8 +2829,21 @@ intel_miptree_finish_external(struct brw_context *brw,
 
    /* We just got this image in from the window system via glxBindTexImageEXT
     * or similar and have no idea what the actual aux state is other than that
-    * we aren't in AUX_INVALID.  Reset the aux state to the default for the
-    * image's modifier.
+    * we aren't in AUX_INVALID.  If the modifier has no aux then any aux
+    * buffer we may have is provided by us and we had better have resolved it
+    * in intel_miptree_prepare_external.
+    *
+    * TODO: It is possible to get here with unresolved AUX because the dri2
+    * stamp can get updated without intel_miptree_prepare_external getting
+    * called.  For example, glReadBuffers calls dri2InvalidateDrawable.  We
+    * then land here on the next draw call.
+    */
+   if (!isl_drm_modifier_has_aux(mt->drm_modifier))
+      return;
+
+   /* Otherwise, reset the aux state to the least common denominator for the
+    * image's modifier because we don't know how it's been edited prior to our
+    * seeing it here.
     */
    enum isl_aux_state default_aux_state =
       isl_drm_modifier_get_default_aux_state(mt->drm_modifier);
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list