<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jul 11, 2016 at 8:04 AM, Pohjolainen, Topi <span dir="ltr"><<a href="mailto:topi.pohjolainen@intel.com" target="_blank">topi.pohjolainen@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, Jul 09, 2016 at 12:17:20PM -0700, Jason Ekstrand wrote:<br>
> ---<br>
>  src/intel/isl/isl.c | 52 +++++++++++++++++++++++++---------------------------<br>
>  1 file changed, 25 insertions(+), 27 deletions(-)<br>
><br>
> diff --git a/src/intel/isl/isl.c b/src/intel/isl/isl.c<br>
> index decba3d..6f57ac2 100644<br>
> --- a/src/intel/isl/isl.c<br>
> +++ b/src/intel/isl/isl.c<br>
> @@ -933,21 +933,21 @@ isl_calc_row_pitch(const struct isl_device *dev,<br>
>  }<br>
><br>
>  /**<br>
> - * Calculate the surface's total height, including padding, in units of<br>
> - * surface elements.<br>
> + * Calculate and apply any padding required for the surface.<br>
> + *<br>
> + * @param[inout] total_h_el is updated with the new height<br>
> + * @param[out] pad_bytes is overwritten with additional padding requirements.<br>
>   */<br>
> -static uint32_t<br>
> -isl_calc_total_height_el(const struct isl_device *dev,<br>
> -                         const struct isl_surf_init_info *restrict info,<br>
> -                         const struct isl_tile_info *tile_info,<br>
> -                         uint32_t phys_array_len,<br>
> -                         uint32_t row_pitch,<br>
> -                         uint32_t array_pitch_el_rows)<br>
> +static void<br>
> +isl_apply_surface_padding(const struct isl_device *dev,<br>
> +                          const struct isl_surf_init_info *restrict info,<br>
> +                          const struct isl_tile_info *tile_info,<br>
> +                          uint32_t *total_h_el,<br>
> +                          uint32_t *pad_bytes)<br>
>  {<br>
>     const struct isl_format_layout *fmtl = isl_format_get_layout(info->format);<br>
><br>
> -   uint32_t total_h_el = phys_array_len * array_pitch_el_rows;<br>
> -   uint32_t pad_bytes = 0;<br>
> +   *pad_bytes = 0;<br>
><br>
>     /* From the Broadwell PRM >> Volume 5: Memory Views >> Common Surface<br>
>      * Formats >> Surface Padding Requirements >> Render Target and Media<br>
> @@ -981,14 +981,14 @@ isl_calc_total_height_el(const struct isl_device *dev,<br>
>      *      is to an even compressed row.<br>
>      */<br>
>     if (isl_format_is_compressed(info->format))<br>
> -      total_h_el = isl_align(total_h_el, 2);<br>
> +      *total_h_el = isl_align(*total_h_el, 2);<br>
><br>
>     /*<br>
>      *    - For cube surfaces, an additional two rows of padding are required<br>
>      *      at the bottom of the surface.<br>
>      */<br>
>     if (info->usage & ISL_SURF_USAGE_CUBE_BIT)<br>
> -      total_h_el += 2;<br>
> +      *total_h_el += 2;<br>
><br>
>     /*<br>
>      *    - For packed YUV, 96 bpt, 48 bpt, and 24 bpt surface formats,<br>
> @@ -998,8 +998,8 @@ isl_calc_total_height_el(const struct isl_device *dev,<br>
>      */<br>
>     if (isl_format_is_yuv(info->format) &&<br>
>         (fmtl->bs == 96 || fmtl->bs == 48|| fmtl->bs == 24)) {<br>
> -      total_h_el += 1;<br>
> -      pad_bytes += 16;<br>
> +      *total_h_el += 1;<br>
> +      *pad_bytes += 16;<br>
>     }<br>
><br>
>     /*<br>
> @@ -1008,7 +1008,7 @@ isl_calc_total_height_el(const struct isl_device *dev,<br>
>      *      required above.<br>
>      */<br>
>     if (tile_info->tiling == ISL_TILING_LINEAR)<br>
> -      pad_bytes += 64;<br>
> +      *pad_bytes += 64;<br>
><br>
>     /* The below text weakens, not strengthens, the padding requirements for<br>
>      * linear surfaces. Therefore we can safely ignore it.<br>
> @@ -1028,7 +1028,7 @@ isl_calc_total_height_el(const struct isl_device *dev,<br>
>     if (ISL_DEV_GEN(dev) >= 9 &&<br>
>         tile_info->tiling == ISL_TILING_LINEAR &&<br>
>         (info->dim == ISL_SURF_DIM_2D || info->dim == ISL_SURF_DIM_3D)) {<br>
> -      total_h_el = isl_align(total_h_el, 4);<br>
> +      *total_h_el = isl_align(*total_h_el, 4);<br>
>     }<br>
><br>
>     /*<br>
> @@ -1038,13 +1038,8 @@ isl_calc_total_height_el(const struct isl_device *dev,<br>
>     if (ISL_DEV_GEN(dev) >= 9 &&<br>
>         tile_info->tiling == ISL_TILING_LINEAR &&<br>
>         info->dim == ISL_SURF_DIM_1D) {<br>
> -      total_h_el += 4;<br>
> +      *total_h_el += 4;<br>
>     }<br>
> -<br>
> -   /* Be sloppy. Align any leftover padding to a row boundary. */<br>
> -   total_h_el += isl_align_div_npot(pad_bytes, row_pitch);<br>
> -<br>
> -   return total_h_el;<br>
>  }<br>
><br>
>  bool<br>
> @@ -1108,10 +1103,13 @@ isl_surf_init_s(const struct isl_device *dev,<br>
>                                     array_pitch_span, &image_align_sa,<br>
>                                     &phys_level0_sa, &phys_slice0_sa);<br>
><br>
> -   const uint32_t total_h_el =<br>
> -      isl_calc_total_height_el(dev, info, &tile_info,<br>
> -                               phys_level0_sa.array_len, row_pitch,<br>
> -                               array_pitch_el_rows);<br>
> +   uint32_t total_h_el = phys_level0_sa.array_len * array_pitch_el_rows;<br>
> +<br>
> +   uint32_t pad_bytes;<br>
> +   isl_apply_surface_padding(dev, info, &tile_info, &total_h_el, &pad_bytes);<br>
> +<br>
> +   /* Be sloppy. Align any leftover padding to a row boundary. */<br>
> +   total_h_el += isl_align_div_npot(pad_bytes, row_pitch);<br>
<br>
</div></div>Am I reading this correctly that this is non-functional change?<br></blockquote><div><br></div><div>Should be.  Perhaps I should change the subect to "Refactor" rather than "rework"<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class=""><br>
><br>
>     const uint32_t size =<br>
>        row_pitch * isl_align(total_h_el, tile_info.height);<br>
> --<br>
> 2.5.0.400.gff86faf<br>
><br>
</span>> _______________________________________________<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>
</blockquote></div><br></div></div>