intel: PAGE_SIZE used in allocators shouldn't be defined on FreeBSD
authorEleni Maria Stea <elene.mst@gmail.com>
Mon, 7 Jun 2021 06:22:20 +0000 (09:22 +0300)
committerEleni Maria Stea <elene.mst@gmail.com>
Mon, 28 Jun 2021 18:12:24 +0000 (21:12 +0300)
iris, i965, and anv define the PAGE_SIZE in anv_allocator and bufmgr
files. As on FreeBSD the page size is defined in machine/param.h that is
indirectly included by those files, we'd rather define it only when the
system is not FreeBSD to avoid compile errors.

v2: Changed the path in the comment to make clear that machine/params.h
is a FreeBSD system file.

Signed-off-by: Eleni Maria Stea <elene.mst@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11203>

src/gallium/drivers/iris/iris_bufmgr.c
src/intel/vulkan/anv_allocator.c
src/mesa/drivers/dri/i965/brw_bufmgr.c

index e74ca19..31dcd61 100644 (file)
 #define VG_DEFINED(ptr, size) VG(VALGRIND_MAKE_MEM_DEFINED(ptr, size))
 #define VG_NOACCESS(ptr, size) VG(VALGRIND_MAKE_MEM_NOACCESS(ptr, size))
 
+/* On FreeBSD PAGE_SIZE is already defined in
+ * /usr/include/machine/param.h that is indirectly
+ * included here.
+ */
+#ifndef PAGE_SIZE
 #define PAGE_SIZE 4096
+#endif
 
 #define WARN_ONCE(cond, fmt...) do {                            \
    if (unlikely(cond)) {                                        \
index 88402b7..c42f688 100644 (file)
  * We use it to indicate the free list is empty. */
 #define EMPTY UINT32_MAX
 
+/* On FreeBSD PAGE_SIZE is already defined in
+ * /usr/include/machine/param.h that is indirectly
+ * included here.
+ */
+#ifndef PAGE_SIZE
 #define PAGE_SIZE 4096
+#endif
 
 struct anv_mmap_cleanup {
    void *map;
index bed6ca9..b62d213 100644 (file)
 #define VG_DEFINED(ptr, size) VG(VALGRIND_MAKE_MEM_DEFINED(ptr, size))
 #define VG_NOACCESS(ptr, size) VG(VALGRIND_MAKE_MEM_NOACCESS(ptr, size))
 
+/* On FreeBSD PAGE_SIZE is already defined in
+ * /usr/include/machine/param.h that is indirectly
+ * included here.
+ */
+#ifndef PAGE_SIZE
 #define PAGE_SIZE 4096
+#endif
 
 #define FILE_DEBUG_FLAG DEBUG_BUFMGR