<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 28, 2016 at 12:21 AM, Pohjolainen, Topi <span dir="ltr"><<a href="mailto:topi.pohjolainen@intel.com" target="_blank">topi.pohjolainen@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 Thu, Jul 28, 2016 at 10:10:29AM +0300, Pohjolainen, Topi wrote:<br>
> On Tue, Jul 26, 2016 at 03:02:10PM -0700, Jason Ekstrand wrote:<br>
> > The helper does a full transformation on the surface to turn it into a new<br>
> > 2-D single-layer single-level surface representing the original layer and<br>
> > level in memory.<br>
> > ---<br>
> >  src/mesa/drivers/dri/i965/brw_<wbr>blorp.c | 84 ++++++++++++++++++------------<wbr>-----<br>
> >  1 file changed, 43 insertions(+), 41 deletions(-)<br>
> ><br>
> > diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c b/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c<br>
> > index c8cb41a..8ccb8da 100644<br>
> > --- a/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c<br>
> > +++ b/src/mesa/drivers/dri/i965/<wbr>brw_blorp.c<br>
> > @@ -114,6 +114,46 @@ blorp_get_image_offset_sa(<wbr>struct isl_device *dev, const struct isl_surf *surf,<br>
> >     }<br>
> >  }<br>
> ><br>
> > +static void<br>
> > +surf_apply_level_layer_<wbr>offsets(struct isl_device *dev, struct isl_surf *surf,<br>
> > +                               struct isl_view *view, uint32_t *byte_offset,<br>
> > +                               uint32_t *tile_x_sa, uint32_t *tile_y_sa)<br>
> > +{<br>
> > +   /* This only makes sense for a single level and array slice */<br>
> > +   assert(view->levels == 1 && view->array_len == 1);<br>
> > +<br>
> > +   uint32_t x_offset_sa, y_offset_sa;<br>
> > +   blorp_get_image_offset_sa(dev, surf, view->base_level,<br>
> > +                             view->base_array_layer,<br>
> > +                             &x_offset_sa, &y_offset_sa);<br>
> > +<br>
> > +   isl_tiling_get_intratile_<wbr>offset_sa(dev, surf->tiling, view->format,<br>
> > +                                      surf->row_pitch, x_offset_sa, y_offset_sa,<br>
> > +                                      byte_offset, tile_x_sa, tile_y_sa);<br>
> > +<br>
> > +   /* Now that that's done, we have a very bare 2-D surface */<br>
> > +   surf->dim = ISL_SURF_DIM_2D;<br>
> > +   surf->dim_layout = ISL_DIM_LAYOUT_GEN4_2D;<br>
> > +<br>
> > +   surf->logical_level0_px.width =<br>
> > +      minify(surf->logical_level0_<wbr>px.width, view->base_level);<br>
> > +   surf->logical_level0_px.height =<br>
> > +      minify(surf->logical_level0_<wbr>px.height, view->base_level);<br>
> > +   surf->logical_level0_px.depth = 1;<br>
> > +   surf->logical_level0_px.array_<wbr>len = 1;<br>
> > +   surf->levels = 1;<br>
> > +<br>
> > +   /* Alignment doesn't matter since we have 1 miplevel and 1 array slice so<br>
> > +    * just pick something that works for everybody.<br>
><br>
> I should have commented this in the original patch that introduced this<br>
> explanation. You explained it some time ago that this is needed to prevent<br>
> asserts from firing, but not for anything else - "works for everybody" is a<br>
> little vague.<br>
><br>
> > +    */<br>
> > +   surf->image_alignment_el = isl_extent3d(4, 4, 1);<br>
> > +<br>
> > +   /* TODO: surf->physcal_level0_extent_<wbr>sa? */<br>
> > +<br>
> > +   view->base_level = 0;<br>
> > +   view->base_array_layer = 0;<br>
> > +}<br>
> > +<br>
> >  void<br>
> >  brw_blorp_surface_info_init(<wbr>struct brw_context *brw,<br>
> >                              struct brw_blorp_surface_info *info,<br>
> > @@ -206,20 +246,9 @@ brw_blorp_surface_info_init(<wbr>struct brw_context *brw,<br>
> >     }<br>
> >     }<br>
> ><br>
> > -   uint32_t x_offset, y_offset;<br>
> > -   blorp_get_image_offset_sa(&<wbr>brw->isl_dev, &info->surf,<br>
> > -                             level, layer / layer_multiplier,<br>
> > -                             &x_offset, &y_offset);<br>
> > -<br>
> > -   uint32_t mt_x, mt_y;<br>
> > -   intel_miptree_get_image_<wbr>offset(mt, level, layer, &mt_x, &mt_y);<br>
> > -   assert(mt_x == x_offset && mt_y == y_offset);<br>
> > -<br>
> > -   isl_tiling_get_intratile_<wbr>offset_sa(&brw->isl_dev, info->surf.tiling,<br>
> > -                                      info->view.format,<br>
> > -                                      info->surf.row_pitch, x_offset, y_offset,<br>
> > -                                      &info->bo_offset,<br>
> > -                                      &info->tile_x_sa, &info->tile_y_sa);<br>
> > +   surf_apply_level_layer_<wbr>offsets(&brw->isl_dev, &info->surf, &info->view,<br>
> > +                                  &info->bo_offset,<br>
> > +                                  &info->tile_x_sa, &info->tile_y_sa);<br>
> >  }<br>
> ><br>
> ><br>
> > @@ -345,35 +374,8 @@ brw_blorp_emit_surface_state(<wbr>struct brw_context *brw,<br>
> >     struct isl_surf surf = surface->surf;<br>
> ><br>
> >     /* Stomp surface dimensions and tiling (if needed) with info from blorp */<br>
> > -   surf.dim = ISL_SURF_DIM_2D;<br>
> > -   surf.dim_layout = ISL_DIM_LAYOUT_GEN4_2D;<br>
> >     surf.logical_level0_px.width = surface->width;<br>
> >     surf.logical_level0_px.height = surface->height;<br>
> > -   surf.logical_level0_px.depth = 1;<br>
> > -   surf.logical_level0_px.array_<wbr>len = 1;<br>
> > -   surf.levels = 1;<br>
> > -<br>
> > -   /* Alignment doesn't matter since we have 1 miplevel and 1 array slice so<br>
> > -    * just pick something that works for everybody.<br>
> > -    */<br>
> > -   surf.image_alignment_el = isl_extent3d(4, 4, 1);<br>
> > -<br>
> > -   if (brw->gen == 6 && surf.samples > 1) {<br>
> > -      /* Since gen6 uses INTEL_MSAA_LAYOUT_IMS, width and height are measured<br>
> > -       * in samples.  But SURFACE_STATE wants them in pixels, so we need to<br>
> > -       * divide them each by 2.<br>
> > -       */<br>
> > -      surf.logical_level0_px.width /= 2;<br>
> > -      surf.logical_level0_px.height /= 2;<br>
><br>
> Does this work on its own? While surf_apply_level_layer_<wbr>offsets() sets these<br>
> you still have the original override in place a few lines earlier?<br>
<br>
</div></div>If this was dropped in the next patch of the series that would make sense.<br>
</blockquote></div><br></div><div class="gmail_extra">You're right.  I moved the hunk.<br></div></div>