Mesa (main): intel: PAGE_SIZE used in allocators shouldn't be defined on FreeBSD

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jun 28 18:39:33 UTC 2021


Module: Mesa
Branch: main
Commit: e094f75bd0b8389b8fa4dd58a5228348bf61a5e5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e094f75bd0b8389b8fa4dd58a5228348bf61a5e5

Author: Eleni Maria Stea <elene.mst at gmail.com>
Date:   Mon Jun  7 09:22:20 2021 +0300

intel: PAGE_SIZE used in allocators shouldn't be defined on FreeBSD

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 at gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11203>

---

 src/gallium/drivers/iris/iris_bufmgr.c | 6 ++++++
 src/intel/vulkan/anv_allocator.c       | 6 ++++++
 src/mesa/drivers/dri/i965/brw_bufmgr.c | 6 ++++++
 3 files changed, 18 insertions(+)

diff --git a/src/gallium/drivers/iris/iris_bufmgr.c b/src/gallium/drivers/iris/iris_bufmgr.c
index e74ca19fcda..31dcd61d767 100644
--- a/src/gallium/drivers/iris/iris_bufmgr.c
+++ b/src/gallium/drivers/iris/iris_bufmgr.c
@@ -87,7 +87,13 @@
 #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)) {                                        \
diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c
index 88402b733a3..c42f6882b3f 100644
--- a/src/intel/vulkan/anv_allocator.c
+++ b/src/intel/vulkan/anv_allocator.c
@@ -104,7 +104,13 @@
  * 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;
diff --git a/src/mesa/drivers/dri/i965/brw_bufmgr.c b/src/mesa/drivers/dri/i965/brw_bufmgr.c
index bed6ca9e2ea..b62d21370da 100644
--- a/src/mesa/drivers/dri/i965/brw_bufmgr.c
+++ b/src/mesa/drivers/dri/i965/brw_bufmgr.c
@@ -95,7 +95,13 @@
 #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
 



More information about the mesa-commit mailing list