summaryrefslogtreecommitdiff
path: root/indra/newview/llappviewer.cpp
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2021-02-01 22:14:44 +0200
committerAndrey Lihatskiy <alihatskiy@productengine.com>2021-02-01 22:14:44 +0200
commit185082f1bbedbe9d5a17f1ee1b85693c2bc990d9 (patch)
treeb60ca5d437a0fe8bfe0fe0d600dd4bf49914f259 /indra/newview/llappviewer.cpp
parenteb042c2365a308c65ac3844c01741b0957bd3e1e (diff)
parent21565a1f3fe1ae737e2f91c58be2c3cb0b5a2fec (diff)
Merge branch 'master' into DRTVWR-521-maint
# Conflicts: # indra/newview/llappviewer.cpp
Diffstat (limited to 'indra/newview/llappviewer.cpp')
-rw-r--r--indra/newview/llappviewer.cpp210
1 files changed, 132 insertions, 78 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index ad91d6167b..2040151008 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -286,7 +286,7 @@ extern BOOL gHiDPISupport;
////////////////////////////////////////////////////////////
// All from the last globals push...
-F32 gSimLastTime; // Used in LLAppViewer::init and send_stats()
+F32 gSimLastTime; // Used in LLAppViewer::init and send_viewer_stats()
F32 gSimFrames;
BOOL gShowObjectUpdates = FALSE;
@@ -679,6 +679,7 @@ LLAppViewer::LLAppViewer()
mPurgeCacheOnExit(false),
mPurgeUserDataOnExit(false),
mSecondInstance(false),
+ mUpdaterNotFound(false),
mSavedFinalSnapshot(false),
mSavePerAccountSettings(false), // don't save settings on logout unless login succeeded.
mQuitRequested(false),
@@ -691,7 +692,8 @@ LLAppViewer::LLAppViewer()
mPeriodicSlowFrame(LLCachedControl<bool>(gSavedSettings,"Periodic Slow Frame", FALSE)),
mFastTimerLogThread(NULL),
mSettingsLocationList(NULL),
- mIsFirstRun(false)
+ mIsFirstRun(false),
+ mMinMicroSecPerFrame(0.f)
{
if(NULL != sInstance)
{
@@ -1163,7 +1165,7 @@ bool LLAppViewer::init()
gGLActive = FALSE;
-#if LL_RELEASE_FOR_DOWNLOAD
+#if LL_RELEASE_FOR_DOWNLOAD
if (!gSavedSettings.getBOOL("CmdLineSkipUpdater"))
{
LLProcess::Params updater;
@@ -1199,6 +1201,7 @@ bool LLAppViewer::init()
{
// Run the updater. An exception from launching the updater should bother us.
LLLeap::create(updater, true);
+ mUpdaterNotFound = false;
}
catch (...)
{
@@ -1208,8 +1211,7 @@ bool LLAppViewer::init()
details.getString(),
LLStringUtil::null,
OSMB_OK);
- // pass this exception to crash handler
- throw;
+ mUpdaterNotFound = true;
}
}
else
@@ -1217,29 +1219,36 @@ bool LLAppViewer::init()
LL_WARNS("InitInfo") << "Skipping updater check." << LL_ENDL;
}
- // Iterate over --leap command-line options. But this is a bit tricky: if
- // there's only one, it won't be an array at all.
- LLSD LeapCommand(gSavedSettings.getLLSD("LeapCommand"));
- LL_DEBUGS("InitInfo") << "LeapCommand: " << LeapCommand << LL_ENDL;
- if (LeapCommand.isDefined() && ! LeapCommand.isArray())
- {
- // If LeapCommand is actually a scalar value, make an array of it.
- // Have to do it in two steps because LeapCommand.append(LeapCommand)
- // trashes content! :-P
- LLSD item(LeapCommand);
- LeapCommand.append(item);
- }
- BOOST_FOREACH(const std::string& leap, llsd::inArray(LeapCommand))
- {
- LL_INFOS("InitInfo") << "processing --leap \"" << leap << '"' << LL_ENDL;
- // We don't have any better description of this plugin than the
- // user-specified command line. Passing "" causes LLLeap to derive a
- // description from the command line itself.
- // Suppress LLLeap::Error exception: trust LLLeap's own logging. We
- // don't consider any one --leap command mission-critical, so if one
- // fails, log it, shrug and carry on.
- LLLeap::create("", leap, false); // exception=false
- }
+ if (mUpdaterNotFound)
+ {
+ LL_WARNS("InitInfo") << "Failed to launch updater. Skipping Leap commands." << LL_ENDL;
+ }
+ else
+ {
+ // Iterate over --leap command-line options. But this is a bit tricky: if
+ // there's only one, it won't be an array at all.
+ LLSD LeapCommand(gSavedSettings.getLLSD("LeapCommand"));
+ LL_DEBUGS("InitInfo") << "LeapCommand: " << LeapCommand << LL_ENDL;
+ if (LeapCommand.isDefined() && !LeapCommand.isArray())
+ {
+ // If LeapCommand is actually a scalar value, make an array of it.
+ // Have to do it in two steps because LeapCommand.append(LeapCommand)
+ // trashes content! :-P
+ LLSD item(LeapCommand);
+ LeapCommand.append(item);
+ }
+ BOOST_FOREACH(const std::string& leap, llsd::inArray(LeapCommand))
+ {
+ LL_INFOS("InitInfo") << "processing --leap \"" << leap << '"' << LL_ENDL;
+ // We don't have any better description of this plugin than the
+ // user-specified command line. Passing "" causes LLLeap to derive a
+ // description from the command line itself.
+ // Suppress LLLeap::Error exception: trust LLLeap's own logging. We
+ // don't consider any one --leap command mission-critical, so if one
+ // fails, log it, shrug and carry on.
+ LLLeap::create("", leap, false); // exception=false
+ }
+ }
if (gSavedSettings.getBOOL("QAMode") && gSavedSettings.getS32("QAModeEventHostPort") > 0)
{
@@ -1247,7 +1256,7 @@ bool LLAppViewer::init()
<< "lleventhost no longer supported as a dynamic library"
<< LL_ENDL;
}
-#endif
+#endif //LL_RELEASE_FOR_DOWNLOAD
LLTextUtil::TextHelpers::iconCallbackCreationFunction = create_text_segment_icon_from_url_match;
@@ -1293,6 +1302,10 @@ bool LLAppViewer::init()
joystick = LLViewerJoystick::getInstance();
joystick->setNeedsReset(true);
+ /*----------------------------------------------------------------------*/
+
+ gSavedSettings.getControl("FramePerSecondLimit")->getSignal()->connect(boost::bind(&LLAppViewer::onChangeFrameLimit, this, _2));
+ onChangeFrameLimit(gSavedSettings.getLLSD("FramePerSecondLimit"));
return true;
}
@@ -1512,6 +1525,21 @@ bool LLAppViewer::doFrame()
display();
+ static U64 last_call = 0;
+ if (!gTeleportDisplay)
+ {
+ // Frame/draw throttling, controlled by FramePerSecondLimit
+ U64 elapsed_time = LLTimer::getTotalTime() - last_call;
+ if (elapsed_time < mMinMicroSecPerFrame)
+ {
+ LL_RECORD_BLOCK_TIME(FTM_SLEEP);
+ // llclamp for when time function gets funky
+ U64 sleep_time = llclamp(mMinMicroSecPerFrame - elapsed_time, (U64)1, (U64)1e6);
+ micro_sleep(sleep_time, 0);
+ }
+ }
+ last_call = LLTimer::getTotalTime();
+
pingMainloopTimeout("Main:Snapshot");
LLFloaterSnapshot::update(); // take snapshots
LLFloaterOutfitSnapshot::update();
@@ -1881,8 +1909,6 @@ bool LLAppViewer::cleanup()
SUBSYSTEM_CLEANUP(LLAvatarAppearance);
- SUBSYSTEM_CLEANUP(LLAvatarAppearance);
-
SUBSYSTEM_CLEANUP(LLPostProcess);
LLTracker::cleanupInstance();
@@ -2084,6 +2110,7 @@ bool LLAppViewer::cleanup()
LLUIImageList::getInstance()->cleanUp();
// This should eventually be done in LLAppViewer
+ SUBSYSTEM_CLEANUP(LLImage);
SUBSYSTEM_CLEANUP(LLVFSThread);
SUBSYSTEM_CLEANUP(LLLFSThread);
@@ -2127,6 +2154,7 @@ bool LLAppViewer::cleanup()
LLWeb::loadURLExternal( gLaunchFileOnQuit, false );
LL_INFOS() << "File launched." << LL_ENDL;
}
+ // make sure nothing uses applyProxySettings by this point.
LL_INFOS() << "Cleaning up LLProxy." << LL_ENDL;
SUBSYSTEM_CLEANUP(LLProxy);
LLCore::LLHttp::cleanup();
@@ -2182,7 +2210,7 @@ bool LLAppViewer::initThreads()
{
static const bool enable_threads = true;
- LLImage::initParamSingleton(gSavedSettings.getBOOL("TextureNewByteRange"),gSavedSettings.getS32("TextureReverseByteRange"));
+ LLImage::initClass(gSavedSettings.getBOOL("TextureNewByteRange"),gSavedSettings.getS32("TextureReverseByteRange"));
LLVFSThread::initClass(enable_threads && false);
LLLFSThread::initClass(enable_threads && false);
@@ -3138,7 +3166,7 @@ LLSD LLAppViewer::getViewerInfo() const
info["REGION"] = gAgent.getRegion()->getName();
boost::regex regex("\\.(secondlife|lindenlab)\\..*");
- info["HOSTNAME"] = boost::regex_replace(gAgent.getRegion()->getHost().getHostName(), regex, "");
+ info["HOSTNAME"] = boost::regex_replace(gAgent.getRegion()->getSimHostName(), regex, "");
info["SERVER_VERSION"] = gLastVersionChannel;
LLSLURL slurl;
LLAgentUI::buildSLURL(slurl);
@@ -3594,7 +3622,7 @@ void LLAppViewer::handleViewerCrash()
if(gAgent.getRegion())
{
- gDebugInfo["Dynamic"]["CurrentSimHost"] = gAgent.getRegionHost().getHostName();
+ gDebugInfo["Dynamic"]["CurrentSimHost"] = gAgent.getRegion()->getSimHostName();
gDebugInfo["Dynamic"]["CurrentRegion"] = gAgent.getRegion()->getName();
const LLVector3& loc = gAgent.getPositionAgent();
@@ -3986,7 +4014,9 @@ void LLAppViewer::requestQuit()
gFloaterView->closeAllChildren(true);
}
- send_stats();
+ // Send preferences once, when exiting
+ bool include_preferences = true;
+ send_viewer_stats(include_preferences);
gLogoutTimer.reset();
mQuitRequested = true;
@@ -4785,7 +4815,8 @@ void LLAppViewer::idle()
if (viewer_stats_timer.getElapsedTimeF32() >= SEND_STATS_PERIOD && !gDisconnected)
{
LL_INFOS() << "Transmitting sessions stats" << LL_ENDL;
- send_stats();
+ bool include_preferences = false;
+ send_viewer_stats(include_preferences);
viewer_stats_timer.reset();
}
@@ -5196,11 +5227,56 @@ void LLAppViewer::sendLogoutRequest()
}
}
+void LLAppViewer::updateNameLookupUrl()
+{
+ LLViewerRegion* region = gAgent.getRegion();
+ if (!region || !region->capabilitiesReceived())
+ {
+ return;
+ }
+
+ LLAvatarNameCache *name_cache = LLAvatarNameCache::getInstance();
+ bool had_capability = LLAvatarNameCache::getInstance()->hasNameLookupURL();
+ std::string name_lookup_url;
+ name_lookup_url.reserve(128); // avoid a memory allocation below
+ name_lookup_url = region->getCapability("GetDisplayNames");
+ bool have_capability = !name_lookup_url.empty();
+ if (have_capability)
+ {
+ // we have support for display names, use it
+ U32 url_size = name_lookup_url.size();
+ // capabilities require URLs with slashes before query params:
+ // https://<host>:<port>/cap/<uuid>/?ids=<blah>
+ // but the caps are granted like:
+ // https://<host>:<port>/cap/<uuid>
+ if (url_size > 0 && name_lookup_url[url_size - 1] != '/')
+ {
+ name_lookup_url += '/';
+ }
+ name_cache->setNameLookupURL(name_lookup_url);
+ }
+ else
+ {
+ // Display names not available on this region
+ name_cache->setNameLookupURL(std::string());
+ }
+
+ // Error recovery - did we change state?
+ if (had_capability != have_capability)
+ {
+ // name tags are persistant on screen, so make sure they refresh
+ LLVOAvatar::invalidateNameTags();
+ }
+}
+
void LLAppViewer::idleNameCache()
{
// Neither old nor new name cache can function before agent has a region
LLViewerRegion* region = gAgent.getRegion();
- if (!region) return;
+ if (!region)
+ {
+ return;
+ }
// deal with any queued name requests and replies.
gCacheName->processPending();
@@ -5208,47 +5284,12 @@ void LLAppViewer::idleNameCache()
// Can't run the new cache until we have the list of capabilities
// for the agent region, and can therefore decide whether to use
// display names or fall back to the old name system.
- if (!region->capabilitiesReceived()) return;
-
- // Agent may have moved to a different region, so need to update cap URL
- // for name lookups. Can't do this in the cap grant code, as caps are
- // granted to neighbor regions before the main agent gets there. Can't
- // do it in the move-into-region code because cap not guaranteed to be
- // granted yet, for example on teleport.
- LLAvatarNameCache *name_cache = LLAvatarNameCache::getInstance();
- bool had_capability = LLAvatarNameCache::getInstance()->hasNameLookupURL();
- std::string name_lookup_url;
- name_lookup_url.reserve(128); // avoid a memory allocation below
- name_lookup_url = region->getCapability("GetDisplayNames");
- bool have_capability = !name_lookup_url.empty();
- if (have_capability)
- {
- // we have support for display names, use it
- U32 url_size = name_lookup_url.size();
- // capabilities require URLs with slashes before query params:
- // https://<host>:<port>/cap/<uuid>/?ids=<blah>
- // but the caps are granted like:
- // https://<host>:<port>/cap/<uuid>
- if (url_size > 0 && name_lookup_url[url_size-1] != '/')
- {
- name_lookup_url += '/';
- }
- name_cache->setNameLookupURL(name_lookup_url);
- }
- else
- {
- // Display names not available on this region
- name_cache->setNameLookupURL( std::string() );
- }
-
- // Error recovery - did we change state?
- if (had_capability != have_capability)
- {
- // name tags are persistant on screen, so make sure they refresh
- LLVOAvatar::invalidateNameTags();
- }
+ if (!region->capabilitiesReceived())
+ {
+ return;
+ }
- name_cache->idle();
+ LLAvatarNameCache::getInstance()->idle();
}
//
@@ -5450,6 +5491,19 @@ void LLAppViewer::disconnectViewer()
LLUrlEntryParcel::setDisconnected(gDisconnected);
}
+bool LLAppViewer::onChangeFrameLimit(LLSD const & evt)
+{
+ if (evt.asInteger() > 0)
+ {
+ mMinMicroSecPerFrame = (U64)(1000000.0f / F32(evt.asInteger()));
+ }
+ else
+ {
+ mMinMicroSecPerFrame = 0;
+ }
+ return false;
+}
+
void LLAppViewer::forceErrorLLError()
{
LL_ERRS() << "This is a deliberate llerror" << LL_ENDL;
@@ -5587,7 +5641,7 @@ void LLAppViewer::handleLoginComplete()
if(gAgent.getRegion())
{
- gDebugInfo["CurrentSimHost"] = gAgent.getRegionHost().getHostName();
+ gDebugInfo["CurrentSimHost"] = gAgent.getRegion()->getSimHostName();
gDebugInfo["CurrentRegion"] = gAgent.getRegion()->getName();
}