util: don't include p_defines.h and u_pointer.h from gallium
authorMarek Olšák <marek.olsak@amd.com>
Thu, 26 Mar 2020 03:44:59 +0000 (23:44 -0400)
committerMarge Bot <eric+marge@anholt.net>
Fri, 27 Mar 2020 21:00:10 +0000 (21:00 +0000)
It's a mess, but this is what I arrived at.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4324>

21 files changed:
src/freedreno/computerator/main.c
src/freedreno/drm/freedreno_bo_cache.c
src/freedreno/drm/freedreno_device.c
src/gallium/auxiliary/gallivm/lp_bld_arit.h
src/gallium/auxiliary/rtasm/rtasm_cpu.c
src/gallium/auxiliary/tgsi/tgsi_ureg.h
src/gallium/auxiliary/util/u_async_debug.h
src/gallium/auxiliary/util/u_idalloc.c
src/gallium/drivers/i915/i915_debug.h
src/gallium/include/pipe/p_defines.h
src/gallium/state_trackers/nine/nine_debug.h
src/gallium/winsys/etnaviv/drm/etnaviv_drm_winsys.c
src/gallium/winsys/freedreno/drm/freedreno_drm_winsys.c
src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c
src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
src/gallium/winsys/virgl/drm/virgl_drm_winsys.c
src/util/macros.h
src/util/u_cpu_detect.c
src/util/u_debug.h
src/util/u_memory.h
src/util/u_mm.c

index 618812841e4c4d016cdf300f48ef7f48e175c893..5224bf0cf9aae0d092302bd2cafa60fccbbe612a 100644 (file)
@@ -25,6 +25,7 @@
 #include <inttypes.h>
 #include <locale.h>
 #include <xf86drm.h>
+#include <stdlib.h>
 
 #include "util/u_math.h"
 
index 88b4454041833c875b8c3f7e149f52cdaf3ff3cd..b51e8db35ab9534633a544e56005f0bcaa880b2b 100644 (file)
@@ -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);
 
index 1031aaf1beff719b96ebc01bf32be0c45012d697..be03cca426f8c0aad93cda6f1c0fd831834c7b28 100644 (file)
@@ -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;
 }
index f5b2800a2cf2118546ad9368b254852db804927e..862f8f6acda73497c29b473a539bb795c02dcbb2 100644 (file)
@@ -38,6 +38,7 @@
 
 
 #include "gallivm/lp_bld.h"
+#include "pipe/p_compiler.h"
 
 
 struct lp_type;
index 9856fc3fe8e402b1d205a327753272844c0d81cc..b1c8b990ef1e058e9eca2d785cba002bcb730492 100644 (file)
@@ -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)
 {
index f23e3fa98f8da5129d7a9473be10b2a05c5279e6..29a1ec07021f76196c7a684f297a503299630b67 100644 (file)
@@ -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"
index be783dc87cb948d8caa657274e5f213b19633ada..b192a01f99bdc23367448a4e744f6e7e4ae669ee 100644 (file)
@@ -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 {
index 26104552e575acfd93f65e5118ec1b491f0e6b27..2c48993b8471066913002e3a32fbcfdad39df1bf 100644 (file)
@@ -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)
index 0f12a592ae898fe24967056aebb5264782706e44..66290a84b629f55c46b5df9771f2c4b05c59dee2 100644 (file)
@@ -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;
index 407b5afe4e3d7288bd44e98fd1702637640387a8..04388d317a34b5197748231da64aed4d279ff1fd 100644 (file)
@@ -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.
index 5ecc37a6f5a31a70269062188b643f7717d9e6ba..75e412497b04294c9e73044e378e2f22583f812e 100644 (file)
@@ -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,
index e5e00dd3d64d186d743c2fbcff51c7caf23ae7f1..3ebe647b12f3d4715f22df9c4f56960bd88902a9 100644 (file)
@@ -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"
index 6bc4853f08af5f9c65de077a49c554cf2c562636..6773af41b18cbe88fdee5adc86fb568f82f03835 100644 (file)
@@ -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"
index 313126060bae7b119cf1c7f841e3e0593145fe44..5c43518afcbbf21a12bd913961bd25e5e2b41179 100644 (file)
@@ -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"
index a8d5c978e17bf5c62c5b0c6acd3ee084b787446b..73ef4bea262e751dafdd6bde4b220111db81e3c7 100644 (file)
@@ -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>
index 9d8b2f75891d8b069a7acb0854fd596aa18de36f..7b20636ad2092c0b1f1f23057b12634e8a296d4f 100644 (file)
@@ -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"
index 55dd80c870b3c6b1c9c0262bf9b23cc93118a260..fcace4e351d61527990a0d28952268b1ed50f4e1 100644 (file)
@@ -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 */
index 79da996a7aa5952d47dfcfa612608e9913719193..ab064957382c1fd77c9e64fa49159c8f450d4cee 100644 (file)
@@ -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
 
 
index bc6cd8ac2a9924c2fa6649801fd7538892342734..a9e44bf24e2073a15fb282eaa27454ed19acfcae 100644 (file)
 #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
index dc22ab0fd1a7e05df0bc048bc89be5e1b8925fd1..15a0bb419b5ebe100de48a73777bf6c01ab1534f 100644 (file)
@@ -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)
index 0d275976688f39bb2d9a15a1191e68d2aae1eea1..305d16f6fd73ec4d3d58f925e5360710204f6b35 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "util/u_memory.h"
 #include "util/u_mm.h"
+#include "util/macros.h"
 
 
 void