[Mesa-dev] [PATCH 12/14] swr: build on FreeBSD/DragonFlyBSD

Greg V greg at unrelenting.technology
Sun Dec 31 16:55:26 UTC 2017


(Needs CPU topology detection to actually work)
---
 src/gallium/drivers/swr/rasterizer/common/os.h      | 3 ++-
 src/gallium/drivers/swr/rasterizer/core/threads.cpp | 4 ++--
 src/gallium/drivers/swr/swr_fence.cpp               | 2 ++
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/swr/rasterizer/common/os.h b/src/gallium/drivers/swr/rasterizer/common/os.h
index 358cb33b6e..307308b737 100644
--- a/src/gallium/drivers/swr/rasterizer/common/os.h
+++ b/src/gallium/drivers/swr/rasterizer/common/os.h
@@ -89,7 +89,8 @@ static inline void AlignedFree(void* p)
 #define _mm_popcount_sizeT _mm_popcnt_u32
 #endif
 
-#elif defined(__APPLE__) || defined(FORCE_LINUX) || defined(__linux__) || defined(__gnu_linux__)
+#elif defined(FORCE_LINUX) || defined(__linux__) || defined(__gnu_linux__) || \
+   defined(__APPLE__) || defined(__FreeBSD__) || defined(__DragonFly__)
 
 #define SWR_API
 #define SWR_VISIBLE __attribute__((visibility("default")))
diff --git a/src/gallium/drivers/swr/rasterizer/core/threads.cpp b/src/gallium/drivers/swr/rasterizer/core/threads.cpp
index d684ffe727..1c7ffcd0cd 100644
--- a/src/gallium/drivers/swr/rasterizer/core/threads.cpp
+++ b/src/gallium/drivers/swr/rasterizer/core/threads.cpp
@@ -30,7 +30,7 @@
 #include <fstream>
 #include <string>
 
-#if defined(__linux__) || defined(__gnu_linux__) || defined(__APPLE__)
+#if defined(__linux__) || defined(__gnu_linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__DragonFly__)
 #include <pthread.h>
 #include <sched.h>
 #include <unistd.h>
@@ -217,7 +217,7 @@ void CalculateProcessorTopology(CPUNumaNodes& out_nodes, uint32_t& out_numThread
         }
     }
 
-#elif defined(__APPLE__)
+#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__DragonFly__)
 
 #else
 
diff --git a/src/gallium/drivers/swr/swr_fence.cpp b/src/gallium/drivers/swr/swr_fence.cpp
index 3005eb9aaa..39024baef9 100644
--- a/src/gallium/drivers/swr/swr_fence.cpp
+++ b/src/gallium/drivers/swr/swr_fence.cpp
@@ -31,6 +31,8 @@
 
 #if defined(PIPE_CC_MSVC) // portable thread yield
    #define sched_yield SwitchToThread
+#elif defined(__FreeBSD__) || defined(__DragonFly__)
+   #include <sched.h>
 #endif
 
 /*
-- 
2.15.1



More information about the mesa-dev mailing list