summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2012-04-13 17:20:53 -0700
committerMerov Linden <merov@lindenlab.com>2012-04-13 17:20:53 -0700
commitadf5b5c1efaed30dc043652b174d76c9088f4b18 (patch)
tree7ebd44c36f7777413406b4043ab436b492600e02 /indra/newview
parent8778010feec5193c5ffc88d70e4a303aebaaaee4 (diff)
parent8b3703bd03487e6d70a793427ed1587b1cd86808 (diff)
Final pull from viewer-thx1138
Diffstat (limited to 'indra/newview')
-rwxr-xr-xindra/newview/app_settings/settings.xml33
-rw-r--r--indra/newview/llappviewer.cpp6
-rwxr-xr-xindra/newview/lltexturefetch.cpp13
-rw-r--r--indra/newview/llviewertexture.cpp33
-rw-r--r--indra/newview/llviewertexture.h2
-rw-r--r--indra/newview/llviewertexturelist.cpp25
-rw-r--r--indra/newview/llviewertexturelist.h2
7 files changed, 103 insertions, 11 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 5fc9c5d863..eb3fcc30ee 100755
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -10631,6 +10631,28 @@
<key>Value</key>
<real>20.0</real>
</map>
+ <key>TextureCameraMotionThreshold</key>
+ <map>
+ <key>Comment</key>
+ <string>If the overall motion is lower than this value, textures will be loaded faster</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>F32</string>
+ <key>Value</key>
+ <integer>0.2</integer>
+ </map>
+ <key>TextureCameraMotionBoost</key>
+ <map>
+ <key>Comment</key>
+ <string>Progressive discard level decrement when the camera is still</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>S32</string>
+ <key>Value</key>
+ <integer>3</integer>
+ </map>
<key>TextureDecodeDisabled</key>
<map>
<key>Comment</key>
@@ -10719,6 +10741,17 @@
<key>Value</key>
<integer>2</integer>
</map>
+ <key>TextureReverseByteRange</key>
+ <map>
+ <key>Comment</key>
+ <string>Minimal percent of the optimal byte range allowed to render a given discard level</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>S32</string>
+ <key>Value</key>
+ <integer>50</integer>
+ </map>
<key>ThrottleBandwidthKBPS</key>
<map>
<key>Comment</key>
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 9a52ee4312..a627f3868b 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;
@@ -1950,7 +1948,7 @@ bool LLAppViewer::initThreads()
static const bool enable_threads = true;
#endif
- LLImage::initClass(gSavedSettings.getBOOL("TextureNewByteRange"));
+ LLImage::initClass(gSavedSettings.getBOOL("TextureNewByteRange"),gSavedSettings.getS32("TextureReverseByteRange"));
LLVFSThread::initClass(enable_threads && false);
LLLFSThread::initClass(enable_threads && false);
diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp
index 5cc8de3d91..2e1b409fa7 100755
--- a/indra/newview/lltexturefetch.cpp
+++ b/indra/newview/lltexturefetch.cpp
@@ -846,6 +846,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)))
@@ -1152,7 +1154,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.
@@ -1188,6 +1190,8 @@ bool LLTextureFetchWorker::doWork(S32 param)
bool res = false;
if (!mUrl.empty())
{
+ mRequestedTimer.reset();
+
mLoaded = FALSE;
mGetStatus = 0;
mGetReason.clear();
@@ -1346,6 +1350,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 2efc9ad4d0..d5b53f3cb1 100644
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -88,6 +88,7 @@ S32 LLViewerTexture::sMaxBoundTextureMemInMegaBytes = 0;
S32 LLViewerTexture::sMaxTotalTextureMemInMegaBytes = 0;
S32 LLViewerTexture::sMaxDesiredTextureMemInBytes = 0 ;
S8 LLViewerTexture::sCameraMovingDiscardBias = 0 ;
+F32 LLViewerTexture::sCameraMovingBias = 0.0f ;
S32 LLViewerTexture::sMaxSculptRez = 128 ; //max sculpt image size
const S32 MAX_CACHED_RAW_IMAGE_AREA = 64 * 64 ;
const S32 MAX_CACHED_RAW_SCULPT_IMAGE_AREA = LLViewerTexture::sMaxSculptRez * LLViewerTexture::sMaxSculptRez ;
@@ -546,7 +547,8 @@ void LLViewerTexture::updateClass(const F32 velocity, const F32 angular_velocity
F32 camera_moving_speed = LLViewerCamera::getInstance()->getAverageSpeed() ;
F32 camera_angular_speed = LLViewerCamera::getInstance()->getAverageAngularSpeed();
- sCameraMovingDiscardBias = (S8)llmax(0.2f * camera_moving_speed, 2.0f * camera_angular_speed - 1) ;
+ sCameraMovingBias = llmax(0.2f * camera_moving_speed, 2.0f * camera_angular_speed - 1);
+ sCameraMovingDiscardBias = (S8)(sCameraMovingBias);
LLViewerTexture::sFreezeImageScalingDown = (BYTES_TO_MEGA_BYTES(sBoundTextureMemoryInBytes) < 0.75f * sMaxBoundTextureMemInMegaBytes * texmem_middle_bound_scale) &&
(BYTES_TO_MEGA_BYTES(sTotalTextureMemoryInBytes) < 0.75f * sMaxTotalTextureMemInMegaBytes * texmem_middle_bound_scale) ;
@@ -1888,6 +1890,8 @@ S32 LLViewerFetchedTexture::getCurrentDiscardLevelForFetching()
bool LLViewerFetchedTexture::updateFetch()
{
static LLCachedControl<bool> textures_decode_disabled(gSavedSettings,"TextureDecodeDisabled");
+ static LLCachedControl<F32> sCameraMotionThreshold(gSavedSettings,"TextureCameraMotionThreshold");
+ static LLCachedControl<S32> sCameraMotionBoost(gSavedSettings,"TextureCameraMotionBoost");
if(textures_decode_disabled)
{
return false ;
@@ -2050,18 +2054,24 @@ bool LLViewerFetchedTexture::updateFetch()
// make_request = false;
//}
- if(make_request)
+ if (make_request)
{
- //load the texture progressively.
+ // Load the texture progressively: we try not to rush to the desired discard too fast.
+ // If the camera is not moving, we do not tweak the discard level notch by notch but go to the desired discard with larger boosted steps
+ // This mitigates the "textures stay blurry" problem when loading while not killing the texture memory while moving around
S32 delta_level = (mBoostLevel > LLViewerTexture::BOOST_NONE) ? 2 : 1 ;
- if(current_discard < 0)
+ if (current_discard < 0)
{
desired_discard = llmax(desired_discard, getMaxDiscardLevel() - delta_level);
}
- else
+ else if (LLViewerTexture::sCameraMovingBias < sCameraMotionThreshold)
{
- desired_discard = llmax(desired_discard, current_discard - delta_level);
+ desired_discard = llmax(desired_discard, current_discard - sCameraMotionBoost);
}
+ else
+ {
+ desired_discard = llmax(desired_discard, current_discard - delta_level);
+ }
if (mIsFetching)
{
@@ -2129,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 99053a8ccc..6ddff3e485 100644
--- a/indra/newview/llviewertexture.h
+++ b/indra/newview/llviewertexture.h
@@ -324,6 +324,7 @@ public:
static S32 sMaxTotalTextureMemInMegaBytes;
static S32 sMaxDesiredTextureMemInBytes ;
static S8 sCameraMovingDiscardBias;
+ static F32 sCameraMovingBias;
static S32 sMaxSculptRez ;
static S32 sMinLargeImageSize ;
static S32 sMaxSmallImageSize ;
@@ -490,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;