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.cpp169
1 files changed, 122 insertions, 47 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 33798032cc..7e6caeba50 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -315,8 +315,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;
@@ -641,7 +639,7 @@ public:
void run()
{
- std::ofstream os(mFile.c_str());
+ llofstream os(mFile.c_str());
while (!LLAppViewer::instance()->isQuitting())
{
@@ -705,7 +703,8 @@ LLAppViewer::LLAppViewer()
mFastTimerLogThread(NULL),
mUpdater(new LLUpdaterService()),
mSettingsLocationList(NULL),
- mIsFirstRun(false)
+ mIsFirstRun(false),
+ mMinMicroSecPerFrame(0.f)
{
if(NULL != sInstance)
{
@@ -734,7 +733,7 @@ LLAppViewer::LLAppViewer()
//
LLLoginInstance::instance().setUpdaterService(mUpdater.get());
- LLLoginInstance::instance().setPlatformInfo(gPlatform, getOSInfo().getOSVersionString(), getOSInfo().getOSStringSimple());
+ LLLoginInstance::instance().setPlatformInfo(gPlatform, LLOSInfo::instance().getOSVersionString(), LLOSInfo::instance().getOSStringSimple());
}
LLAppViewer::~LLAppViewer()
@@ -1249,6 +1248,9 @@ bool LLAppViewer::init()
joystick->setNeedsReset(true);
/*----------------------------------------------------------------------*/
+ gSavedSettings.getControl("FramePerSecondLimit")->getSignal()->connect(boost::bind(&LLAppViewer::onChangeFrameLimit, this, _2));
+ onChangeFrameLimit(gSavedSettings.getLLSD("FramePerSecondLimit"));
+
return true;
}
@@ -1328,9 +1330,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() ;
@@ -1371,14 +1370,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");
@@ -1432,7 +1423,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();
@@ -1460,7 +1468,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)
@@ -1484,7 +1493,6 @@ bool LLAppViewer::frame()
ms_sleep(500);
}
- idleTimer.reset();
S32 total_work_pending = 0;
S32 total_io_pending = 0;
{
@@ -1537,13 +1545,6 @@ bool LLAppViewer::frame()
}
}
- if ((LLStartUp::getStartupState() >= STATE_CLEANUP) &&
- (frameTimer.getElapsedTimeF64() > FRAME_STALL_THRESHOLD))
- {
- gFrameStalls++;
- }
- frameTimer.reset();
-
resumeMainloopTimeout();
pingMainloopTimeout("Main:End");
@@ -3110,7 +3111,7 @@ void LLAppViewer::initUpdater()
mUpdater->initialize(channel,
version,
gPlatform,
- getOSInfo().getOSVersionString(),
+ LLOSInfo::instance().getOSVersionString(),
unique_id,
willing_to_test
);
@@ -3192,10 +3193,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"))
@@ -3337,7 +3341,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));
@@ -3382,7 +3386,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();
@@ -3519,6 +3523,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);
@@ -3595,7 +3663,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.
@@ -3637,8 +3705,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();
@@ -3670,7 +3738,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];
@@ -4358,6 +4426,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
@@ -4372,6 +4441,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);
@@ -4397,23 +4467,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;
@@ -5586,6 +5648,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;