[Mesa-dev] [PATCH 06/18] swr: [rasterizer core] cygwin cleanup

Tim Rowley timothy.o.rowley at intel.com
Tue May 17 01:10:45 UTC 2016


---
 .../drivers/swr/rasterizer/core/threads.cpp        | 60 ++++++++++++++--------
 1 file changed, 38 insertions(+), 22 deletions(-)

diff --git a/src/gallium/drivers/swr/rasterizer/core/threads.cpp b/src/gallium/drivers/swr/rasterizer/core/threads.cpp
index 0b57a3f..17bf616 100644
--- a/src/gallium/drivers/swr/rasterizer/core/threads.cpp
+++ b/src/gallium/drivers/swr/rasterizer/core/threads.cpp
@@ -221,6 +221,16 @@ void CalculateProcessorTopology(CPUNumaNodes& out_nodes, uint32_t& out_numThread
         }
     }
 
+#elif defined(__CYGWIN__)
+
+    // Dummy data just to compile
+    NumaNode node;
+    Core core;
+    core.threadIds.push_back(0);
+    node.cores.push_back(core);
+    out_nodes.push_back(node);
+    out_numThreadsPerProcGroup = 1;
+
 #else
 
 #error Unsupported platform
@@ -238,42 +248,48 @@ void bindThread(uint32_t threadId, uint32_t procGroupId = 0, bool bindProcGroup=
     }
 
 #if defined(_WIN32)
-    {
-        GROUP_AFFINITY affinity = {};
-        affinity.Group = procGroupId;
+
+    GROUP_AFFINITY affinity = {};
+    affinity.Group = procGroupId;
 
 #if !defined(_WIN64)
-        if (threadId >= 32)
-        {
-            // Hopefully we don't get here.  Logic in CreateThreadPool should prevent this.
-            SWR_REL_ASSERT(false, "Shouldn't get here");
+    if (threadId >= 32)
+    {
+        // Hopefully we don't get here.  Logic in CreateThreadPool should prevent this.
+        SWR_REL_ASSERT(false, "Shouldn't get here");
 
-            // In a 32-bit process on Windows it is impossible to bind
-            // to logical processors 32-63 within a processor group.
-            // In this case set the mask to 0 and let the system assign
-            // the processor.  Hopefully it will make smart choices.
-            affinity.Mask = 0;
-        }
-        else
+        // In a 32-bit process on Windows it is impossible to bind
+        // to logical processors 32-63 within a processor group.
+        // In this case set the mask to 0 and let the system assign
+        // the processor.  Hopefully it will make smart choices.
+        affinity.Mask = 0;
+    }
+    else
 #endif
+    {
+        // If KNOB_MAX_WORKER_THREADS is set, only bind to the proc group,
+        // Not the individual HW thread.
+        if (!KNOB_MAX_WORKER_THREADS)
         {
-            // If KNOB_MAX_WORKER_THREADS is set, only bind to the proc group,
-            // Not the individual HW thread.
-            if (!KNOB_MAX_WORKER_THREADS)
-            {
-                affinity.Mask = KAFFINITY(1) << threadId;
-            }
+            affinity.Mask = KAFFINITY(1) << threadId;
         }
-
-        SetThreadGroupAffinity(GetCurrentThread(), &affinity, nullptr);
     }
+
+    SetThreadGroupAffinity(GetCurrentThread(), &affinity, nullptr);
+
+#elif defined(__CYGWIN__)
+
+    // do nothing
+
 #else
+
     cpu_set_t cpuset;
     pthread_t thread = pthread_self();
     CPU_ZERO(&cpuset);
     CPU_SET(threadId, &cpuset);
 
     pthread_setaffinity_np(thread, sizeof(cpu_set_t), &cpuset);
+
 #endif
 }
 
-- 
1.9.1



More information about the mesa-dev mailing list