[Mesa-dev] [PATCH 8/8] i965: Drop mt->levels[].width/height.

Kenneth Graunke kenneth at whitecape.org
Fri Feb 14 17:48:28 PST 2014


On 02/14/2014 03:00 PM, Eric Anholt wrote:
> It often confused people because it was unclear on whether it was the
> physical or logical, and people needed the other one as well.  We can
> recompute it trivially using the minify() macro, clarifying which value is
> being used and making getting the other value obvious.
> ---
>  src/mesa/drivers/dri/i965/brw_blorp.cpp       |  4 +--
>  src/mesa/drivers/dri/i965/brw_clear.c         |  3 +-
>  src/mesa/drivers/dri/i965/brw_tex_layout.c    |  5 ++--
>  src/mesa/drivers/dri/i965/intel_blit.c        |  4 +--
>  src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 40 ++++++++-------------------
>  src/mesa/drivers/dri/i965/intel_mipmap_tree.h |  5 +---
>  src/mesa/drivers/dri/i965/intel_screen.c      |  4 +--
>  7 files changed, 23 insertions(+), 42 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_blorp.cpp b/src/mesa/drivers/dri/i965/brw_blorp.cpp
> index 76537c8..7980013 100644
> --- a/src/mesa/drivers/dri/i965/brw_blorp.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_blorp.cpp
> @@ -68,8 +68,8 @@ brw_blorp_mip_info::set(struct intel_mipmap_tree *mt,
>     this->mt = mt;
>     this->level = level;
>     this->layer = layer;
> -   this->width = mt->level[level].width;
> -   this->height = mt->level[level].height;
> +   this->width = minify(mt->physical_width0, level);
> +   this->height = minify(mt->physical_height0, level);
>  
>     intel_miptree_get_image_offset(mt, level, layer, &x_offset, &y_offset);
>  }
> diff --git a/src/mesa/drivers/dri/i965/brw_clear.c b/src/mesa/drivers/dri/i965/brw_clear.c
> index 1964572..d9a8792 100644
> --- a/src/mesa/drivers/dri/i965/brw_clear.c
> +++ b/src/mesa/drivers/dri/i965/brw_clear.c
> @@ -155,7 +155,8 @@ brw_fast_clear_depth(struct gl_context *ctx)
>         *        width of the map (LOD0) is not multiple of 16, fast clear
>         *        optimization must be disabled.
>         */
> -      if (brw->gen == 6 && (mt->level[depth_irb->mt_level].width % 16) != 0)
> +      if (brw->gen == 6 && (minify(mt->physical_width0,
> +                                   depth_irb->mt_level) % 16) != 0)
>  	 return false;
>        /* FALLTHROUGH */
>  
> diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c b/src/mesa/drivers/dri/i965/brw_tex_layout.c
> index 61a2eba..76044b2 100644
> --- a/src/mesa/drivers/dri/i965/brw_tex_layout.c
> +++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c
> @@ -197,8 +197,7 @@ brw_miptree_layout_2d(struct intel_mipmap_tree *mt)
>     for (unsigned level = mt->first_level; level <= mt->last_level; level++) {
>        unsigned img_height;
>  
> -      intel_miptree_set_level_info(mt, level, x, y, width,
> -				   height, depth);
> +      intel_miptree_set_level_info(mt, level, x, y, depth);
>  
>        img_height = ALIGN(height, mt->align_h);
>        if (mt->compressed)
> @@ -281,7 +280,7 @@ brw_miptree_layout_texture_3d(struct brw_context *brw,
>        if (mt->target == GL_TEXTURE_CUBE_MAP)
>           DL = 6;
>  
> -      intel_miptree_set_level_info(mt, level, 0, 0, WL, HL, DL);
> +      intel_miptree_set_level_info(mt, level, 0, 0, DL);
>  
>        for (unsigned q = 0; q < DL; q++) {
>           unsigned x = (q % (1 << level)) * wL;
> diff --git a/src/mesa/drivers/dri/i965/intel_blit.c b/src/mesa/drivers/dri/i965/intel_blit.c
> index b12ecca..23757f3 100644
> --- a/src/mesa/drivers/dri/i965/intel_blit.c
> +++ b/src/mesa/drivers/dri/i965/intel_blit.c
> @@ -215,10 +215,10 @@ intel_miptree_blit(struct brw_context *brw,
>     intel_miptree_resolve_color(brw, dst_mt);
>  
>     if (src_flip)
> -      src_y = src_mt->level[src_level].height - src_y - height;
> +      src_y = minify(src_mt->physical_height0, src_level) - src_y - height;
>  
>     if (dst_flip)
> -      dst_y = dst_mt->level[dst_level].height - dst_y - height;
> +      dst_y = minify(dst_mt->physical_height0, src_level) - dst_y - height;

This looks like a typo.  Shouldn't this be dst_level?

Assuming you fix that, this series is:
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

(You're welcome to take or ignore my other suggestions.)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140214/69f41975/attachment.pgp>


More information about the mesa-dev mailing list