summaryrefslogtreecommitdiff
path: root/indra/newview/llappviewer.cpp
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2022-10-12 22:58:25 -0500
committerDave Parks <davep@lindenlab.com>2022-10-12 22:58:25 -0500
commit80127acfa876bd98e843a67bd17514a2b3f63d49 (patch)
tree307742e23d9e52a42677451437db428bc3734f17 /indra/newview/llappviewer.cpp
parent6a63c546ec854332dcfea1724018139b0bc8cd41 (diff)
SL-18190 Limit the number of decode threads.
Diffstat (limited to 'indra/newview/llappviewer.cpp')
-rw-r--r--indra/newview/llappviewer.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index e874cf02cb..8e5a796498 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -2190,6 +2190,19 @@ bool LLAppViewer::initThreads()
LLLFSThread::initClass(enable_threads && true); // TODO: fix crashes associated with this shutdo
+ //auto configure thread count
+ LLSD threadCounts = gSavedSettings.getLLSD("ThreadPoolSizes");
+
+ // get the number of concurrent threads that can run
+ S32 cores = std::thread::hardware_concurrency();
+
+ // The only configurable thread count right now is ImageDecode
+ // The viewer typically starts around 8 threads not including image decode,
+ // so try to leave at least one core free
+ S32 image_decode_count = llclamp(cores - 9, 1, 8);
+ threadCounts["ImageDecode"] = image_decode_count;
+ gSavedSettings.setLLSD("ThreadPoolSizes", threadCounts);
+
// Image decoding
LLAppViewer::sImageDecodeThread = new LLImageDecodeThread(enable_threads && true);
LLAppViewer::sTextureCache = new LLTextureCache(enable_threads && true);