[Mesa-dev] [PATCH 4/5] i965: Make a helper function intel_miptree_can_use_tr_mode()

Ben Widawsky ben at bwidawsk.net
Mon Jun 22 14:56:46 PDT 2015


1-4 (with/without changes) are:
Reviewed-by: Ben Widawsky <ben at bwidawsk.net>

On Wed, Jun 10, 2015 at 03:30:49PM -0700, Anuj Phogat wrote:
> Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
> Cc: Ben Widawsky <ben at bwidawsk.net>
> ---
>  src/mesa/drivers/dri/i965/brw_tex_layout.c | 30 +++++++++++++++++++-----------
>  1 file changed, 19 insertions(+), 11 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c b/src/mesa/drivers/dri/i965/brw_tex_layout.c
> index c185e41..39c6a39 100644
> --- a/src/mesa/drivers/dri/i965/brw_tex_layout.c
> +++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c
> @@ -812,6 +812,23 @@ intel_miptree_release_levels(struct intel_mipmap_tree *mt)
>     }
>  }
>  
> +static bool
> +intel_miptree_can_use_tr_mode(const struct intel_mipmap_tree *mt)
> +{
> +   if (mt->tiling == I915_TILING_Y ||
> +       mt->tiling == (I915_TILING_Y | I915_TILING_X) ||
> +       mt->tr_mode == INTEL_MIPTREE_TRMODE_NONE) {
> +      /* FIXME: Don't allow YS tiling at the moment. Using 64KB tiling
> +       * for small textures might result in to memory wastage. Revisit
> +       * this condition when we have more information about the specific
> +       * cases where using YS over YF will be useful.
> +       */
> +      if (mt->tr_mode != INTEL_MIPTREE_TRMODE_YS)
> +         return true;
> +   }
> +   return false;
> +}
> +
>  void
>  brw_miptree_layout(struct brw_context *brw,
>                     bool for_bo,
> @@ -879,17 +896,8 @@ brw_miptree_layout(struct brw_context *brw,
>        if (is_tr_mode_yf_ys_allowed) {
>           assert(brw->gen >= 9);
>  
> -         if (mt->tiling == I915_TILING_Y ||
> -             mt->tiling == (I915_TILING_Y | I915_TILING_X) ||
> -             mt->tr_mode == INTEL_MIPTREE_TRMODE_NONE) {
> -            /* FIXME: Don't allow YS tiling at the moment. Using 64KB tiling
> -             * for small textures might result in to memory wastage. Revisit
> -             * this condition when we have more information about the specific
> -             * cases where using YS over YF will be useful.
> -             */
> -            if (mt->tr_mode != INTEL_MIPTREE_TRMODE_YS)
> -               return;
> -         }
> +         if (intel_miptree_can_use_tr_mode(mt))
> +            return;
>           /* Failed to use selected tr_mode. Free up the memory allocated
>            * for miptree levels in intel_miptree_total_width_height().
>            */
> -- 
> 1.9.3
> 


More information about the mesa-dev mailing list