<p dir="ltr"></p>
<p dir="ltr">On Jul 28, 2016 12:56 PM, "Pohjolainen, Topi" <<a href="mailto:topi.pohjolainen@intel.com">topi.pohjolainen@intel.com</a>> wrote:<br>
><br>
> On Tue, Jul 26, 2016 at 03:11:13PM -0700, Jason Ekstrand wrote:<br>
> > ---<br>
> >  src/mesa/drivers/dri/i965/brw_blorp.c | 43 ++++++++++++++++++++---------------<br>
> >  src/mesa/drivers/dri/i965/brw_blorp.h |  4 ++++<br>
> >  2 files changed, 29 insertions(+), 18 deletions(-)<br>
> ><br>
> > diff --git a/src/mesa/drivers/dri/i965/brw_blorp.c b/src/mesa/drivers/dri/i965/brw_blorp.c<br>
> > index cf1615f..97eddf9 100644<br>
> > --- a/src/mesa/drivers/dri/i965/brw_blorp.c<br>
> > +++ b/src/mesa/drivers/dri/i965/brw_blorp.c<br>
> > @@ -136,8 +136,17 @@ brw_blorp_surface_info_init(struct brw_context *brw,<br>
> >     if (mt->mcs_mt) {<br>
> >        intel_miptree_get_aux_isl_surf(brw, mt, &info->aux_surf,<br>
> >                                       &info->aux_usage);<br>
> > +      info->aux_bo = mt->mcs_mt->bo;<br>
> > +      info->aux_offset = mt->mcs_mt->offset;<br>
> > +<br>
> > +      /* We only really need a clear color if we also have an auxiliary<br>
> > +       * surface.  Without one, it does nothing.<br>
> > +       */<br>
> > +      info->clear_color = intel_miptree_get_isl_clear_color(brw, mt);<br>
> >     } else {<br>
> >        info->aux_usage = ISL_AUX_USAGE_NONE;<br>
> > +      info->aux_bo = NULL;<br>
> > +      info->aux_offset = 0;<br>
><br>
> Could we just do this here instead of overriding in<br>
> brw_blorp_emit_surface_state()?<br>
><br>
>          memset(&info->clear_color, 0, sizeof(clear_color));</p>
<p dir="ltr">That's not a bad idea.</p>
<p dir="ltr">> >     }<br>
> ><br>
> >     info->view = (struct isl_view) {<br>
> > @@ -341,20 +350,17 @@ brw_blorp_emit_surface_state(struct brw_context *brw,<br>
> >        surf.dim = ISL_SURF_DIM_2D;<br>
> >     }<br>
> ><br>
> > -   union isl_color_value clear_color = { .u32 = { 0, 0, 0, 0 } };<br>
> > -<br>
> > -   const struct isl_surf *aux_surf = NULL;<br>
> > -   uint64_t aux_offset = 0;<br>
> > -   if (surface->mt->mcs_mt) {<br>
> > -      aux_surf = &surface->aux_surf;<br>
> > -      assert(surface->mt->mcs_mt->offset == 0);<br>
> > -      aux_offset = surface->mt->mcs_mt->bo->offset64;<br>
> > +   /* Blorp doesn't support HiZ in any of the blit or slow-clear paths */<br>
> > +   enum isl_aux_usage aux_usage = surface->aux_usage;<br>
> > +   if (aux_usage == ISL_AUX_USAGE_HIZ)<br>
> > +      aux_usage = ISL_AUX_USAGE_NONE;<br>
> ><br>
> > -      /* We only really need a clear color if we also have an auxiliary<br>
> > -       * surface.  Without one, it does nothing.<br>
> > -       */<br>
> > -      clear_color = intel_miptree_get_isl_clear_color(brw, surface->mt);<br>
> > -   }<br>
> > +   /* If we don't have an aux surface, the clear color is meaningless.  Don't<br>
> > +    * bother to set it up in the surface state.<br>
> > +    */<br>
> > +   union isl_color_value clear_color = surface->clear_color;<br>
> > +   if (aux_usage == ISL_AUX_USAGE_NONE)<br>
> > +      memset(&clear_color, 0, sizeof(clear_color));<br>
> ><br>
> >     uint32_t surf_offset;<br>
> >     uint32_t *dw = brw_state_batch(brw, AUB_TRACE_SURFACE_STATE,<br>
> > @@ -362,11 +368,12 @@ brw_blorp_emit_surface_state(struct brw_context *brw,<br>
> >                                    &surf_offset);<br>
> ><br>
> >     const uint32_t mocs = is_render_target ? ss_info.rb_mocs : ss_info.tex_mocs;<br>
> > +   uint64_t aux_bo_offset = surface->aux_bo ? surface->aux_bo->offset64 : 0;<br>
> ><br>
> >     isl_surf_fill_state(&brw->isl_dev, dw, .surf = &surf, .view = &surface->view,<br>
> >                         .address = surface->bo->offset64 + surface->offset,<br>
> > -                       .aux_surf = aux_surf, .aux_usage = surface->aux_usage,<br>
> > -                       .aux_address = aux_offset,<br>
> > +                       .aux_surf = &surface->aux_surf, .aux_usage = aux_usage,<br>
> > +                       .aux_address = aux_bo_offset + surface->aux_offset,<br>
> >                         .mocs = mocs, .clear_color = clear_color,<br>
> >                         .x_offset_sa = surface->tile_x_sa,<br>
> >                         .y_offset_sa = surface->tile_y_sa);<br>
> > @@ -378,15 +385,15 @@ brw_blorp_emit_surface_state(struct brw_context *brw,<br>
> >                             dw[ss_info.reloc_dw] - surface->bo->offset64,<br>
> >                             read_domains, write_domain);<br>
> ><br>
> > -   if (aux_surf) {<br>
> > +   if (aux_usage != ISL_AUX_USAGE_NONE) {<br>
> >        /* On gen7 and prior, the bottom 12 bits of the MCS base address are<br>
> >         * used to store other information.  This should be ok, however, because<br>
> >         * surface buffer addresses are always 4K page alinged.<br>
> >         */<br>
> > -      assert((aux_offset & 0xfff) == 0);<br>
> > +      assert((surface->aux_offset & 0xfff) == 0);<br>
> >        drm_intel_bo_emit_reloc(brw-><a href="http://batch.bo">batch.bo</a>,<br>
> >                                surf_offset + ss_info.aux_reloc_dw * 4,<br>
> > -                              surface->mt->mcs_mt->bo,<br>
> > +                              surface->aux_bo,<br>
> >                                dw[ss_info.aux_reloc_dw] & 0xfff,<br>
> >                                read_domains, write_domain);<br>
> >     }<br>
> > diff --git a/src/mesa/drivers/dri/i965/brw_blorp.h b/src/mesa/drivers/dri/i965/brw_blorp.h<br>
> > index 98a9436..d747880 100644<br>
> > --- a/src/mesa/drivers/dri/i965/brw_blorp.h<br>
> > +++ b/src/mesa/drivers/dri/i965/brw_blorp.h<br>
> > @@ -76,8 +76,12 @@ struct brw_blorp_surface_info<br>
> >     uint32_t offset;<br>
> ><br>
> >     struct isl_surf aux_surf;<br>
> > +   drm_intel_bo *aux_bo;<br>
> > +   uint32_t aux_offset;<br>
> >     enum isl_aux_usage aux_usage;<br>
> ><br>
> > +   union isl_color_value clear_color;<br>
> > +<br>
> >     struct isl_view view;<br>
> ><br>
> >     /* Z offset into a 3-D texture or slice of a 2-D array texture. */<br>
> > --<br>
> > 2.5.0.400.gff86faf<br>
> ><br>
> > _______________________________________________<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">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br></p>