diff options
Diffstat (limited to 'indra/newview/llappviewer.cpp')
-rw-r--r-- | indra/newview/llappviewer.cpp | 383 |
1 files changed, 250 insertions, 133 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index f6fe7ecd01..90f46316e8 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -46,6 +46,7 @@ #include "llviewerstats.h" #include "llviewerstatsrecorder.h" #include "llmd5.h" +#include "llmeshrepository.h" #include "llpumpio.h" #include "llmimetypes.h" #include "llslurl.h" @@ -75,21 +76,23 @@ #include "llteleporthistory.h" #include "lllocationhistory.h" #include "llfasttimerview.h" +#include "llvector4a.h" +#include "llviewermenufile.h" #include "llvoicechannel.h" #include "llvoavatarself.h" #include "llsidetray.h" -#include "llfeaturemanager.h" #include "llurlmatch.h" #include "lltextutil.h" #include "lllogininstance.h" #include "llprogressview.h" - +#include "llvocache.h" #include "llweb.h" #include "llsecondlifeurls.h" #include "llupdaterservice.h" // Linden library includes #include "llavatarnamecache.h" +#include "lldiriterator.h" #include "llimagej2c.h" #include "llmemory.h" #include "llprimitive.h" @@ -133,7 +136,6 @@ #include "lltoolmgr.h" #include "llassetstorage.h" #include "llpolymesh.h" -#include "llcachename.h" #include "llaudioengine.h" #include "llstreamingaudio.h" #include "llviewermenu.h" @@ -201,7 +203,6 @@ // Include for security api initialization #include "llsecapi.h" #include "llmachineid.h" - #include "llmainlooprepeater.h" // *FIX: These extern globals should be cleaned up. @@ -498,6 +499,7 @@ static void settings_to_globals() LLVolumeImplFlexible::sUpdateFactor = gSavedSettings.getF32("RenderFlexTimeFactor"); LLVOTree::sTreeFactor = gSavedSettings.getF32("RenderTreeLODFactor"); LLVOAvatar::sLODFactor = gSavedSettings.getF32("RenderAvatarLODFactor"); + LLVOAvatar::sPhysicsLODFactor = gSavedSettings.getF32("RenderAvatarPhysicsLODFactor"); LLVOAvatar::sMaxVisible = (U32)gSavedSettings.getS32("RenderAvatarMaxVisible"); LLVOAvatar::sVisibleInFirstPerson = gSavedSettings.getBOOL("FirstPersonAvatarVisible"); // clamp auto-open time to some minimum usable value @@ -506,8 +508,8 @@ static void settings_to_globals() LLSelectMgr::sRenderHiddenSelections = gSavedSettings.getBOOL("RenderHiddenSelections"); LLSelectMgr::sRenderLightRadius = gSavedSettings.getBOOL("RenderLightRadius"); - gAgentPilot.mNumRuns = gSavedSettings.getS32("StatsNumRuns"); - gAgentPilot.mQuitAfterRuns = gSavedSettings.getBOOL("StatsQuitAfterRuns"); + gAgentPilot.setNumRuns(gSavedSettings.getS32("StatsNumRuns")); + gAgentPilot.setQuitAfterRuns(gSavedSettings.getBOOL("StatsQuitAfterRuns")); gAgent.setHideGroupTitle(gSavedSettings.getBOOL("RenderHideGroupTitle")); gDebugWindowProc = gSavedSettings.getBOOL("DebugWindowProc"); @@ -517,7 +519,8 @@ static void settings_to_globals() static void settings_modify() { - LLRenderTarget::sUseFBO = gSavedSettings.getBOOL("RenderUseFBO"); + LLRenderTarget::sUseFBO = gSavedSettings.getBOOL("RenderDeferred"); + LLPipeline::sRenderDeferred = gSavedSettings.getBOOL("RenderDeferred"); LLVOAvatar::sUseImpostors = gSavedSettings.getBOOL("RenderUseImpostors"); LLVOSurfacePatch::sLODFactor = gSavedSettings.getF32("RenderTerrainLODFactor"); LLVOSurfacePatch::sLODFactor *= LLVOSurfacePatch::sLODFactor; //square lod factor to get exponential range of [1,4] @@ -568,7 +571,7 @@ public: std::string mFile; LLFastTimerLogThread(std::string& test_name) : LLThread("fast timer log") - { + { std::string file_name = test_name + std::string(".slp"); mFile = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, file_name); } @@ -586,7 +589,6 @@ public: os.close(); } - }; //virtual @@ -672,6 +674,9 @@ bool LLAppViewer::init() // LLFastTimer::reset(); + // initialize SSE options + LLVector4a::initClass(); + // Need to do this initialization before we do anything else, since anything // that touches files should really go through the lldir API gDirUtilp->initAppDirs("SecondLife"); @@ -690,6 +695,8 @@ bool LLAppViewer::init() if (!initConfiguration()) return false; + LL_INFOS("InitInfo") << "Configuration initialized." << LL_ENDL ; + // write Google Breakpad minidump files to our log directory std::string logdir = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, ""); logdir += gDirUtilp->getDirDelimiter(); @@ -716,6 +723,8 @@ bool LLAppViewer::init() // *NOTE:Mani - LLCurl::initClass is not thread safe. // Called before threads are created. LLCurl::initClass(); + LL_INFOS("InitInfo") << "LLCurl initialized." << LL_ENDL ; + LLMachineID::init(); { @@ -734,6 +743,8 @@ bool LLAppViewer::init() } initThreads(); + LL_INFOS("InitInfo") << "Threads initialized." << LL_ENDL ; + writeSystemInfo(); // Initialize updater service (now that we have an io pump) @@ -755,7 +766,7 @@ bool LLAppViewer::init() // // Various introspection concerning the libs we're using - particularly - // the libs involved in getting to a full login screen. + // the libs involved in getting to a full login screen. // LL_INFOS("InitInfo") << "J2C Engine is: " << LLImageJ2C::getEngineInfo() << LL_ENDL; LL_INFOS("InitInfo") << "libcurl version is: " << LLCurl::getVersionString() << LL_ENDL; @@ -768,6 +779,7 @@ bool LLAppViewer::init() gCrashSettings.setS32(CRASH_BEHAVIOR_SETTING, CRASH_BEHAVIOR_ALWAYS_SEND); gCrashSettings.saveToFile(crash_settings_filename, FALSE); } + LL_INFOS("InitInfo") << "Crash settings done." << LL_ENDL ; ///////////////////////////////////////////////// // OS-specific login dialogs @@ -816,6 +828,8 @@ bool LLAppViewer::init() // Let code in llui access the viewer help floater LLUI::sHelpImpl = LLViewerHelp::getInstance(); + LL_INFOS("InitInfo") << "UI initialization is done." << LL_ENDL ; + // Load translations for tooltips LLFloater::initClass(); @@ -865,6 +879,7 @@ bool LLAppViewer::init() // Early out from user choice. return false; } + LL_INFOS("InitInfo") << "Hardware test initialization done." << LL_ENDL ; // Prepare for out-of-memory situations, during which we will crash on // purpose and save a dump. @@ -885,15 +900,17 @@ bool LLAppViewer::init() OSMessageBox(msg.str(),LLStringUtil::null,OSMB_OK); return 1; } - + LL_INFOS("InitInfo") << "Cache initialization is done." << LL_ENDL ; + // Initialize the repeater service. LLMainLoopRepeater::instance().start(); - + // // Initialize the window // gGLActive = TRUE; initWindow(); + LL_INFOS("InitInfo") << "Window is initialized." << LL_ENDL ; // initWindow also initializes the Feature List, so now we can initialize this global. LLCubeMap::sUseCubeMaps = LLFeatureManager::getInstance()->isFeatureAvailable("RenderCubeMap"); @@ -924,7 +941,7 @@ bool LLAppViewer::init() } // If we don't have the right GL requirements, exit. - if (!gGLManager.mHasRequirements && !gNoRender) + if (!gGLManager.mHasRequirements) { // can't use an alert here since we're exiting and // all hell breaks lose. @@ -935,6 +952,18 @@ bool LLAppViewer::init() return 0; } + // Without SSE2 support we will crash almost immediately, warn here. + if (!gSysCPU.hasSSE2()) + { + // can't use an alert here since we're exiting and + // all hell breaks lose. + OSMessageBox( + LLNotifications::instance().getGlobalString("UnsupportedCPUSSE2"), + LLStringUtil::null, + OSMB_OK); + return 0; + } + // alert the user if they are using unsupported hardware if(!gSavedSettings.getBOOL("AlertedUnsupportedHardware")) { @@ -994,7 +1023,7 @@ bool LLAppViewer::init() gDebugInfo["GraphicsCard"] = LLFeatureManager::getInstance()->getGPUString(); // Save the current version to the prefs file - gSavedSettings.setString("LastRunVersion", + gSavedSettings.setString("LastRunVersion", LLVersionInfo::getChannelAndVersion()); gSimLastTime = gRenderStartTime.getElapsedTimeF32(); @@ -1019,6 +1048,8 @@ bool LLAppViewer::init() } LLViewerMedia::initClass(); + LL_INFOS("InitInfo") << "Viewer media initialized." << LL_ENDL ; + LLTextUtil::TextHelpers::iconCallbackCreationFunction = create_text_segment_icon_from_url_match; //EXT-7013 - On windows for some locale (Japanese) standard @@ -1072,7 +1103,7 @@ bool LLAppViewer::mainLoop() gServicePump = new LLPumpIO(gAPRPoolp); LLHTTPClient::setPump(*gServicePump); LLCurl::setCAFile(gDirUtilp->getCAFile()); - + // Note: this is where gLocalSpeakerMgr and gActiveSpeakerMgr used to be instantiated. LLVoiceChannel::initClass(); @@ -1162,11 +1193,11 @@ bool LLAppViewer::mainLoop() // Scan keyboard for movement keys. Command keys and typing // are handled by windows callbacks. Don't do this until we're // done initializing. JC - if (gViewerWindow->mWindow->getVisible() + if ((gHeadlessClient || gViewerWindow->mWindow->getVisible()) && gViewerWindow->getActive() && !gViewerWindow->mWindow->getMinimized() && LLStartUp::getStartupState() == STATE_STARTED - && !gViewerWindow->getShowProgress() + && (gHeadlessClient || !gViewerWindow->getShowProgress()) && !gFocusMgr.focusLocked()) { LLMemType mjk(LLMemType::MTYPE_JOY_KEY); @@ -1214,7 +1245,8 @@ bool LLAppViewer::mainLoop() } // Render scene. - if (!LLApp::isExiting()) + // *TODO: Should we run display() even during gHeadlessClient? DK 2011-02-18 + if (!LLApp::isExiting() && !gHeadlessClient) { pingMainloopTimeout("Main:Display"); gGLActive = TRUE; @@ -1242,8 +1274,7 @@ bool LLAppViewer::mainLoop() } // yield cooperatively when not running as foreground window - if ( gNoRender - || (gViewerWindow && !gViewerWindow->mWindow->getVisible()) + if ( (gViewerWindow && !gViewerWindow->mWindow->getVisible()) || !gFocusMgr.getAppHasFocus()) { // Sleep if we're not rendering, or the window is minimized. @@ -1316,6 +1347,7 @@ bool LLAppViewer::mainLoop() break; } } + gMeshRepo.update() ; if(!total_work_pending) //pause texture fetching threads if nothing to process. { @@ -1421,6 +1453,20 @@ bool LLAppViewer::cleanup() // workaround for DEV-35406 crash on shutdown LLEventPumps::instance().reset(); + if (LLFastTimerView::sAnalyzePerformance) + { + llinfos << "Analyzing performance" << llendl; + std::string baseline_name = LLFastTimer::sLogName + "_baseline.slp"; + std::string current_name = LLFastTimer::sLogName + ".slp"; + std::string report_name = LLFastTimer::sLogName + "_report.csv"; + + LLFastTimerView::doAnalysis( + gDirUtilp->getExpandedFilename(LL_PATH_LOGS, baseline_name), + gDirUtilp->getExpandedFilename(LL_PATH_LOGS, current_name), + gDirUtilp->getExpandedFilename(LL_PATH_LOGS, report_name)); + } + LLMetricPerformanceTesterBasic::cleanClass(); + // remove any old breakpad minidump files from the log directory if (! isError()) { @@ -1459,6 +1505,9 @@ bool LLAppViewer::cleanup() llinfos << "Cleaning Up" << llendflush; + // shut down mesh streamer + gMeshRepo.shutdown(); + // Must clean up texture references before viewer window is destroyed. if(LLHUDManager::instanceExists()) { @@ -1727,6 +1776,8 @@ bool LLAppViewer::cleanup() sTextureFetch->shutDownTextureCacheThread() ; sTextureFetch->shutDownImageDecodeThread() ; + LLFilePickerThread::cleanupClass(); + delete sTextureCache; sTextureCache = NULL; delete sTextureFetch; @@ -1748,7 +1799,8 @@ bool LLAppViewer::cleanup() gDirUtilp->getExpandedFilename(LL_PATH_LOGS, baseline_name), gDirUtilp->getExpandedFilename(LL_PATH_LOGS, current_name), gDirUtilp->getExpandedFilename(LL_PATH_LOGS, report_name)); - } + } + LLMetricPerformanceTesterBasic::cleanClass() ; #if LL_RECORD_VIEWER_STATS @@ -1876,6 +1928,11 @@ bool LLAppViewer::initThreads() mFastTimerLogThread->start(); } + // Mesh streaming and caching + gMeshRepo.init(); + + LLFilePickerThread::initClass(); + // *FIX: no error handling here! return true; } @@ -2088,6 +2145,8 @@ bool LLAppViewer::initConfiguration() gSavedSettings.setString("ClientSettingsFile", gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, getSettingsFilename("Default", "Global"))); + gSavedSettings.setString("VersionChannelName", LLVersionInfo::getChannel()); + #ifndef LL_RELEASE_FOR_DOWNLOAD // provide developer build only overrides for these control variables that are not // persisted to settings.xml @@ -2258,7 +2317,6 @@ bool LLAppViewer::initConfiguration() { LLVersionInfo::resetChannel(clp.getOption("channel")[0]); } - // If we have specified crash on startup, set the global so we'll trigger the crash at the right time if(clp.hasOption("crashonstartup")) @@ -2269,12 +2327,12 @@ bool LLAppViewer::initConfiguration() if (clp.hasOption("logperformance")) { LLFastTimer::sLog = TRUE; - LLFastTimer::sLogName = std::string("performance"); + LLFastTimer::sLogName = std::string("performance"); } if (clp.hasOption("logmetrics")) - { - LLFastTimer::sMetricLog = TRUE ; + { + LLFastTimer::sMetricLog = TRUE ; // '--logmetrics' can be specified with a named test metric argument so the data gathering is done only on that test // In the absence of argument, every metric is gathered (makes for a rather slow run and hard to decipher report...) std::string test_name = clp.getOption("logmetrics")[0]; @@ -2288,7 +2346,7 @@ bool LLAppViewer::initConfiguration() { LLFastTimer::sLogName = test_name; } - } + } if (clp.hasOption("graphicslevel")) { @@ -2331,7 +2389,7 @@ bool LLAppViewer::initConfiguration() if (clp.hasOption("replaysession")) { - LLAgentPilot::sReplaySession = TRUE; + gAgentPilot.setReplaySession(TRUE); } if (clp.hasOption("nonotifications")) @@ -2458,7 +2516,8 @@ bool LLAppViewer::initConfiguration() // it relies on checking a marker file which will not work when running // out of different directories - if (LLStartUp::getStartSLURL().isValid()) + if (LLStartUp::getStartSLURL().isValid() && + (gSavedSettings.getBOOL("SLURLPassToOtherInstance"))) { if (sendURLToOtherInstance(LLStartUp::getStartSLURL().getSLURLString())) { @@ -2467,6 +2526,14 @@ bool LLAppViewer::initConfiguration() } } + // If automatic login from command line with --login switch + // init StartSLURL location. In interactive login, LLPanelLogin + // will take care of it. + if ((clp.hasOption("login") || clp.hasOption("autologin")) && !clp.hasOption("url") && !clp.hasOption("slurl")) + { + LLStartUp::setStartSLURL(LLSLURL(gSavedSettings.getString("LoginLocation"))); + } + if (!gSavedSettings.getBOOL("AllowMultipleViewers")) { // @@ -2530,7 +2597,7 @@ bool LLAppViewer::initConfiguration() namespace { // *TODO - decide if there's a better place for these functions. - // do we need a file llupdaterui.cpp or something? -brad + // do we need a file llupdaterui.cpp or something? -brad void apply_update_callback(LLSD const & notification, LLSD const & response) { @@ -2623,8 +2690,8 @@ namespace { LLAppViewer::instance()->forceQuit(); } - bool notify_update(LLSD const & evt) - { + bool notify_update(LLSD const & evt) + { std::string notification_name; switch (evt["type"].asInteger()) { @@ -2643,8 +2710,8 @@ namespace { } // let others also handle this event by default - return false; - } + return false; + } bool on_bandwidth_throttle(LLUpdaterService * updater, LLSD const & evt) { @@ -2731,12 +2798,26 @@ void LLAppViewer::checkForCrash(void) } +// +// 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); + + const U32 one_gigabyte_kb = 1024 * 1024; + maximizedOk &= (gSysMemory.getPhysicalMemoryKB() >= one_gigabyte_kb); + + return maximizedOk; +} + bool LLAppViewer::initWindow() { LL_INFOS("AppInit") << "Initializing window..." << LL_ENDL; // store setting in a global for easy access and modification - gNoRender = gSavedSettings.getBOOL("DisableRendering"); + gHeadlessClient = gSavedSettings.getBOOL("HeadlessClient"); // always start windowed BOOL ignorePixelDepth = gSavedSettings.getBOOL("IgnorePixelDepth"); @@ -2746,11 +2827,14 @@ bool LLAppViewer::initWindow() gSavedSettings.getS32("WindowWidth"), gSavedSettings.getS32("WindowHeight"), gSavedSettings.getBOOL("WindowFullScreen"), ignorePixelDepth); + LL_INFOS("AppInit") << "gViewerwindow created." << LL_ENDL; + // Need to load feature table before cheking to start watchdog. const S32 NEVER_SUBMIT_REPORT = 2; bool use_watchdog = false; int watchdog_enabled_setting = gSavedSettings.getS32("WatchdogEnabled"); - if(watchdog_enabled_setting == -1){ + if(watchdog_enabled_setting == -1) + { use_watchdog = !LLFeatureManager::getInstance()->isFeatureAvailable("WatchdogDisabled"); } else @@ -2764,6 +2848,7 @@ bool LLAppViewer::initWindow() { LLWatchdog::getInstance()->init(watchdog_killer_callback); } + LL_INFOS("AppInit") << "watchdog setting is done." << LL_ENDL; LLNotificationsUI::LLNotificationManager::getInstance(); @@ -2772,28 +2857,27 @@ bool LLAppViewer::initWindow() gViewerWindow->mWindow->maximize(); } - if (!gNoRender) + // + // Initialize GL stuff + // + + if (mForceGraphicsDetail) { - // - // Initialize GL stuff - // + LLFeatureManager::getInstance()->setGraphicsLevel(gSavedSettings.getU32("RenderQualityPerformance"), false); + } + + // Set this flag in case we crash while initializing GL + gSavedSettings.setBOOL("RenderInitError", TRUE); + gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), TRUE ); - if (mForceGraphicsDetail) - { - LLFeatureManager::getInstance()->setGraphicsLevel(gSavedSettings.getU32("RenderQualityPerformance"), false); - } - - // Set this flag in case we crash while initializing GL - gSavedSettings.setBOOL("RenderInitError", TRUE); - gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), TRUE ); - - gPipeline.init(); - stop_glerror(); - gViewerWindow->initGLDefaults(); + gPipeline.init(); + LL_INFOS("AppInit") << "gPipeline Initialized" << LL_ENDL; - gSavedSettings.setBOOL("RenderInitError", FALSE); - gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), TRUE ); - } + stop_glerror(); + gViewerWindow->initGLDefaults(); + + gSavedSettings.setBOOL("RenderInitError", FALSE); + gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), TRUE ); //If we have a startup crash, it's usually near GL initialization, so simulate that. if(gCrashOnStartup) @@ -2801,6 +2885,21 @@ bool LLAppViewer::initWindow() LLAppViewer::instance()->forceErrorLLError(); } + // + // Determine if the window should start maximized on initial run based + // on graphics capability + // + if (gSavedSettings.getBOOL("FirstLoginThisInstall") && meetsRequirementsForMaximizedStart()) + { + LL_INFOS("AppInit") << "This client met the requirements for a maximized initial screen." << LL_ENDL; + gSavedSettings.setBOOL("WindowMaximized", TRUE); + } + + if (gSavedSettings.getBOOL("WindowMaximized")) + { + gViewerWindow->mWindow->maximize(); + } + LLUI::sWindow = gViewerWindow->getWindow(); // Show watch cursor @@ -2812,7 +2911,7 @@ bool LLAppViewer::initWindow() // show viewer window //gViewerWindow->mWindow->show(); - + LL_INFOS("AppInit") << "Window initialization done." << LL_ENDL; return true; } @@ -2835,12 +2934,9 @@ void LLAppViewer::cleanupSavedSettings() gSavedSettings.setBOOL("ShowObjectUpdates", gShowObjectUpdates); - if (!gNoRender) + if (gDebugView) { - if (gDebugView) - { - gSavedSettings.setBOOL("ShowDebugConsole", gDebugView->mDebugConsolep->getVisible()); - } + gSavedSettings.setBOOL("ShowDebugConsole", gDebugView->mDebugConsolep->getVisible()); } // save window position if not maximized @@ -2851,7 +2947,7 @@ void LLAppViewer::cleanupSavedSettings() if (!maximized) { LLCoordScreen window_pos; - + if (gViewerWindow->mWindow->getPosition(&window_pos)) { gSavedSettings.setS32("WindowX", window_pos.mX); @@ -2941,6 +3037,8 @@ void LLAppViewer::writeSystemInfo() LL_INFOS("SystemInfo") << "OS: " << getOSInfo().getOSStringSimple() << LL_ENDL; LL_INFOS("SystemInfo") << "OS info: " << getOSInfo() << LL_ENDL; + LL_INFOS("SystemInfo") << "Timers: " << LLFastTimer::sClockType << LL_ENDL; + writeDebugInfo(); // Save out debug_info.log early, in case of crash. } @@ -3400,7 +3498,9 @@ void LLAppViewer::migrateCacheDirectory() S32 file_count = 0; std::string file_name; std::string mask = delimiter + "*.*"; - while (gDirUtilp->getNextFileInDir(old_cache_dir, mask, file_name)) + + LLDirIterator iter(old_cache_dir, mask); + while (iter.next(file_name)) { if (file_name == "." || file_name == "..") continue; std::string source_path = old_cache_dir + delimiter + file_name; @@ -3499,10 +3599,10 @@ bool LLAppViewer::initCache() LLAppViewer::getTextureCache()->setReadOnly(read_only) ; LLVOCache::getInstance()->setReadOnly(read_only); - BOOL texture_cache_mismatch = FALSE ; + bool texture_cache_mismatch = false; if (gSavedSettings.getS32("LocalCacheVersion") != LLAppViewer::getTextureCacheVersion()) { - texture_cache_mismatch = TRUE ; + texture_cache_mismatch = true; if(!read_only) { gSavedSettings.setS32("LocalCacheVersion", LLAppViewer::getTextureCacheVersion()); @@ -3516,7 +3616,9 @@ bool LLAppViewer::initCache() gSavedSettings.getBOOL("PurgeCacheOnNextStartup")) { gSavedSettings.setBOOL("PurgeCacheOnNextStartup", false); - mPurgeCache = true; + mPurgeCache = true; + // STORM-1141 force purgeAllTextures to get called to prevent a crash here. -brad + texture_cache_mismatch = true; } // We have moved the location of the cache directory over time. @@ -3551,11 +3653,25 @@ bool LLAppViewer::initCache() // Init the texture cache // Allocate 80% of the cache size for textures - const S32 MB = 1024*1024; + const S32 MB = 1024 * 1024; + const S64 MIN_CACHE_SIZE = 64 * 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; - const S64 MAX_CACHE_SIZE = 1024*MB; - cache_size = llmin(cache_size, MAX_CACHE_SIZE); - S64 texture_cache_size = ((cache_size * 8)/10); + 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 extra = LLAppViewer::getTextureCache()->initCache(LL_PATH_CACHE, texture_cache_size, texture_cache_mismatch); texture_cache_size -= extra; @@ -3564,21 +3680,19 @@ bool LLAppViewer::initCache() LLSplashScreen::update(LLTrans::getString("StartupInitializingVFS")); // Init the VFS - S64 vfs_size = cache_size - texture_cache_size; - const S64 MAX_VFS_SIZE = 1024 * MB; // 1 GB - vfs_size = llmin(vfs_size, MAX_VFS_SIZE); + vfs_size = llmin(vfs_size + extra, MAX_VFS_SIZE); vfs_size = (vfs_size / MB) * MB; // make sure it is MB aligned U32 vfs_size_u32 = (U32)vfs_size; U32 old_vfs_size = gSavedSettings.getU32("VFSOldSize") * MB; bool resize_vfs = (vfs_size_u32 != old_vfs_size); if (resize_vfs) { - gSavedSettings.setU32("VFSOldSize", vfs_size_u32/MB); + gSavedSettings.setU32("VFSOldSize", vfs_size_u32 / MB); } - LL_INFOS("AppCache") << "VFS CACHE SIZE: " << vfs_size/(1024*1024) << " MB" << LL_ENDL; + LL_INFOS("AppCache") << "VFS CACHE SIZE: " << vfs_size / (1024*1024) << " MB" << LL_ENDL; // This has to happen BEFORE starting the vfs - //time_t ltime; + // time_t ltime; srand(time(NULL)); // Flawfinder: ignore U32 old_salt = gSavedSettings.getU32("VFSSalt"); U32 new_salt; @@ -3599,10 +3713,10 @@ bool LLAppViewer::initCache() do { new_salt = rand(); - } while( new_salt == old_salt ); + } while(new_salt == old_salt); } - old_vfs_data_file = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,VFS_DATA_FILE_BASE) + llformat("%u",old_salt); + old_vfs_data_file = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, VFS_DATA_FILE_BASE) + llformat("%u", old_salt); // make sure this file exists llstat s; @@ -3616,10 +3730,11 @@ bool LLAppViewer::initCache() mask += "*"; std::string dir; - dir = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,""); + dir = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""); std::string found_file; - if (gDirUtilp->getNextFileInDir(dir, mask, found_file)) + LLDirIterator iter(dir, mask); + if (iter.next(found_file)) { old_vfs_data_file = dir + gDirUtilp->getDirDelimiter() + found_file; @@ -3632,7 +3747,7 @@ bool LLAppViewer::initCache() } } - old_vfs_index_file = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,VFS_INDEX_FILE_BASE) + llformat("%u",old_salt); + old_vfs_index_file = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, VFS_INDEX_FILE_BASE) + llformat("%u", old_salt); stat_result = LLFile::stat(old_vfs_index_file, &s); if (stat_result) @@ -3645,27 +3760,25 @@ bool LLAppViewer::initCache() // Just in case, nuke any other old cache files in the directory. std::string dir; - dir = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,""); + dir = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""); std::string mask; - mask = gDirUtilp->getDirDelimiter(); - mask += VFS_DATA_FILE_BASE; + mask = VFS_DATA_FILE_BASE; mask += "*"; gDirUtilp->deleteFilesInDir(dir, mask); - mask = gDirUtilp->getDirDelimiter(); - mask += VFS_INDEX_FILE_BASE; + mask = VFS_INDEX_FILE_BASE; mask += "*"; gDirUtilp->deleteFilesInDir(dir, mask); } - new_vfs_data_file = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,VFS_DATA_FILE_BASE) + llformat("%u",new_salt); - new_vfs_index_file = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, VFS_INDEX_FILE_BASE) + llformat("%u",new_salt); + new_vfs_data_file = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, VFS_DATA_FILE_BASE) + llformat("%u", new_salt); + new_vfs_index_file = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, VFS_INDEX_FILE_BASE) + llformat("%u", new_salt); - static_vfs_data_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"static_data.db2"); - static_vfs_index_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"static_index.db2"); + static_vfs_data_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "static_data.db2"); + static_vfs_index_file = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "static_index.db2"); if (resize_vfs) { @@ -3688,19 +3801,19 @@ bool LLAppViewer::initCache() // Don't remove VFS after viewer crashes. If user has corrupt data, they can reinstall. JC gVFS = LLVFS::createLLVFS(new_vfs_index_file, new_vfs_data_file, false, vfs_size_u32, false); - if( !gVFS ) + if (!gVFS) { return false; } gStaticVFS = LLVFS::createLLVFS(static_vfs_index_file, static_vfs_data_file, true, 0, false); - if( !gStaticVFS ) + if (!gStaticVFS) { return false; } BOOL success = gVFS->isValid() && gStaticVFS->isValid(); - if( !success ) + if (!success) { return false; } @@ -3721,11 +3834,11 @@ bool LLAppViewer::initCache() void LLAppViewer::purgeCache() { - LL_INFOS("AppCache") << "Purging Cache and Texture Cache..." << llendl; + LL_INFOS("AppCache") << "Purging Cache and Texture Cache..." << LL_ENDL; LLAppViewer::getTextureCache()->purgeCache(LL_PATH_CACHE); LLVOCache::getInstance()->removeCache(LL_PATH_CACHE); - std::string mask = gDirUtilp->getDirDelimiter() + "*.*"; - gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE,""),mask); + std::string mask = "*.*"; + gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""), mask); } std::string LLAppViewer::getSecondLifeTitle() const @@ -3821,7 +3934,7 @@ void LLAppViewer::badNetworkHandler() // is destroyed. void LLAppViewer::saveFinalSnapshot() { - if (!mSavedFinalSnapshot && !gNoRender) + if (!mSavedFinalSnapshot) { gSavedSettings.setVector3d("FocusPosOnLogout", gAgentCamera.calcFocusPositionTargetGlobal()); gSavedSettings.setVector3d("CameraPosOnLogout", gAgentCamera.calcCameraPositionTargetGlobal()); @@ -3908,6 +4021,8 @@ static LLFastTimer::DeclareTimer FTM_OBJECTLIST_UPDATE("Update Objectlist"); static LLFastTimer::DeclareTimer FTM_REGION_UPDATE("Update Region"); static LLFastTimer::DeclareTimer FTM_WORLD_UPDATE("Update World"); static LLFastTimer::DeclareTimer FTM_NETWORK("Network"); +static LLFastTimer::DeclareTimer FTM_AGENT_NETWORK("Agent Network"); +static LLFastTimer::DeclareTimer FTM_VLMANAGER("VL Manager"); /////////////////////////////////////////////////////// // idle() @@ -3928,6 +4043,8 @@ void LLAppViewer::idle() LLEventTimer::updateClass(); LLCriticalDamp::updateInterpolants(); LLMortician::updateClass(); + LLFilePickerThread::clearDead(); //calls LLFilePickerThread::notify() + F32 dt_raw = idle_timer.getElapsedTimeAndResetF32(); // Cap out-of-control frame times @@ -4225,34 +4342,31 @@ void LLAppViewer::idle() // // Update weather effects // - if (!gNoRender) - { - LLWorld::getInstance()->updateClouds(gFrameDTClamped); - gSky.propagateHeavenlyBodies(gFrameDTClamped); // moves sun, moon, and planets + LLWorld::getInstance()->updateClouds(gFrameDTClamped); + gSky.propagateHeavenlyBodies(gFrameDTClamped); // moves sun, moon, and planets - // Update wind vector - LLVector3 wind_position_region; - static LLVector3 average_wind; + // Update wind vector + LLVector3 wind_position_region; + static LLVector3 average_wind; - LLViewerRegion *regionp; - regionp = LLWorld::getInstance()->resolveRegionGlobal(wind_position_region, gAgent.getPositionGlobal()); // puts agent's local coords into wind_position - if (regionp) - { - gWindVec = regionp->mWind.getVelocity(wind_position_region); + LLViewerRegion *regionp; + regionp = LLWorld::getInstance()->resolveRegionGlobal(wind_position_region, gAgent.getPositionGlobal()); // puts agent's local coords into wind_position + if (regionp) + { + gWindVec = regionp->mWind.getVelocity(wind_position_region); - // Compute average wind and use to drive motion of water - - average_wind = regionp->mWind.getAverage(); - F32 cloud_density = regionp->mCloudLayer.getDensityRegion(wind_position_region); - - gSky.setCloudDensityAtAgent(cloud_density); - gSky.setWind(average_wind); - //LLVOWater::setWind(average_wind); - } - else - { - gWindVec.setVec(0.0f, 0.0f, 0.0f); - } + // Compute average wind and use to drive motion of water + + average_wind = regionp->mWind.getAverage(); + F32 cloud_density = regionp->mCloudLayer.getDensityRegion(wind_position_region); + + gSky.setCloudDensityAtAgent(cloud_density); + gSky.setWind(average_wind); + //LLVOWater::setWind(average_wind); + } + else + { + gWindVec.setVec(0.0f, 0.0f, 0.0f); } ////////////////////////////////////// @@ -4261,16 +4375,17 @@ void LLAppViewer::idle() // Here, particles are updated and drawables are moved. // - if (!gNoRender) - { - LLFastTimer t(FTM_WORLD_UPDATE); - gPipeline.updateMove(); + LLFastTimer t(FTM_WORLD_UPDATE); + gPipeline.updateMove(); - LLWorld::getInstance()->updateParticles(); - } + LLWorld::getInstance()->updateParticles(); - if (LLViewerJoystick::getInstance()->getOverrideCamera()) + if (gAgentPilot.isPlaying() && gAgentPilot.getOverrideCamera()) { + gAgentPilot.moveCamera(); + } + else if (LLViewerJoystick::getInstance()->getOverrideCamera()) + { LLViewerJoystick::getInstance()->moveFlycam(); } else @@ -4508,6 +4623,11 @@ static F32 CheckMessagesMaxTime = CHECK_MESSAGES_DEFAULT_MAX_TIME; #endif static LLFastTimer::DeclareTimer FTM_IDLE_NETWORK("Idle Network"); +static LLFastTimer::DeclareTimer FTM_MESSAGE_ACKS("Message Acks"); +static LLFastTimer::DeclareTimer FTM_RETRANSMIT("Retransmit"); +static LLFastTimer::DeclareTimer FTM_TIMEOUT_CHECK("Timeout Check"); +static LLFastTimer::DeclareTimer FTM_DYNAMIC_THROTTLE("Dynamic Throttle"); +static LLFastTimer::DeclareTimer FTM_CHECK_REGION_CIRCUIT("Check Region Circuit"); void LLAppViewer::idleNetwork() { @@ -4633,12 +4753,9 @@ void LLAppViewer::disconnectViewer() gSavedSettings.setBOOL("FlyingAtExit", gAgent.getFlying() ); // Un-minimize all windows so they don't get saved minimized - if (!gNoRender) + if (gFloaterView) { - if (gFloaterView) - { - gFloaterView->restoreAll(); - } + gFloaterView->restoreAll(); } if (LLSelectMgr::getInstance()) |