summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2012-04-13 10:54:31 -0700
committerMerov Linden <merov@lindenlab.com>2012-04-13 10:54:31 -0700
commit18fa5cd60ba673ce168095d277e9e34599b56547 (patch)
treec8424611a04ab27ff0385a5daed7d444b2d04a65
parentb4a3bb4f3b6247ebcd7d084df601ae77161664e1 (diff)
parent0a42495906fdc56eeb118ac41ffa9ebcadc8de17 (diff)
Pull from viewer-thx1138
-rw-r--r--indra/newview/llappviewer.cpp4
-rwxr-xr-xindra/newview/lltexturefetch.cpp13
-rw-r--r--indra/newview/llviewertexture.cpp11
-rw-r--r--indra/newview/llviewertexture.h1
-rw-r--r--indra/newview/llviewertexturelist.cpp25
-rw-r--r--indra/newview/llviewertexturelist.h2
6 files changed, 52 insertions, 4 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 37119f4451..40920dfd07 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -1339,13 +1339,11 @@ bool LLAppViewer::mainLoop()
ms_sleep(500);
}
- static const F64 FRAME_SLOW_THRESHOLD = 0.5; //2 frames per seconds
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;
S32 total_io_pending = 0;
- while(!is_slow)//do not unpause threads if the frame rates are very low.
+ while(1)
{
S32 work_pending = 0;
S32 io_pending = 0;
diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp
index e27ebf9018..3d8424e274 100755
--- a/indra/newview/lltexturefetch.cpp
+++ b/indra/newview/lltexturefetch.cpp
@@ -845,6 +845,8 @@ void LLTextureFetchWorker::startWork(S32 param)
// Called from LLWorkerThread::processRequest()
bool LLTextureFetchWorker::doWork(S32 param)
{
+ static const F32 FETCHING_TIMEOUT = 120.f;//seconds
+
LLMutexLock lock(&mWorkMutex);
if ((mFetcher->isQuitting() || getFlags(LLWorkerClass::WCF_DELETE_REQUESTED)))
@@ -1151,7 +1153,7 @@ bool LLTextureFetchWorker::doWork(S32 param)
//1, not openning too many file descriptors at the same time;
//2, control the traffic of http so udp gets bandwidth.
//
- static const S32 MAX_NUM_OF_HTTP_REQUESTS_IN_QUEUE = 8 ;
+ static const S32 MAX_NUM_OF_HTTP_REQUESTS_IN_QUEUE = 24 ;
if(mFetcher->getNumHTTPRequests() > MAX_NUM_OF_HTTP_REQUESTS_IN_QUEUE)
{
return false ; //wait.
@@ -1187,6 +1189,8 @@ bool LLTextureFetchWorker::doWork(S32 param)
bool res = false;
if (!mUrl.empty())
{
+ mRequestedTimer.reset();
+
mLoaded = FALSE;
mGetStatus = 0;
mGetReason.clear();
@@ -1345,6 +1349,13 @@ bool LLTextureFetchWorker::doWork(S32 param)
}
else
{
+ if(FETCHING_TIMEOUT < mRequestedTimer.getElapsedTimeF32())
+ {
+ //timeout, abort.
+ mState = DONE;
+ return true;
+ }
+
setPriority(LLWorkerThread::PRIORITY_LOW | mWorkPriority);
return false;
}
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index 508599e5ae..d5b53f3cb1 100644
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -2139,6 +2139,17 @@ bool LLViewerFetchedTexture::updateFetch()
return mIsFetching ? true : false;
}
+void LLViewerFetchedTexture::forceToDeleteRequest()
+{
+ if (mHasFetcher)
+ {
+ LLAppViewer::getTextureFetch()->deleteRequest(getID(), true);
+ mHasFetcher = FALSE;
+ mIsFetching = FALSE ;
+ resetTextureStats();
+ }
+}
+
void LLViewerFetchedTexture::setIsMissingAsset()
{
if (mUrl.empty())
diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h
index bd85b491ad..6ddff3e485 100644
--- a/indra/newview/llviewertexture.h
+++ b/indra/newview/llviewertexture.h
@@ -491,6 +491,7 @@ public:
BOOL hasFetcher() const { return mHasFetcher;}
void setCanUseHTTP(bool can_use_http) {mCanUseHTTP = can_use_http;}
+ void forceToDeleteRequest();
protected:
/*virtual*/ void switchToCachedImage();
S32 getCurrentDiscardLevelForFetching() ;
diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp
index 54ae519422..2008a884db 100644
--- a/indra/newview/llviewertexturelist.cpp
+++ b/indra/newview/llviewertexturelist.cpp
@@ -58,6 +58,7 @@
#include "pipeline.h"
#include "llappviewer.h"
#include "llxuiparser.h"
+#include "llagent.h"
////////////////////////////////////////////////////////////////////////////
@@ -597,6 +598,12 @@ static LLFastTimer::DeclareTimer FTM_IMAGE_STATS("Stats");
void LLViewerTextureList::updateImages(F32 max_time)
{
+ if(gAgent.getTeleportState() != LLAgent::TELEPORT_NONE)
+ {
+ clearFetchingRequests();
+ return;
+ }
+
LLAppViewer::getTextureFetch()->setTextureBandwidth(LLViewerStats::getInstance()->mTextureKBitStat.getMeanPerSec());
LLViewerStats::getInstance()->mNumImagesStat.addValue(sNumImages);
@@ -659,6 +666,24 @@ void LLViewerTextureList::updateImages(F32 max_time)
}
}
+void LLViewerTextureList::clearFetchingRequests()
+{
+ if (LLAppViewer::getTextureFetch()->getNumRequests() == 0)
+ {
+ return;
+ }
+
+ for (image_priority_list_t::iterator iter = mImageList.begin();
+ iter != mImageList.end(); ++iter)
+ {
+ LLViewerFetchedTexture* image = *iter;
+ if(image->hasFetcher())
+ {
+ image->forceToDeleteRequest() ;
+ }
+ }
+}
+
void LLViewerTextureList::updateImagesDecodePriorities()
{
// Update the decode priority for N images each frame
diff --git a/indra/newview/llviewertexturelist.h b/indra/newview/llviewertexturelist.h
index e0a362596d..64e2c1f791 100644
--- a/indra/newview/llviewertexturelist.h
+++ b/indra/newview/llviewertexturelist.h
@@ -164,6 +164,8 @@ private:
// Implemented in header in case someone changes default params above. JC
LLViewerFetchedTexture* getImageFromHost(const LLUUID& image_id, LLHost host)
{ return getImage(image_id, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, host); }
+
+ void clearFetchingRequests();
public:
typedef std::set<LLPointer<LLViewerFetchedTexture> > image_list_t;