[Mesa-dev] [PATCH 10/15] i965/miptree: Add option to resolve offsets using isl_surf

Nanley Chery nanleychery at gmail.com
Fri Jun 16 17:17:14 UTC 2017


On Tue, Jun 13, 2017 at 05:50:08PM +0300, Topi Pohjolainen wrote:
> Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
> ---
>  src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> index c81d345fbc..212dfa30ec 100644
> --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> @@ -1175,6 +1175,22 @@ intel_miptree_get_image_offset(const struct intel_mipmap_tree *mt,
>  			       GLuint level, GLuint slice,
>  			       GLuint *x, GLuint *y)
>  {
> +   if (mt->surf.size > 0) {
> +      uint32_t x_offset_sa, y_offset_sa;
> +

A comment explaining that we need to perform a subtraction because the
ISL surf begins at first_level may be helpful. It took me some digging
to realize why it was needed.

> +      assert(level >= mt->first_level);
> +      level -= mt->first_level;
> +
> +      const unsigned z = mt->surf.dim == ISL_SURF_DIM_3D ? slice : 0;
> +      slice = mt->surf.dim == ISL_SURF_DIM_3D ? 0 : slice;
> +      isl_surf_get_image_offset_sa(&mt->surf, level, slice, z,
> +                                   &x_offset_sa, &y_offset_sa);
> +
> +      *x = x_offset_sa;
> +      *y = y_offset_sa;

I'm assuming that using these intermediate variables avoids casting
warnings?


With or without the code comment, this patch is
Reviewed-by: Nanley Chery <nanley.g.chery at intel.com>

> +      return;
> +   }
> +
>     assert(slice < mt->level[level].depth);
>  
>     *x = mt->level[level].slice[slice].x_offset;
> -- 
> 2.11.0
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list