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.cpp152
1 files changed, 103 insertions, 49 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 58b651ec39..d4621db329 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -50,6 +50,7 @@
#include "llwindow.h"
#include "llviewerstats.h"
#include "llmd5.h"
+#include "llmeshrepository.h"
#include "llpumpio.h"
#include "llmimetypes.h"
#include "llslurl.h"
@@ -79,6 +80,8 @@
#include "llteleporthistory.h"
#include "lllocationhistory.h"
#include "llfasttimerview.h"
+#include "llvector4a.h"
+#include "llviewermenufile.h"
#include "llvoicechannel.h"
#include "llvoavatarself.h"
#include "llsidetray.h"
@@ -618,6 +621,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");
@@ -961,6 +967,11 @@ static LLFastTimer::DeclareTimer FTM_LFS("LFS Thread");
static LLFastTimer::DeclareTimer FTM_PAUSE_THREADS("Pause Threads");
static LLFastTimer::DeclareTimer FTM_IDLE("Idle");
static LLFastTimer::DeclareTimer FTM_PUMP("Pump");
+static LLFastTimer::DeclareTimer FTM_PUMP_ARES("Ares");
+static LLFastTimer::DeclareTimer FTM_PUMP_SERVICE("Service");
+static LLFastTimer::DeclareTimer FTM_SERVICE_CALLBACK("Callback");
+static LLFastTimer::DeclareTimer FTM_AGENT_AUTOPILOT("Autopilot");
+static LLFastTimer::DeclareTimer FTM_AGENT_UPDATE("Update");
bool LLAppViewer::mainLoop()
{
@@ -1070,10 +1081,20 @@ bool LLAppViewer::mainLoop()
LLMemType mt_ip(LLMemType::MTYPE_IDLE_PUMP);
pingMainloopTimeout("Main:ServicePump");
LLFastTimer t4(FTM_PUMP);
- gAres->process();
- // this pump is necessary to make the login screen show up
- gServicePump->pump();
- gServicePump->callback();
+ {
+ LLFastTimer t(FTM_PUMP_ARES);
+ gAres->process();
+ }
+ {
+ LLFastTimer t(FTM_PUMP_SERVICE);
+ // this pump is necessary to make the login screen show up
+ gServicePump->pump();
+
+ {
+ LLFastTimer t(FTM_SERVICE_CALLBACK);
+ gServicePump->callback();
+ }
+ }
}
resumeMainloopTimeout();
@@ -1108,8 +1129,7 @@ bool LLAppViewer::mainLoop()
{
LLMemType mt_sleep(LLMemType::MTYPE_SLEEP);
LLFastTimer t2(FTM_SLEEP);
- bool run_multiple_threads = gSavedSettings.getBOOL("RunMultipleThreads");
-
+
// yield some time to the os based on command line option
if(mYieldTime >= 0)
{
@@ -1147,9 +1167,7 @@ bool LLAppViewer::mainLoop()
}
static const F64 FRAME_SLOW_THRESHOLD = 0.5; //2 frames per seconds
- const F64 min_frame_time = 0.0; //(.0333 - .0010); // max video frame rate = 30 fps
- const F64 min_idle_time = 0.0; //(.0010); // min idle time = 1 ms
- const F64 max_idle_time = run_multiple_threads ? min_idle_time : llmin(.005*10.0*gFrameTimeSeconds, 0.005); // 5 ms a second
+ const F64 max_idle_time = llmin(.005*10.0*gFrameTimeSeconds, 0.005); // 5 ms a second
idleTimer.reset();
bool is_slow = (frameTimer.getElapsedTimeF64() > FRAME_SLOW_THRESHOLD) ;
S32 total_work_pending = 0;
@@ -1187,34 +1205,24 @@ bool LLAppViewer::mainLoop()
total_work_pending += work_pending ;
total_io_pending += io_pending ;
- F64 frame_time = frameTimer.getElapsedTimeF64();
- F64 idle_time = idleTimer.getElapsedTimeF64();
- if (frame_time >= min_frame_time &&
- idle_time >= min_idle_time &&
- (!work_pending || idle_time >= max_idle_time))
+
+ if (!work_pending || idleTimer.getElapsedTimeF64() >= max_idle_time)
{
break;
}
}
- // Prevent the worker threads from running while rendering.
- // if (LLThread::processorCount()==1) //pause() should only be required when on a single processor client...
- if (run_multiple_threads == FALSE)
+ if(!total_work_pending) //pause texture fetching threads if nothing to process.
{
- //LLFastTimer ftm(FTM_PAUSE_THREADS); //not necessary.
-
- if(!total_work_pending) //pause texture fetching threads if nothing to process.
- {
- LLAppViewer::getTextureCache()->pause();
- LLAppViewer::getImageDecodeThread()->pause();
- LLAppViewer::getTextureFetch()->pause();
- }
- if(!total_io_pending) //pause file threads if nothing to process.
- {
- LLVFSThread::sLocal->pause();
- LLLFSThread::sLocal->pause();
- }
- }
+ LLAppViewer::getTextureCache()->pause();
+ LLAppViewer::getImageDecodeThread()->pause();
+ LLAppViewer::getTextureFetch()->pause();
+ }
+ if(!total_io_pending) //pause file threads if nothing to process.
+ {
+ LLVFSThread::sLocal->pause();
+ LLLFSThread::sLocal->pause();
+ }
if ((LLStartUp::getStartupState() >= STATE_CLEANUP) &&
(frameTimer.getElapsedTimeF64() > FRAME_STALL_THRESHOLD))
@@ -1332,6 +1340,11 @@ bool LLAppViewer::cleanup()
llinfos << "Cleaning Up" << llendflush;
+#if LL_MESH_ENABLED
+ // shut down mesh streamer
+ gMeshRepo.shutdown();
+#endif
+
// Must clean up texture references before viewer window is destroyed.
LLHUDManager::getInstance()->updateEffects();
LLHUDObject::updateAll();
@@ -1606,6 +1619,8 @@ bool LLAppViewer::cleanup()
sTextureFetch->shutDownTextureCacheThread() ;
sTextureFetch->shutDownImageDecodeThread() ;
+ LLFilePickerThread::cleanupClass();
+
delete sTextureCache;
sTextureCache = NULL;
delete sTextureFetch;
@@ -1745,6 +1760,13 @@ bool LLAppViewer::initThreads()
mFastTimerLogThread->start();
}
+#if LL_MESH_ENABLED
+ // Mesh streaming and caching
+ gMeshRepo.init();
+#endif
+
+ LLFilePickerThread::initClass();
+
// *FIX: no error handling here!
return true;
}
@@ -2431,6 +2453,7 @@ bool LLAppViewer::initWindow()
gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), TRUE );
gPipeline.init();
+
stop_glerror();
gViewerWindow->initGLDefaults();
@@ -3481,6 +3504,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()
@@ -3501,6 +3526,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
@@ -3551,7 +3578,7 @@ void LLAppViewer::idle()
if (!gDisconnected)
{
- LLFastTimer t(FTM_NETWORK);
+ LLFastTimer t(FTM_AGENT_NETWORK);
// Update spaceserver timeinfo
LLWorld::getInstance()->setSpaceTimeUSec(LLWorld::getInstance()->getSpaceTimeUSec() + (U32)(dt_raw * SEC_TO_MICROSEC));
@@ -3566,9 +3593,12 @@ void LLAppViewer::idle()
gAgent.moveYaw(-1.f);
}
- // Handle automatic walking towards points
- gAgentPilot.updateTarget();
- gAgent.autoPilot(&yaw);
+ {
+ LLFastTimer t(FTM_AGENT_AUTOPILOT);
+ // Handle automatic walking towards points
+ gAgentPilot.updateTarget();
+ gAgent.autoPilot(&yaw);
+ }
static LLFrameTimer agent_update_timer;
static U32 last_control_flags;
@@ -3579,6 +3609,7 @@ void LLAppViewer::idle()
if (flags_changed || (agent_update_time > (1.0f / (F32) AGENT_UPDATES_PER_SECOND)))
{
+ LLFastTimer t(FTM_AGENT_UPDATE);
// Send avatar and camera info
last_control_flags = gAgent.getControlFlags();
send_agent_update(TRUE);
@@ -3744,7 +3775,7 @@ void LLAppViewer::idle()
//
{
- LLFastTimer t(FTM_NETWORK);
+ LLFastTimer t(FTM_VLMANAGER);
gVLManager.unpackData();
}
@@ -3990,6 +4021,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()
{
@@ -4040,7 +4076,10 @@ void LLAppViewer::idleNetwork()
}
// Handle per-frame message system processing.
- gMessageSystem->processAcks();
+ {
+ LLFastTimer ftm(FTM_MESSAGE_ACKS);
+ gMessageSystem->processAcks();
+ }
#ifdef TIME_THROTTLE_MESSAGES
if (total_time >= CheckMessagesMaxTime)
@@ -4077,24 +4116,39 @@ void LLAppViewer::idleNetwork()
LLViewerStats::getInstance()->mNumNewObjectsStat.addValue(gObjectList.mNumNewObjects);
// Retransmit unacknowledged packets.
- gXferManager->retransmitUnackedPackets();
- gAssetStorage->checkForTimeouts();
- gViewerThrottle.updateDynamicThrottle();
+ {
+ LLFastTimer ftm(FTM_RETRANSMIT);
+ gXferManager->retransmitUnackedPackets();
+ }
+
+ {
+ LLFastTimer ftm(FTM_TIMEOUT_CHECK);
+ gAssetStorage->checkForTimeouts();
+ }
+
+
+ {
+ LLFastTimer ftm(FTM_DYNAMIC_THROTTLE);
+ gViewerThrottle.updateDynamicThrottle();
+ }
// Check that the circuit between the viewer and the agent's current
// region is still alive
- LLViewerRegion *agent_region = gAgent.getRegion();
- if (agent_region && (LLStartUp::getStartupState()==STATE_STARTED))
{
- LLUUID this_region_id = agent_region->getRegionID();
- bool this_region_alive = agent_region->isAlive();
- if ((mAgentRegionLastAlive && !this_region_alive) // newly dead
- && (mAgentRegionLastID == this_region_id)) // same region
+ LLFastTimer ftm(FTM_CHECK_REGION_CIRCUIT);
+ LLViewerRegion *agent_region = gAgent.getRegion();
+ if (agent_region && (LLStartUp::getStartupState()==STATE_STARTED))
{
- forceDisconnect(LLTrans::getString("AgentLostConnection"));
+ LLUUID this_region_id = agent_region->getRegionID();
+ bool this_region_alive = agent_region->isAlive();
+ if ((mAgentRegionLastAlive && !this_region_alive) // newly dead
+ && (mAgentRegionLastID == this_region_id)) // same region
+ {
+ forceDisconnect(LLTrans::getString("AgentLostConnection"));
+ }
+ mAgentRegionLastID = this_region_id;
+ mAgentRegionLastAlive = this_region_alive;
}
- mAgentRegionLastID = this_region_id;
- mAgentRegionLastAlive = this_region_alive;
}
}