<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Oct 11, 2016 at 12:26 PM, Topi Pohjolainen <span dir="ltr"><<a href="mailto:topi.pohjolainen@gmail.com" target="_blank">topi.pohjolainen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This patch also introduces getter and setter for fast clear state<br>
preparing for tracking the state per slice.<br>
<br>
Signed-off-by: Topi Pohjolainen <<a href="mailto:topi.pohjolainen@intel.com">topi.pohjolainen@intel.com</a>><br>
---<br>
 src/mesa/drivers/dri/i965/brw_<wbr>blorp.c         |  7 ++--<br>
 src/mesa/drivers/dri/i965/brw_<wbr>draw.c          | 12 ++++---<br>
 src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c | 46 +++++++++++++++++++++++++++<br>
 src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.h | 25 ++++++++-------<br>
 4 files changed, 72 insertions(+), 18 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c b/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c<br>
index 6332788..83f47aa 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c<br>
@@ -363,7 +363,8 @@ brw_blorp_blit_miptrees(struct brw_context *brw,<br>
<br>
    intel_miptree_check_level_<wbr>layer(src_mt, src_level, src_layer);<br>
    intel_miptree_check_level_<wbr>layer(dst_mt, dst_level, dst_layer);<br>
-   intel_miptree_used_for_<wbr>rendering(brw, dst_mt);<br>
+   intel_miptree_used_for_<wbr>rendering(brw, dst_mt, dst_level,<br>
+                                    dst_logical_layer, 1);<br>
<br>
    struct isl_surf tmp_surfs[4];<br>
    struct blorp_surf src_surf, dst_surf;<br>
@@ -425,7 +426,7 @@ brw_blorp_copy_miptrees(struct brw_context *brw,<br>
<br>
    miptree_check_level_logical_<wbr>layer(src_mt, src_level, src_layer);<br>
    miptree_check_level_logical_<wbr>layer(dst_mt, dst_level, dst_layer);<br>
-   intel_miptree_used_for_<wbr>rendering(brw, dst_mt);<br>
+   intel_miptree_used_for_<wbr>rendering(brw, dst_mt, dst_level, dst_layer, 1);<br>
<br>
    struct isl_surf tmp_surfs[4];<br>
    struct blorp_surf src_surf, dst_surf;<br>
@@ -862,7 +863,7 @@ do_single_blorp_clear(struct brw_context *brw, struct gl_framebuffer *fb,<br>
        */<br>
       irb->mt->fast_clear_state = INTEL_FAST_CLEAR_STATE_CLEAR;<br>
    } else {<br>
-      intel_miptree_used_for_<wbr>rendering(brw, irb->mt);<br>
+      intel_miptree_used_for_<wbr>rendering(brw, irb->mt, level, layer, num_layers);<br>
<br>
       DBG("%s (slow) to mt %p level %d layer %d+%d\n", __FUNCTION__,<br>
           irb->mt, irb->mt_level, irb->mt_layer, num_layers);<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_draw.c b/src/mesa/drivers/dri/i965/<wbr>brw_draw.c<br>
index 5680403..e387eb9 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_draw.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_draw.c<br>
@@ -386,10 +386,14 @@ brw_postdraw_set_buffers_need_<wbr>resolve(struct brw_context *brw)<br>
       struct intel_renderbuffer *irb =<br>
          intel_renderbuffer(fb->_<wbr>ColorDrawBuffers[i]);<br>
<br>
-      if (irb) {<br>
-         brw_render_cache_set_add_bo(<wbr>brw, irb->mt->bo);<br>
-         intel_miptree_used_for_<wbr>rendering(brw, irb->mt);<br>
-      }<br>
+      if (!irb)<br>
+         continue;<br>
+<br>
+      brw_render_cache_set_add_bo(<wbr>brw, irb->mt->bo);<br>
+      intel_miptree_used_for_<wbr>rendering(<br>
+         brw, irb->mt, irb->mt_level,<br>
+         intel_miptree_physical_to_<wbr>logical_layer(irb->mt, irb->mt_layer),<br>
+         irb->layer_count);<br>
    }<br>
 }<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c<br>
index 4fb07e9..7b0d411 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c<br>
@@ -2101,6 +2101,13 @@ intel_miptree_all_slices_<wbr>resolve_depth(struct brw_context *brw,<br>
                                           BLORP_HIZ_OP_DEPTH_RESOLVE);<br>
 }<br>
<br>
+enum intel_fast_clear_state<br>
+intel_miptree_get_fast_clear_<wbr>state(const struct intel_mipmap_tree *mt,<br>
+                                   unsigned level, unsigned layer)<br>
+{<br>
+   return mt->fast_clear_state;<br>
+}<br>
+<br>
 static void<br>
 intel_miptree_check_color_<wbr>resolve(const struct intel_mipmap_tree *mt,<br>
                                   unsigned level, unsigned layer)<br>
@@ -2122,6 +2129,45 @@ intel_miptree_check_color_<wbr>resolve(const struct intel_mipmap_tree *mt,<br>
    (void)layer;<br>
 }<br>
<br>
+void<br>
+intel_miptree_set_fast_clear_<wbr>state(struct intel_mipmap_tree *mt,<br>
+                                   unsigned level,<br>
+                                   unsigned first_layer,<br>
+                                   unsigned num_layers,<br>
+                                   enum intel_fast_clear_state new_state)<br>
+{<br>
+   intel_miptree_check_color_<wbr>resolve(mt, level, first_layer);<br>
+<br>
+   assert(first_layer + num_layers <= mt->physical_depth0);<br>
+<br>
+   mt->fast_clear_state = new_state;<br>
+}<br>
+<br>
+void<br>
+intel_miptree_used_for_<wbr>rendering(const struct brw_context *brw,<br>
+                                 struct intel_mipmap_tree *mt, unsigned level,<br>
+                                 unsigned start_layer, unsigned num_layers)<br>
+{<br>
+   const bool is_lossless_compressed =<br>
+      intel_miptree_is_lossless_<wbr>compressed(brw, mt);<br>
+<br>
+   for (unsigned i = 0; i < num_layers; ++i) {<br>
+      const enum intel_fast_clear_state fast_clear_state =<br>
+         intel_miptree_get_fast_clear_<wbr>state(mt, level, start_layer + i);<br>
+<br>
+      /* If the buffer was previously in fast clear state, change it to<br>
+       * unresolved state, since it won't be guaranteed to be clear after<br>
+       * rendering occurs.<br>
+       */<br>
+      if (is_lossless_compressed ||<br>
+          fast_clear_state == INTEL_FAST_CLEAR_STATE_CLEAR) {<br>
+         intel_miptree_set_fast_clear_<wbr>state(<br>
+            mt, level, start_layer + i, 1,<br>
+            INTEL_FAST_CLEAR_STATE_<wbr>UNRESOLVED);<br>
+      }<br>
+   }<br>
+}<br>
+<br>
 bool<br>
 intel_miptree_resolve_color(<wbr>struct brw_context *brw,<br>
                             struct intel_mipmap_tree *mt,<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.h b/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.h<br>
index 57d7b80..44685ca 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.h<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.h<br>
@@ -947,22 +947,25 @@ intel_miptree_all_slices_<wbr>resolve_depth(struct brw_context *brw,<br>
<br>
 /**\}*/<br>
<br>
+enum intel_fast_clear_state<br>
+intel_miptree_get_fast_clear_<wbr>state(const struct intel_mipmap_tree *mt,<br>
+                                   unsigned level, unsigned layer);<br>
+<br>
+void<br>
+intel_miptree_set_fast_clear_<wbr>state(struct intel_mipmap_tree *mt,<br>
+                                   unsigned level,<br>
+                                   unsigned first_layer,<br>
+                                   unsigned num_layers,<br>
+                                   enum intel_fast_clear_state new_state);<br>
+<br>
 /**<br>
  * Update the fast clear state for a miptree to indicate that it has been used<br>
  * for rendering.<br>
  */<br>
-static inline void<br>
+void<br>
 intel_miptree_used_for_<wbr>rendering(const struct brw_context *brw,<br>
-                                 struct intel_mipmap_tree *mt)<br>
-{<br>
-   /* If the buffer was previously in fast clear state, change it to<br>
-    * unresolved state, since it won't be guaranteed to be clear after<br>
-    * rendering occurs.<br>
-    */<br>
-   if (mt->fast_clear_state == INTEL_FAST_CLEAR_STATE_CLEAR ||<br>
-      intel_miptree_is_lossless_<wbr>compressed(brw, mt))<br>
-      mt->fast_clear_state = INTEL_FAST_CLEAR_STATE_<wbr>UNRESOLVED;<br>
-}<br>
+                                 struct intel_mipmap_tree *mt, unsigned level,<br>
+                                 unsigned start_layer, unsigned num_layers);<br></blockquote><div><br></div><div>This hunk doesn't look quite right...<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
 /**<br>
  * Flag values telling color resolve pass which special types of buffers<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.5.5<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>