[Mesa-dev] [PATCH v2 1/2] move u_math to src/util

Juan A. Suarez Romero jasuarez at igalia.com
Wed Oct 24 16:24:10 UTC 2018


On Wed, 2018-09-05 at 14:55 -0700, Dylan Baker wrote:
> Currently we have two sets of functions for bit counts, one in gallium
> and one in core mesa. The ones in core mesa are header only in many
> cases, since they reduce to "#define _mesa_bitcount popcount", but they
> provide a fallback implementation. This is important because 32bit msvc
> doesn't have popcountll, just popcount; so when nir (for example)
> includes the core mesa header it doesn't (and shouldn't) link with core
> mesa. To fix this we'll promote the version out of gallium util, then
> replace the core mesa uses with the util version, since nir (and other
> non-core mesa users) can and do link with mesautils.
> ---


I've noticed this patch has broken "macOs make" target in Travis CI:

https://travis-ci.org/mesa3d/mesa/builds/445588600


Seems that now it can't find some symbols (_util_cpu_caps).


	J.A.

>  src/broadcom/cle/v3d_packet_helpers.h       | 2 +-
>  src/gallium/auxiliary/Makefile.sources      | 2 --
>  src/gallium/auxiliary/meson.build           | 2 --
>  src/gallium/auxiliary/util/u_format.c       | 2 +-
>  src/gallium/auxiliary/util/u_format_bptc.c  | 2 +-
>  src/gallium/auxiliary/util/u_format_latc.c  | 2 +-
>  src/gallium/auxiliary/util/u_format_other.c | 2 +-
>  src/gallium/auxiliary/util/u_format_pack.py | 2 +-
>  src/gallium/auxiliary/util/u_format_rgtc.c  | 2 +-
>  src/gallium/auxiliary/util/u_format_s3tc.c  | 2 +-
>  src/gallium/auxiliary/util/u_format_yuv.h   | 2 +-
>  src/gallium/auxiliary/util/u_format_zs.c    | 2 +-
>  src/util/Makefile.sources                   | 2 ++
>  src/util/meson.build                        | 2 ++
>  src/{gallium/auxiliary => }/util/u_math.c   | 0
>  src/{gallium/auxiliary => }/util/u_math.h   | 2 +-
>  16 files changed, 15 insertions(+), 15 deletions(-)
>  rename src/{gallium/auxiliary => }/util/u_math.c (100%)
>  rename src/{gallium/auxiliary => }/util/u_math.h (99%)
> 
> diff --git a/src/broadcom/cle/v3d_packet_helpers.h b/src/broadcom/cle/v3d_packet_helpers.h
> index f340b790697..c46089a0e60 100644
> --- a/src/broadcom/cle/v3d_packet_helpers.h
> +++ b/src/broadcom/cle/v3d_packet_helpers.h
> @@ -26,7 +26,7 @@
>  #include <stdbool.h>
>  #include <assert.h>
>  #include <math.h>
> -#include <gallium/auxiliary/util/u_math.h>
> +#include "util/u_math.h"
>  
>  #ifdef HAVE_VALGRIND
>  #include <valgrind.h>
> diff --git a/src/gallium/auxiliary/Makefile.sources b/src/gallium/auxiliary/Makefile.sources
> index d66fa85f798..33d58dedf28 100644
> --- a/src/gallium/auxiliary/Makefile.sources
> +++ b/src/gallium/auxiliary/Makefile.sources
> @@ -294,8 +294,6 @@ C_SOURCES := \
>  	util/u_linear.h \
>  	util/u_log.c \
>  	util/u_log.h \
> -	util/u_math.c \
> -	util/u_math.h \
>  	util/u_memory.h \
>  	util/u_mm.c \
>  	util/u_mm.h \
> diff --git a/src/gallium/auxiliary/meson.build b/src/gallium/auxiliary/meson.build
> index be558e07b27..9e3673a53c0 100644
> --- a/src/gallium/auxiliary/meson.build
> +++ b/src/gallium/auxiliary/meson.build
> @@ -314,8 +314,6 @@ files_libgallium = files(
>    'util/u_linear.h',
>    'util/u_log.c',
>    'util/u_log.h',
> -  'util/u_math.c',
> -  'util/u_math.h',
>    'util/u_memory.h',
>    'util/u_mm.c',
>    'util/u_mm.h',
> diff --git a/src/gallium/auxiliary/util/u_format.c b/src/gallium/auxiliary/util/u_format.c
> index 1dd724d9b84..6445f2647cf 100644
> --- a/src/gallium/auxiliary/util/u_format.c
> +++ b/src/gallium/auxiliary/util/u_format.c
> @@ -32,11 +32,11 @@
>   * @author Jose Fonseca <jfonseca at vmware.com>
>   */
>  
> -#include "u_math.h"
>  #include "u_memory.h"
>  #include "u_format.h"
>  #include "u_format_s3tc.h"
>  #include "u_surface.h"
> +#include "util/u_math.h"
>  
>  #include "pipe/p_defines.h"
>  
> diff --git a/src/gallium/auxiliary/util/u_format_bptc.c b/src/gallium/auxiliary/util/u_format_bptc.c
> index 87ec4139e09..519a541e380 100644
> --- a/src/gallium/auxiliary/util/u_format_bptc.c
> +++ b/src/gallium/auxiliary/util/u_format_bptc.c
> @@ -23,10 +23,10 @@
>   *
>   **************************************************************************/
>  
> -#include "u_math.h"
>  #include "u_format.h"
>  #include "u_format_bptc.h"
>  #include "util/format_srgb.h"
> +#include "util/u_math.h"
>  
>  #define BPTC_BLOCK_DECODE
>  #include "../../../mesa/main/texcompress_bptc_tmp.h"
> diff --git a/src/gallium/auxiliary/util/u_format_latc.c b/src/gallium/auxiliary/util/u_format_latc.c
> index 7b2bb00693f..f145081d56d 100644
> --- a/src/gallium/auxiliary/util/u_format_latc.c
> +++ b/src/gallium/auxiliary/util/u_format_latc.c
> @@ -23,11 +23,11 @@
>   **************************************************************************/
>  
>  #include <stdio.h>
> -#include "u_math.h"
>  #include "u_format.h"
>  #include "u_format_rgtc.h"
>  #include "u_format_latc.h"
>  #include "util/rgtc.h"
> +#include "util/u_math.h"
>  
>  void
>  util_format_latc1_unorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
> diff --git a/src/gallium/auxiliary/util/u_format_other.c b/src/gallium/auxiliary/util/u_format_other.c
> index 025e096a95c..213cb9fd941 100644
> --- a/src/gallium/auxiliary/util/u_format_other.c
> +++ b/src/gallium/auxiliary/util/u_format_other.c
> @@ -26,8 +26,8 @@
>   **************************************************************************/
>  
>  
> -#include "u_math.h"
>  #include "u_format_other.h"
> +#include "util/u_math.h"
>  #include "util/format_rgb9e5.h"
>  #include "util/format_r11g11b10f.h"
>  
> diff --git a/src/gallium/auxiliary/util/u_format_pack.py b/src/gallium/auxiliary/util/u_format_pack.py
> index c1307d30c2f..62e531716ca 100644
> --- a/src/gallium/auxiliary/util/u_format_pack.py
> +++ b/src/gallium/auxiliary/util/u_format_pack.py
> @@ -702,7 +702,7 @@ def is_format_hand_written(format):
>  def generate(formats):
>      print()
>      print('#include "pipe/p_compiler.h"')
> -    print('#include "u_math.h"')
> +    print('#include "util/u_math.h"')
>      print('#include "u_half.h"')
>      print('#include "u_format.h"')
>      print('#include "u_format_other.h"')
> diff --git a/src/gallium/auxiliary/util/u_format_rgtc.c b/src/gallium/auxiliary/util/u_format_rgtc.c
> index da64b63f777..0b98c01a922 100644
> --- a/src/gallium/auxiliary/util/u_format_rgtc.c
> +++ b/src/gallium/auxiliary/util/u_format_rgtc.c
> @@ -23,9 +23,9 @@
>   **************************************************************************/
>  
>  #include <stdio.h>
> -#include "u_math.h"
>  #include "u_format.h"
>  #include "u_format_rgtc.h"
> +#include "util/u_math.h"
>  #include "util/rgtc.h"
>  
>  void
> diff --git a/src/gallium/auxiliary/util/u_format_s3tc.c b/src/gallium/auxiliary/util/u_format_s3tc.c
> index 3f755e53636..69ca62a961c 100644
> --- a/src/gallium/auxiliary/util/u_format_s3tc.c
> +++ b/src/gallium/auxiliary/util/u_format_s3tc.c
> @@ -24,10 +24,10 @@
>   **************************************************************************/
>  
>  #include "u_dl.h"
> -#include "u_math.h"
>  #include "u_format.h"
>  #include "u_format_s3tc.h"
>  #include "util/format_srgb.h"
> +#include "util/u_math.h"
>  #include "../../../mesa/main/texcompress_s3tc_tmp.h"
>  
>  
> diff --git a/src/gallium/auxiliary/util/u_format_yuv.h b/src/gallium/auxiliary/util/u_format_yuv.h
> index d8e67b45940..171cbc928d7 100644
> --- a/src/gallium/auxiliary/util/u_format_yuv.h
> +++ b/src/gallium/auxiliary/util/u_format_yuv.h
> @@ -46,7 +46,7 @@
>  
>  
>  #include "pipe/p_compiler.h"
> -#include "u_math.h"
> +#include "util/u_math.h"
>  
>  
>  /*
> diff --git a/src/gallium/auxiliary/util/u_format_zs.c b/src/gallium/auxiliary/util/u_format_zs.c
> index 69f2f2971f7..4ad3a0c6477 100644
> --- a/src/gallium/auxiliary/util/u_format_zs.c
> +++ b/src/gallium/auxiliary/util/u_format_zs.c
> @@ -27,8 +27,8 @@
>  
>  
>  #include "u_debug.h"
> -#include "u_math.h"
>  #include "u_format_zs.h"
> +#include "util/u_math.h"
>  
>  
>  /*
> diff --git a/src/util/Makefile.sources b/src/util/Makefile.sources
> index 531fd833c7f..b562d6cd6f4 100644
> --- a/src/util/Makefile.sources
> +++ b/src/util/Makefile.sources
> @@ -55,6 +55,8 @@ MESA_UTIL_FILES := \
>  	u_atomic.h \
>  	u_dynarray.h \
>  	u_endian.h \
> +	u_math.c \
> +	u_math.h \
>  	u_queue.c \
>  	u_queue.h \
>  	u_string.h \
> diff --git a/src/util/meson.build b/src/util/meson.build
> index a4ff0b92ed6..e7ad2861238 100644
> --- a/src/util/meson.build
> +++ b/src/util/meson.build
> @@ -85,6 +85,8 @@ files_mesa_util = files(
>    'u_thread.h',
>    'u_vector.c',
>    'u_vector.h',
> +  'u_math.c',
> +  'u_math.h',
>    'vma.c',
>    'vma.h',
>  )
> diff --git a/src/gallium/auxiliary/util/u_math.c b/src/util/u_math.c
> similarity index 100%
> rename from src/gallium/auxiliary/util/u_math.c
> rename to src/util/u_math.c
> diff --git a/src/gallium/auxiliary/util/u_math.h b/src/util/u_math.h
> similarity index 99%
> rename from src/gallium/auxiliary/util/u_math.h
> rename to src/util/u_math.h
> index 712305c98a4..e7dbbe5ca22 100644
> --- a/src/gallium/auxiliary/util/u_math.h
> +++ b/src/util/u_math.h
> @@ -46,7 +46,7 @@
>  #include <float.h>
>  #include <stdarg.h>
>  
> -#include "util/bitscan.h"
> +#include "bitscan.h"
>  
>  #ifdef __cplusplus
>  extern "C" {



More information about the mesa-dev mailing list