From aa358035a3553e382128c62d24755b7dce2a8278 Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Tue, 20 Apr 2021 10:49:33 -0600 Subject: DRTVWR-528 remove wrapper code for RAD telemetry library --- indra/newview/llstartup.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'indra/newview/llstartup.cpp') diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 1242131534..57c5074804 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -179,7 +179,6 @@ #include "pipeline.h" #include "llappviewer.h" #include "llfasttimerview.h" -#include "lltelemetry.h" #include "llfloatermap.h" #include "llweb.h" #include "llvoiceclient.h" @@ -530,8 +529,6 @@ bool idle_startup() } #if LL_WINDOWS - LLPROFILE_STARTUP(); - // On the windows dev builds, unpackaged, the message.xml file will // be located in indra/build-vc**/newview//app_settings. std::string message_path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"message.xml"); -- cgit v1.2.3 From 11afa09ea3f56c0e20eb195ae1520a88602ceaca Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 22 Oct 2021 11:36:31 -0400 Subject: SL-16220: Add LL::ThreadPool class and a "General" instance. ThreadPool bundles a WorkQueue with the specified number of worker threads to service it. Each ThreadPool has a name that can be used to locate its WorkQueue. Each worker thread calls WorkQueue::runUntilClose(). ThreadPool listens on the "LLApp" LLEventPump for shutdown notification. On receiving that, it closes its WorkQueue and then join()s each of its worker threads for orderly shutdown. Add a settings.xml entry "ThreadPoolSizes", the first LLSD-valued settings entry to expect a map: pool name->size. The expectation is that usually code instantiating a particular ThreadPool will have a default size in mind, but it should check "ThreadPoolSizes" for a user override. Make idle_startup()'s STATE_SEED_CAP_GRANTED state instantiate a "General" ThreadPool. This is function-static for lazy initialization. Eliminate LLMainLoopRepeater, which is completely unreferenced. Any potential future use cases are better addressed by posting to the main loop's WorkQueue. Eliminate llappviewer.cpp's private LLDeferredTaskList class, which implemented LLAppViewer::addOnIdleCallback(). Make addOnIdleCallback() post work to the main loop's WorkQueue instead. --- indra/newview/llstartup.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'indra/newview/llstartup.cpp') diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 57c5074804..13e7fcb6e4 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -205,6 +205,9 @@ #include "llstacktrace.h" +#include "threadpool.h" + + #if LL_WINDOWS #include "lldxhardware.h" #endif @@ -301,6 +304,18 @@ void callback_cache_name(const LLUUID& id, const std::string& full_name, bool is // local classes // +void launchThreadPool() +{ + LLSD poolSizes{ gSavedSettings.getLLSD("ThreadPoolSizes") }; + LLSD sizeSpec{ poolSizes["General"] }; + LLSD::Integer size{ sizeSpec.isInteger()? sizeSpec.asInteger() : 3 }; + LL_DEBUGS("ThreadPool") << "Instantiating General pool with " + << size << " threads" << LL_ENDL; + // Use a function-static ThreadPool: static duration, but instantiated + // only on demand. + static LL::ThreadPool pool("General", size); +} + void update_texture_fetch() { LLAppViewer::getTextureCache()->update(1); // unpauses the texture cache thread @@ -1489,6 +1504,9 @@ bool idle_startup() gAgentCamera.resetCamera(); display_startup(); + // start up the ThreadPool we'll use for textures et al. + launchThreadPool(); + // Initialize global class data needed for surfaces (i.e. textures) LL_DEBUGS("AppInit") << "Initializing sky..." << LL_ENDL; // Initialize all of the viewer object classes for the first time (doing things like texture fetches. -- cgit v1.2.3 From 834e7ca088b5f417235327cd290b42459c733594 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 4 Nov 2021 17:18:57 -0400 Subject: SL-16202: Use large WorkQueue size limits for mainloop and General. Give ThreadPool and WorkQueue the ability to override default ThreadSafeSchedule capacity. Instantiate "mainloop" WorkQueue and "General" ThreadPool with very large capacity because we never want to have to block trying to push to either. --- indra/newview/llstartup.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llstartup.cpp') diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 13e7fcb6e4..9a4149948c 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -313,7 +313,9 @@ void launchThreadPool() << size << " threads" << LL_ENDL; // Use a function-static ThreadPool: static duration, but instantiated // only on demand. - static LL::ThreadPool pool("General", size); + // We don't want anyone, especially the main thread, to have to block + // due to this ThreadPool being full. + static LL::ThreadPool pool("General", size, 1024*1024); } void update_texture_fetch() -- cgit v1.2.3 From 029b41c0419e975bbb28454538b46dc69ce5d2ba Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Mon, 15 Nov 2021 09:25:35 -0700 Subject: Revert "SL-16220: Merge branch 'origin/DRTVWR-546' into glthread" This reverts commit 5188a26a8521251dda07ac0140bb129f28417e49, reversing changes made to 819088563e13f1d75e048311fbaf0df4a79b7e19. --- indra/newview/llstartup.cpp | 20 -------------------- 1 file changed, 20 deletions(-) (limited to 'indra/newview/llstartup.cpp') diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 9a4149948c..57c5074804 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -205,9 +205,6 @@ #include "llstacktrace.h" -#include "threadpool.h" - - #if LL_WINDOWS #include "lldxhardware.h" #endif @@ -304,20 +301,6 @@ void callback_cache_name(const LLUUID& id, const std::string& full_name, bool is // local classes // -void launchThreadPool() -{ - LLSD poolSizes{ gSavedSettings.getLLSD("ThreadPoolSizes") }; - LLSD sizeSpec{ poolSizes["General"] }; - LLSD::Integer size{ sizeSpec.isInteger()? sizeSpec.asInteger() : 3 }; - LL_DEBUGS("ThreadPool") << "Instantiating General pool with " - << size << " threads" << LL_ENDL; - // Use a function-static ThreadPool: static duration, but instantiated - // only on demand. - // We don't want anyone, especially the main thread, to have to block - // due to this ThreadPool being full. - static LL::ThreadPool pool("General", size, 1024*1024); -} - void update_texture_fetch() { LLAppViewer::getTextureCache()->update(1); // unpauses the texture cache thread @@ -1506,9 +1489,6 @@ bool idle_startup() gAgentCamera.resetCamera(); display_startup(); - // start up the ThreadPool we'll use for textures et al. - launchThreadPool(); - // Initialize global class data needed for surfaces (i.e. textures) LL_DEBUGS("AppInit") << "Initializing sky..." << LL_ENDL; // Initialize all of the viewer object classes for the first time (doing things like texture fetches. -- cgit v1.2.3 From 67ace0df9953ce3264048c3946720a9df492edfa Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 23 Nov 2021 20:48:44 -0500 Subject: SL-16400: Address a couple shutdown crashes. It can happen that we try to post() work for LLWindowWin32's window thread after the thread's WorkQueue has been closed. Also, instead of giving the "General" ThreadPool static lifespan, put it on the heap, anchored with a static unique_ptr. --- indra/newview/llstartup.cpp | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) (limited to 'indra/newview/llstartup.cpp') diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 9a4149948c..2b94ab76ba 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -35,6 +35,7 @@ #else # include // mkdir() #endif +#include // std::unique_ptr #include "llviewermedia_streamingaudio.h" #include "llaudioengine.h" @@ -255,9 +256,10 @@ static bool mBenefitsSuccessfullyInit = false; const F32 STATE_AGENT_WAIT_TIMEOUT = 240; //seconds -boost::scoped_ptr LLStartUp::sStateWatcher(new LLEventStream("StartupState")); -boost::scoped_ptr LLStartUp::sListener(new LLStartupListener()); -boost::scoped_ptr LLStartUp::sPhases(new LLViewerStats::PhaseMap); +std::unique_ptr LLStartUp::sStateWatcher(new LLEventStream("StartupState")); +std::unique_ptr LLStartUp::sListener(new LLStartupListener()); +std::unique_ptr LLStartUp::sPhases(new LLViewerStats::PhaseMap); +std::unique_ptr gGeneralThreadPool; // // local function declaration @@ -304,20 +306,6 @@ void callback_cache_name(const LLUUID& id, const std::string& full_name, bool is // local classes // -void launchThreadPool() -{ - LLSD poolSizes{ gSavedSettings.getLLSD("ThreadPoolSizes") }; - LLSD sizeSpec{ poolSizes["General"] }; - LLSD::Integer size{ sizeSpec.isInteger()? sizeSpec.asInteger() : 3 }; - LL_DEBUGS("ThreadPool") << "Instantiating General pool with " - << size << " threads" << LL_ENDL; - // Use a function-static ThreadPool: static duration, but instantiated - // only on demand. - // We don't want anyone, especially the main thread, to have to block - // due to this ThreadPool being full. - static LL::ThreadPool pool("General", size, 1024*1024); -} - void update_texture_fetch() { LLAppViewer::getTextureCache()->update(1); // unpauses the texture cache thread @@ -1507,7 +1495,15 @@ bool idle_startup() display_startup(); // start up the ThreadPool we'll use for textures et al. - launchThreadPool(); + LLSD poolSizes{ gSavedSettings.getLLSD("ThreadPoolSizes") }; + LLSD sizeSpec{ poolSizes["General"] }; + LLSD::Integer poolSize{ sizeSpec.isInteger()? sizeSpec.asInteger() : 3 }; + LL_DEBUGS("ThreadPool") << "Instantiating General pool with " + << poolSize << " threads" << LL_ENDL; + // We don't want anyone, especially the main thread, to have to block + // due to this ThreadPool being full. + gGeneralThreadPool.reset(new LL::ThreadPool("General", poolSize, 1024*1024)); + gGeneralThreadPool->start(); // Initialize global class data needed for surfaces (i.e. textures) LL_DEBUGS("AppInit") << "Initializing sky..." << LL_ENDL; -- cgit v1.2.3 From 0b066539fe68dc5750900c3452189645c40adb45 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 24 Nov 2021 10:47:54 -0500 Subject: DRTVWR-546, SL-16220, SL-16094: Undo previous glthread branch revert. Reverting a merge is sticky: it tells git you never want to see that branch again. Merging the DRTVWR-546 branch, which contained the revert, into the glthread branch undid much of the development work on that branch. To restore it we must revert the revert. This reverts commit 029b41c0419e975bbb28454538b46dc69ce5d2ba. --- indra/newview/llstartup.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'indra/newview/llstartup.cpp') diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 8d21b04511..df066fb7ed 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -206,6 +206,9 @@ #include "llstacktrace.h" +#include "threadpool.h" + + #if LL_WINDOWS #include "lldxhardware.h" #endif @@ -303,6 +306,20 @@ void callback_cache_name(const LLUUID& id, const std::string& full_name, bool is // local classes // +void launchThreadPool() +{ + LLSD poolSizes{ gSavedSettings.getLLSD("ThreadPoolSizes") }; + LLSD sizeSpec{ poolSizes["General"] }; + LLSD::Integer size{ sizeSpec.isInteger()? sizeSpec.asInteger() : 3 }; + LL_DEBUGS("ThreadPool") << "Instantiating General pool with " + << size << " threads" << LL_ENDL; + // Use a function-static ThreadPool: static duration, but instantiated + // only on demand. + // We don't want anyone, especially the main thread, to have to block + // due to this ThreadPool being full. + static LL::ThreadPool pool("General", size, 1024*1024); +} + void update_texture_fetch() { LLAppViewer::getTextureCache()->update(1); // unpauses the texture cache thread -- cgit v1.2.3 From bd653fb69382e5a94417ff13c4041b2bc7efdc1f Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 24 Nov 2021 15:20:47 -0500 Subject: SL-16094: Clean up a bit more merge cruft. --- indra/newview/llstartup.cpp | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'indra/newview/llstartup.cpp') diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index df066fb7ed..adfa1b0c10 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -306,20 +306,6 @@ void callback_cache_name(const LLUUID& id, const std::string& full_name, bool is // local classes // -void launchThreadPool() -{ - LLSD poolSizes{ gSavedSettings.getLLSD("ThreadPoolSizes") }; - LLSD sizeSpec{ poolSizes["General"] }; - LLSD::Integer size{ sizeSpec.isInteger()? sizeSpec.asInteger() : 3 }; - LL_DEBUGS("ThreadPool") << "Instantiating General pool with " - << size << " threads" << LL_ENDL; - // Use a function-static ThreadPool: static duration, but instantiated - // only on demand. - // We don't want anyone, especially the main thread, to have to block - // due to this ThreadPool being full. - static LL::ThreadPool pool("General", size, 1024*1024); -} - void update_texture_fetch() { LLAppViewer::getTextureCache()->update(1); // unpauses the texture cache thread -- cgit v1.2.3 From 01317a2faded53c79db7e0814426f1d8b2fd12fc Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 30 Nov 2021 15:22:26 -0500 Subject: SL-16421: Destroy the "General" ThreadPool as soon as cleanup starts. Introduce LLAppViewer::onCleanup(), a method that accepts a nullary callable to execute once viewer shutdown begins. Fire the collected callables in LLAppViewer::cleanup(). In llstartup.cpp, instead of declaring a static unique_ptr and relying on static object destruction to clean up the "General" ThreadPool, bind the pointer to the new ThreadPool into an onCleanup() lambda that will delete it when called. ~ThreadPool() takes care of orderly shutdown. --- indra/newview/llstartup.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'indra/newview/llstartup.cpp') diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index adfa1b0c10..d8e68dbc1e 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -259,7 +259,6 @@ const F32 STATE_AGENT_WAIT_TIMEOUT = 240; //seconds std::unique_ptr LLStartUp::sStateWatcher(new LLEventStream("StartupState")); std::unique_ptr LLStartUp::sListener(new LLStartupListener()); std::unique_ptr LLStartUp::sPhases(new LLViewerStats::PhaseMap); -std::unique_ptr gGeneralThreadPool; // // local function declaration @@ -1495,15 +1494,19 @@ bool idle_startup() display_startup(); // start up the ThreadPool we'll use for textures et al. - LLSD poolSizes{ gSavedSettings.getLLSD("ThreadPoolSizes") }; - LLSD sizeSpec{ poolSizes["General"] }; - LLSD::Integer poolSize{ sizeSpec.isInteger()? sizeSpec.asInteger() : 3 }; - LL_DEBUGS("ThreadPool") << "Instantiating General pool with " - << poolSize << " threads" << LL_ENDL; - // We don't want anyone, especially the main thread, to have to block - // due to this ThreadPool being full. - gGeneralThreadPool.reset(new LL::ThreadPool("General", poolSize, 1024*1024)); - gGeneralThreadPool->start(); + { + LLSD poolSizes{ gSavedSettings.getLLSD("ThreadPoolSizes") }; + LLSD sizeSpec{ poolSizes["General"] }; + LLSD::Integer poolSize{ sizeSpec.isInteger()? sizeSpec.asInteger() : 3 }; + LL_DEBUGS("ThreadPool") << "Instantiating General pool with " + << poolSize << " threads" << LL_ENDL; + // We don't want anyone, especially the main thread, to have to block + // due to this ThreadPool being full. + auto pool = new LL::ThreadPool("General", poolSize, 1024*1024); + pool->start(); + // Once we start shutting down, destroy this ThreadPool. + LLAppViewer::instance()->onCleanup([pool](){ delete pool; }); + } // Initialize global class data needed for surfaces (i.e. textures) LL_DEBUGS("AppInit") << "Initializing sky..." << LL_ENDL; -- cgit v1.2.3 From 3b6a4facae201d1249db02154c4d360fcdff3bd7 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 23 Mar 2022 16:30:10 +0200 Subject: SL-17041 Texture loading was slower at login on Performance viewer --- indra/newview/llstartup.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'indra/newview/llstartup.cpp') diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 94bafcb612..bb6ad5d8fb 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -310,6 +310,12 @@ void update_texture_fetch() LLAppViewer::getImageDecodeThread()->update(1); // unpauses the image thread LLAppViewer::getTextureFetch()->update(1); // unpauses the texture fetch thread gTextureList.updateImages(0.10f); + + if (LLImageGLThread::sEnabled) + { + std::shared_ptr main_queue = LL::WorkQueue::getInstance("mainloop"); + main_queue->runFor(std::chrono::milliseconds(1)); + } } void set_flags_and_update_appearance() @@ -1518,7 +1524,11 @@ bool idle_startup() display_startup(); LL_DEBUGS("AppInit") << "Decoding images..." << LL_ENDL; - // For all images pre-loaded into viewer cache, decode them. + // For all images pre-loaded into viewer cache, init + // priorities and fetching using decodeAllImages. + // Most of the fetching and decoding likely to be done + // by update_texture_fetch() later, while viewer waits. + // // Need to do this AFTER we init the sky const S32 DECODE_TIME_SEC = 2; for (int i = 0; i < DECODE_TIME_SEC; i++) -- cgit v1.2.3 From cf7bc4406e983b3779db0bffff8057b36702cf8d Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 20 Apr 2022 23:15:04 +0300 Subject: SL-17159 Crash initializing LLInstanceTrackerPrivate --- indra/newview/llstartup.cpp | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'indra/newview/llstartup.cpp') diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 9782881f0e..8912d1cff1 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -1496,19 +1496,7 @@ bool idle_startup() display_startup(); // start up the ThreadPool we'll use for textures et al. - { - LLSD poolSizes{ gSavedSettings.getLLSD("ThreadPoolSizes") }; - LLSD sizeSpec{ poolSizes["General"] }; - LLSD::Integer poolSize{ sizeSpec.isInteger()? sizeSpec.asInteger() : 3 }; - LL_DEBUGS("ThreadPool") << "Instantiating General pool with " - << poolSize << " threads" << LL_ENDL; - // We don't want anyone, especially the main thread, to have to block - // due to this ThreadPool being full. - auto pool = new LL::ThreadPool("General", poolSize, 1024*1024); - pool->start(); - // Once we start shutting down, destroy this ThreadPool. - LLAppViewer::instance()->onCleanup([pool](){ delete pool; }); - } + LLAppViewer::instance()->initGeneralThread(); // Initialize global class data needed for surfaces (i.e. textures) LL_DEBUGS("AppInit") << "Initializing sky..." << LL_ENDL; -- cgit v1.2.3 From ffdc04f5d2b2d952ace912a473b11f4305e9d057 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 21 Apr 2022 22:58:30 +0300 Subject: SL-17040 Crash due to LLWord not existing LLWord should persist till the end due to wide usage. --- indra/newview/llstartup.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llstartup.cpp') diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 8912d1cff1..5df8cd9cb0 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -2841,7 +2841,7 @@ void reset_login() gAgentWearables.cleanup(); gAgentCamera.cleanup(); gAgent.cleanup(); - LLWorld::getInstance()->destroyClass(); + LLWorld::getInstance()->resetClass(); if ( gViewerWindow ) { // Hide menus and normal buttons -- cgit v1.2.3