[Mesa-dev] [PATCH mesa] isl: use existing util_next_power_of_two function

Ilia Mirkin imirkin at alum.mit.edu
Thu Sep 1 15:57:32 UTC 2016


Oh well look at that. src/intel is actually hooked up to include from
src/gallium/auxiliary. However this would be the first usage of
u_math.h in src/intel and they have a bunch of functions which mirror
functionality in u_math.h, so perhaps they like having copies? Not
sure.

On Thu, Sep 1, 2016 at 11:54 AM, Eric Engestrom
<eric.engestrom at imgtec.com> wrote:
> v3 of the patch had an updated commit message but the actual code was
> that of the v2.
> Use the existing function instead of creating a new one, like the commit
> message says.
>
> Fixes: 2dc6930a5a54c0f586ba ("isl: round format alignment to nearest power of 2")
> CC: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
> CC: Jason Ekstrand <jason at jlekstrand.net>
> CC: Ilia Mirkin <imirkin at alum.mit.edu>
> Signed-off-by: Eric Engestrom <eric.engestrom at imgtec.com>
> ---
>  src/intel/isl/isl.c      | 4 +++-
>  src/intel/isl/isl_priv.h | 9 ---------
>  2 files changed, 3 insertions(+), 10 deletions(-)
>
> diff --git a/src/intel/isl/isl.c b/src/intel/isl/isl.c
> index 0487515..cf547e8 100644
> --- a/src/intel/isl/isl.c
> +++ b/src/intel/isl/isl.c
> @@ -33,6 +33,8 @@
>  #include "isl_gen9.h"
>  #include "isl_priv.h"
>
> +#include "util/u_math.h"
> +
>  void PRINTFLIKE(3, 4) UNUSED
>  __isl_finishme(const char *file, int line, const char *fmt, ...)
>  {
> @@ -1201,7 +1203,7 @@ isl_surf_init_s(const struct isl_device *dev,
>              base_alignment = MAX(base_alignment, fmtl->bpb / 8);
>           }
>        }
> -      base_alignment = isl_round_up_to_power_of_two(base_alignment);
> +      base_alignment = util_next_power_of_two(base_alignment);
>     } else {
>        assert(phys_slice0_sa.w % fmtl->bw == 0);
>        const uint32_t total_w_el = phys_slice0_sa.width / fmtl->bw;
> diff --git a/src/intel/isl/isl_priv.h b/src/intel/isl/isl_priv.h
> index 9867e22..3a7af1a 100644
> --- a/src/intel/isl/isl_priv.h
> +++ b/src/intel/isl/isl_priv.h
> @@ -99,15 +99,6 @@ isl_log2u(uint32_t n)
>  }
>
>  static inline uint32_t
> -isl_round_up_to_power_of_two(uint32_t value)
> -{
> -   if (value <= 1)
> -      return value;
> -
> -   return 1 << (32 - __builtin_clz(value - 1));
> -}
> -
> -static inline uint32_t
>  isl_minify(uint32_t n, uint32_t levels)
>  {
>     if (unlikely(n == 0))
> --
> Cheers,
>   Eric
>


More information about the mesa-dev mailing list