diff options
author | Xiaohong Bao <bao@lindenlab.com> | 2010-03-25 17:46:36 -0600 |
---|---|---|
committer | Xiaohong Bao <bao@lindenlab.com> | 2010-03-25 17:46:36 -0600 |
commit | fad31dc087cb670bd4479195cac2c31da9a55e57 (patch) | |
tree | 83e3cb702a00dce270e4b7755c6130b6661bcdb9 /indra | |
parent | 091e4c2bdc7fa9139437872e09886892f2a9f702 (diff) | |
parent | 6f179fc6aca66a8349ca608b34ea7707ff590519 (diff) |
Automated merge with ssh://hg.lindenlab.com/q/viewer-trunk
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llcommon/llqueuedthread.cpp | 5 | ||||
-rw-r--r-- | indra/llrender/llimagegl.cpp | 14 | ||||
-rw-r--r-- | indra/newview/llappviewer.cpp | 42 | ||||
-rw-r--r-- | indra/newview/lltexturefetch.cpp | 23 | ||||
-rw-r--r-- | indra/newview/llviewertexture.cpp | 14 |
5 files changed, 61 insertions, 37 deletions
diff --git a/indra/llcommon/llqueuedthread.cpp b/indra/llcommon/llqueuedthread.cpp index 06ceeb2bc3..809a626c93 100644 --- a/indra/llcommon/llqueuedthread.cpp +++ b/indra/llcommon/llqueuedthread.cpp @@ -133,8 +133,11 @@ S32 LLQueuedThread::updateQueue(U32 max_time_ms) if (mThreaded) { pending = getPending(); + if(pending > 0) + { unpause(); } + } else { while (pending > 0) @@ -459,7 +462,7 @@ S32 LLQueuedThread::processNextRequest() req->setStatus(STATUS_QUEUED); mRequestQueue.insert(req); unlockData(); - if (mThreaded && start_priority <= PRIORITY_LOW) + if (mThreaded && start_priority < PRIORITY_NORMAL) { ms_sleep(1); // sleep the thread a little } diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 36ac3ff119..5edd6c8886 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -1699,8 +1699,8 @@ void LLImageGL::updatePickMask(S32 width, S32 height, const U8* data_in) U32 size = pick_width * pick_height; size = (size + 7) / 8; // pixelcount-to-bits mPickMask = new U8[size]; - mPickMaskWidth = pick_width; - mPickMaskHeight = pick_height; + mPickMaskWidth = pick_width - 1; + mPickMaskHeight = pick_height - 1; memset(mPickMask, 0, sizeof(U8) * size); @@ -1743,20 +1743,20 @@ BOOL LLImageGL::getMask(const LLVector2 &tc) llassert(false); } - llassert(mPickMaskWidth > 0 && mPickMaskHeight > 0); + llassert(mPickMaskWidth >= 0 && mPickMaskHeight >= 0); S32 x = llfloor(u * mPickMaskWidth); S32 y = llfloor(v * mPickMaskHeight); - if (LL_UNLIKELY(x >= mPickMaskWidth)) + if (LL_UNLIKELY(x > mPickMaskWidth)) { LL_WARNS_ONCE("render") << "Ooh, width overrun on pick mask read, that coulda been bad." << LL_ENDL; - x = llmax(0, mPickMaskWidth-1); + x = llmax((U16)0, mPickMaskWidth); } - if (LL_UNLIKELY(y >= mPickMaskHeight)) + if (LL_UNLIKELY(y > mPickMaskHeight)) { LL_WARNS_ONCE("render") << "Ooh, height overrun on pick mask read, that woulda been bad." << LL_ENDL; - y = llmax(0, mPickMaskHeight-1); + y = llmax((U16)0, mPickMaskHeight); } S32 idx = y*mPickMaskWidth+x; diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 11c252406a..41fbc2fa33 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1107,12 +1107,15 @@ bool LLAppViewer::mainLoop() ms_sleep(500); } - + 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 idleTimer.reset(); - while(1) + 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. { S32 work_pending = 0; S32 io_pending = 0; @@ -1143,6 +1146,8 @@ bool LLAppViewer::mainLoop() ms_sleep(llmin(io_pending/100,100)); // give the vfs some time to catch up } + 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 && @@ -1152,25 +1157,32 @@ bool LLAppViewer::mainLoop() break; } } - if ((LLStartUp::getStartupState() >= STATE_CLEANUP) && - (frameTimer.getElapsedTimeF64() > FRAME_STALL_THRESHOLD)) - { - gFrameStalls++; - } - frameTimer.reset(); // 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) { - LLFastTimer ftm(FTM_PAUSE_THREADS); - - LLAppViewer::getTextureCache()->pause(); - LLAppViewer::getImageDecodeThread()->pause(); - // LLAppViewer::getTextureFetch()->pause(); // Don't pause the fetch (IO) thread + //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(); + } + } + + if ((LLStartUp::getStartupState() >= STATE_CLEANUP) && + (frameTimer.getElapsedTimeF64() > FRAME_STALL_THRESHOLD)) + { + gFrameStalls++; } - //LLVFSThread::sLocal->pause(); // Prevent the VFS thread from running while rendering. - //LLLFSThread::sLocal->pause(); // Prevent the LFS thread from running while rendering. + frameTimer.reset(); resumeMainloopTimeout(); diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 1c7b3a0fe0..2ea6e5936d 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -292,7 +292,10 @@ public: const LLChannelDescriptors& channels, const LLIOPipe::buffer_ptr_t& buffer) { - if ((gSavedSettings.getBOOL("LogTextureDownloadsToViewerLog")) || (gSavedSettings.getBOOL("LogTextureDownloadsToSimulator"))) + static LLCachedControl<bool> log_to_viewer_log(gSavedSettings,"LogTextureDownloadsToViewerLog"); + static LLCachedControl<bool> log_to_sim(gSavedSettings,"LogTextureDownloadsToSimulator"); + + if (log_to_viewer_log || log_to_sim) { mFetcher->mTextureInfo.setRequestStartTime(mID, mStartTime); U64 timeNow = LLTimer::getTotalTime(); @@ -715,10 +718,10 @@ bool LLTextureFetchWorker::doWork(S32 param) if (mState == LOAD_FROM_NETWORK) { - bool get_url = gSavedSettings.getBOOL("ImagePipelineUseHTTP"); - if (!mUrl.empty()) get_url = false; + static LLCachedControl<bool> use_http(gSavedSettings,"ImagePipelineUseHTTP"); + // if (mHost != LLHost::invalid) get_url = false; - if ( get_url ) + if ( use_http && mUrl.empty())//get http url. { LLViewerRegion* region = NULL; if (mHost == LLHost::invalid) @@ -1717,7 +1720,8 @@ S32 LLTextureFetch::update(U32 max_time_ms) { S32 res; - mMaxBandwidth = gSavedSettings.getF32("ThrottleBandwidthKBPS"); + static LLCachedControl<F32> band_width(gSavedSettings,"ThrottleBandwidthKBPS"); + mMaxBandwidth = band_width ; res = LLWorkerThread::update(max_time_ms); @@ -1923,7 +1927,9 @@ void LLTextureFetch::sendRequestListToSimulators() // llinfos << "IMAGE REQUEST: " << req->mID << " Discard: " << req->mDesiredDiscard // << " Packet: " << packet << " Priority: " << req->mImagePriority << llendl; - if ((gSavedSettings.getBOOL("LogTextureDownloadsToViewerLog")) || (gSavedSettings.getBOOL("LogTextureDownloadsToSimulator"))) + static LLCachedControl<bool> log_to_viewer_log(gSavedSettings,"LogTextureDownloadsToViewerLog"); + static LLCachedControl<bool> log_to_sim(gSavedSettings,"LogTextureDownloadsToSimulator"); + if (log_to_viewer_log || log_to_sim) { mTextureInfo.setRequestStartTime(req->mID, LLTimer::getTotalTime()); mTextureInfo.setRequestOffset(req->mID, 0); @@ -2144,7 +2150,10 @@ bool LLTextureFetch::receiveImagePacket(const LLHost& host, const LLUUID& id, U1 if(packet_num >= (worker->mTotalPackets - 1)) { - if ((gSavedSettings.getBOOL("LogTextureDownloadsToViewerLog")) || (gSavedSettings.getBOOL("LogTextureDownloadsToSimulator"))) + static LLCachedControl<bool> log_to_viewer_log(gSavedSettings,"LogTextureDownloadsToViewerLog"); + static LLCachedControl<bool> log_to_sim(gSavedSettings,"LogTextureDownloadsToSimulator"); + + if (log_to_viewer_log || log_to_sim) { U64 timeNow = LLTimer::getTotalTime(); mTextureInfo.setRequestSize(id, worker->mFileSize); diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 9fbffdac35..af0dcd8e35 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -1578,12 +1578,12 @@ F32 LLViewerFetchedTexture::calcDecodePriority() } else if (!isJustBound() && mCachedRawImageReady) { - //if(mBoostLevel < BOOST_HIGH) - //{ - // // We haven't rendered this in a while, de-prioritize it - // desired_discard += 2; - //} - //else + if(mBoostLevel < BOOST_HIGH) + { + // We haven't rendered this in a while, de-prioritize it + desired_discard += 2; + } + else { // We haven't rendered this in the last half second, and we have a cached raw image, leave the desired discard as-is desired_discard = cur_discard; @@ -1591,7 +1591,7 @@ F32 LLViewerFetchedTexture::calcDecodePriority() } S32 ddiscard = cur_discard - desired_discard; - ddiscard = llclamp(ddiscard, 0, MAX_DELTA_DISCARD_LEVEL_FOR_PRIORITY); + ddiscard = llclamp(ddiscard, -1, MAX_DELTA_DISCARD_LEVEL_FOR_PRIORITY); priority = (ddiscard + 1) * PRIORITY_DELTA_DISCARD_LEVEL_FACTOR; } |