<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, May 30, 2017 at 12:40 AM, Pohjolainen, Topi <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"><div class="HOEnZb"><div class="h5">On Fri, May 26, 2017 at 04:30:10PM -0700, Jason Ekstrand wrote:<br>
> The new version now takes a range of levels as well as a range of<br>
> layers.  It should also be a tiny bit faster because it only walks the<br>
> resolve_map list once instead of once per layer.<br>
> ---<br>
>  src/mesa/drivers/dri/i965/brw_<wbr>blorp.c         |  3 +-<br>
>  src/mesa/drivers/dri/i965/brw_<wbr>context.c       |  9 +++---<br>
>  src/mesa/drivers/dri/i965/brw_<wbr>draw.c          |  2 +-<br>
>  src/mesa/drivers/dri/i965/<wbr>intel_blit.c        |  8 ++---<br>
>  src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c | 46 ++++++++++++---------------<br>
>  src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.h |  5 +--<br>
>  6 files changed, 35 insertions(+), 38 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 0b04ea0..96e239a 100644<br>
> --- a/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c<br>
> +++ b/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c<br>
> @@ -225,7 +225,8 @@ blorp_surf_for_miptree(struct brw_context *brw,<br>
>              flags |= INTEL_MIPTREE_IGNORE_CCS_E;<br>
><br>
>           intel_miptree_resolve_color(<wbr>brw, mt,<br>
> -                                     *level, start_layer, num_layers, flags);<br>
> +                                     *level, 1,<br>
> +                                     start_layer, num_layers, flags);<br>
><br>
>           assert(!intel_miptree_has_<wbr>color_unresolved(mt, *level, 1,<br>
>                                                      start_layer, num_layers));<br>
> diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_context.c b/src/mesa/drivers/dri/i965/<wbr>brw_context.c<br>
> index c815a04..10cd5f5 100644<br>
> --- a/src/mesa/drivers/dri/i965/<wbr>brw_context.c<br>
> +++ b/src/mesa/drivers/dri/i965/<wbr>brw_context.c<br>
> @@ -313,9 +313,10 @@ intel_update_state(struct gl_context * ctx, GLuint new_state)<br>
>              intel_renderbuffer(fb->_<wbr>ColorDrawBuffers[i]);<br>
><br>
>           if (irb &&<br>
> -             intel_miptree_resolve_color(<br>
> -                brw, irb->mt, irb->mt_level, irb->mt_layer, irb->layer_count,<br>
> -                INTEL_MIPTREE_IGNORE_CCS_E))<br>
> +             intel_miptree_resolve_color(<wbr>brw, irb->mt,<br>
> +                                         irb->mt_level, 1,<br>
> +                                         irb->mt_layer, irb->layer_count,<br>
> +                                         INTEL_MIPTREE_IGNORE_CCS_E))<br>
>              brw_render_cache_set_check_<wbr>flush(brw, irb->mt->bo);<br>
>        }<br>
>     }<br>
> @@ -1375,7 +1376,7 @@ intel_resolve_for_dri2_flush(<wbr>struct brw_context *brw,<br>
>        if (rb->mt->num_samples <= 1) {<br>
>           assert(rb->mt_layer == 0 && rb->mt_level == 0 &&<br>
>                  rb->layer_count == 1);<br>
> -         intel_miptree_resolve_color(<wbr>brw, rb->mt, 0, 0, 1, 0);<br>
> +         intel_miptree_resolve_color(<wbr>brw, rb->mt, 0, 1, 0, 1, 0);<br>
>        } else {<br>
>           intel_renderbuffer_downsample(<wbr>brw, rb);<br>
>        }<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 611cb86..23a3c6c 100644<br>
> --- a/src/mesa/drivers/dri/i965/<wbr>brw_draw.c<br>
> +++ b/src/mesa/drivers/dri/i965/<wbr>brw_draw.c<br>
> @@ -422,7 +422,7 @@ brw_predraw_set_aux_buffers(<wbr>struct brw_context *brw)<br>
>            !intel_miptree_is_lossless_<wbr>compressed(brw, irb->mt)) {<br>
>           assert(brw->gen >= 8);<br>
><br>
> -         intel_miptree_resolve_color(<wbr>brw, irb->mt, irb->mt_level,<br>
> +         intel_miptree_resolve_color(<wbr>brw, irb->mt, irb->mt_level, 1,<br>
>                                       irb->mt_layer, irb->layer_count, 0);<br>
>        }<br>
>     }<br>
> diff --git a/src/mesa/drivers/dri/i965/<wbr>intel_blit.c b/src/mesa/drivers/dri/i965/<wbr>intel_blit.c<br>
> index b1e1eaa..4d68fcf 100644<br>
> --- a/src/mesa/drivers/dri/i965/<wbr>intel_blit.c<br>
> +++ b/src/mesa/drivers/dri/i965/<wbr>intel_blit.c<br>
> @@ -327,8 +327,8 @@ intel_miptree_blit(struct brw_context *brw,<br>
>      */<br>
>     intel_miptree_slice_resolve_<wbr>depth(brw, src_mt, src_level, src_slice);<br>
>     intel_miptree_slice_resolve_<wbr>depth(brw, dst_mt, dst_level, dst_slice);<br>
> -   intel_miptree_resolve_color(<wbr>brw, src_mt, src_level, src_slice, 1, 0);<br>
> -   intel_miptree_resolve_color(<wbr>brw, dst_mt, dst_level, dst_slice, 1, 0);<br>
> +   intel_miptree_resolve_color(<wbr>brw, src_mt, src_level, 1, src_slice, 1, 0);<br>
> +   intel_miptree_resolve_color(<wbr>brw, dst_mt, dst_level, 1, dst_slice, 1, 0);<br>
>     intel_miptree_slice_set_needs_<wbr>hiz_resolve(dst_mt, dst_level, dst_slice);<br>
><br>
>     if (src_flip)<br>
> @@ -386,8 +386,8 @@ intel_miptree_copy(struct brw_context *brw,<br>
>      */<br>
>     intel_miptree_slice_resolve_<wbr>depth(brw, src_mt, src_level, src_slice);<br>
>     intel_miptree_slice_resolve_<wbr>depth(brw, dst_mt, dst_level, dst_slice);<br>
> -   intel_miptree_resolve_color(<wbr>brw, src_mt, src_level, src_slice, 1, 0);<br>
> -   intel_miptree_resolve_color(<wbr>brw, dst_mt, dst_level, dst_slice, 1, 0);<br>
> +   intel_miptree_resolve_color(<wbr>brw, src_mt, src_level, 1, src_slice, 1, 0);<br>
> +   intel_miptree_resolve_color(<wbr>brw, dst_mt, dst_level, 1, dst_slice, 1, 0);<br>
>     intel_miptree_slice_set_needs_<wbr>hiz_resolve(dst_mt, dst_level, dst_slice);<br>
><br>
>     uint32_t src_image_x, src_image_y;<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 3a4fd89..093f157 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>
> @@ -2165,33 +2165,35 @@ intel_miptree_needs_color_<wbr>resolve(const struct brw_context *brw,<br>
><br>
>  bool<br>
>  intel_miptree_resolve_color(<wbr>struct brw_context *brw,<br>
> -                            struct intel_mipmap_tree *mt, unsigned level,<br>
> -                            unsigned start_layer, unsigned num_layers,<br>
> +                            struct intel_mipmap_tree *mt,<br>
> +                            uint32_t start_level, uint32_t num_levels,<br>
> +                            uint32_t start_layer, uint32_t num_layers,<br>
>                              int flags)<br>
>  {<br>
> -   intel_miptree_check_color_<wbr>resolve(brw, mt, level, start_layer);<br>
> +   intel_miptree_check_color_<wbr>resolve(brw, mt, start_level, start_layer);<br>
><br>
>     if (!intel_miptree_needs_color_<wbr>resolve(brw, mt, flags))<br>
>        return false;<br>
><br>
> -   /* Arrayed fast clear is only supported for gen8+. */<br>
> -   assert(brw->gen >= 8 || num_layers == 1);<br>
<br>
</div></div>You keep this I think?<br>
<span class=""><br>
> -<br>
>     bool resolved = false;<br>
> -   for (unsigned i = 0; i < num_layers; ++i) {<br>
> -      intel_miptree_check_level_<wbr>layer(mt, level, start_layer + i);<br>
> +   foreach_list_typed_safe(struct intel_resolve_map, map, link,<br>
> +                           &mt->color_resolve_map) {<br>
> +      if (map->level < start_level ||<br>
> +          map->level >= (start_level + num_levels) ||<br>
> +          map->layer < start_layer ||<br>
> +          map->layer >= (start_layer + num_layers))<br>
> +         continue;<br>
><br>
> -      struct intel_resolve_map *item =<br>
> -         intel_resolve_map_get(&mt-><wbr>color_resolve_map, level,<br>
> -                               start_layer + i);<br>
> +      /* Arrayed fast clear is only supported for gen8+. */<br>
<br>
</span>Original (a dozen lines earlier) checked for num_layers. Maybe:<br>
<br>
         /* Mipmapped fast clear is only supported for gen8+. */<br>
<div><div class="h5"><br>
> +      assert(brw->gen >= 8 || map->level == 0);<br></div></div></blockquote><div><br></div><div>Actually, I think I want "assert(brw->gen >= 8 || (map->level == 0 && map->layer == 0))"<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
><br>
> -      if (item) {<br>
> -         assert(item->fast_clear_state != INTEL_FAST_CLEAR_STATE_<wbr>RESOLVED);<br>
> +      intel_miptree_check_level_<wbr>layer(mt, map->level, map->layer);<br>
><br>
> -         brw_blorp_resolve_color(brw, mt, level, start_layer);<br>
> -         intel_resolve_map_remove(item)<wbr>;<br>
> -         resolved = true;<br>
> -      }<br>
> +      assert(map->fast_clear_state != INTEL_FAST_CLEAR_STATE_<wbr>RESOLVED);<br>
> +<br>
> +      brw_blorp_resolve_color(brw, mt, map->level, map->layer);<br>
> +      intel_resolve_map_remove(map);<br>
> +      resolved = true;<br>
>     }<br>
><br>
>     return resolved;<br>
> @@ -2202,16 +2204,8 @@ intel_miptree_all_slices_<wbr>resolve_color(struct brw_context *brw,<br>
>                                         struct intel_mipmap_tree *mt,<br>
>                                         int flags)<br>
>  {<br>
> -   if (!intel_miptree_needs_color_<wbr>resolve(brw, mt, flags))<br>
> -      return;<br>
> -<br>
> -   foreach_list_typed_safe(struct intel_resolve_map, map, link,<br>
> -                           &mt->color_resolve_map) {<br>
> -      assert(map->fast_clear_state != INTEL_FAST_CLEAR_STATE_<wbr>RESOLVED);<br>
><br>
> -      brw_blorp_resolve_color(brw, mt, map->level, map->layer);<br>
> -      intel_resolve_map_remove(map);<br>
> -   }<br>
> +   intel_miptree_resolve_color(<wbr>brw, mt, 0, UINT32_MAX, 0, UINT32_MAX, flags);<br>
>  }<br>
><br>
>  /**<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 8c82094..ffcedef 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>
> @@ -902,8 +902,9 @@ intel_miptree_used_for_<wbr>rendering(const struct brw_context *brw,<br>
><br>
>  bool<br>
>  intel_miptree_resolve_color(<wbr>struct brw_context *brw,<br>
> -                            struct intel_mipmap_tree *mt, unsigned level,<br>
> -                            unsigned start_layer, unsigned num_layers,<br>
> +                            struct intel_mipmap_tree *mt,<br>
> +                            uint32_t start_level, uint32_t num_levels,<br>
> +                            uint32_t start_layer, uint32_t num_layers,<br>
>                              int flags);<br>
><br>
>  void<br>
> --<br>
> 2.5.0.400.gff86faf<br>
><br>
</div></div>> ______________________________<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>
</blockquote></div><br></div></div>