diff options
author | Marek Olšák <[email protected]> | 2020-03-25 23:44:59 -0400 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-03-27 21:00:10 +0000 |
commit | 71646745002504302bcef51bdb438abbe66961fc (patch) | |
tree | 6f1aaa9b23d2c378be574922feffd5488c44d0a9 | |
parent | 013b65635f1db45650809d8d802436c1e9d009e3 (diff) |
util: don't include p_defines.h and u_pointer.h from gallium
It's a mess, but this is what I arrived at.
Reviewed-by: Timothy Arceri <[email protected]
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4324>
21 files changed, 38 insertions, 26 deletions
diff --git a/src/freedreno/computerator/main.c b/src/freedreno/computerator/main.c index 618812841e4..5224bf0cf9a 100644 --- a/src/freedreno/computerator/main.c +++ b/src/freedreno/computerator/main.c @@ -25,6 +25,7 @@ #include <inttypes.h> #include <locale.h> #include <xf86drm.h> +#include <stdlib.h> #include "util/u_math.h" diff --git a/src/freedreno/drm/freedreno_bo_cache.c b/src/freedreno/drm/freedreno_bo_cache.c index 88b44540418..b51e8db35ab 100644 --- a/src/freedreno/drm/freedreno_bo_cache.c +++ b/src/freedreno/drm/freedreno_bo_cache.c @@ -172,7 +172,7 @@ retry: bo = find_in_bucket(bucket, flags); if (bo) { VG_BO_OBTAIN(bo); - if (bo->funcs->madvise(bo, TRUE) <= 0) { + if (bo->funcs->madvise(bo, true) <= 0) { /* we've lost the backing pages, delete and try again: */ pthread_mutex_lock(&table_lock); bo_del(bo); @@ -197,7 +197,7 @@ fd_bo_cache_free(struct fd_bo_cache *cache, struct fd_bo *bo) if (bucket) { struct timespec time; - bo->funcs->madvise(bo, FALSE); + bo->funcs->madvise(bo, false); clock_gettime(CLOCK_MONOTONIC, &time); diff --git a/src/freedreno/drm/freedreno_device.c b/src/freedreno/drm/freedreno_device.c index 1031aaf1bef..be03cca426f 100644 --- a/src/freedreno/drm/freedreno_device.c +++ b/src/freedreno/drm/freedreno_device.c @@ -79,8 +79,8 @@ out: dev->fd = fd; dev->handle_table = _mesa_hash_table_create(NULL, _mesa_hash_u32, _mesa_key_u32_equal); dev->name_table = _mesa_hash_table_create(NULL, _mesa_hash_u32, _mesa_key_u32_equal); - fd_bo_cache_init(&dev->bo_cache, FALSE); - fd_bo_cache_init(&dev->ring_cache, TRUE); + fd_bo_cache_init(&dev->bo_cache, false); + fd_bo_cache_init(&dev->ring_cache, true); return dev; } diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.h b/src/gallium/auxiliary/gallivm/lp_bld_arit.h index f5b2800a2cf..862f8f6acda 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_arit.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.h @@ -38,6 +38,7 @@ #include "gallivm/lp_bld.h" +#include "pipe/p_compiler.h" struct lp_type; diff --git a/src/gallium/auxiliary/rtasm/rtasm_cpu.c b/src/gallium/auxiliary/rtasm/rtasm_cpu.c index 9856fc3fe8e..b1c8b990ef1 100644 --- a/src/gallium/auxiliary/rtasm/rtasm_cpu.c +++ b/src/gallium/auxiliary/rtasm/rtasm_cpu.c @@ -33,7 +33,7 @@ #include "util/u_debug.h" #include "util/u_cpu_detect.h" -DEBUG_GET_ONCE_BOOL_OPTION(nosse, "GALLIUM_NOSSE", FALSE); +DEBUG_GET_ONCE_BOOL_OPTION(nosse, "GALLIUM_NOSSE", false); static struct util_cpu_caps *get_cpu_caps(void) { diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h b/src/gallium/auxiliary/tgsi/tgsi_ureg.h index f23e3fa98f8..29a1ec07021 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h @@ -28,6 +28,7 @@ #ifndef TGSI_UREG_H #define TGSI_UREG_H +#include "pipe/p_defines.h" #include "pipe/p_format.h" #include "pipe/p_compiler.h" #include "pipe/p_shader_tokens.h" diff --git a/src/gallium/auxiliary/util/u_async_debug.h b/src/gallium/auxiliary/util/u_async_debug.h index be783dc87cb..b192a01f99b 100644 --- a/src/gallium/auxiliary/util/u_async_debug.h +++ b/src/gallium/auxiliary/util/u_async_debug.h @@ -34,7 +34,7 @@ #define UTIL_ASYNC_DEBUG_H #include "pipe/p_state.h" - +#include "util/u_debug.h" #include "util/simple_mtx.h" struct util_debug_message { diff --git a/src/gallium/auxiliary/util/u_idalloc.c b/src/gallium/auxiliary/util/u_idalloc.c index 26104552e57..2c48993b847 100644 --- a/src/gallium/auxiliary/util/u_idalloc.c +++ b/src/gallium/auxiliary/util/u_idalloc.c @@ -34,7 +34,7 @@ #include "util/u_idalloc.h" #include "util/u_math.h" -#include "util/u_memory.h" +#include <stdlib.h> void util_idalloc_init(struct util_idalloc *buf) diff --git a/src/gallium/drivers/i915/i915_debug.h b/src/gallium/drivers/i915/i915_debug.h index 0f12a592ae8..66290a84b62 100644 --- a/src/gallium/drivers/i915/i915_debug.h +++ b/src/gallium/drivers/i915/i915_debug.h @@ -48,7 +48,7 @@ struct i915_winsys_batchbuffer; extern unsigned i915_debug; #ifdef DEBUG -static inline boolean +static inline bool I915_DBG_ON(unsigned flags) { return i915_debug & flags; diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index 407b5afe4e3..04388d317a3 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -1246,17 +1246,6 @@ enum pipe_fd_type PIPE_FD_TYPE_SYNCOBJ, }; -enum pipe_debug_type -{ - PIPE_DEBUG_TYPE_OUT_OF_MEMORY = 1, - PIPE_DEBUG_TYPE_ERROR, - PIPE_DEBUG_TYPE_SHADER_INFO, - PIPE_DEBUG_TYPE_PERF_INFO, - PIPE_DEBUG_TYPE_INFO, - PIPE_DEBUG_TYPE_FALLBACK, - PIPE_DEBUG_TYPE_CONFORMANCE, -}; - /** * counter type and counter data type enums used by INTEL_performance_query * APIs in gallium drivers. diff --git a/src/gallium/state_trackers/nine/nine_debug.h b/src/gallium/state_trackers/nine/nine_debug.h index 5ecc37a6f5a..75e412497b0 100644 --- a/src/gallium/state_trackers/nine/nine_debug.h +++ b/src/gallium/state_trackers/nine/nine_debug.h @@ -24,6 +24,7 @@ #define _NINE_DEBUG_H_ #include "util/u_debug.h" +#include "pipe/p_compiler.h" void _nine_debug_printf( unsigned long flag, diff --git a/src/gallium/winsys/etnaviv/drm/etnaviv_drm_winsys.c b/src/gallium/winsys/etnaviv/drm/etnaviv_drm_winsys.c index e5e00dd3d64..3ebe647b12f 100644 --- a/src/gallium/winsys/etnaviv/drm/etnaviv_drm_winsys.c +++ b/src/gallium/winsys/etnaviv/drm/etnaviv_drm_winsys.c @@ -28,6 +28,7 @@ #include "util/u_hash_table.h" #include "util/u_memory.h" +#include "util/u_pointer.h" #include "etnaviv/etnaviv_screen.h" #include "etnaviv/hw/common.xml.h" diff --git a/src/gallium/winsys/freedreno/drm/freedreno_drm_winsys.c b/src/gallium/winsys/freedreno/drm/freedreno_drm_winsys.c index 6bc4853f08a..6773af41b18 100644 --- a/src/gallium/winsys/freedreno/drm/freedreno_drm_winsys.c +++ b/src/gallium/winsys/freedreno/drm/freedreno_drm_winsys.c @@ -32,6 +32,7 @@ #include "util/u_memory.h" #include "util/u_inlines.h" #include "util/u_hash_table.h" +#include "util/u_pointer.h" #include "os/os_thread.h" #include "freedreno_drm_public.h" diff --git a/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c index 313126060ba..5c43518afcb 100644 --- a/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c +++ b/src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c @@ -7,6 +7,7 @@ #include "util/u_memory.h" #include "util/u_inlines.h" #include "util/u_hash_table.h" +#include "util/u_pointer.h" #include "os/os_thread.h" #include "nouveau_drm_public.h" diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c index a8d5c978e17..73ef4bea262 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c @@ -32,6 +32,7 @@ #include "util/u_cpu_detect.h" #include "util/u_memory.h" #include "util/u_hash_table.h" +#include "util/u_pointer.h" #include <xf86drm.h> #include <stdio.h> diff --git a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c index 9d8b2f75891..7b20636ad20 100644 --- a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c +++ b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c @@ -34,6 +34,7 @@ #include "util/format/u_format.h" #include "util/u_hash_table.h" #include "util/u_inlines.h" +#include "util/u_pointer.h" #include "state_tracker/drm_driver.h" #include "virgl/virgl_screen.h" #include "virgl/virgl_public.h" diff --git a/src/util/macros.h b/src/util/macros.h index 55dd80c870b..fcace4e351d 100644 --- a/src/util/macros.h +++ b/src/util/macros.h @@ -332,4 +332,18 @@ do { \ #define BITFIELD64_RANGE(b, count) \ (BITFIELD64_MASK((b) + (count)) & ~BITFIELD64_MASK(b)) +/* TODO: In future we should try to move this to u_debug.h once header + * dependencies are reorganised to allow this. + */ +enum pipe_debug_type +{ + PIPE_DEBUG_TYPE_OUT_OF_MEMORY = 1, + PIPE_DEBUG_TYPE_ERROR, + PIPE_DEBUG_TYPE_SHADER_INFO, + PIPE_DEBUG_TYPE_PERF_INFO, + PIPE_DEBUG_TYPE_INFO, + PIPE_DEBUG_TYPE_FALLBACK, + PIPE_DEBUG_TYPE_CONFORMANCE, +}; + #endif /* UTIL_MACROS_H */ diff --git a/src/util/u_cpu_detect.c b/src/util/u_cpu_detect.c index 79da996a7aa..ab064957382 100644 --- a/src/util/u_cpu_detect.c +++ b/src/util/u_cpu_detect.c @@ -33,6 +33,7 @@ */ #include "pipe/p_config.h" +#include "pipe/p_compiler.h" #include "util/u_debug.h" #include "u_cpu_detect.h" @@ -83,7 +84,7 @@ #ifdef DEBUG -DEBUG_GET_ONCE_BOOL_OPTION(dump_cpu, "GALLIUM_DUMP_CPU", FALSE) +DEBUG_GET_ONCE_BOOL_OPTION(dump_cpu, "GALLIUM_DUMP_CPU", false) #endif diff --git a/src/util/u_debug.h b/src/util/u_debug.h index bc6cd8ac2a9..a9e44bf24e2 100644 --- a/src/util/u_debug.h +++ b/src/util/u_debug.h @@ -38,18 +38,17 @@ #ifndef U_DEBUG_H_ #define U_DEBUG_H_ - +#include <stdarg.h> +#include <string.h> #include "util/os_misc.h" #include "util/detect_os.h" +#include "util/macros.h" #if DETECT_OS_HAIKU /* Haiku provides debug_printf in libroot with OS.h */ #include <OS.h> #endif -#include "pipe/p_defines.h" - - #ifdef __cplusplus extern "C" { #endif diff --git a/src/util/u_memory.h b/src/util/u_memory.h index dc22ab0fd1a..15a0bb419b5 100644 --- a/src/util/u_memory.h +++ b/src/util/u_memory.h @@ -34,7 +34,6 @@ #ifndef U_MEMORY_H #define U_MEMORY_H -#include "util/u_pointer.h" #include "util/u_debug.h" #include "util/os_memory.h" @@ -75,7 +74,7 @@ align_calloc(size_t size, unsigned long alignment) * Duplicate a block of memory. */ static inline void * -mem_dup(const void *src, uint size) +mem_dup(const void *src, size_t size) { void *dup = MALLOC(size); if (dup) diff --git a/src/util/u_mm.c b/src/util/u_mm.c index 0d275976688..305d16f6fd7 100644 --- a/src/util/u_mm.c +++ b/src/util/u_mm.c @@ -27,6 +27,7 @@ #include "util/u_memory.h" #include "util/u_mm.h" +#include "util/macros.h" void |