<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 13, 2016 at 10:36 AM, 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>
> Reviewed-by: Topi Pohjolainen <<a href="mailto:topi.pohjolainen@intel.com">topi.pohjolainen@intel.com</a>><br>
> ---<br>
> src/intel/isl/isl.h | 7 +++++++<br>
> src/intel/isl/isl_surface_state.c | 43 +++++++++++++++++++++++++++++++++++++--<br>
> 2 files changed, 48 insertions(+), 2 deletions(-)<br>
><br>
> diff --git a/src/intel/isl/isl.h b/src/intel/isl/isl.h<br>
> index dfc00d5..8716cbd 100644<br>
> --- a/src/intel/isl/isl.h<br>
> +++ b/src/intel/isl/isl.h<br>
> @@ -899,6 +899,13 @@ struct isl_surf_fill_state_info {<br>
> uint32_t mocs;<br>
><br>
> /**<br>
> + * The auxilary surface or NULL if no auxilary surface is to be used.<br>
> + */<br>
> + const struct isl_surf *aux_surf;<br>
> + enum isl_aux_usage aux_usage;<br>
> + uint64_t aux_address;<br>
> +<br>
> + /**<br>
> * The clear color for this surface<br>
> *<br>
> * Valid values depend on hardware generation.<br>
> diff --git a/src/intel/isl/isl_surface_state.c b/src/intel/isl/isl_surface_state.c<br>
> index c65126d..9ef0042 100644<br>
> --- a/src/intel/isl/isl_surface_state.c<br>
> +++ b/src/intel/isl/isl_surface_state.c<br>
> @@ -84,6 +84,23 @@ static const uint32_t isl_to_gen_multisample_layout[] = {<br>
> [ISL_MSAA_LAYOUT_ARRAY] = MSFMT_MSS,<br>
> };<br>
><br>
> +#if GEN_GEN >= 9<br>
> +static const uint32_t isl_to_gen_aux_mode[] = {<br>
> + [ISL_AUX_USAGE_NONE] = AUX_NONE,<br>
> + [ISL_AUX_USAGE_HIZ] = AUX_HIZ,<br>
> + [ISL_AUX_USAGE_MCS] = AUX_CCS_D,<br>
> + [ISL_AUX_USAGE_CCS_D] = AUX_CCS_D,<br>
> + [ISL_AUX_USAGE_CCS_E] = AUX_CCS_E,<br>
> +};<br>
> +#elif GEN_GEN >= 8<br>
> +static const uint32_t isl_to_gen_aux_mode[] = {<br>
> + [ISL_AUX_USAGE_NONE] = AUX_NONE,<br>
> + [ISL_AUX_USAGE_HIZ] = AUX_HIZ,<br>
> + [ISL_AUX_USAGE_MCS] = AUX_MCS,<br>
> + [ISL_AUX_USAGE_CCS_D] = AUX_MCS,<br>
> +};<br>
> +#endif<br>
<br>
</div></div>Argh! This is where your "table lookup with validation" idea would be<br>
very useful. It would protect against<br>
isl_to_gen_aux_mode[ISL_AUX_USAGE_CCS_E] on gen8.<br>
<br>
Oh well. That improvement can happen later.<br>
<span class=""><br>
> +<br>
> static uint8_t<br>
> get_surftype(enum isl_surf_dim dim, isl_surf_usage_flags_t usage)<br>
> {<br>
> @@ -353,10 +370,32 @@ isl_genX(surf_fill_state_s)(const struct isl_device *dev, void *state,<br>
> s.SurfaceBaseAddress = info->address;<br>
> s.MOCS = info->mocs;<br>
><br>
> +#if GEN_GEN >= 7<br>
> + if (info->aux_surf && info->aux_usage != ISL_AUX_USAGE_NONE) {<br>
> + struct isl_tile_info tile_info;<br>
> + isl_surf_get_tile_info(dev, info->aux_surf, &tile_info);<br>
> + uint32_t pitch_in_tiles =<br>
> + info->aux_surf->row_pitch / tile_info.phys_extent_B.width;<br>
> +<br>
> #if GEN_GEN >= 8<br>
> - s.AuxiliarySurfaceMode = AUX_NONE;<br>
> + assert(GEN_GEN >= 9 || info->aux_usage != ISL_AUX_USAGE_CCS_E);<br>
> + s.AuxiliarySurfacePitch = pitch_in_tiles - 1;<br>
> + /* Auxiliary surfaces in ISL have compressed formats but the hardware<br>
> + * doesn't expect our definition of the compression, it expects qpitch<br>
> + * in units of samples the main surface.<br>
<br>
</span>grammar: ^^^^^^^^^^^^^^^^^<br>
on the main surface<br>
<span class="">> + */<br>
> + s.AuxiliarySurfaceQPitch =<br>
> + isl_surf_get_array_pitch_sa_rows(info->aux_surf);<br>
> + s.AuxiliarySurfaceBaseAddress = info->aux_address;<br>
> + s.AuxiliarySurfaceMode = isl_to_gen_aux_mode[info->aux_usage];<br>
> #else<br>
> - s.MCSEnable = false;<br>
> + assert(info->aux_usage == ISL_AUX_USAGE_MCS ||<br>
> + info->aux_usage == ISL_AUX_USAGE_CCS_D);<br>
> + s.MCSBaseAddress = info->aux_address,<br>
> + s.MCSSurfacePitch = pitch_in_tiles - 1;<br>
> + s.MCSEnable = true;<br>
> +#endif<br>
> + }<br>
> #endif<br>
<br>
</span>I really like how this patch turned out. ISL's auxiliary surface support<br>
is fairly straightforward, especially the SURFACE_STATE parts.<br>
<br>
Fix the little comment mistake, and<br>
Reviewed-by: Chad Versace <<a href="mailto:chad.versace@intel.com">chad.versace@intel.com</a>><br>
<br>
As a tangent, isl should probably acquire a function for filling<br>
3DSTATE_DEPTH_BUFFER, analagous to isl_genX_surf_fill_state().<br>
</blockquote></div><br></div><div class="gmail_extra">And STENCIL_BUFFER and maybe HIER_DEPTH as well. It's all on my TODO list.<br></div></div>