<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 14, 2016 at 3:45 PM, Nanley Chery <span dir="ltr"><<a href="mailto:nanleychery@gmail.com" target="_blank">nanleychery@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Sat, Jul 09, 2016 at 12:17:28PM -0700, Jason Ekstrand wrote:<br>
</span><div><div class="h5">> ---<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>
</div></div>Why is HiZ a color compression surface instead of a depth compression<br>
surface?<br></blockquote><div><br></div><div>Aux surfaces then? It's not really "color" compression...<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>
> +<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>
><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>
> 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>
<br>
</div></div>Higher up in this function, HiZ will be recognized as an compressed<br>
texture, and the msaa_layout function will bail. The recognition occurs<br>
because in isl_format_layout.csv, HIZ has the txc field set. I'll send<br>
a patch that moves the compressed texture check below this hunk.<br></blockquote><div><br></div><div>I've been thinking about this and I think we want make is_compressed return false for aux surfaces. I'm not sure exactly how we want to do this. One option would be to add a ISL_TXC_FIRST_AUX enum and check for txc != ISL_TXC_NONE && txc < ISL_TXC_FIRST_AUX.<br><br></div><div>--Jason<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="HOEnZb"><font color="#888888"><br>
- Nanley<br>
</font></span><div class="HOEnZb"><div class="h5"><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>
> 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>
> 2.5.0.400.gff86faf<br>
><br>
</div></div><div class="HOEnZb"><div class="h5">> _______________________________________________<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" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</div></div></blockquote></div><br></div></div>