summaryrefslogtreecommitdiff
path: root/indra/newview/llappviewer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llappviewer.cpp')
-rw-r--r--indra/newview/llappviewer.cpp244
1 files changed, 135 insertions, 109 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index e7cb17ddd9..8235e4466c 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -108,6 +108,7 @@
#include "llscenemonitor.h"
#include "llavatarrenderinfoaccountant.h"
#include "lllocalbitmaps.h"
+#include "llperfstats.h"
// Linden library includes
#include "llavatarnamecache.h"
@@ -135,6 +136,10 @@
#include "vlc/libvlc_version.h"
#endif // LL_LINUX
+#if LL_DARWIN
+#include "llwindowmacosx.h"
+#endif
+
// Third party library includes
#include <boost/bind.hpp>
#include <boost/foreach.hpp>
@@ -209,7 +214,7 @@
#include "llcommandlineparser.h"
#include "llfloatermemleak.h"
#include "llfloaterreg.h"
-#include "llfloateroutfitsnapshot.h"
+#include "llfloatersimpleoutfitsnapshot.h"
#include "llfloatersnapshot.h"
#include "llsidepanelinventory.h"
#include "llatmosphere.h"
@@ -557,9 +562,10 @@ static void settings_to_globals()
gDebugWindowProc = gSavedSettings.getBOOL("DebugWindowProc");
gShowObjectUpdates = gSavedSettings.getBOOL("ShowObjectUpdates");
- LLWorldMapView::sMapScale = gSavedSettings.getF32("MapScale");
+ LLWorldMapView::setScaleSetting(gSavedSettings.getF32("MapScale"));
#if LL_DARWIN
+ LLWindowMacOSX::sUseMultGL = gSavedSettings.getBOOL("RenderAppleUseMultGL");
gHiDPISupport = gSavedSettings.getBOOL("RenderHiDPI");
#endif
}
@@ -1270,7 +1276,6 @@ bool LLAppViewer::init()
//LLSimpleton creations
LLEnvironment::createInstance();
- LLEnvironment::getInstance()->initSingleton();
LLWorld::createInstance();
LLSelectMgr::createInstance();
LLViewerCamera::createInstance();
@@ -1372,82 +1377,91 @@ bool LLAppViewer::frame()
bool LLAppViewer::doFrame()
{
- LL_RECORD_BLOCK_TIME(FTM_FRAME);
+ LL_RECORD_BLOCK_TIME(FTM_FRAME);
+ {
+ // and now adjust the visuals from previous frame.
+ if(LLPerfStats::tunables.userAutoTuneEnabled && LLPerfStats::tunables.tuningFlag != LLPerfStats::Tunables::Nothing)
+ {
+ LLPerfStats::tunables.applyUpdates();
+ }
+ LLPerfStats::RecordSceneTime T (LLPerfStats::StatType_t::RENDER_FRAME);
if (!LLWorld::instanceExists())
{
LLWorld::createInstance();
}
- LLEventPump& mainloop(LLEventPumps::instance().obtain("mainloop"));
- LLSD newFrame;
-
- {
- LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df LLTrace");
- if (LLFloaterReg::instanceVisible("block_timers"))
+ LLEventPump& mainloop(LLEventPumps::instance().obtain("mainloop"));
+ LLSD newFrame;
+ {
+ LLPerfStats::RecordSceneTime T (LLPerfStats::StatType_t::RENDER_IDLE); // perf stats
{
- LLTrace::BlockTimer::processTimes();
- }
-
- LLTrace::get_frame_recording().nextPeriod();
- LLTrace::BlockTimer::logStats();
- }
+ LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df LLTrace");
+ if (LLFloaterReg::instanceVisible("block_timers"))
+ {
+ LLTrace::BlockTimer::processTimes();
+ }
- LLTrace::get_thread_recorder()->pullFromChildren();
+ LLTrace::get_frame_recording().nextPeriod();
+ LLTrace::BlockTimer::logStats();
+ }
- //clear call stack records
- LL_CLEAR_CALLSTACKS();
+ LLTrace::get_thread_recorder()->pullFromChildren();
- {
- LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df processMiscNativeEvents" )
- pingMainloopTimeout("Main:MiscNativeWindowEvents");
+ //clear call stack records
+ LL_CLEAR_CALLSTACKS();
+ }
+ {
+ {
+ LLPerfStats::RecordSceneTime T(LLPerfStats::StatType_t::RENDER_IDLE); // ensure we have the entire top scope of frame covered (input event and coro)
+ LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df processMiscNativeEvents")
+ pingMainloopTimeout("Main:MiscNativeWindowEvents");
- if (gViewerWindow)
- {
- LL_RECORD_BLOCK_TIME(FTM_MESSAGES);
- gViewerWindow->getWindow()->processMiscNativeEvents();
- }
+ if (gViewerWindow)
+ {
+ LL_RECORD_BLOCK_TIME(FTM_MESSAGES);
+ gViewerWindow->getWindow()->processMiscNativeEvents();
+ }
- {
- LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df gatherInput" )
- pingMainloopTimeout("Main:GatherInput");
- }
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df gatherInput")
+ pingMainloopTimeout("Main:GatherInput");
+ }
- if (gViewerWindow)
- {
- LL_RECORD_BLOCK_TIME(FTM_MESSAGES);
- if (!restoreErrorTrap())
- {
- LL_WARNS() << " Someone took over my signal/exception handler (post messagehandling)!" << LL_ENDL;
- }
+ if (gViewerWindow)
+ {
+ LL_RECORD_BLOCK_TIME(FTM_MESSAGES);
+ if (!restoreErrorTrap())
+ {
+ LL_WARNS() << " Someone took over my signal/exception handler (post messagehandling)!" << LL_ENDL;
+ }
- gViewerWindow->getWindow()->gatherInput();
- }
+ gViewerWindow->getWindow()->gatherInput();
+ }
- //memory leaking simulation
- if (gSimulateMemLeak)
- {
- LLFloaterMemLeak* mem_leak_instance =
- LLFloaterReg::findTypedInstance<LLFloaterMemLeak>("mem_leaking");
- if (mem_leak_instance)
- {
- mem_leak_instance->idle();
- }
- }
+ //memory leaking simulation
+ if (gSimulateMemLeak)
+ {
+ LLFloaterMemLeak* mem_leak_instance =
+ LLFloaterReg::findTypedInstance<LLFloaterMemLeak>("mem_leaking");
+ if (mem_leak_instance)
+ {
+ mem_leak_instance->idle();
+ }
+ }
- {
- LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df mainloop" )
- // canonical per-frame event
- mainloop.post(newFrame);
- }
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df mainloop")
+ // canonical per-frame event
+ mainloop.post(newFrame);
+ }
- {
- LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df suspend" )
- // give listeners a chance to run
- llcoro::suspend();
- // if one of our coroutines threw an uncaught exception, rethrow it now
- LLCoros::instance().rethrow();
- }
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df suspend")
+ // give listeners a chance to run
+ llcoro::suspend();
+ }
+ }
if (!LLApp::isExiting())
{
@@ -1465,6 +1479,7 @@ bool LLAppViewer::doFrame()
&& (gHeadlessClient || !gViewerWindow->getShowProgress())
&& !gFocusMgr.focusLocked())
{
+ LLPerfStats::RecordSceneTime T (LLPerfStats::StatType_t::RENDER_IDLE);
joystick->scanJoystick();
gKeyboard->scanKeyboard();
gViewerInput.scanMouse();
@@ -1478,6 +1493,7 @@ bool LLAppViewer::doFrame()
}
{
+ LLPerfStats::RecordSceneTime T (LLPerfStats::StatType_t::RENDER_IDLE);
LL_PROFILE_ZONE_NAMED_CATEGORY_APP("df idle"); //LL_RECORD_BLOCK_TIME(FTM_IDLE);
idle();
}
@@ -1512,13 +1528,14 @@ bool LLAppViewer::doFrame()
display();
- {
- LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df Snapshot" )
- pingMainloopTimeout("Main:Snapshot");
- LLFloaterSnapshot::update(); // take snapshots
- LLFloaterOutfitSnapshot::update();
- gGLActive = FALSE;
- }
+ {
+ LLPerfStats::RecordSceneTime T(LLPerfStats::StatType_t::RENDER_IDLE);
+ LL_PROFILE_ZONE_NAMED_CATEGORY_APP( "df Snapshot" )
+ pingMainloopTimeout("Main:Snapshot");
+ LLFloaterSnapshot::update(); // take snapshots
+ LLFloaterSimpleOutfitSnapshot::update();
+ gGLActive = FALSE;
+ }
}
}
@@ -1564,7 +1581,8 @@ bool LLAppViewer::doFrame()
// of equal priority on Windows
if (milliseconds_to_sleep > 0)
{
- ms_sleep(milliseconds_to_sleep);
+ LLPerfStats::RecordSceneTime T ( LLPerfStats::StatType_t::RENDER_SLEEP );
+ ms_sleep(milliseconds_to_sleep);
// also pause worker threads during this wait period
LLAppViewer::getTextureCache()->pause();
LLAppViewer::getImageDecodeThread()->pause();
@@ -1665,7 +1683,7 @@ bool LLAppViewer::doFrame()
LL_INFOS() << "Exiting main_loop" << LL_ENDL;
}
-
+ }LLPerfStats::StatsRecorder::endFrame();
LL_PROFILER_FRAME_END
return ! LLApp::isRunning();
@@ -1720,7 +1738,8 @@ bool LLAppViewer::cleanup()
{
if (!isSecondInstance())
{
- LLSceneMonitor::instance().dumpToFile(gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "scene_monitor_results.csv"));
+ std::string dump_path = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "scene_monitor_results.csv");
+ LLSceneMonitor::instance().dumpToFile(dump_path);
}
LLSceneMonitor::deleteSingleton();
}
@@ -2154,6 +2173,7 @@ bool LLAppViewer::cleanup()
LLSelectMgr::deleteSingleton();
LLViewerEventRecorder::deleteSingleton();
LLWorld::deleteSingleton();
+ LLVoiceClient::deleteSingleton();
// It's not at first obvious where, in this long sequence, a generic cleanup
// call OUGHT to go. So let's say this: as we migrate cleanup from
@@ -2487,10 +2507,24 @@ bool LLAppViewer::initConfiguration()
//Load settings files list
std::string settings_file_list = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "settings_files.xml");
LLXMLNodePtr root;
- BOOL success = LLXMLNode::parseFile(settings_file_list, root, NULL);
+ BOOL success = LLXMLNode::parseFile(settings_file_list, root, NULL);
if (!success)
{
- LL_ERRS() << "Cannot load default configuration file " << settings_file_list << LL_ENDL;
+ LL_WARNS() << "Cannot load default configuration file " << settings_file_list << LL_ENDL;
+ if (gDirUtilp->fileExists(settings_file_list))
+ {
+ LL_ERRS() << "Cannot load default configuration file settings_files.xml. "
+ << "Please reinstall viewer from https://secondlife.com/support/downloads/ "
+ << "and contact https://support.secondlife.com if issue persists after reinstall."
+ << LL_ENDL;
+ }
+ else
+ {
+ LL_ERRS() << "Default configuration file settings_files.xml not found. "
+ << "Please reinstall viewer from https://secondlife.com/support/downloads/ "
+ << "and contact https://support.secondlife.com if issue persists after reinstall."
+ << LL_ENDL;
+ }
}
mSettingsLocationList = new SettingsFiles();
@@ -2991,15 +3025,9 @@ void LLAppViewer::initStrings()
}
}
-//
-// This function decides whether the client machine meets the minimum requirements to
-// run in a maximized window, per the consensus of davep, boa and nyx on 3/30/2011.
-//
bool LLAppViewer::meetsRequirementsForMaximizedStart()
{
- bool maximizedOk = (LLFeatureManager::getInstance()->getGPUClass() >= GPU_CLASS_2);
-
- maximizedOk &= (gSysMemory.getPhysicalMemoryKB() >= U32Gigabytes(1));
+ bool maximizedOk = (gSysMemory.getPhysicalMemoryKB() >= U32Gigabytes(1));
return maximizedOk;
}
@@ -3176,15 +3204,16 @@ LLSD LLAppViewer::getViewerInfo() const
// LLFloaterAbout.
LLSD info;
auto& versionInfo(LLVersionInfo::instance());
- info["VIEWER_VERSION"] = LLSDArray(versionInfo.getMajor())(versionInfo.getMinor())(versionInfo.getPatch())(versionInfo.getBuild());
+ info["VIEWER_VERSION"] = llsd::array(versionInfo.getMajor(), versionInfo.getMinor(),
+ versionInfo.getPatch(), versionInfo.getBuild());
info["VIEWER_VERSION_STR"] = versionInfo.getVersion();
info["CHANNEL"] = versionInfo.getChannel();
- info["ADDRESS_SIZE"] = ADDRESS_SIZE;
- std::string build_config = versionInfo.getBuildConfig();
- if (build_config != "Release")
- {
- info["BUILD_CONFIG"] = build_config;
- }
+ info["ADDRESS_SIZE"] = ADDRESS_SIZE;
+ std::string build_config = versionInfo.getBuildConfig();
+ if (build_config != "Release")
+ {
+ info["BUILD_CONFIG"] = build_config;
+ }
// return a URL to the release notes for this viewer, such as:
// https://releasenotes.secondlife.com/viewer/2.1.0.123456.html
@@ -3492,7 +3521,7 @@ void LLAppViewer::cleanupSavedSettings()
}
}
- gSavedSettings.setF32("MapScale", LLWorldMapView::sMapScale );
+ gSavedSettings.setF32("MapScale", LLWorldMapView::getScaleSetting());
// Some things are cached in LLAgent.
if (gAgent.isInitialized())
@@ -4291,12 +4320,17 @@ bool LLAppViewer::initCache()
// initialize the new disk cache using saved settings
const std::string cache_dir_name = gSavedSettings.getString("DiskCacheDirName");
+ const U32 MB = 1024 * 1024;
+ const uintmax_t MIN_CACHE_SIZE = 256 * MB;
+ const uintmax_t MAX_CACHE_SIZE = 9984ll * MB;
+ const uintmax_t setting_cache_total_size = uintmax_t(gSavedSettings.getU32("CacheSize")) * MB;
+ const uintmax_t cache_total_size = llclamp(setting_cache_total_size, MIN_CACHE_SIZE, MAX_CACHE_SIZE);
+ const F64 disk_cache_percent = gSavedSettings.getF32("DiskCachePercentOfTotal");
+ const F64 texture_cache_percent = 100.0 - disk_cache_percent;
+
// note that the maximum size of this cache is defined as a percentage of the
// total cache size - the 'CacheSize' pref - for all caches.
- const unsigned int cache_total_size_mb = gSavedSettings.getU32("CacheSize");
- const double disk_cache_percent = gSavedSettings.getF32("DiskCachePercentOfTotal");
- const unsigned int disk_cache_mb = cache_total_size_mb * disk_cache_percent / 100;
- const uintmax_t disk_cache_bytes = disk_cache_mb * 1024 * 1024;
+ const uintmax_t disk_cache_size = uintmax_t(cache_total_size * disk_cache_percent / 100);
const bool enable_cache_debug_info = gSavedSettings.getBOOL("EnableDiskCacheDebugInfo");
bool texture_cache_mismatch = false;
@@ -4351,7 +4385,7 @@ bool LLAppViewer::initCache()
}
const std::string cache_dir = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, cache_dir_name);
- LLDiskCache::initParamSingleton(cache_dir, disk_cache_bytes, enable_cache_debug_info);
+ LLDiskCache::initParamSingleton(cache_dir, disk_cache_size, enable_cache_debug_info);
if (!read_only)
{
@@ -4386,22 +4420,14 @@ bool LLAppViewer::initCache()
LLSplashScreen::update(LLTrans::getString("StartupInitializingTextureCache"));
// Init the texture cache
- // Allocate 80% of the cache size for textures
- const S32 MB = 1024 * 1024;
- const S64 MIN_CACHE_SIZE = 256 * MB;
- const S64 MAX_CACHE_SIZE = 9984ll * MB;
-
- S64 cache_size = (S64)(gSavedSettings.getU32("CacheSize")) * MB;
- cache_size = llclamp(cache_size, MIN_CACHE_SIZE, MAX_CACHE_SIZE);
+ // Allocate the remaining percent which is not allocated to the disk cache
+ const S64 texture_cache_size = S64(cache_total_size * texture_cache_percent / 100);
- S64 texture_cache_size = cache_size;
-
- S64 extra = LLAppViewer::getTextureCache()->initCache(LL_PATH_CACHE, texture_cache_size, texture_cache_mismatch);
- texture_cache_size -= extra;
+ LLAppViewer::getTextureCache()->initCache(LL_PATH_CACHE, texture_cache_size, texture_cache_mismatch);
LLVOCache::getInstance()->initCache(LL_PATH_CACHE, gSavedSettings.getU32("CacheNumberOfRegionsForObjects"), getObjectCacheVersion());
- return true;
+ return true;
}
void LLAppViewer::addOnIdleCallback(const boost::function<void()>& cb)
@@ -5087,8 +5113,7 @@ void LLAppViewer::idle()
audio_update_wind(false);
// this line actually commits the changes we've made to source positions, etc.
- const F32 max_audio_decode_time = 0.002f; // 2 ms decode time
- gAudiop->idle(max_audio_decode_time);
+ gAudiop->idle();
}
}
@@ -5460,7 +5485,8 @@ void LLAppViewer::disconnectViewer()
{
gInventory.cache(gInventory.getRootFolderID(), gAgent.getID());
if (gInventory.getLibraryRootFolderID().notNull()
- && gInventory.getLibraryOwnerID().notNull())
+ && gInventory.getLibraryOwnerID().notNull()
+ && !mSecondInstance) // agent is unique, library isn't
{
gInventory.cache(
gInventory.getLibraryRootFolderID(),