summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Rowley <[email protected]>2016-04-27 13:02:27 -0600
committerTim Rowley <[email protected]>2016-05-05 14:49:04 -0500
commitc2f5d2daa897c11e4d8f5804217e7e35d3092313 (patch)
tree44ab13c50f54ff624402c2d55e390497de94315e
parent1eb211c4a4c31e5e46840435df90554fbc864adc (diff)
swr: [rasterizer core] Fix threadviz support in buckets
Need to do lazy eval of the threadviz knob since order of globals is undefined. Reviewed-by: Bruce Cherniak <[email protected]>
-rw-r--r--src/gallium/drivers/swr/rasterizer/common/rdtsc_buckets.cpp12
-rw-r--r--src/gallium/drivers/swr/rasterizer/common/rdtsc_buckets.h12
-rw-r--r--src/gallium/drivers/swr/rasterizer/core/rdtsc_core.cpp2
3 files changed, 14 insertions, 12 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/common/rdtsc_buckets.cpp b/src/gallium/drivers/swr/rasterizer/common/rdtsc_buckets.cpp
index eb038b1d74d..7163f9d3837 100644
--- a/src/gallium/drivers/swr/rasterizer/common/rdtsc_buckets.cpp
+++ b/src/gallium/drivers/swr/rasterizer/common/rdtsc_buckets.cpp
@@ -34,6 +34,18 @@ THREAD UINT tlsThreadId = 0;
void BucketManager::RegisterThread(const std::string& name)
{
+ // lazy evaluate threadviz knob
+ if (!mThreadViz && KNOB_BUCKETS_ENABLE_THREADVIZ)
+ {
+ uint32_t pid = GetCurrentProcessId();
+ std::stringstream str;
+ str << "threadviz." << pid;
+ mThreadVizDir = str.str();
+ CreateDirectory(mThreadVizDir.c_str(), NULL);
+
+ mThreadViz = true;
+ }
+
BUCKET_THREAD newThread;
newThread.name = name;
newThread.root.children.reserve(mBuckets.size());
diff --git a/src/gallium/drivers/swr/rasterizer/common/rdtsc_buckets.h b/src/gallium/drivers/swr/rasterizer/common/rdtsc_buckets.h
index 9dfa7f694d0..95841163155 100644
--- a/src/gallium/drivers/swr/rasterizer/common/rdtsc_buckets.h
+++ b/src/gallium/drivers/swr/rasterizer/common/rdtsc_buckets.h
@@ -47,17 +47,7 @@ extern THREAD UINT tlsThreadId;
class BucketManager
{
public:
- BucketManager(bool enableThreadViz) : mThreadViz(enableThreadViz)
- {
- if (mThreadViz)
- {
- uint32_t pid = GetCurrentProcessId();
- std::stringstream str;
- str << "threadviz." << pid;
- mThreadVizDir = str.str();
- CreateDirectory(mThreadVizDir.c_str(), NULL);
- }
- }
+ BucketManager() { }
// removes all registered thread data
void ClearThreads()
diff --git a/src/gallium/drivers/swr/rasterizer/core/rdtsc_core.cpp b/src/gallium/drivers/swr/rasterizer/core/rdtsc_core.cpp
index df8bad32023..52c84ee2465 100644
--- a/src/gallium/drivers/swr/rasterizer/core/rdtsc_core.cpp
+++ b/src/gallium/drivers/swr/rasterizer/core/rdtsc_core.cpp
@@ -90,6 +90,6 @@ BUCKET_DESC gCoreBuckets[] = {
/// @todo bucketmanager and mapping should probably be a part of the SWR context
std::vector<uint32_t> gBucketMap;
-BucketManager gBucketMgr(KNOB_BUCKETS_ENABLE_THREADVIZ);
+BucketManager gBucketMgr;
uint32_t gCurrentFrame = 0;