<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 23, 2016 at 10:13 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 Wed, Nov 23, 2016 at 09:26:29AM -0800, Jason Ekstrand wrote:<br>
> General comment: Does it make sense to squash this with the previous<br>
> patch? I'm fine either way.<br>
> On Wed, Nov 23, 2016 at 1:16 AM, Topi Pohjolainen<br>
</span>> <[1]<a href="mailto:topi.pohjolainen@gmail.com">topi.pohjolainen@gmail.com</a><wbr>> wrote:<br>
><br>
> 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 | 15 +++++++++------<br>
> src/mesa/drivers/dri/i965/brw_<wbr>blorp.h | 3 ++-<br>
> src/mesa/drivers/dri/i965/brw_<wbr>context.c | 14 +++++++++-----<br>
> src/mesa/drivers/dri/i965/<wbr>intel_blit.c | 4 ++--<br>
> src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c | 27<br>
> +++++++++++++++++++++++++--<br>
> src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.h | 1 +<br>
> 6 files changed, 48 insertions(+), 16 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 9a849f5..99df21e 100644<br>
> --- a/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c<br>
> +++ b/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c<br>
> @@ -213,7 +213,10 @@ blorp_surf_for_miptree(struct brw_context *brw,<br>
> if (safe_aux_usage & (1 << ISL_AUX_USAGE_CCS_E))<br>
> flags |= INTEL_MIPTREE_IGNORE_CCS_E;<br>
> - intel_miptree_resolve_color(<wbr>brw, mt, flags);<br>
> + for (unsigned i = 0; i < num_layers; i++) {<br>
> + intel_miptree_resolve_color(<wbr>brw, mt,<br>
> + *level, start_layer + i,<br>
> flags);<br>
> + }<br>
> assert(mt->fast_clear_state == INTEL_FAST_CLEAR_STATE_<br>
> RESOLVED);<br>
> surf->aux_usage = ISL_AUX_USAGE_NONE;<br>
> @@ -942,19 +945,19 @@ brw_blorp_clear_color(struct brw_context *brw,<br>
> struct gl_framebuffer *fb,<br>
> }<br>
> void<br>
> -brw_blorp_resolve_color(<wbr>struct brw_context *brw, struct<br>
> intel_mipmap_tree *mt)<br>
> +brw_blorp_resolve_color(<wbr>struct brw_context *brw, struct<br>
> intel_mipmap_tree *mt,<br>
> + unsigned level, unsigned layer)<br>
> {<br>
> - DBG("%s to mt %p\n", __FUNCTION__, mt);<br>
> + DBG("%s to mt %p level %u layer %u\n", __FUNCTION__, mt, level,<br>
> layer);<br>
> const mesa_format format = _mesa_get_srgb_format_linear(<br>
> mt->format);<br>
> struct isl_surf isl_tmp[2];<br>
> struct blorp_surf surf;<br>
> - unsigned level = 0;<br>
> blorp_surf_for_miptree(brw, &surf, mt, true,<br>
> (1 << ISL_AUX_USAGE_CCS_E) |<br>
> (1 << ISL_AUX_USAGE_CCS_D),<br>
> - &level, 0 /* start_layer */, 1 /*<br>
> num_layers */,<br>
> + &level, layer, 1 /* num_layers */,<br>
> isl_tmp);<br>
> enum blorp_fast_clear_op resolve_op;<br>
> @@ -971,7 +974,7 @@ brw_blorp_resolve_color(struct brw_context *brw,<br>
> struct intel_mipmap_tree *mt)<br>
> struct blorp_batch batch;<br>
> blorp_batch_init(&brw->blorp, &batch, brw, 0);<br>
> - blorp_ccs_resolve(&batch, &surf, 0 /* level */, 0 /* layer */,<br>
> + blorp_ccs_resolve(&batch, &surf, level, layer,<br>
> brw_blorp_to_isl_format(brw, format, true),<br>
> resolve_op);<br>
> blorp_batch_finish(&batch);<br>
> diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_blorp.h<br>
> b/src/mesa/drivers/dri/i965/<wbr>brw_blorp.h<br>
> index abf3956..277b00e 100644<br>
> --- a/src/mesa/drivers/dri/i965/<wbr>brw_blorp.h<br>
> +++ b/src/mesa/drivers/dri/i965/<wbr>brw_blorp.h<br>
> @@ -64,7 +64,8 @@ brw_blorp_clear_color(struct brw_context *brw,<br>
> struct gl_framebuffer *fb,<br>
> void<br>
> brw_blorp_resolve_color(struct brw_context *brw,<br>
> - struct intel_mipmap_tree *mt);<br>
> + struct intel_mipmap_tree *mt,<br>
> + unsigned level, unsigned layer);<br>
><br>
> Would it be better to make this start_layer and num_layers and do the<br>
> looping in blorp?<br>
<br>
</div></div>Sounds good to me.<br>
<span class=""><br>
><br>
> void<br>
> intel_hiz_exec(struct brw_context *brw, struct intel_mipmap_tree<br>
> *mt,<br>
> diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_context.c<br>
> b/src/mesa/drivers/dri/i965/<wbr>brw_context.c<br>
> index 3f88f7f..b0e762b 100644<br>
> --- a/src/mesa/drivers/dri/i965/<wbr>brw_context.c<br>
> +++ b/src/mesa/drivers/dri/i965/<wbr>brw_context.c<br>
> @@ -316,8 +316,9 @@ intel_update_state(struct gl_context * ctx,<br>
> GLuint new_state)<br>
> intel_renderbuffer(fb->_<wbr>ColorDrawBuffers[i]);<br>
> if (irb &&<br>
> - intel_miptree_resolve_color(<wbr>brw, irb->mt,<br>
> -<br>
> INTEL_MIPTREE_IGNORE_CCS_E))<br>
> + intel_miptree_resolve_color(<br>
> + brw, irb->mt, irb->mt_level, irb->mt_layer,<br>
> + INTEL_MIPTREE_IGNORE_CCS_E))<br>
><br>
> Do you need to loop here?<br>
<br>
</span>Let me check, I think you might be right.<br>
<div><div class="h5"><br>
><br>
> brw_render_cache_set_check_<wbr>flush(brw, irb->mt->bo);<br>
> }<br>
> }<br>
> @@ -1349,10 +1350,13 @@ intel_resolve_for_dri2_flush(<wbr>struct<br>
> brw_context *brw,<br>
> rb = intel_get_renderbuffer(fb, buffers[i]);<br>
> if (rb == NULL || rb->mt == NULL)<br>
> continue;<br>
> - if (rb->mt->num_samples <= 1)<br>
> - intel_miptree_resolve_color(<wbr>brw, rb->mt, 0);<br>
> - else<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, 0);<br>
> + } else {<br>
> intel_renderbuffer_downsample(<wbr>brw, rb);<br>
> + }<br>
> }<br>
> }<br>
> diff --git a/src/mesa/drivers/dri/i965/<wbr>intel_blit.c<br>
> b/src/mesa/drivers/dri/i965/<wbr>intel_blit.c<br>
> index 7e97fbc..a4e1216 100644<br>
> --- a/src/mesa/drivers/dri/i965/<wbr>intel_blit.c<br>
> +++ b/src/mesa/drivers/dri/i965/<wbr>intel_blit.c<br>
> @@ -294,8 +294,8 @@ intel_miptree_blit(struct brw_context *brw,<br>
> */<br>
> intel_miptree_slice_resolve_<wbr>depth(brw, src_mt, src_level,<br>
> src_slice);<br>
> intel_miptree_slice_resolve_<wbr>depth(brw, dst_mt, dst_level,<br>
> dst_slice);<br>
> - intel_miptree_resolve_color(<wbr>brw, src_mt, 0);<br>
> - intel_miptree_resolve_color(<wbr>brw, dst_mt, 0);<br>
> + intel_miptree_resolve_color(<wbr>brw, src_mt, src_level, src_slice,<br>
> 0);<br>
> + intel_miptree_resolve_color(<wbr>brw, dst_mt, dst_level, dst_slice,<br>
> 0);<br>
> if (src_flip)<br>
> src_y = minify(src_mt->physical_<wbr>height0, src_level -<br>
> src_mt->first_level) - src_y - height;<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 328c770..8482afe 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>
> @@ -2203,12 +2203,35 @@ intel_miptree_all_slices_<br>
> resolve_depth(struct brw_context *brw,<br>
><br>
> BLORP_HIZ_OP_DEPTH_RESOLVE);<br>
> }<br>
> +static void<br>
> +intel_miptree_check_color_<wbr>resolve(const struct intel_mipmap_tree<br>
> *mt,<br>
> + unsigned level, unsigned layer)<br>
> +{<br>
> + if (!mt->mcs_buf)<br>
> + return;<br>
> +<br>
> + /* Fast color clear is not supported for mipmapped surfaces. */<br>
> + assert(level == 0 && mt->first_level == 0 && mt->last_level ==<br>
> 0);<br>
> +<br>
> + /* Compression of arrayed msaa surfaces is supported. */<br>
> + if (mt->num_samples > 1)<br>
> + return;<br>
> +<br>
> + /* Fast color clear is not supported for non-msaa arrays. */<br>
> + assert(layer == 0 && mt->logical_depth0 == 1);<br>
><br>
> Is this a hardware limitation or a software limitation? If it's a<br>
> hardware limitation, I'd like a PRM citation or something to explain<br>
> why. This seems to me like something that should totally be possible.<br>
> If there are any layered rendering tests in the Vulkan CTS (I think<br>
> there are but I'm not sure), then it's definitely possible. I just<br>
> kicked off a Jenkins run to find out.<br>
<br>
</div></div>This is just stating the current state of affairs in the driver just as the<br>
assert a few lines earlier for mip-mapped. Patch "i965/gen8: Relax asserts<br>
prohibiting arrayed/mipmapped fast clears" in the end lifts the assert for<br>
gen8+.<br></blockquote><div><br></div><div>Ok. That makes sense. I just hadn't read far enough yet.<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>
> +<br>
> + (void)level;<br>
> + (void)layer;<br>
> +}<br>
> bool<br>
> intel_miptree_resolve_color(<wbr>struct brw_context *brw,<br>
> struct intel_mipmap_tree *mt,<br>
> + unsigned level, unsigned layer,<br>
> int flags)<br>
> {<br>
> + intel_miptree_check_color_<wbr>resolve(mt, level, layer);<br>
> +<br>
> /* From gen9 onwards there is new compression scheme for single<br>
> sampled<br>
> * surfaces called "lossless compressed". These don't need to be<br>
> always<br>
> * resolved.<br>
> @@ -2227,7 +2250,7 @@ intel_miptree_resolve_color(<wbr>struct brw_context<br>
> *brw,<br>
> /* Fast color clear resolves only make sense for non-MSAA<br>
> buffers. */<br>
> if (mt->msaa_layout == INTEL_MSAA_LAYOUT_NONE ||<br>
> intel_miptree_is_lossless_<wbr>compressed(brw, mt)) {<br>
> - brw_blorp_resolve_color(brw, mt);<br>
> + brw_blorp_resolve_color(brw, mt, level, layer);<br>
> return true;<br>
> } else {<br>
> return false;<br>
> @@ -2242,7 +2265,7 @@ intel_miptree_all_slices_<wbr>resolve_color(struct<br>
> brw_context *brw,<br>
> struct intel_mipmap_tree<br>
> *mt,<br>
> int flags)<br>
> {<br>
> - intel_miptree_resolve_color(<wbr>brw, mt, flags);<br>
> + intel_miptree_resolve_color(<wbr>brw, mt, 0, 0, flags);<br>
> }<br>
> /**<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 80cc876..95d9dad 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>
> @@ -991,6 +991,7 @@ intel_miptree_used_for_<wbr>rendering(const struct<br>
> brw_context *brw,<br>
> bool<br>
> intel_miptree_resolve_color(<wbr>struct brw_context *brw,<br>
> struct intel_mipmap_tree *mt,<br>
> + unsigned level, unsigned layer,<br>
> int flags);<br>
> void<br>
> --<br>
> 2.5.5<br>
> ______________________________<wbr>_________________<br>
> mesa-dev mailing list<br>
</div></div>> [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>