diff options
37 files changed, 147 insertions, 38 deletions
diff --git a/src/gallium/auxiliary/driver_ddebug/dd_draw.c b/src/gallium/auxiliary/driver_ddebug/dd_draw.c index 48de3ff5b1a..91abc9fd690 100644 --- a/src/gallium/auxiliary/driver_ddebug/dd_draw.c +++ b/src/gallium/auxiliary/driver_ddebug/dd_draw.c @@ -38,7 +38,7 @@ #include "tgsi/tgsi_scan.h" #include "util/os_time.h" #include <inttypes.h> -#include "pipe/p_config.h" +#include "util/detect.h" void dd_get_debug_filename_and_mkdir(char *buf, size_t buflen, bool verbose) diff --git a/src/gallium/auxiliary/driver_ddebug/dd_util.h b/src/gallium/auxiliary/driver_ddebug/dd_util.h index 4c77cbcc163..10b0fc97e3b 100644 --- a/src/gallium/auxiliary/driver_ddebug/dd_util.h +++ b/src/gallium/auxiliary/driver_ddebug/dd_util.h @@ -37,7 +37,7 @@ #include "util/u_debug.h" #include "util/u_string.h" -#include "pipe/p_config.h" +#include "util/detect.h" #if defined(PIPE_OS_UNIX) #include <unistd.h> #include <sys/stat.h> diff --git a/src/gallium/auxiliary/driver_trace/tr_dump.c b/src/gallium/auxiliary/driver_trace/tr_dump.c index 829f9037c76..47dc27f04b4 100644 --- a/src/gallium/auxiliary/driver_trace/tr_dump.c +++ b/src/gallium/auxiliary/driver_trace/tr_dump.c @@ -38,7 +38,7 @@ * @author Jose Fonseca <jfonseca@vmware.com> */ -#include "pipe/p_config.h" +#include "util/detect.h" #include <stdio.h> #include <stdlib.h> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c index 584ea738668..2ac02412a3c 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_init.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c @@ -26,7 +26,7 @@ **************************************************************************/ -#include "pipe/p_config.h" +#include "util/detect.h" #include "pipe/p_compiler.h" #include "util/macros.h" #include "util/u_cpu_detect.h" diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp index bdf666560bd..705ee65404e 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp @@ -87,7 +87,7 @@ #include "c11/threads.h" #include "util/u_thread.h" -#include "pipe/p_config.h" +#include "util/detect.h" #include "util/u_debug.h" #include "util/u_cpu_detect.h" diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c index edf9cf89ad9..d859e6ef973 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c @@ -37,7 +37,7 @@ * @author Jose Fonseca <jfonseca@vmware.com> */ -#include "pipe/p_config.h" +#include "util/detect.h" #include "pipe/p_shader_tokens.h" #include "util/u_debug.h" #include "util/u_math.h" diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c index d98d20e11e5..916386d31c3 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c @@ -36,7 +36,7 @@ * Brian Paul, and others. */ -#include "pipe/p_config.h" +#include "util/detect.h" #include "pipe/p_shader_tokens.h" #include "util/u_debug.h" #include "util/u_math.h" diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c index 05e03a830c1..9919def4656 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c +++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c @@ -34,7 +34,7 @@ */ -#include "pipe/p_config.h" +#include "util/detect.h" #if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) #include <unistd.h> diff --git a/src/gallium/auxiliary/rtasm/rtasm_x86sse.c b/src/gallium/auxiliary/rtasm/rtasm_x86sse.c index 1a5678f8407..5dabce21826 100644 --- a/src/gallium/auxiliary/rtasm/rtasm_x86sse.c +++ b/src/gallium/auxiliary/rtasm/rtasm_x86sse.c @@ -22,7 +22,7 @@ * **************************************************************************/ -#include "pipe/p_config.h" +#include "util/detect.h" #include "util/u_cpu_detect.h" #if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) diff --git a/src/gallium/auxiliary/rtasm/rtasm_x86sse.h b/src/gallium/auxiliary/rtasm/rtasm_x86sse.h index 54a41490b97..58655a117ed 100644 --- a/src/gallium/auxiliary/rtasm/rtasm_x86sse.h +++ b/src/gallium/auxiliary/rtasm/rtasm_x86sse.h @@ -26,7 +26,7 @@ #define _RTASM_X86SSE_H_ #include "pipe/p_compiler.h" -#include "pipe/p_config.h" +#include "util/detect.h" #if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) diff --git a/src/gallium/auxiliary/translate/translate.c b/src/gallium/auxiliary/translate/translate.c index 7a8e747a671..6ce296da89b 100644 --- a/src/gallium/auxiliary/translate/translate.c +++ b/src/gallium/auxiliary/translate/translate.c @@ -30,7 +30,7 @@ * Keith Whitwell <keithw@vmware.com> */ -#include "pipe/p_config.h" +#include "util/detect.h" #include "pipe/p_state.h" #include "translate.h" diff --git a/src/gallium/auxiliary/translate/translate_sse.c b/src/gallium/auxiliary/translate/translate_sse.c index e4a1350829e..7469d8268ec 100644 --- a/src/gallium/auxiliary/translate/translate_sse.c +++ b/src/gallium/auxiliary/translate/translate_sse.c @@ -26,7 +26,7 @@ */ -#include "pipe/p_config.h" +#include "util/detect.h" #include "pipe/p_compiler.h" #include "util/u_memory.h" #include "util/u_cpu_detect.h" diff --git a/src/gallium/auxiliary/util/u_sse.h b/src/gallium/auxiliary/util/u_sse.h index 091e15fdd6a..c8acb1cfbe3 100644 --- a/src/gallium/auxiliary/util/u_sse.h +++ b/src/gallium/auxiliary/util/u_sse.h @@ -37,7 +37,7 @@ #ifndef U_SSE_H_ #define U_SSE_H_ -#include "pipe/p_config.h" +#include "util/detect.h" #include "pipe/p_compiler.h" #include "util/u_debug.h" diff --git a/src/gallium/drivers/llvmpipe/lp_linear.c b/src/gallium/drivers/llvmpipe/lp_linear.c index e950ba6cfd6..81a677a8ab2 100644 --- a/src/gallium/drivers/llvmpipe/lp_linear.c +++ b/src/gallium/drivers/llvmpipe/lp_linear.c @@ -26,7 +26,7 @@ **************************************************************************/ -#include "pipe/p_config.h" +#include "util/detect.h" #include "util/u_math.h" #include "util/u_cpu_detect.h" diff --git a/src/gallium/drivers/llvmpipe/lp_linear_fastpath.c b/src/gallium/drivers/llvmpipe/lp_linear_fastpath.c index 3f894c65464..07c616b2675 100644 --- a/src/gallium/drivers/llvmpipe/lp_linear_fastpath.c +++ b/src/gallium/drivers/llvmpipe/lp_linear_fastpath.c @@ -26,7 +26,7 @@ **************************************************************************/ -#include "pipe/p_config.h" +#include "util/detect.h" #include "util/u_math.h" #include "util/u_cpu_detect.h" diff --git a/src/gallium/drivers/llvmpipe/lp_linear_interp.c b/src/gallium/drivers/llvmpipe/lp_linear_interp.c index 1b47e7ab7ff..c372fe819b1 100644 --- a/src/gallium/drivers/llvmpipe/lp_linear_interp.c +++ b/src/gallium/drivers/llvmpipe/lp_linear_interp.c @@ -26,7 +26,7 @@ **************************************************************************/ -#include "pipe/p_config.h" +#include "util/detect.h" #include "util/u_math.h" #include "util/u_cpu_detect.h" diff --git a/src/gallium/drivers/llvmpipe/lp_linear_sampler.c b/src/gallium/drivers/llvmpipe/lp_linear_sampler.c index 7469c9cfd67..8765e3d5159 100644 --- a/src/gallium/drivers/llvmpipe/lp_linear_sampler.c +++ b/src/gallium/drivers/llvmpipe/lp_linear_sampler.c @@ -26,7 +26,7 @@ **************************************************************************/ -#include "pipe/p_config.h" +#include "util/detect.h" #include "util/u_math.h" #include "util/u_cpu_detect.h" diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs_fastpath.c b/src/gallium/drivers/llvmpipe/lp_state_fs_fastpath.c index 3fbb9142c14..cf887184296 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs_fastpath.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs_fastpath.c @@ -26,7 +26,7 @@ **************************************************************************/ -#include "pipe/p_config.h" +#include "util/detect.h" #include "util/u_math.h" #include "util/u_cpu_detect.h" diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs_linear.c b/src/gallium/drivers/llvmpipe/lp_state_fs_linear.c index 45b1d0c4271..9554cb451ec 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs_linear.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs_linear.c @@ -26,7 +26,7 @@ **************************************************************************/ -#include "pipe/p_config.h" +#include "util/detect.h" #include "util/u_math.h" #include "util/u_cpu_detect.h" diff --git a/src/gallium/drivers/panfrost/pan_context.h b/src/gallium/drivers/panfrost/pan_context.h index 327604defca..a6081b8c4d5 100644 --- a/src/gallium/drivers/panfrost/pan_context.h +++ b/src/gallium/drivers/panfrost/pan_context.h @@ -36,7 +36,7 @@ #include "pan_earlyzs.h" #include "pipe/p_compiler.h" -#include "pipe/p_config.h" +#include "util/detect.h" #include "pipe/p_context.h" #include "pipe/p_defines.h" #include "pipe/p_format.h" diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 6130b10602f..617da7c1497 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -34,7 +34,7 @@ #include "tgsi/tgsi_parse.h" -#include "pipe/p_config.h" +#include "util/detect.h" #include "r300_cb.h" #include "r300_context.h" diff --git a/src/gallium/frontends/lavapipe/lvp_device.c b/src/gallium/frontends/lavapipe/lvp_device.c index d1a4b233fa6..cfce318eaab 100644 --- a/src/gallium/frontends/lavapipe/lvp_device.c +++ b/src/gallium/frontends/lavapipe/lvp_device.c @@ -29,7 +29,7 @@ #include "vk_cmd_enqueue_entrypoints.h" #include "vk_sampler.h" #include "vk_util.h" -#include "pipe/p_config.h" +#include "util/detect.h" #include "pipe/p_defines.h" #include "pipe/p_state.h" #include "pipe/p_context.h" diff --git a/src/gallium/frontends/lavapipe/lvp_formats.c b/src/gallium/frontends/lavapipe/lvp_formats.c index 4a54a898150..0a4a854ef71 100644 --- a/src/gallium/frontends/lavapipe/lvp_formats.c +++ b/src/gallium/frontends/lavapipe/lvp_formats.c @@ -22,7 +22,7 @@ */ #include "lvp_private.h" -#include "pipe/p_config.h" +#include "util/detect.h" #include "pipe/p_defines.h" #include "util/format/u_format.h" #include "util/u_math.h" diff --git a/src/gallium/frontends/nine/device9.c b/src/gallium/frontends/nine/device9.c index a03a89c3b92..ce846ea4fc1 100644 --- a/src/gallium/frontends/nine/device9.c +++ b/src/gallium/frontends/nine/device9.c @@ -44,7 +44,7 @@ #include "pipe/p_screen.h" #include "pipe/p_context.h" -#include "pipe/p_config.h" +#include "util/detect.h" #include "util/macros.h" #include "util/u_math.h" #include "util/u_inlines.h" diff --git a/src/gallium/include/pipe/p_compiler.h b/src/gallium/include/pipe/p_compiler.h index 8f16db7bd17..3963e2f08b9 100644 --- a/src/gallium/include/pipe/p_compiler.h +++ b/src/gallium/include/pipe/p_compiler.h @@ -29,8 +29,7 @@ #define P_COMPILER_H -#include "p_config.h" - +#include "util/detect.h" #include "util/macros.h" #include <limits.h> diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h index 3387d3091ab..4a7cb363e97 100644 --- a/src/gallium/include/pipe/p_format.h +++ b/src/gallium/include/pipe/p_format.h @@ -29,7 +29,7 @@ #ifndef PIPE_FORMAT_H #define PIPE_FORMAT_H -#include "p_config.h" +#include "util/detect.h" #ifdef __cplusplus extern "C" { diff --git a/src/gallium/winsys/svga/drm/pb_buffer_simple_fenced.c b/src/gallium/winsys/svga/drm/pb_buffer_simple_fenced.c index e4f798c7f61..4b83bc2a86b 100644 --- a/src/gallium/winsys/svga/drm/pb_buffer_simple_fenced.c +++ b/src/gallium/winsys/svga/drm/pb_buffer_simple_fenced.c @@ -34,7 +34,7 @@ */ -#include "pipe/p_config.h" +#include "util/detect.h" #if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) #include <unistd.h> diff --git a/src/util/detect.h b/src/util/detect.h new file mode 100644 index 00000000000..f31cbd26331 --- /dev/null +++ b/src/util/detect.h @@ -0,0 +1,68 @@ +/************************************************************************** + * + * Copyright 2022 Yonggang Luo + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +/** + * @file + * Mesa configuration defines. + * + * This header file sets several defines based on the compiler, processor + * architecture, and operating system being used. These defines are comes + * from corresponding headers. + * + * See: + * - http://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html + * - echo | gcc -dM -E - | sort + * - http://msdn.microsoft.com/en-us/library/b0084kay.aspx + * - https://sourceforge.net/p/predef/wiki/Home/ + */ + +#ifndef UTIL_DETECT_H_ +#define UTIL_DETECT_H_ + +#include <limits.h> + +/* + * Compiler detection + */ +#include "util/detect_cc.h" + +/* + * Processor architecture detection + */ +#include "util/detect_arch.h" + +/* + * Endian detection detection + */ +#include "util/u_endian.h" + +/* + * Operating system family detection + */ +#include "util/detect_os.h" + +#endif /* UTIL_DETECT_H_ */ diff --git a/src/gallium/include/pipe/p_config.h b/src/util/detect_arch.h index f35a7dc9f04..ef86008798f 100644 --- a/src/gallium/include/pipe/p_config.h +++ b/src/util/detect_arch.h @@ -43,8 +43,8 @@ * @author José Fonseca <jfonseca@vmware.com> */ -#ifndef P_CONFIG_H_ -#define P_CONFIG_H_ +#ifndef UTIL_DETECT_ARCH_H_ +#define UTIL_DETECT_ARCH_H_ #include <limits.h> /* @@ -192,4 +192,4 @@ #define PIPE_OS_CYGWIN #endif -#endif /* P_CONFIG_H_ */ +#endif /* UTIL_DETECT_ARCH_H_ */ diff --git a/src/util/detect_cc.h b/src/util/detect_cc.h new file mode 100644 index 00000000000..753c69255c0 --- /dev/null +++ b/src/util/detect_cc.h @@ -0,0 +1,42 @@ +/************************************************************************** + * + * Copyright 2022 Yonggang Luo + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +/** + * @file + * Compiler configuration defines. + * + * See: + * - http://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html + * - echo | gcc -dM -E - | sort + * - http://msdn.microsoft.com/en-us/library/b0084kay.aspx + * - https://sourceforge.net/p/predef/wiki/Home/ + */ + +#ifndef UTIL_DETECT_CC_H_ +#define UTIL_DETECT_CC_H_ + +#endif /* UTIL_DETECT_CC_H_ */ diff --git a/src/util/format/u_format_tests.c b/src/util/format/u_format_tests.c index 167b971ce09..ffcbaca1271 100644 --- a/src/util/format/u_format_tests.c +++ b/src/util/format/u_format_tests.c @@ -29,7 +29,7 @@ #include <math.h> #include <float.h> -#include "pipe/p_config.h" +#include "util/detect.h" #include "util/u_memory.h" #include "util/format/u_format_tests.h" diff --git a/src/util/u_cpu_detect.c b/src/util/u_cpu_detect.c index 793fb211da0..8848463f47b 100644 --- a/src/util/u_cpu_detect.c +++ b/src/util/u_cpu_detect.c @@ -32,7 +32,7 @@ * @author Based on the work of Eric Anholt <anholt@FreeBSD.org> */ -#include "pipe/p_config.h" +#include "util/detect.h" #include "pipe/p_compiler.h" #include "util/u_debug.h" diff --git a/src/util/u_debug_memory.c b/src/util/u_debug_memory.c index fe64aca65d0..96a2be8e350 100644 --- a/src/util/u_debug_memory.c +++ b/src/util/u_debug_memory.c @@ -32,7 +32,7 @@ * @author José Fonseca <jfonseca@vmware.com> */ -#include "pipe/p_config.h" +#include "util/detect.h" #define DEBUG_MEMORY_IMPLEMENTATION diff --git a/src/util/u_debug_refcnt.h b/src/util/u_debug_refcnt.h index 78f690b025f..b831aaffe02 100644 --- a/src/util/u_debug_refcnt.h +++ b/src/util/u_debug_refcnt.h @@ -27,7 +27,7 @@ #ifndef U_DEBUG_REFCNT_H_ #define U_DEBUG_REFCNT_H_ -#include "pipe/p_config.h" +#include "util/detect.h" #include "pipe/p_state.h" #ifdef __cplusplus diff --git a/src/util/u_debug_stack.c b/src/util/u_debug_stack.c index 8cf1afb77c0..7ce608b664a 100644 --- a/src/util/u_debug_stack.c +++ b/src/util/u_debug_stack.c @@ -36,7 +36,7 @@ #include "util/u_debug.h" #include "u_debug_symbol.h" #include "u_debug_stack.h" -#include "pipe/p_config.h" +#include "util/detect.h" #if defined(HAVE_LIBUNWIND) diff --git a/src/util/u_math.c b/src/util/u_math.c index cbeb1324ca2..6e9c3ba32a9 100644 --- a/src/util/u_math.c +++ b/src/util/u_math.c @@ -27,7 +27,7 @@ -#include "pipe/p_config.h" +#include "util/detect.h" #include "util/u_math.h" #include "util/u_cpu_detect.h" diff --git a/src/util/u_memset.h b/src/util/u_memset.h index 46a43e54c4a..c988302e430 100644 --- a/src/util/u_memset.h +++ b/src/util/u_memset.h @@ -25,7 +25,7 @@ * **************************************************************************/ -#include "pipe/p_config.h" +#include "util/detect.h" static inline void * util_memset32(void *s, uint32_t ui, size_t n) |