<p dir="ltr"></p>
<p dir="ltr">On Sep 7, 2016 12:23 PM, "Chad Versace" <<a href="mailto:chadversary@chromium.org">chadversary@chromium.org</a>> wrote:<br>
><br>
> On Fri 02 Sep 2016, Jason Ekstrand wrote:<br>
> > ---<br>
> >Â src/intel/isl/isl.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++--<br>
> >Â 1 file changed, 58 insertions(+), 2 deletions(-)<br>
> ><br>
> > diff --git a/src/intel/isl/isl.c b/src/intel/isl/isl.c<br>
> > index 33e83b1..cb9eb23 100644<br>
> > --- a/src/intel/isl/isl.c<br>
> > +++ b/src/intel/isl/isl.c<br>
> > @@ -1284,6 +1284,63 @@ isl_surf_get_hiz_surf(const struct isl_device *dev,<br>
> >Â Â Â assert(surf->msaa_layout == ISL_MSAA_LAYOUT_NONE ||<br>
> >Â Â Â Â Â Â surf->msaa_layout == ISL_MSAA_LAYOUT_INTERLEAVED);<br>
> ><br>
> > +Â Â /* From the Broadwell PRM Vol. 7, "Hierarchical Depth Buffer":<br>
> > +Â Â *<br>
> > +Â Â *Â Â "The Surface Type, Height, Width, Depth, Minimum Array Element, Render<br>
> > +Â Â *Â Â Target View Extent, and Depth Coordinate Offset X/Y of the<br>
> > +Â Â *Â Â hierarchical depth buffer are inherited from the depth buffer. The<br>
> > +Â Â *Â Â height and width of the hierarchical depth buffer that must be<br>
> > +Â Â *Â Â allocated are computed by the following formulas, where HZ is the<br>
> > +Â Â *Â Â hierarchical depth buffer and Z is the depth buffer. The Z_Height,<br>
> > +Â Â *Â Â Z_Width, and Z_Depth values given in these formulas are those present<br>
> > +Â Â *Â Â in 3DSTATE_DEPTH_BUFFER incremented by one.<br>
> > +Â Â *<br>
> > +Â Â *Â Â "The value of Z_Height and Z_Width must each be multiplied by 2 before<br>
> > +Â Â *Â Â being applied to the table below if Number of Multisamples is set to<br>
> > +Â Â *Â Â NUMSAMPLES_4. The value of Z_Height must be multiplied by 2 and<br>
> > +Â Â *Â Â Z_Width must be multiplied by 4 before being applied to the table<br>
> > +Â Â *Â Â below if Number of Multisamples is set to NUMSAMPLES_8."<br>
> > +Â Â *<br>
> > +Â Â * In the Sky Lake PRM, the second paragraph is replaced with this:<br>
> > +Â Â *<br>
> > +Â Â *Â Â "The Z_Height and Z_Width values must equal those present in<br>
> > +Â Â *Â Â 3DSTATE_DEPTH_BUFFER incremented by one."<br>
> > +Â Â *<br>
> > +Â Â * In other words, on Sandy Bridge through Broadwell, each 128-bit HiX<br>
><br>
> Typo s/HiX/HiZ/<br>
><br>
> > +Â Â * block corresponds to a region of 8x4 samples in the primary depth<br>
> > +  * surface. On Sky Lake, on the other hand, each HiZ block corresponds to<br>
> > +Â Â * a region of 8x4 pixels in the primary depth surface regarldess of the<br>
><br>
> Typo                             ^^^^^^^^^^<br>
><br>
> > +  * number of samples. The dimensions of a HiZ block in both pixes and<br>
><br>
> Typo                                ^^^^^<br>
><br>
> > +Â Â * samples are given in the table below:<br>
> > +Â Â *<br>
> > +Â Â *Â Â Â Â Â Â Â Â Â Â | SNB - BDW |Â Â Â SKL+<br>
> > +Â Â *Â Â Â Â Â Â Â ------------------+-------------<br>
> > +  *        1x | 8 x 4 sa |  8 x 4 sa<br>
> > +Â Â *Â Â Â Â Â Â Â Â MSAA |Â 8 x 4 px |Â Â 8 x 4 px<br>
> > +Â Â *Â Â Â Â Â Â Â ------------------+-------------<br>
> > +  *        2x | 8 x 4 sa | 16 x 4 sa<br>
> > +Â Â *Â Â Â Â Â Â Â Â MSAA |Â 4 x 4 px |Â Â 8 x 4 px<br>
> > +Â Â *Â Â Â Â Â Â Â ------------------+-------------<br>
> > +  *        4x | 8 x 4 sa | 16 x 8 sa<br>
> > +Â Â *Â Â Â Â Â Â Â Â MSAA |Â 4 x 2 px |Â Â 8 x 4 px<br>
> > +Â Â *Â Â Â Â Â Â Â ------------------+-------------<br>
> > +  *        8x | 8 x 4 sa | 32 x 8 sa<br>
> > +Â Â *Â Â Â Â Â Â Â Â MSAA |Â 2 x 2 px |Â Â 8 x 4 px<br>
> > +Â Â *Â Â Â Â Â Â Â ------------------+-------------<br>
> > +  *        16x |  N/A  | 32 x 16 sa<br>
> > +  *        MSAA |  N/A  | 8 x 4 px<br>
> > +Â Â *Â Â Â Â Â Â Â ------------------+-------------<br>
><br>
> THANK YOU THANK YOU THANK YOU.<br>
> You win all the cat gifs [<a href="https://s-media-cache-ak0.pinimg.com/originals/34/71/dc/3471dc5d6443b2af5476ad3dbbca9d7c.jpg">https://s-media-cache-ak0.pinimg.com/originals/34/71/dc/3471dc5d6443b2af5476ad3dbbca9d7c.jpg</a>]</p>
<p dir="ltr">Yeah... This stuff has proven surprisingly difficult to reason about. The table gives us a central spot to write down "the facts" so that future generations of ISL hackers understand what's going on.</p>
<p dir="ltr">> > +Â Â *<br>
> > +Â Â * There are a number of different ways that this discrepency could be<br>
> > +  * handled. The way we have chosen is to simply make MSAA HiZ have the<br>
> > +Â Â * same number of samples as the parent surface pre-Sky Lake and always be<br>
> > +  * single-sampled on Sky Lake and above. Since the block sizes of<br>
> > +Â Â * compressed formats are given in samples, this neatly handles everything<br>
> > +Â Â * without the need for additional HiZ formats with different block sizes<br>
> > +Â Â * on SKL+.<br>
> > +Â Â */<br>
><br>
> This makes perfect sense.<br>
><br>
> > +Â Â const unsigned samples = ISL_DEV_GEN(dev) >= 9 ? 1 : surf->samples;<br>
> > +<br>
> >Â Â Â isl_surf_init(dev, hiz_surf,<br>
> >Â Â Â Â Â Â Â Â Â Â .dim = ISL_SURF_DIM_2D,<br>
> >Â Â Â Â Â Â Â Â Â Â .format = ISL_FORMAT_HIZ,<br>
> > @@ -1292,8 +1349,7 @@ isl_surf_get_hiz_surf(const struct isl_device *dev,<br>
> >Â Â Â Â Â Â Â Â Â Â .depth = 1,<br>
> >Â Â Â Â Â Â Â Â Â Â .levels = surf->levels,<br>
> >Â Â Â Â Â Â Â Â Â Â .array_len = surf->logical_level0_px.array_len,<br>
> > -Â Â Â Â Â Â Â Â Â /* On SKL+, HiZ is always single-sampled */<br>
> > -Â Â Â Â Â Â Â Â Â .samples = ISL_DEV_GEN(dev) >= 9 ? 1 : surf->samples,<br>
> > +Â Â Â Â Â Â Â Â Â .samples = samples,<br>
> >Â Â Â Â Â Â Â Â Â Â .usage = ISL_SURF_USAGE_HIZ_BIT,<br>
> >Â Â Â Â Â Â Â Â Â Â .tiling_flags = ISL_TILING_HIZ_BIT);<br>
> >Â }<br>
> > --<br>
><br>
> Reviewed-by: Chad Versace <<a href="mailto:chadversary@chromium.org">chadversary@chromium.org</a>></p>
<p dir="ltr">Thanks. I'll get the convent typos fixed when I get back to my computer.</p>
<p dir="ltr">--Jason</p>