<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Oct 31, 2016 at 12:35 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"><span class="">On Sat, Oct 29, 2016 at 01:17:16AM -0700, Jason Ekstrand wrote:<br>
> On Tue, Oct 11, 2016 at 12:26 PM, Topi Pohjolainen<br>
</span><span class="">> <[1]<a href="mailto:topi.pohjolainen@gmail.com">topi.pohjolainen@gmail.com</a><wbr>> wrote:<br>
><br>
> This patch also introduces getter and setter for fast clear state<br>
> preparing for tracking the state per slice.<br>
</span>> Signed-off-by: Topi Pohjolainen <[2]<a href="mailto:topi.pohjolainen@intel.com">topi.pohjolainen@intel.com</a><wbr>><br>
<div><div class="h5">> ---<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>
> +++++++++++++++++++++++++++<br>
> src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.h | 25 ++++++++-------<br>
> 4 files changed, 72 insertions(+), 18 deletions(-)<br>
> diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c<br>
> 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>
> 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>
> 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>
> 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,<br>
> dst_layer, 1);<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,<br>
> 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,<br>
> num_layers);<br>
> DBG("%s (slow) to mt %p level %d layer %d+%d\n",<br>
> __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<br>
> 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<br>
> brw_context *brw)<br>
> struct intel_renderbuffer *irb =<br>
> intel_renderbuffer(fb->_<wbr>ColorDrawBuffers[i]);<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,<br>
> irb->mt_layer),<br>
> + irb->layer_count);<br>
> }<br>
> }<br>
> diff --git a/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c<br>
> 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<br>
> brw_context *brw,<br>
><br>
> BLORP_HIZ_OP_DEPTH_RESOLVE);<br>
> }<br>
> +enum intel_fast_clear_state<br>
> +intel_miptree_get_fast_clear_<wbr>state(const struct intel_mipmap_tree<br>
> *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<br>
> *mt,<br>
> unsigned level, unsigned layer)<br>
> @@ -2122,6 +2129,45 @@ intel_miptree_check_color_<wbr>resolve(const<br>
> struct intel_mipmap_tree *mt,<br>
> (void)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<br>
> 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,<br>
> unsigned level,<br>
> + unsigned start_layer, unsigned<br>
> 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<br>
> + i);<br>
> +<br>
> + /* If the buffer was previously in fast clear state, change<br>
> it to<br>
> + * unresolved state, since it won't be guaranteed to be clear<br>
> 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<br>
> 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<br>
> brw_context *brw,<br>
> /**\}*/<br>
> +enum intel_fast_clear_state<br>
> +intel_miptree_get_fast_clear_<wbr>state(const struct intel_mipmap_tree<br>
> *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<br>
> new_state);<br>
> +<br>
> /**<br>
> * Update the fast clear state for a miptree to indicate that it<br>
> 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<br>
> to<br>
> - * unresolved state, since it won't be guaranteed to be clear<br>
> 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,<br>
> unsigned level,<br>
> + unsigned start_layer, unsigned<br>
> num_layers);<br>
><br>
> This hunk doesn't look quite right...<br>
<br>
</div></div>You mean this part changing the inline function to a prototype and adding<br>
argyments? Implementation is now in intel_mipmap_tree.c and has the same<br>
signature. Compiles and runs fine.<br></blockquote><div><br></div><div>Right... That's just a function going from inline to not. I was having trouble parsing the diff. Feel free to ignore it.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class=""><br>
><br>
> /**<br>
> * Flag values telling color resolve pass which special types of<br>
> buffers<br>
> --<br>
> 2.5.5<br>
> ______________________________<wbr>_________________<br>
> mesa-dev mailing list<br>
</span>> [3]<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.<wbr>org</a><br>
> [4]<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.<wbr>org/mailman/listinfo/mesa-dev</a><br>
><br>
> References<br>
><br>
> 1. mailto:<a href="mailto:topi.pohjolainen@gmail.com">topi.pohjolainen@gmail.<wbr>com</a><br>
> 2. mailto:<a href="mailto:topi.pohjolainen@intel.com">topi.pohjolainen@intel.<wbr>com</a><br>
> 3. mailto:<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.<wbr>freedesktop.org</a><br>
> 4. <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>