summaryrefslogtreecommitdiff
path: root/indra/newview/llappviewer.cpp
diff options
context:
space:
mode:
authorThomas Nelson <rider@lindenlab.com>2017-10-17 13:38:39 -0700
committerThomas Nelson <rider@lindenlab.com>2017-10-17 13:38:39 -0700
commit5754493cdcfeac76d0576abc19bdf5a03717780d (patch)
treee6db53ae1cd654f9b2a1a6b9ab47e01ea738ecef /indra/newview/llappviewer.cpp
parentcc22ffc6d799544e8f2a9dfed6813081d908c88d (diff)
parent9c5becd67d7e6fe5f696dcae8690dd562b7b0449 (diff)
Merged lindenlab/viewer64 into default
Diffstat (limited to 'indra/newview/llappviewer.cpp')
-rw-r--r--indra/newview/llappviewer.cpp167
1 files changed, 121 insertions, 46 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 3794c19bb1..9af7d9e815 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -307,8 +307,6 @@ F32SecondsImplicit gFrameIntervalSeconds = 0.f;
F32 gFPSClamped = 10.f; // Pretend we start at target rate.
F32 gFrameDTClamped = 0.f; // Time between adjacent checks to network for packets
U64MicrosecondsImplicit gStartTime = 0; // gStartTime is "private", used only to calculate gFrameTimeSeconds
-U32 gFrameStalls = 0;
-const F64 FRAME_STALL_THRESHOLD = 1.0;
LLTimer gRenderStartTime;
LLFrameTimer gForegroundTime;
@@ -631,7 +629,7 @@ public:
void run()
{
- std::ofstream os(mFile.c_str());
+ llofstream os(mFile.c_str());
while (!LLAppViewer::instance()->isQuitting())
{
@@ -694,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)
{
@@ -722,7 +721,7 @@ LLAppViewer::LLAppViewer()
// OK to write stuff to logs now, we've now crash reported if necessary
//
- LLLoginInstance::instance().setPlatformInfo(gPlatform, getOSInfo().getOSVersionString(), getOSInfo().getOSStringSimple());
+ LLLoginInstance::instance().setPlatformInfo(gPlatform, LLOSInfo::instance().getOSVersionString(), LLOSInfo::instance().getOSStringSimple());
}
LLAppViewer::~LLAppViewer()
@@ -1239,6 +1238,9 @@ bool LLAppViewer::init()
joystick->setNeedsReset(true);
/*----------------------------------------------------------------------*/
+ gSavedSettings.getControl("FramePerSecondLimit")->getSignal()->connect(boost::bind(&LLAppViewer::onChangeFrameLimit, this, _2));
+ onChangeFrameLimit(gSavedSettings.getLLSD("FramePerSecondLimit"));
+
return true;
}
@@ -1318,9 +1320,6 @@ bool LLAppViewer::frame()
LLEventPump& mainloop(LLEventPumps::instance().obtain("mainloop"));
LLSD newFrame;
- LLTimer frameTimer,idleTimer;
- LLTimer debugTime;
-
//LLPrivateMemoryPoolTester::getInstance()->run(false) ;
//LLPrivateMemoryPoolTester::getInstance()->run(true) ;
//LLPrivateMemoryPoolTester::destroy() ;
@@ -1361,14 +1360,6 @@ bool LLAppViewer::frame()
gViewerWindow->getWindow()->gatherInput();
}
-#if 1 && !LL_RELEASE_FOR_DOWNLOAD
- // once per second debug info
- if (debugTime.getElapsedTimeF32() > 1.f)
- {
- debugTime.reset();
- }
-
-#endif
//memory leaking simulation
LLFloaterMemLeak* mem_leak_instance =
LLFloaterReg::findTypedInstance<LLFloaterMemLeak>("mem_leaking");
@@ -1422,7 +1413,24 @@ bool LLAppViewer::frame()
{
pingMainloopTimeout("Main:Display");
gGLActive = TRUE;
+
+ static U64 last_call = 0;
+ if (!gTeleportDisplay)
+ {
+ // Frame/draw throttling
+ 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();
+
display();
+
pingMainloopTimeout("Main:Snapshot");
LLFloaterSnapshot::update(); // take snapshots
LLFloaterOutfitSnapshot::update();
@@ -1450,7 +1458,8 @@ bool LLAppViewer::frame()
|| !gFocusMgr.getAppHasFocus())
{
// Sleep if we're not rendering, or the window is minimized.
- S32 milliseconds_to_sleep = llclamp(gSavedSettings.getS32("BackgroundYieldTime"), 0, 1000);
+ static LLCachedControl<S32> s_bacground_yeild_time(gSavedSettings, "BackgroundYieldTime", 40);
+ S32 milliseconds_to_sleep = llclamp((S32)s_bacground_yeild_time, 0, 1000);
// don't sleep when BackgroundYieldTime set to 0, since this will still yield to other threads
// of equal priority on Windows
if (milliseconds_to_sleep > 0)
@@ -1474,7 +1483,6 @@ bool LLAppViewer::frame()
ms_sleep(500);
}
- idleTimer.reset();
S32 total_work_pending = 0;
S32 total_io_pending = 0;
{
@@ -1527,13 +1535,6 @@ bool LLAppViewer::frame()
}
}
- if ((LLStartUp::getStartupState() >= STATE_CLEANUP) &&
- (frameTimer.getElapsedTimeF64() > FRAME_STALL_THRESHOLD))
- {
- gFrameStalls++;
- }
- frameTimer.reset();
-
resumeMainloopTimeout();
pingMainloopTimeout("Main:End");
@@ -2958,10 +2959,13 @@ bool LLAppViewer::initWindow()
#ifdef LL_DARWIN
- //Satisfy both MAINT-3135 (OSX 10.6 and earlier) MAINT-3288 (OSX 10.7 and later)
- if (getOSInfo().mMajorVer == 10 && getOSInfo().mMinorVer < 7)
- if ( getOSInfo().mMinorVer == 6 && getOSInfo().mBuild < 8 )
- gViewerWindow->getWindow()->setOldResize(true);
+ //Satisfy both MAINT-3135 (OSX 10.6 and earlier) MAINT-3288 (OSX 10.7 and later)
+ LLOSInfo& os_info = LLOSInfo::instance();
+ if (os_info.mMajorVer == 10 && os_info.mMinorVer < 7)
+ {
+ if ( os_info.mMinorVer == 6 && os_info.mBuild < 8 )
+ gViewerWindow->getWindow()->setOldResize(true);
+ }
#endif
if (gSavedSettings.getBOOL("WindowMaximized"))
@@ -3104,7 +3108,7 @@ LLSD LLAppViewer::getViewerInfo() const
info["CPU"] = gSysCPU.getCPUString();
info["MEMORY_MB"] = LLSD::Integer(gSysMemory.getPhysicalMemoryKB().valueInUnits<LLUnits::Megabytes>());
// Moved hack adjustment to Windows memory size into llsys.cpp
- info["OS_VERSION"] = LLAppViewer::instance()->getOSInfo().getOSString();
+ info["OS_VERSION"] = LLOSInfo::instance().getOSString();
info["GRAPHICS_CARD_VENDOR"] = (const char*)(glGetString(GL_VENDOR));
info["GRAPHICS_CARD"] = (const char*)(glGetString(GL_RENDERER));
@@ -3149,7 +3153,7 @@ LLSD LLAppViewer::getViewerInfo() const
info["J2C_VERSION"] = LLImageJ2C::getEngineInfo();
bool want_fullname = true;
- info["AUDIO_DRIVER_VERSION"] = gAudiop ? LLSD(gAudiop->getDriverName(want_fullname)) : LLSD();
+ info["AUDIO_DRIVER_VERSION"] = gAudiop ? LLSD(gAudiop->getDriverName(want_fullname)) : "Undefined";
if(LLVoiceClient::getInstance()->voiceEnabled())
{
LLVoiceVersionInfo version = LLVoiceClient::getInstance()->getVersion();
@@ -3299,6 +3303,70 @@ std::string LLAppViewer::getViewerInfoString() const
return support.str();
}
+std::string LLAppViewer::getShortViewerInfoString() const
+{
+ std::ostringstream support;
+ LLSD info(getViewerInfo());
+
+ support << LLTrans::getString("APP_NAME") << " " << info["VIEWER_VERSION_STR"].asString();
+ support << " (" << info["CHANNEL"].asString() << ")";
+ if (info.has("BUILD_CONFIG"))
+ {
+ support << "\n" << "Build Configuration " << info["BUILD_CONFIG"].asString();
+ }
+ if (info.has("REGION"))
+ {
+ support << "\n\n" << "You are at " << ll_vector3_from_sd(info["POSITION_LOCAL"]) << " in " << info["REGION"].asString();
+ support << " located at " << info["HOSTNAME"].asString() << " (" << info["HOSTIP"].asString() << ")";
+ support << "\n" << "SLURL: " << info["SLURL"].asString();
+ support << "\n" << "(Global coordinates " << ll_vector3_from_sd(info["POSITION"]) << ")";
+ support << "\n" << info["SERVER_VERSION"].asString();
+ }
+
+ support << "\n\n" << "CPU: " << info["CPU"].asString();
+ support << "\n" << "Memory: " << info["MEMORY_MB"].asString() << " MB";
+ support << "\n" << "OS: " << info["OS_VERSION"].asString();
+ support << "\n" << "Graphics Card: " << info["GRAPHICS_CARD"].asString() << " (" << info["GRAPHICS_CARD_VENDOR"].asString() << ")";
+
+ if (info.has("GRAPHICS_DRIVER_VERSION"))
+ {
+ support << "\n" << "Windows Graphics Driver Version: " << info["GRAPHICS_DRIVER_VERSION"].asString();
+ }
+
+ support << "\n" << "OpenGL Version: " << info["OPENGL_VERSION"].asString();
+
+ support << "\n\n" << "Window size:" << info["WINDOW_WIDTH"].asString() << "x" << info["WINDOW_HEIGHT"].asString();
+ support << "\n" << "Language: " << LLUI::getLanguage();
+ support << "\n" << "Font Size Adjustment: " << info["FONT_SIZE_ADJUSTMENT"].asString() << "pt";
+ support << "\n" << "UI Scaling: " << info["UI_SCALE"].asString();
+ support << "\n" << "Draw distance: " << info["DRAW_DISTANCE"].asString();
+ support << "\n" << "Bandwidth: " << info["NET_BANDWITH"].asString() << "kbit/s";
+ support << "\n" << "LOD factor: " << info["LOD_FACTOR"].asString();
+ support << "\n" << "Render quality: " << info["RENDER_QUALITY"].asString() << " / 7";
+ support << "\n" << "ALM: " << info["GPU_SHADERS"].asString();
+ support << "\n" << "Texture memory: " << info["TEXTURE_MEMORY"].asString() << "MB";
+ support << "\n" << "VFS (cache) creation time: " << info["VFS_TIME"].asString();
+
+ support << "\n\n" << "J2C Decoder: " << info["J2C_VERSION"].asString();
+ support << "\n" << "Audio Driver: " << info["AUDIO_DRIVER_VERSION"].asString();
+ support << "\n" << "LLCEFLib/CEF: " << info["LLCEFLIB_VERSION"].asString();
+ support << "\n" << "LibVLC: " << info["LIBVLC_VERSION"].asString();
+ support << "\n" << "Voice Server: " << info["VOICE_VERSION"].asString();
+
+ if (info.has("PACKETS_IN"))
+ {
+ support << "\n" << "Packets Lost: " << info["PACKETS_LOST"].asInteger() << "/" << info["PACKETS_IN"].asInteger();
+ F32 packets_pct = info["PACKETS_PCT"].asReal();
+ support << " (" << ll_round(packets_pct, 0.001f) << "%)";
+ }
+
+ LLSD substitution;
+ substitution["datetime"] = (S32)time(NULL);
+ support << "\n" << LLTrans::getString("AboutTime", substitution);
+
+ return support.str();
+}
+
void LLAppViewer::cleanupSavedSettings()
{
gSavedSettings.setBOOL("MouseSun", FALSE);
@@ -3376,7 +3444,7 @@ void LLAppViewer::writeSystemInfo()
gDebugInfo["RAMInfo"]["Physical"] = (LLSD::Integer)(gSysMemory.getPhysicalMemoryKB().value());
gDebugInfo["RAMInfo"]["Allocated"] = (LLSD::Integer)(gMemoryAllocated.valueInUnits<LLUnits::Kilobytes>());
- gDebugInfo["OSInfo"] = getOSInfo().getOSStringSimple();
+ gDebugInfo["OSInfo"] = LLOSInfo::instance().getOSStringSimple();
// The user is not logged on yet, but record the current grid choice login url
// which may have been the intended grid.
@@ -3418,8 +3486,8 @@ void LLAppViewer::writeSystemInfo()
// query some system information
LL_INFOS("SystemInfo") << "CPU info:\n" << gSysCPU << LL_ENDL;
LL_INFOS("SystemInfo") << "Memory info:\n" << gSysMemory << LL_ENDL;
- LL_INFOS("SystemInfo") << "OS: " << getOSInfo().getOSStringSimple() << LL_ENDL;
- LL_INFOS("SystemInfo") << "OS info: " << getOSInfo() << LL_ENDL;
+ LL_INFOS("SystemInfo") << "OS: " << LLOSInfo::instance().getOSStringSimple() << LL_ENDL;
+ LL_INFOS("SystemInfo") << "OS info: " << LLOSInfo::instance() << LL_ENDL;
gDebugInfo["SettingsFilename"] = gSavedSettings.getString("ClientSettingsFile");
gDebugInfo["ViewerExePath"] = gDirUtilp->getExecutablePathAndName();
@@ -3451,7 +3519,7 @@ void getFileList()
if ( ( iter->length() > 30 ) && (iter->rfind(".dmp") == (iter->length()-4) ) )
{
std::string fullname = pathname + *iter;
- std::ifstream fdat( fullname.c_str(), std::ifstream::binary);
+ llifstream fdat( fullname.c_str(), std::ifstream::binary);
if (fdat)
{
char buf[5];
@@ -4138,6 +4206,7 @@ bool LLAppViewer::initCache()
if (gSavedSettings.getBOOL("PurgeCacheOnStartup") ||
gSavedSettings.getBOOL("PurgeCacheOnNextStartup"))
{
+ LL_INFOS("AppCache") << "Startup cache purge requested: " << (gSavedSettings.getBOOL("PurgeCacheOnStartup") ? "ALWAYS" : "ONCE") << LL_ENDL;
gSavedSettings.setBOOL("PurgeCacheOnNextStartup", false);
mPurgeCache = true;
// STORM-1141 force purgeAllTextures to get called to prevent a crash here. -brad
@@ -4152,6 +4221,7 @@ bool LLAppViewer::initCache()
std::string new_cache_location = gSavedSettings.getString("NewCacheLocation");
if (new_cache_location != cache_location)
{
+ LL_INFOS("AppCache") << "Cache location changed, cache needs purging" << LL_ENDL;
gDirUtilp->setCacheDir(gSavedSettings.getString("CacheLocation"));
purgeCache(); // purge old cache
gSavedSettings.setString("CacheLocation", new_cache_location);
@@ -4177,23 +4247,15 @@ bool LLAppViewer::initCache()
// Init the texture cache
// Allocate 80% of the cache size for textures
const S32 MB = 1024 * 1024;
- const S64 MIN_CACHE_SIZE = 64 * MB;
+ const S64 MIN_CACHE_SIZE = 256 * MB;
const S64 MAX_CACHE_SIZE = 9984ll * MB;
const S64 MAX_VFS_SIZE = 1024 * MB; // 1 GB
S64 cache_size = (S64)(gSavedSettings.getU32("CacheSize")) * MB;
cache_size = llclamp(cache_size, MIN_CACHE_SIZE, MAX_CACHE_SIZE);
- S64 texture_cache_size = ((cache_size * 8) / 10);
- S64 vfs_size = cache_size - texture_cache_size;
-
- if (vfs_size > MAX_VFS_SIZE)
- {
- // Give the texture cache more space, since the VFS can't be bigger than 1GB.
- // This happens when the user's CacheSize setting is greater than 5GB.
- vfs_size = MAX_VFS_SIZE;
- texture_cache_size = cache_size - MAX_VFS_SIZE;
- }
+ S64 vfs_size = llmin((S64)((cache_size * 2) / 10), MAX_VFS_SIZE);
+ S64 texture_cache_size = cache_size - vfs_size;
S64 extra = LLAppViewer::getTextureCache()->initCache(LL_PATH_CACHE, texture_cache_size, texture_cache_mismatch);
texture_cache_size -= extra;
@@ -5366,6 +5428,19 @@ void LLAppViewer::disconnectViewer()
LLUrlEntryParcel::setDisconnected(gDisconnected);
}
+bool LLAppViewer::onChangeFrameLimit(LLSD const & evt)
+{
+ if (evt.asInteger() > 0)
+ {
+ mMinMicroSecPerFrame = 1000000 / evt.asInteger();
+ }
+ else
+ {
+ mMinMicroSecPerFrame = 0;
+ }
+ return false;
+}
+
void LLAppViewer::forceErrorLLError()
{
LL_ERRS() << "This is a deliberate llerror" << LL_ENDL;