<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 23, 2016 at 7:06 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, Aug 19, 2016 at 09:55:48AM -0700, Jason Ekstrand wrote:<br>
> ---<br>
>  src/mesa/drivers/dri/i965/<wbr>genX_blorp_exec.c | 38 ++++++++++++++++-------------<br>
>  1 file changed, 21 insertions(+), 17 deletions(-)<br>
><br>
> diff --git a/src/mesa/drivers/dri/i965/<wbr>genX_blorp_exec.c b/src/mesa/drivers/dri/i965/<wbr>genX_blorp_exec.c<br>
> index 32a7445..f226255 100644<br>
> --- a/src/mesa/drivers/dri/i965/<wbr>genX_blorp_exec.c<br>
> +++ b/src/mesa/drivers/dri/i965/<wbr>genX_blorp_exec.c<br>
> @@ -61,6 +61,23 @@ blorp_emit_reloc(struct brw_context *brw, void *location,<br>
>     }<br>
>  }<br>
><br>
> +static void<br>
> +blorp_surface_reloc(struct brw_context *brw, uint32_t ss_offset,<br>
> +                    struct blorp_address address, uint32_t delta)<br>
> +{<br>
> +   drm_intel_bo_emit_reloc(brw-><a href="http://batch.bo" rel="noreferrer" target="_blank">b<wbr>atch.bo</a>, ss_offset,<br>
> +                           address.buffer, address.offset + delta,<br>
> +                           address.read_domains, address.write_domain);<br>
> +<br>
> +   uint64_t reloc_val = address.buffer->offset64 + address.offset + delta;<br>
> +   void *reloc_ptr = (void *)brw->batch.map + ss_offset;<br>
> +#if GEN_GEN >= 8<br>
> +   *(uint64_t *)reloc_ptr = reloc_val;<br>
> +#else<br>
> +   *(uint32_t *)reloc_ptr = reloc_val;<br>
> +#endif<br>
> +}<br>
> +<br>
>  static void *<br>
>  blorp_alloc_dynamic_state(<wbr>struct blorp_context *blorp,<br>
>                            enum aub_state_struct_type type,<br>
> @@ -951,24 +968,15 @@ blorp_emit_surface_state(<wbr>struct brw_context *brw,<br>
><br>
>     const uint32_t mocs =<br>
>        is_render_target ? brw->blorp.mocs.rb : brw->blorp.mocs.tex;<br>
> -   uint64_t aux_bo_offset =<br>
> -      surface->aux_addr.buffer ? surface->aux_addr.buffer-><wbr>offset64 : 0;<br>
><br>
>     isl_surf_fill_state(&brw->isl_<wbr>dev, dw, .surf = &surf, .view = &surface->view,<br>
> -                       .address = surface->addr.buffer->offset64 + surface->addr.offset,<br>
>                         .aux_surf = &surface->aux_surf, .aux_usage = aux_usage,<br>
> -                       .aux_address = aux_bo_offset + surface->aux_addr.offset,<br>
<br>
</div></div>Should you have dropped ".address" and ".aux_address" already in the previous<br>
patch?<br>
Otherwise the patch makes sense.<br></blockquote><div><br></div><div>No.  One of the big changes here is that the blorp_surface_reloc helper writes the relocated value into the buffer.  Previously, we were depending on isl to write the value for us and drm_intel_bo_emit_reloc only added the relocation to the list.<br><br></div><div>Maybe that needs to go in the commit message?<br><br></div><div>--Jason<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">
>                         .mocs = mocs, .clear_color = surface->clear_color,<br>
>                         .x_offset_sa = surface->tile_x_sa,<br>
>                         .y_offset_sa = surface->tile_y_sa);<br>
><br>
> -   /* Emit relocation to surface contents */<br>
> -   drm_intel_bo_emit_reloc(brw-><a href="http://batch.bo" rel="noreferrer" target="_blank">b<wbr>atch.bo</a>,<br>
> -                           surf_offset + ss_info.reloc_dw * 4,<br>
> -                           surface->addr.buffer,<br>
> -                           dw[ss_info.reloc_dw] - surface->addr.buffer-><wbr>offset64,<br>
> -                           surface->addr.read_domains,<br>
> -                           surface->addr.write_domain);<br>
> +   blorp_surface_reloc(brw, surf_offset + ss_info.reloc_dw * 4,<br>
> +                       surface->addr, 0);<br>
><br>
>     if (aux_usage != ISL_AUX_USAGE_NONE) {<br>
>        /* On gen7 and prior, the bottom 12 bits of the MCS base address are<br>
> @@ -976,12 +984,8 @@ blorp_emit_surface_state(<wbr>struct brw_context *brw,<br>
>         * surface buffer addresses are always 4K page alinged.<br>
>         */<br>
>        assert((surface->aux_addr.<wbr>offset & 0xfff) == 0);<br>
> -      drm_intel_bo_emit_reloc(brw-><a href="http://batch.bo" rel="noreferrer" target="_blank">b<wbr>atch.bo</a>,<br>
> -                              surf_offset + ss_info.aux_reloc_dw * 4,<br>
> -                              surface->aux_addr.buffer,<br>
> -                              dw[ss_info.aux_reloc_dw] & 0xfff,<br>
> -                              surface->aux_addr.read_<wbr>domains,<br>
> -                              surface->aux_addr.write_<wbr>domain);<br>
> +      blorp_surface_reloc(brw, surf_offset + ss_info.aux_reloc_dw * 4,<br>
> +                          surface->aux_addr, dw[ss_info.aux_reloc_dw]);<br>
>     }<br>
><br>
>     return surf_offset;<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>