diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2012-06-26 16:43:58 -0400 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2012-06-26 16:43:58 -0400 |
commit | 74d4f8af01358c0975351f90f044c03bc9c50c4c (patch) | |
tree | 72b8f043cd5787409718d1ca7be21ec32cf10657 /indra/newview/lltexturefetch.cpp | |
parent | 52411f83a1e92d8449f68a6528f5b78e7c391553 (diff) | |
parent | 90547ff411db177bf6424ca553449a81a808fc0f (diff) |
v-r to drano merge conflicts wip
Diffstat (limited to 'indra/newview/lltexturefetch.cpp')
-rwxr-xr-x | indra/newview/lltexturefetch.cpp | 257 |
1 files changed, 257 insertions, 0 deletions
diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 5a9cf4aeb6..4f635bf855 100755 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -870,6 +870,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))) @@ -929,7 +931,10 @@ bool LLTextureFetchWorker::doWork(S32 param) mCacheWriteHandle = LLTextureCache::nullHandle(); mState = LOAD_FROM_TEXTURE_CACHE; mInCache = FALSE; +<<<<<<< local mDelay = -1.f; +======= +>>>>>>> other mDesiredSize = llmax(mDesiredSize, TEXTURE_CACHE_ENTRY_SIZE); // min desired size is TEXTURE_CACHE_ENTRY_SIZE LL_DEBUGS("Texture") << mID << ": Priority: " << llformat("%8.0f",mImagePriority) << " Desired Discard: " << mDesiredDiscard << " Desired Size: " << mDesiredSize << LL_ENDL; @@ -1381,10 +1386,20 @@ bool LLTextureFetchWorker::doWork(S32 param) } else { +<<<<<<< local // //No need to timeout, the responder should be triggered automatically. // +======= + if(FETCHING_TIMEOUT < mRequestedTimer.getElapsedTimeF32()) + { + //timeout, abort. + mState = DONE; + return true; + } +>>>>>>> other +<<<<<<< local //if(FETCHING_TIMEOUT < mRequestedTimer.getElapsedTimeF32()) //{ // if(mFetcher->getCurlRequest().isWaiting(mHTTPHandle)) @@ -1405,6 +1420,8 @@ bool LLTextureFetchWorker::doWork(S32 param) // } //} +======= +>>>>>>> other setPriority(LLWorkerThread::PRIORITY_LOW | mWorkPriority); return false; } @@ -1904,8 +1921,11 @@ LLTextureFetch::LLTextureFetch(LLTextureCache* cache, LLImageDecodeThread* image mCurlGetRequest(NULL), mQAMode(qa_mode), mFetchDebugger(NULL), +<<<<<<< local mFetchSource(LLTextureFetch::FROM_ALL), mOriginFetchSource(LLTextureFetch::FROM_ALL), +======= +>>>>>>> other mFetcherLocked(FALSE) { mCurlPOSTRequestCount = 0; @@ -1916,6 +1936,7 @@ LLTextureFetch::LLTextureFetch(LLTextureCache* cache, LLImageDecodeThread* image if(LLTextureFetchDebugger::isEnabled()) { mFetchDebugger = new LLTextureFetchDebugger(this, cache, imagedecodethread) ; +<<<<<<< local mFetchSource = (e_tex_source)gSavedSettings.getS32("TextureFetchSource"); if(mFetchSource < 0 && mFetchSource >= INVALID_SOURCE) { @@ -1923,6 +1944,8 @@ LLTextureFetch::LLTextureFetch(LLTextureCache* cache, LLImageDecodeThread* image gSavedSettings.setS32("TextureFetchSource", 0); } mOriginFetchSource = mFetchSource; +======= +>>>>>>> other } } @@ -2305,7 +2328,11 @@ S32 LLTextureFetch::update(F32 max_time_ms) // won't work so don't bother trying if (LLStartUp::getStartupState() > STATE_AGENT_SEND) { +<<<<<<< local sendRequestListToSimulators(); +======= + sendRequestListToSimulators(); +>>>>>>> other } } @@ -2356,7 +2383,11 @@ void LLTextureFetch::shutDownImageDecodeThread() void LLTextureFetch::startThread() { // Construct mCurlGetRequest from Worker Thread +<<<<<<< local mCurlGetRequest = new LLCurlTextureRequest(8); +======= + mCurlGetRequest = new LLCurlRequest(); +>>>>>>> other if(mFetchDebugger) { @@ -3195,7 +3226,10 @@ public: llinfos << "Fetch Debugger : CURL GET FAILED, index = " << mIndex << ", status:" << status << " reason:" << reason << llendl; } mDebugger->callbackHTTP(mIndex, channels, buffer, partial, success); +<<<<<<< local mDebugger->getCurlGetRequest()->completeRequest(0); +======= +>>>>>>> other } virtual bool followRedir() { @@ -3218,8 +3252,12 @@ LLTextureFetchDebugger::LLTextureFetchDebugger(LLTextureFetch* fetcher, LLTextur LLTextureFetchDebugger::~LLTextureFetchDebugger() { mFetchingHistory.clear(); +<<<<<<< local mStopDebug = TRUE; tryToStopDebug(); +======= + stopDebug(); +>>>>>>> other } void LLTextureFetchDebugger::init() @@ -3234,8 +3272,11 @@ void LLTextureFetchDebugger::init() mTotalFetchingTime = 0.f; mRefetchVisCacheTime = -1.f; mRefetchVisHTTPTime = -1.f; +<<<<<<< local mRefetchAllCacheTime = -1.f; mRefetchAllHTTPTime = -1.f; +======= +>>>>>>> other mNumFetchedTextures = 0; mNumCacheHits = 0; @@ -3249,12 +3290,18 @@ void LLTextureFetchDebugger::init() mRenderedDecodedData = 0; mFetchedPixels = 0; mRenderedPixels = 0; +<<<<<<< local mRefetchedVisData = 0; mRefetchedVisPixels = 0; mRefetchedAllData = 0; mRefetchedAllPixels = 0; +======= + mRefetchedData = 0; + mRefetchedPixels = 0; +>>>>>>> other mFreezeHistory = FALSE; +<<<<<<< local mStopDebug = FALSE; mClearHistory = FALSE; } @@ -3299,6 +3346,8 @@ void LLTextureFetchDebugger::startWork(e_debug_state state) break; } return; +======= +>>>>>>> other } void LLTextureFetchDebugger::startDebug() @@ -3306,11 +3355,15 @@ void LLTextureFetchDebugger::startDebug() //lock the fetcher mFetcher->lockFetcher(true); mFreezeHistory = TRUE; +<<<<<<< local mFetcher->resetLoadSource(); +======= +>>>>>>> other //clear the current fetching queue gTextureList.clearFetchingRequests(); +<<<<<<< local mState = START_DEBUG; } @@ -3318,6 +3371,8 @@ bool LLTextureFetchDebugger::processStartDebug(F32 max_time) { mTimer.reset(); +======= +>>>>>>> other //wait for all works to be done while(1) { @@ -3329,11 +3384,14 @@ bool LLTextureFetchDebugger::processStartDebug(F32 max_time) { break; } +<<<<<<< local if(mTimer.getElapsedTimeF32() > max_time) { return false; } +======= +>>>>>>> other } //collect statistics @@ -3372,17 +3430,27 @@ bool LLTextureFetchDebugger::processStartDebug(F32 max_time) } mNumFetchedTextures = fetched_textures.size(); +<<<<<<< local return true; +======= +>>>>>>> other } +<<<<<<< local void LLTextureFetchDebugger::tryToStopDebug() +======= +void LLTextureFetchDebugger::stopDebug() +>>>>>>> other { +<<<<<<< local if(!mStopDebug) { return; } +======= +>>>>>>> other //clear the current debug work S32 size = mFetchingHistory.size(); switch(mState) @@ -3411,6 +3479,7 @@ void LLTextureFetchDebugger::tryToStopDebug() break; case GL_TEX: break; +<<<<<<< local case REFETCH_VIS_CACHE: break; case REFETCH_VIS_HTTP: @@ -3421,12 +3490,19 @@ void LLTextureFetchDebugger::tryToStopDebug() case REFETCH_ALL_HTTP: mRefetchList.clear(); break; +======= +>>>>>>> other default: break; } +<<<<<<< local if(update(0.005f)) +======= + while(1) +>>>>>>> other { +<<<<<<< local //unlock the fetcher mFetcher->lockFetcher(false); mFetcher->resetLoadSource(); @@ -3434,29 +3510,53 @@ void LLTextureFetchDebugger::tryToStopDebug() mStopDebug = FALSE; if(mClearHistory) +======= + if(update()) +>>>>>>> other { +<<<<<<< local mFetchingHistory.clear(); init(); mTotalFetchingTime = gDebugTimers[0].getElapsedTimeF32(); //reset +======= + break; +>>>>>>> other } } +<<<<<<< local +======= + + //unlock the fetcher + mFetcher->lockFetcher(false); + mFreezeHistory = FALSE; + mTotalFetchingTime = gDebugTimers[0].getElapsedTimeF32(); //reset +>>>>>>> other } //called in the main thread and when the fetching queue is empty void LLTextureFetchDebugger::clearHistory() { +<<<<<<< local mClearHistory = TRUE; +======= + mFetchingHistory.clear(); + init(); +>>>>>>> other } void LLTextureFetchDebugger::addHistoryEntry(LLTextureFetchWorker* worker) { +<<<<<<< local if(worker->mRawImage.isNull() || worker->mFormattedImage.isNull()) { return; } +======= +>>>>>>> other if(mFreezeHistory) { +<<<<<<< local if(mState == REFETCH_VIS_CACHE || mState == REFETCH_VIS_HTTP) { mRefetchedVisPixels += worker->mRawImage->getWidth() * worker->mRawImage->getHeight(); @@ -3476,6 +3576,10 @@ void LLTextureFetchDebugger::addHistoryEntry(LLTextureFetchWorker* worker) } } } +======= + mRefetchedPixels += worker->mRawImage->getWidth() * worker->mRawImage->getHeight(); + mRefetchedData += worker->mFormattedImage->getDataSize(); +>>>>>>> other return; } @@ -3487,8 +3591,14 @@ void LLTextureFetchDebugger::addHistoryEntry(LLTextureFetchWorker* worker) mDecodedData += worker->mRawImage->getDataSize(); mFetchedPixels += worker->mRawImage->getWidth() * worker->mRawImage->getHeight(); +<<<<<<< local mFetchingHistory.push_back(FetchEntry(worker->mID, worker->mDesiredSize, worker->mDecodedDiscard, worker->mFormattedImage->getDataSize(), worker->mRawImage->getDataSize())); +======= + mFetchingHistory.push_back(FetchEntry(worker->mID, worker->mDesiredSize, worker->mDecodedDiscard, worker->mFormattedImage->getDataSize(), worker->mRawImage->getDataSize())); + //mFetchingHistory.push_back(FetchEntry(worker->mID, worker->mDesiredSize, worker->mHaveAllData ? 0 : worker->mLoadedDiscard, worker->mFormattedImage->getComponents(), + //worker->mDecodedDiscard, worker->mFormattedImage->getDataSize(), worker->mRawImage->getDataSize())); +>>>>>>> other } void LLTextureFetchDebugger::lockCache() @@ -3505,7 +3615,10 @@ void LLTextureFetchDebugger::debugCacheRead() llassert_always(mState == IDLE); mTimer.reset(); mState = READ_CACHE; +<<<<<<< local mCacheReadTime = -1.f; +======= +>>>>>>> other S32 size = mFetchingHistory.size(); for(S32 i = 0 ; i < size ; i++) @@ -3541,7 +3654,10 @@ void LLTextureFetchDebugger::debugCacheWrite() llassert_always(mState == IDLE); mTimer.reset(); mState = WRITE_CACHE; +<<<<<<< local mCacheWriteTime = -1.f; +======= +>>>>>>> other S32 size = mFetchingHistory.size(); for(S32 i = 0 ; i < size ; i++) @@ -3551,7 +3667,11 @@ void LLTextureFetchDebugger::debugCacheWrite() mFetchingHistory[i].mCacheHandle = mTextureCache->writeToCache(mFetchingHistory[i].mID, LLWorkerThread::PRIORITY_NORMAL, mFetchingHistory[i].mFormattedImage->getData(), mFetchingHistory[i].mFetchedSize, mFetchingHistory[i].mDecodedLevel == 0 ? mFetchingHistory[i].mFetchedSize : mFetchingHistory[i].mFetchedSize + 1, +<<<<<<< local NULL, 0, new LLDebuggerCacheWriteResponder(this, i)); +======= + new LLDebuggerCacheWriteResponder(this, i)); +>>>>>>> other } } } @@ -3570,7 +3690,10 @@ void LLTextureFetchDebugger::debugDecoder() llassert_always(mState == IDLE); mTimer.reset(); mState = DECODING; +<<<<<<< local mDecodingTime = -1.f; +======= +>>>>>>> other S32 size = mFetchingHistory.size(); for(S32 i = 0 ; i < size ; i++) @@ -3606,7 +3729,10 @@ void LLTextureFetchDebugger::debugHTTP() mTimer.reset(); mState = HTTP_FETCHING; +<<<<<<< local mHTTPTime = -1.f; +======= +>>>>>>> other S32 size = mFetchingHistory.size(); for (S32 i = 0 ; i < size ; i++) @@ -3623,12 +3749,19 @@ void LLTextureFetchDebugger::debugHTTP() S32 LLTextureFetchDebugger::fillCurlQueue() { +<<<<<<< local if(mStopDebug) //stop { mNbCurlCompleted = mFetchingHistory.size(); return 0; } +======= + if (mNbCurlRequests == 24) + return mNbCurlRequests; + +>>>>>>> other S32 size = mFetchingHistory.size(); +<<<<<<< local if (mNbCurlRequests == size) //all issued { @@ -3637,14 +3770,25 @@ S32 LLTextureFetchDebugger::fillCurlQueue() S32 counter = 8; mNbCurlRequests = 0; +======= +>>>>>>> other for (S32 i = 0 ; i < size ; i++) { +<<<<<<< local mNbCurlRequests++; +======= +>>>>>>> other if (mFetchingHistory[i].mCurlState != FetchEntry::CURL_NOT_DONE) +<<<<<<< local { +======= +>>>>>>> other continue; +<<<<<<< local } +======= +>>>>>>> other std::string texture_url = mHTTPUrl + "/?texture_id=" + mFetchingHistory[i].mID.asString().c_str(); S32 requestedSize = mFetchingHistory[i].mRequestedSize; // We request the whole file if the size was not set. @@ -3653,11 +3797,24 @@ S32 LLTextureFetchDebugger::fillCurlQueue() requestedSize = (requestedSize == 33554432 ? 0 : requestedSize); std::vector<std::string> headers; headers.push_back("Accept: image/x-j2c"); +<<<<<<< local mCurlGetRequest->getByteRange(texture_url, headers, 0, requestedSize, 0x10000, new LLDebuggerHTTPResponder(this, i)); mFetchingHistory[i].mCurlState = FetchEntry::CURL_IN_PROGRESS; counter--; if(counter < 1) +======= + bool res = mCurlGetRequest->getByteRange(texture_url, headers, 0, requestedSize, new LLDebuggerHTTPResponder(this, i)); + if (res) + { + mFetchingHistory[i].mCurlState = FetchEntry::CURL_IN_PROGRESS; + mNbCurlRequests++; + // Hack + if (mNbCurlRequests == 24) + break; + } + else +>>>>>>> other { break; } @@ -3670,7 +3827,11 @@ void LLTextureFetchDebugger::debugGLTextureCreation() { llassert_always(mState == IDLE); mState = GL_TEX; +<<<<<<< local mTempTexList.clear(); +======= + std::vector<LLViewerFetchedTexture*> tex_list; +>>>>>>> other S32 size = mFetchingHistory.size(); for(S32 i = 0 ; i < size ; i++) @@ -3681,10 +3842,15 @@ void LLTextureFetchDebugger::debugGLTextureCreation() if(tex && !tex->isForSculptOnly()) { tex->destroyGLTexture() ; +<<<<<<< local mTempTexList.push_back(tex); +======= + tex_list.push_back(tex); +>>>>>>> other } } } +<<<<<<< local mGLCreationTime = -1.f; mTempIndex = 0; @@ -3692,33 +3858,61 @@ void LLTextureFetchDebugger::debugGLTextureCreation() return; } +======= +>>>>>>> other +<<<<<<< local bool LLTextureFetchDebugger::processGLCreation(F32 max_time) { +======= +>>>>>>> other mTimer.reset(); +<<<<<<< local bool done = true; S32 size = mFetchingHistory.size(); S32 size1 = mTempTexList.size(); for(; mHistoryListIndex < size && mTempIndex < size1; mHistoryListIndex++) +======= + S32 j = 0 ; + S32 size1 = tex_list.size(); + for(S32 i = 0 ; i < size && j < size1; i++) +>>>>>>> other { +<<<<<<< local if(mFetchingHistory[mHistoryListIndex].mRawImage.notNull()) +======= + if(mFetchingHistory[i].mRawImage.notNull()) +>>>>>>> other { +<<<<<<< local if(mFetchingHistory[mHistoryListIndex].mID == mTempTexList[mTempIndex]->getID()) +======= + if(mFetchingHistory[i].mID == tex_list[j]->getID()) +>>>>>>> other { +<<<<<<< local mTempTexList[mTempIndex]->createGLTexture(mFetchingHistory[mHistoryListIndex].mDecodedLevel, mFetchingHistory[mHistoryListIndex].mRawImage, 0, TRUE, mTempTexList[mTempIndex]->getBoostLevel()); mTempIndex++; +======= + tex_list[j]->createGLTexture(mFetchingHistory[i].mDecodedLevel, mFetchingHistory[i].mRawImage, 0, TRUE, tex_list[j]->getBoostLevel()); + j++; +>>>>>>> other } } +<<<<<<< local if(mTimer.getElapsedTimeF32() > max_time) { done = false; break; } +======= +>>>>>>> other } +<<<<<<< local if(mGLCreationTime < 0.f) { mGLCreationTime = mTimer.getElapsedTimeF32() ; @@ -3729,6 +3923,10 @@ bool LLTextureFetchDebugger::processGLCreation(F32 max_time) } return done; +======= + mGLCreationTime = mTimer.getElapsedTimeF32() ; + return; +>>>>>>> other } //clear fetching results of all textures. @@ -3745,6 +3943,7 @@ void LLTextureFetchDebugger::clearTextures() } } +<<<<<<< local void LLTextureFetchDebugger::makeRefetchList() { mRefetchList.clear(); @@ -3788,19 +3987,28 @@ void LLTextureFetchDebugger::scanRefetchList() } } +======= +>>>>>>> other void LLTextureFetchDebugger::debugRefetchVisibleFromCache() { llassert_always(mState == IDLE); mState = REFETCH_VIS_CACHE; clearTextures(); +<<<<<<< local mFetcher->setLoadSource(LLTextureFetch::FROM_ALL); +======= + +>>>>>>> other mTimer.reset(); mFetcher->lockFetcher(false); +<<<<<<< local mRefetchVisCacheTime = -1.f; mRefetchedVisData = 0; mRefetchedVisPixels = 0; +======= +>>>>>>> other } void LLTextureFetchDebugger::debugRefetchVisibleFromHTTP() @@ -3808,16 +4016,27 @@ void LLTextureFetchDebugger::debugRefetchVisibleFromHTTP() llassert_always(mState == IDLE); mState = REFETCH_VIS_HTTP; +<<<<<<< local +======= + clearCache(); +>>>>>>> other clearTextures(); +<<<<<<< local mFetcher->setLoadSource(LLTextureFetch::FROM_HTTP_ONLY); +======= +>>>>>>> other mTimer.reset(); mFetcher->lockFetcher(false); +<<<<<<< local mRefetchVisHTTPTime = -1.f; mRefetchedVisData = 0; mRefetchedVisPixels = 0; +======= +>>>>>>> other } +<<<<<<< local void LLTextureFetchDebugger::debugRefetchAllFromCache() { llassert_always(mState == IDLE); @@ -3853,15 +4072,21 @@ void LLTextureFetchDebugger::debugRefetchAllFromHTTP() } bool LLTextureFetchDebugger::update(F32 max_time) +======= +bool LLTextureFetchDebugger::update() +>>>>>>> other { switch(mState) { +<<<<<<< local case START_DEBUG: if(processStartDebug(max_time)) { mState = IDLE; } break; +======= +>>>>>>> other case READ_CACHE: if(!mTextureCache->update(1)) { @@ -3888,7 +4113,10 @@ bool LLTextureFetchDebugger::update(F32 max_time) break; case HTTP_FETCHING: mCurlGetRequest->process(); +<<<<<<< local mCurlGetRequest->nextRequests(); +======= +>>>>>>> other LLCurl::getCurlThread()->update(1); if (!fillCurlQueue() && mNbCurlCompleted == mFetchingHistory.size()) { @@ -3897,27 +4125,43 @@ bool LLTextureFetchDebugger::update(F32 max_time) } break; case GL_TEX: +<<<<<<< local if(processGLCreation(max_time)) { mState = IDLE; mTempTexList.clear(); } +======= + mState = IDLE; +>>>>>>> other break; case REFETCH_VIS_CACHE: if (LLAppViewer::getTextureFetch()->getNumRequests() == 0) { +<<<<<<< local mRefetchVisCacheTime = mTimer.getElapsedTimeF32() ; +======= + mRefetchVisCacheTime = gDebugTimers[0].getElapsedTimeF32() - mTotalFetchingTime; +>>>>>>> other mState = IDLE; mFetcher->lockFetcher(true); +<<<<<<< local mFetcher->resetLoadSource(); +======= +>>>>>>> other } break; case REFETCH_VIS_HTTP: if (LLAppViewer::getTextureFetch()->getNumRequests() == 0) { +<<<<<<< local mRefetchVisHTTPTime = mTimer.getElapsedTimeF32() ; +======= + mRefetchVisHTTPTime = gDebugTimers[0].getElapsedTimeF32() - mTotalFetchingTime; +>>>>>>> other mState = IDLE; mFetcher->lockFetcher(true); +<<<<<<< local mFetcher->resetLoadSource(); } break; @@ -3950,6 +4194,8 @@ bool LLTextureFetchDebugger::update(F32 max_time) mFetcher->resetLoadSource(); mRefetchList.clear(); mRefetchNonVis = FALSE; +======= +>>>>>>> other } break; default: @@ -3990,6 +4236,10 @@ void LLTextureFetchDebugger::callbackHTTP(S32 id, const LLChannelDescriptors& ch const LLIOPipe::buffer_ptr_t& buffer, bool partial, bool success) { +<<<<<<< local +======= + mNbCurlRequests--; +>>>>>>> other if (success) { mFetchingHistory[id].mCurlState = FetchEntry::CURL_DONE; @@ -4003,7 +4253,11 @@ void LLTextureFetchDebugger::callbackHTTP(S32 id, const LLChannelDescriptors& ch U8* d_buffer = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), data_size); buffer->readAfter(channels.in(), NULL, d_buffer, data_size); +<<<<<<< local mFetchingHistory[id].mFormattedImage = NULL; +======= + llassert_always(mFetchingHistory[id].mFormattedImage.isNull()); +>>>>>>> other { // For now, create formatted image based on extension std::string texture_url = mHTTPUrl + "/?texture_id=" + mFetchingHistory[id].mID.asString().c_str(); @@ -4025,7 +4279,10 @@ void LLTextureFetchDebugger::callbackHTTP(S32 id, const LLChannelDescriptors& ch { // Fetch will have to be redone mFetchingHistory[id].mCurlState = FetchEntry::CURL_NOT_DONE; +<<<<<<< local mNbCurlRequests--; +======= +>>>>>>> other } else //skip { |