<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Nov 22, 2016 at 4:02 PM, Jordan Justen <span dir="ltr"><<a href="mailto:jordan.l.justen@intel.com" target="_blank">jordan.l.justen@intel.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 2016-11-22 15:16:45, Jason Ekstrand wrote:<br>
> On Thu, Nov 17, 2016 at 3:27 PM, Jordan Justen <<a href="mailto:jordan.l.justen@intel.com">jordan.l.justen@intel.com</a>><br>
> wrote:<br>
><br>
> Signed-off-by: Jordan Justen <<a href="mailto:jordan.l.justen@intel.com">jordan.l.justen@intel.com</a>><br>
> Cc: Matt Turner <<a href="mailto:mattst88@gmail.com">mattst88@gmail.com</a>><br>
> ---<br>
> src/mesa/drivers/dri/i965/brw_<wbr>blorp.c | 83<br>
> ++++++++++++++++++++++++++++--<wbr>-----<br>
> 1 file changed, 66 insertions(+), 17 deletions(-)<br>
><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 8aab1a7..d66bf14 100644<br>
> --- a/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c<br>
> +++ b/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c<br>
> @@ -39,6 +39,8 @@<br>
><br>
> #define FILE_DEBUG_FLAG DEBUG_BLORP<br>
><br>
> +static const bool isl_hiz_debug_dump = false;<br>
> +<br>
> static void<br>
> brw_blorp_map(const struct blorp_context *blorp,<br>
> const struct blorp_address *blorp_addr,<br>
> @@ -1005,20 +1007,42 @@ brw_blorp_resolve_color(struct brw_context *brw,<br>
> struct intel_mipmap_tree *mt)<br>
> }<br>
><br>
> static void<br>
> -gen6_blorp_hiz_exec(struct brw_context *brw, struct intel_mipmap_tree<br>
> *mt,<br>
> - unsigned int level, unsigned int layer, enum<br>
> blorp_hiz_op op)<br>
> +hiz_dump_blorp_surf(const struct blorp_context *blorp,<br>
> + const struct blorp_surf *surf,<br>
> + const char *opname, const char *when)<br>
><br>
> How is this code different from the other blorp surface dumping code?<br>
> They seem pretty much the same to me.<br>
><br>
<br>
</div></div>Yeah, it is pretty similar, but I didn't add a new public interface to<br>
blorp for dumping a surface.<br></blockquote><div><br></div><div>You've already added all of the mapping functions. It's not that much further.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Does adding a new 'blorp_dump_surf' function sound like the right<br>
idea?<br></blockquote><div><br></div><div>I'd probably call it blorp_surf_dump, but yeah.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I guess that would make it easier to add similar debug features to<br>
other blorp ops (like clears).<br></blockquote><div><br></div><div>Yup<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="HOEnZb"><font color="#888888"><br>
-Jordan<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
><br>
> {<br>
> - assert(intel_miptree_level_<wbr>has_hiz(mt, level));<br>
> -<br>
> - struct isl_surf isl_tmp[2];<br>
> - struct blorp_surf surf;<br>
> - blorp_surf_for_miptree(brw, &surf, mt, true, (1 <<<br>
> ISL_AUX_USAGE_HIZ),<br>
> - &level, layer, 1, isl_tmp);<br>
> + void *map, *aux_map;<br>
> + unsigned int size, aux_size;<br>
> + bool was_mapped, aux_was_mapped;<br>
> + char *basename;<br>
> +<br>
> + blorp->map(blorp, &surf->addr, &map, &size, &was_mapped);<br>
> + if (map == NULL)<br>
> + return;<br>
> +<br>
> + if (surf->aux_addr.buffer) {<br>
> + blorp->map(blorp, &surf->aux_addr, &aux_map, &aux_size,<br>
> &aux_was_mapped);<br>
> + if (aux_map == NULL) {<br>
> + if (!was_mapped)<br>
> + blorp->unmap(blorp, &surf->addr);<br>
> + return;<br>
> + }<br>
> + } else {<br>
> + aux_map = NULL;<br>
> + aux_size = 0;<br>
> + }<br>
><br>
> - struct blorp_batch batch;<br>
> - blorp_batch_init(&brw->blorp, &batch, brw, 0);<br>
> - blorp_gen6_hiz_op(&batch, &surf, level, layer, op);<br>
> - blorp_batch_finish(&batch);<br>
> + basename = ralloc_asprintf(NULL, "%s-%s", opname, when);<br>
> + assert(basename);<br>
> + isl_dump_surf(blorp->isl_dev, surf->surf, map, size,<br>
> + aux_map ? surf->aux_surf : NULL, aux_map, aux_size,<br>
> + basename);<br>
> + ralloc_free(basename);<br>
> +<br>
> + if (!was_mapped)<br>
> + blorp->unmap(blorp, &surf->addr);<br>
> + if (surf->aux_addr.buffer && !aux_was_mapped)<br>
> + blorp->unmap(blorp, &surf->aux_addr);<br>
> }<br>
><br>
> /**<br>
> @@ -1038,25 +1062,50 @@ intel_hiz_exec(struct brw_context *brw, struct<br>
> intel_mipmap_tree *mt,<br>
><br>
> switch (op) {<br>
> case BLORP_HIZ_OP_DEPTH_RESOLVE:<br>
> - opname = "depth resolve";<br>
> + opname = "depth-resolve";<br>
> break;<br>
> case BLORP_HIZ_OP_HIZ_RESOLVE:<br>
> - opname = "hiz ambiguate";<br>
> + opname = "hiz-ambiguate";<br>
> break;<br>
> case BLORP_HIZ_OP_DEPTH_CLEAR:<br>
> - opname = "depth clear";<br>
> + opname = "depth-clear";<br>
> break;<br>
> case BLORP_HIZ_OP_NONE:<br>
> - opname = "noop?";<br>
> + opname = "hiz-noop";<br>
> break;<br>
> }<br>
><br>
> DBG("%s %s to mt %p level %d layer %d\n",<br>
> __func__, opname, mt, level, layer);<br>
><br>
> + intel_miptree_check_level_<wbr>layer(mt, level, layer);<br>
> + intel_miptree_used_for_<wbr>rendering(mt);<br>
> +<br>
> + assert(intel_miptree_level_<wbr>has_hiz(mt, level));<br>
> +<br>
> + struct isl_surf isl_tmp[2];<br>
> + struct blorp_surf surf;<br>
> + struct blorp_batch batch;<br>
> + const bool need_blorp = brw->gen < 8 || isl_hiz_debug_dump;<br>
> +<br>
> + if (need_blorp) {<br>
> + blorp_surf_for_miptree(brw, &surf, mt, true, (1 <<<br>
> ISL_AUX_USAGE_HIZ),<br>
> + &level, layer, 1, isl_tmp);<br>
> + blorp_batch_init(&brw->blorp, &batch, brw, 0);<br>
> + }<br>
> +<br>
> + if (isl_hiz_debug_dump)<br>
> + hiz_dump_blorp_surf(batch.<wbr>blorp, &surf, opname, "before");<br>
> +<br>
> if (brw->gen >= 8) {<br>
> gen8_hiz_exec(brw, mt, level, layer, op);<br>
> } else {<br>
> - gen6_blorp_hiz_exec(brw, mt, level, layer, op);<br>
> + blorp_gen6_hiz_op(&batch, &surf, level, layer, op);<br>
> }<br>
> +<br>
> + if (isl_hiz_debug_dump)<br>
> + hiz_dump_blorp_surf(batch.<wbr>blorp, &surf, opname, "after");<br>
> +<br>
> + if (need_blorp)<br>
> + blorp_batch_finish(&batch);<br>
> }<br>
> --<br>
> 2.10.2<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>
</div></div></blockquote></div><br></div></div>