<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 12, 2016 at 2:36 PM, Chad Versace <span dir="ltr"><<a href="mailto:chad.versace@intel.com" target="_blank">chad.versace@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 Sat 09 Jul 2016, Jason Ekstrand wrote:<br>
> ---<br>
>  src/intel/isl/isl.c  Â  Â  Â  Â  Â  Â  Â  Â | 11 +++++++++++<br>
>  src/intel/isl/isl.h  Â  Â  Â  Â  Â  Â  Â  Â | 17 +++++++++++++++++<br>
>  src/intel/isl/isl_format_layout.csv |  1 +<br>
>  src/intel/isl/isl_gen6.c  Â  Â  Â  Â  Â  |  8 ++++++++<br>
>  src/intel/isl/isl_gen7.c  Â  Â  Â  Â  Â  | 10 +++++++++-<br>
>  src/intel/isl/isl_gen8.c  Â  Â  Â  Â  Â  |  3 ++-<br>
>  6 files changed, 48 insertions(+), 2 deletions(-)<br>
><br>
> diff --git a/src/intel/isl/isl.c b/src/intel/isl/isl.c<br>
> index 8c114a2..9ccdea2 100644<br>
> --- a/src/intel/isl/isl.c<br>
> +++ b/src/intel/isl/isl.c<br>
> @@ -167,6 +167,16 @@ isl_tiling_get_info(const struct isl_device *dev,<br>
>  Â  Â  Â  break;<br>
>  Â  Â }<br>
><br>
> +  Â case ISL_TILING_HIZ:<br>
> +  Â  Â  /* HiZ buffers are required to have ISL_FORMAT_HIZ which is an 8x4<br>
> +  Â  Â  Â * 128bpb format.  The tiling has the same physical dimensions as<br>
> +  Â  Â  Â * Y-tiling but actually has two HiZ columns per Y-tiled column.<br>
> +  Â  Â  Â */<br>
> +  Â  Â  assert(bs == 16);<br>
> +  Â  Â  logical_el = isl_extent2d(16, 16);<br>
> +  Â  Â  phys_B = isl_extent2d(128, 32);<br>
> +  Â  Â  break;<br>
> +<br>
>  Â  Â default:<br>
>  Â  Â  Â  unreachable("not reached");<br>
>  Â  Â } /* end switch */<br>
> @@ -221,6 +231,7 @@ isl_surf_choose_tiling(const struct isl_device *dev,<br>
>  Â  Â  Â  CHOOSE(ISL_TILING_LINEAR);<br>
>  Â  Â }<br>
><br>
> +  Â CHOOSE(ISL_TILING_HIZ);<br>
>  Â  Â CHOOSE(ISL_TILING_Ys);<br>
>  Â  Â CHOOSE(ISL_TILING_Yf);<br>
>  Â  Â CHOOSE(ISL_TILING_Y0);<br>
> diff --git a/src/intel/isl/isl.h b/src/intel/isl/isl.h<br>
> index 85af2d1..9a60bbd 100644<br>
> --- a/src/intel/isl/isl.h<br>
> +++ b/src/intel/isl/isl.h<br>
> @@ -345,6 +345,14 @@ enum isl_format {<br>
>  Â  Â ISL_FORMAT_ASTC_LDR_2D_12X10_FLT16 =  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  638,<br>
>  Â  Â ISL_FORMAT_ASTC_LDR_2D_12X12_FLT16 =  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  639,<br>
><br>
> +  Â /* The formats that follow are internal to ISL and as such don't have an<br>
> +  Â  * explicit number.  We'll just let the C compiler assign it for us.  Any<br>
> +  Â  * actual hardware formats *must* come before these in the list.<br>
> +  Â  */<br>
> +<br>
> +  Â /* Formats for color compression surfaces */<br>
> +  Â ISL_FORMAT_HIZ,<br>
> +<br>
>  Â  Â /* Hardware doesn't understand this out-of-band value */<br>
>  Â  Â ISL_FORMAT_UNSUPPORTED =  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â UINT16_MAX,<br>
>  };<br>
> @@ -392,6 +400,9 @@ enum isl_txc {<br>
>  Â  Â ISL_TXC_ETC1,<br>
>  Â  Â ISL_TXC_ETC2,<br>
>  Â  Â ISL_TXC_ASTC,<br>
> +<br>
> +  Â /* Used for auxiliary surface formats */<br>
> +  Â ISL_TXC_HIZ,<br>
<br>
</div></div>Yes yes yes! It really is a compressed texture format!<br>
<div><div class="h5"><br>
>  };<br>
><br>
>  /**<br>
> @@ -410,6 +421,7 @@ enum isl_tiling {<br>
>  Â  Â ISL_TILING_Y0, /**< Legacy Y tiling */<br>
>  Â  Â ISL_TILING_Yf, /**< Standard 4K tiling. The 'f' means "four". */<br>
>  Â  Â ISL_TILING_Ys, /**< Standard 64K tiling. The 's' means "sixty-four". */<br>
> +  Â ISL_TILING_HIZ, /**< Tiling format for HiZ surfaces */<br>
>  };<br>
><br>
>  /**<br>
> @@ -423,6 +435,7 @@ typedef uint32_t isl_tiling_flags_t;<br>
>  #define ISL_TILING_Y0_BIT  Â  Â  Â  Â  Â  Â  Â  Â (1u << ISL_TILING_Y0)<br>
>  #define ISL_TILING_Yf_BIT  Â  Â  Â  Â  Â  Â  Â  Â (1u << ISL_TILING_Yf)<br>
>  #define ISL_TILING_Ys_BIT  Â  Â  Â  Â  Â  Â  Â  Â (1u << ISL_TILING_Ys)<br>
> +#define ISL_TILING_HIZ_BIT  Â  Â  Â  Â  Â  Â  Â  (1u << ISL_TILING_HIZ)<br>
>  #define ISL_TILING_ANY_MASK  Â  Â  Â  Â  Â  Â  Â (~0u)<br>
>  #define ISL_TILING_NON_LINEAR_MASK  Â  Â  Â  (~ISL_TILING_LINEAR_BIT)<br>
><br>
> @@ -505,6 +518,7 @@ typedef uint64_t isl_surf_usage_flags_t;<br>
>  #define ISL_SURF_USAGE_DISPLAY_FLIP_X_BIT  Â  Â  (1u << 10)<br>
>  #define ISL_SURF_USAGE_DISPLAY_FLIP_Y_BIT  Â  Â  (1u << 11)<br>
>  #define ISL_SURF_USAGE_STORAGE_BIT  Â  Â  Â  Â  Â  Â (1u << 12)<br>
> +#define ISL_SURF_USAGE_HIZ_BIT  Â  Â  Â  Â  Â  Â  Â  Â (1u << 13)<br>
>  /** @} */<br>
><br>
>  /**<br>
> @@ -966,6 +980,9 @@ isl_format_has_bc_compression(enum isl_format fmt)<br>
>  Â  Â case ISL_TXC_ETC2:<br>
>  Â  Â case ISL_TXC_ASTC:<br>
>  Â  Â  Â  return false;<br>
> +<br>
> +  Â case ISL_TXC_HIZ:<br>
> +  Â  Â  unreachable("Should not be called on an aux surface");<br>
>  Â  Â }<br>
><br>
>  Â  Â unreachable("bad texture compression mode");<br>
> diff --git a/src/intel/isl/isl_format_layout.csv b/src/intel/isl/isl_format_layout.csv<br>
> index f90fbe0..3e681e8 100644<br>
> --- a/src/intel/isl/isl_format_layout.csv<br>
> +++ b/src/intel/isl/isl_format_layout.csv<br>
> @@ -314,3 +314,4 @@ ASTC_LDR_2D_10X8_FLT16  Â  Â  , 128, 10,  8,  1, sf16, sf16, sf16, sf16,  Â  Â ,<br>
>  ASTC_LDR_2D_10X10_FLT16  Â  Â , 128, 10, 10,  1, sf16, sf16, sf16, sf16,  Â  Â ,  Â  Â ,  Â  , linear,  astc<br>
>  ASTC_LDR_2D_12X10_FLT16  Â  Â , 128, 12, 10,  1, sf16, sf16, sf16, sf16,  Â  Â ,  Â  Â ,  Â  , linear,  astc<br>
>  ASTC_LDR_2D_12X12_FLT16  Â  Â , 128, 12, 12,  1, sf16, sf16, sf16, sf16,  Â  Â ,  Â  Â ,  Â  , linear,  astc<br>
> +HIZ  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â , 128,  8,  4,  1,  Â  Â ,  Â  Â ,  Â  Â ,  Â  Â ,  Â  Â ,  Â  Â ,  Â  ,  Â  Â  Â ,  Â hiz<br>
<br>
</div></div>TODO: hiz in script<br></blockquote><div><br></div><div>Thanks to the script being rewritten in a *sane* programming language, there's nothing to change.<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"><br>
> diff --git a/src/intel/isl/isl_gen6.c b/src/intel/isl/isl_gen6.c<br>
> index 699aa41..b5050ed 100644<br>
> --- a/src/intel/isl/isl_gen6.c<br>
> +++ b/src/intel/isl/isl_gen6.c<br>
> @@ -89,6 +89,14 @@ gen6_choose_image_alignment_el(const struct isl_device *dev,<br>
>  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â enum isl_msaa_layout msaa_layout,<br>
>  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â struct isl_extent3d *image_align_el)<br>
>  {<br>
> +  Â if (info->format == ISL_FORMAT_HIZ) {<br>
> +  Â  Â  /* HiZ surfaces are always aligned to 8x16 pixels in the primary surface<br>
> +  Â  Â  Â * which works out to 2x2 HiZ elments.<br>
> +  Â  Â  Â */<br>
> +  Â  Â  *image_align_el = isl_extent3d(2, 2, 1);<br>
> +  Â  Â  return;<br>
> +  Â }<br>
> +<br>
>  Â  Â /* Note that the surface's horizontal image alignment is not programmable<br>
>  Â  Â  * on Sandybridge.<br>
>  Â  Â  *<br>
> diff --git a/src/intel/isl/isl_gen7.c b/src/intel/isl/isl_gen7.c<br>
> index d9b0c08..349875f 100644<br>
> --- a/src/intel/isl/isl_gen7.c<br>
> +++ b/src/intel/isl/isl_gen7.c<br>
> @@ -111,7 +111,8 @@ gen7_choose_msaa_layout(const struct isl_device *dev,<br>
>  Â  Â  * In the table above, MSFMT_MSS refers to ISL_MSAA_LAYOUT_ARRAY, and<br>
>  Â  Â  * MSFMT_DEPTH_STENCIL refers to ISL_MSAA_LAYOUT_INTERLEAVED.<br>
>  Â  Â  */<br>
> -  Â if (isl_surf_usage_is_depth_or_stencil(info->usage))<br>
> +  Â if (isl_surf_usage_is_depth_or_stencil(info->usage) ||<br>
> +  Â  Â  Â (info->usage & ISL_SURF_USAGE_HIZ_BIT))<br>
>  Â  Â  Â  require_interleaved = true;<br>
><br>
>  Â  Â /* From the Ivybridge PRM, Volume 4 Part 1 p72, SURFACE_STATE, Multisampled<br>
> @@ -230,6 +231,13 @@ gen7_filter_tiling(const struct isl_device *dev,<br>
>  Â  Â  Â  *flags &= ~ISL_TILING_W_BIT;<br>
>  Â  Â }<br>
><br>
> +  Â /* The HiZ format and tiling always go together */<br>
> +  Â if (info->format == ISL_FORMAT_HIZ) {<br>
> +  Â  Â  *flags &= ISL_TILING_HIZ_BIT;<br>
> +  Â } else {<br>
> +  Â  Â  *flags &= ~ISL_TILING_HIZ_BIT;<br>
> +  Â }<br>
> +<br>
>  Â  Â if (info->usage & (ISL_SURF_USAGE_DISPLAY_ROTATE_90_BIT |<br>
>  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  ISL_SURF_USAGE_DISPLAY_ROTATE_180_BIT |<br>
>  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  ISL_SURF_USAGE_DISPLAY_ROTATE_270_BIT)) {<br>
<br>
</div></div>I believe isl_gen7.c needs more updates:<br>
<br>
  Â  static uint32_t<br>
  Â  gen7_choose_halign_el(const struct isl_device *dev,<br>
  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  const struct isl_surf_init_info *restrict info)<br>
<span class="">  Â  {<br>
  Â +  Â if (info->format == ISL_FORMAT_HIZ)<br>
</span>  Â +  Â  Â  return 2;<br>
  Â +<br>
  Â  Â  Â if (isl_format_is_compressed(info->format))<br>
  Â  Â  Â  Â  return 1;<br>
<br>
  Â  ...<br>
<br>
  Â  static uint32_t<br>
  Â  gen7_choose_valign_el(const struct isl_device *dev,<br>
  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  const struct isl_surf_init_info *restrict info,<br>
  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  enum isl_tiling tiling)<br>
  Â  {<br>
  Â  Â  Â MAYBE_UNUSED bool require_valign2 = false;<br>
  Â  Â  Â bool require_valign4 = false;<br>
<span class=""><br>
  Â +  Â if (info->format == ISL_FORMAT_HIZ)<br>
</span>  Â +  Â  Â  return 2;<br>
  Â +<br>
  Â  Â  Â if (isl_format_is_compressed(info->format))<br>
  Â  Â  Â  Â  return 1;<br>
<span class=""><br>
> diff --git a/src/intel/isl/isl_gen8.c b/src/intel/isl/isl_gen8.c<br>
> index a46427a..62c331c 100644<br>
> --- a/src/intel/isl/isl_gen8.c<br>
> +++ b/src/intel/isl/isl_gen8.c<br>
> @@ -84,7 +84,8 @@ gen8_choose_msaa_layout(const struct isl_device *dev,<br>
>  Â  Â if (isl_format_is_yuv(info->format))<br>
>  Â  Â  Â  return false;<br>
><br>
> -  Â if (isl_surf_usage_is_depth_or_stencil(info->usage))<br>
> +  Â if (isl_surf_usage_is_depth_or_stencil(info->usage) ||<br>
> +  Â  Â  Â (info->usage & ISL_SURF_USAGE_HIZ_BIT))<br>
>  Â  Â  Â  require_interleaved = true;<br>
><br>
>  Â  Â if (require_array && require_interleaved)<br>
<br>
</span>And isl_gen8.c needs the same updates I posted for isl_gen7.c<br>
<br>
Also, isl.c needs an update in this hunk:<br>
<br>
  Â # isl.c<br>
  Â if (isl_surf_usage_is_depth_or_stencil(info->usage)) {<br>
  Â  Â  /* From the Ivybridge PRM >> Volume 1 Part 1: Graphics Core >><br>
  Â  Â  Â * Section <a href="http://6.18.4.7" rel="noreferrer" target="_blank">6.18.4.7</a>: Surface Arrays (p112):<br>
  Â  Â  Â *<br>
  Â  Â  Â *  Â  If Surface Array Spacing is set to ARYSPC_FULL (note that<br>
  Â  Â  Â *  Â  the depth buffer and stencil buffer have an implied value<br>
  Â  Â  Â *  Â  ARYSPC_FULL):<br>
  Â  Â  Â */<br>
  Â  Â  return ISL_ARRAY_PITCH_SPAN_COMPACT;<br>
  Â }<br>
</blockquote></div><br></div></div>