<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>