From e094f75bd0b8389b8fa4dd58a5228348bf61a5e5 Mon Sep 17 00:00:00 2001 From: Eleni Maria Stea Date: Mon, 7 Jun 2021 09:22:20 +0300 Subject: [PATCH] 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 Reviewed-by: Ian Romanick Part-of: --- 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