<p dir="ltr"></p>
<p dir="ltr">On Oct 9, 2016 10:48 PM, "Pohjolainen, Topi" <<a href="mailto:topi.pohjolainen@gmail.com">topi.pohjolainen@gmail.com</a>> wrote:<br>
><br>
> On Fri, Oct 07, 2016 at 09:41:08PM -0700, Jason Ekstrand wrote:<br>
> > Signed-off-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br>
> > ---<br>
> > src/intel/blorp/blorp.h | 10 ++++++++<br>
> > src/intel/blorp/blorp_clear.c | 58 +++++++++++++++++++++++++++++++++++++++++++<br>
> > 2 files changed, 68 insertions(+)<br>
> ><br>
> > diff --git a/src/intel/blorp/blorp.h b/src/intel/blorp/blorp.h<br>
> > index 480f1bb..263d194 100644<br>
> > --- a/src/intel/blorp/blorp.h<br>
> > +++ b/src/intel/blorp/blorp.h<br>
> > @@ -134,6 +134,16 @@ blorp_clear(struct blorp_batch *batch,<br>
> > const bool color_write_disable[4]);<br>
> ><br>
> > void<br>
> > +blorp_clear_depth_stencil(struct blorp_batch *batch,<br>
> > + const struct blorp_surf *depth,<br>
> > + const struct blorp_surf *stencil,<br>
> > + uint32_t level, uint32_t start_layer,<br>
> > + uint32_t num_layers,<br>
> > + uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1,<br>
> > + bool clear_depth, float depth_value,<br>
> > + bool clear_stencil, uint8_t stencil_value);<br>
> > +<br>
> > +void<br>
> > blorp_ccs_resolve(struct blorp_batch *batch,<br>
> > struct blorp_surf *surf, enum isl_format format);<br>
> ><br>
> > diff --git a/src/intel/blorp/blorp_clear.c b/src/intel/blorp/blorp_clear.c<br>
> > index a8f29fd..1d6bf1c 100644<br>
> > --- a/src/intel/blorp/blorp_clear.c<br>
> > +++ b/src/intel/blorp/blorp_clear.c<br>
> > @@ -306,6 +306,64 @@ blorp_clear(struct blorp_batch *batch,<br>
> > }<br>
> ><br>
> > void<br>
> > +blorp_clear_depth_stencil(struct blorp_batch *batch,<br>
> > + const struct blorp_surf *depth,<br>
> > + const struct blorp_surf *stencil,<br>
> > + uint32_t level, uint32_t start_layer,<br>
> > + uint32_t num_layers,<br>
> > + uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1,<br>
> > + bool clear_depth, float depth_value,<br>
> > + bool clear_stencil, uint8_t stencil_value)<br>
> > +{<br>
> > + struct blorp_params params;<br>
> > + blorp_params_init(¶ms);<br>
> > +<br>
> > + params.x0 = x0;<br>
> > + params.y0 = y0;<br>
> > + params.x1 = x1;<br>
> > + params.y1 = y1;<br>
> > +<br>
> > + while (num_layers > 0) {<br>
> > + params.num_layers = num_layers;<br>
> > +<br>
> > + if (clear_stencil) {<br>
> > + brw_blorp_surface_info_init(batch->blorp, ¶ms.stencil, stencil,<br>
> > + level, start_layer,<br>
> > + ISL_FORMAT_UNSUPPORTED, true);<br>
> > + params.stencil_ref = stencil_value;<br>
> > +<br>
> > + params.dst.surf.samples = params.stencil.surf.samples;<br>
> > + params.dst.surf.logical_level0_px =<br>
> > + params.stencil.surf.logical_level0_px;<br>
> > +<br>
> > + if (params.stencil.view.array_len < params.num_layers)<br>
> > + params.num_layers = params.stencil.view.array_len;<br>
> > + }<br>
> > +<br>
> > + if (clear_depth) {<br>
> > + brw_blorp_surface_info_init(batch->blorp, ¶ms.depth, depth,<br>
> > + level, start_layer,<br>
> > + ISL_FORMAT_UNSUPPORTED, true);<br>
> > + params.z = depth_value;<br>
> > + params.depth_format =<br>
> > + isl_format_get_depth_format(depth->surf->format, false);<br>
> > +<br>
> > + params.dst.surf.samples = params.depth.surf.samples;<br>
> > + params.dst.surf.logical_level0_px =<br>
> > + params.depth.surf.logical_level0_px;<br>
> > +<br>
> > + if (params.depth.view.array_len < params.num_layers)<br>
> > + params.num_layers = params.depth.view.array_len;<br>
><br>
> Stencil already does the same, could we add an assert here:<br>
><br>
> assert(!clear_stencil ||<br>
> params.depth.view.array_len ==<br>
> params.stencil.view.array_len)</p>
<p dir="ltr">Sure.</p>
<p dir="ltr">><br>
> Moreover, I thought that start_layer + num_layers <= view.array_len should<br>
> always apply. You seem to explicitly prepare for that not to hold. Could you<br>
> give an example?</p>
<p dir="ltr">I had to do this recently with the other clears as well. Sandy Bridge has a max of 512 layers for rendering. In the surface_info_init function, we clamp as needed and this ensures that 16k-slice textures get 32 draw calls.</p>
<p dir="ltr">> > + }<br>
> > +<br>
> > + batch->blorp->exec(batch, ¶ms);<br>
> > +<br>
> > + start_layer += params.num_layers;<br>
> > + num_layers -= params.num_layers;<br>
> > + }<br>
> > +}<br>
> > +<br>
> > +void<br>
> > blorp_ccs_resolve(struct blorp_batch *batch,<br>
> > struct blorp_surf *surf, enum isl_format format)<br>
> > {<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>