diff options
Diffstat (limited to 'indra/newview/lltexturefetch.cpp')
-rw-r--r-- | indra/newview/lltexturefetch.cpp | 80 |
1 files changed, 64 insertions, 16 deletions
diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 69c40066b4..bac0c736b1 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -537,7 +537,6 @@ private: F32 mImagePriority; // should map to max virtual size F32 mRequestedPriority; S32 mDesiredDiscard; - S32 mSimRequestedDiscard; S32 mRequestedDiscard; S32 mLoadedDiscard; S32 mDecodedDiscard; @@ -870,7 +869,6 @@ LLTextureFetchWorker::LLTextureFetchWorker(LLTextureFetch* fetcher, mImagePriority(priority), mRequestedPriority(0.f), mDesiredDiscard(-1), - mSimRequestedDiscard(-1), mRequestedDiscard(-1), mLoadedDiscard(-1), mDecodedDiscard(-1), @@ -1505,18 +1503,13 @@ bool LLTextureFetchWorker::doWork(S32 param) { if (http_not_found == mGetStatus) { - if (mFTType != FTT_MAP_TILE) - { - LL_WARNS(LOG_TXT) << "Texture missing from server (404): " << mUrl << LL_ENDL; - } - if(mWriteToCacheState == NOT_WRITE) //map tiles or server bakes { setState(DONE); releaseHttpSemaphore(); if (mFTType != FTT_MAP_TILE) { - LL_WARNS(LOG_TXT) << mID << " abort: WAIT_HTTP_REQ not found" << LL_ENDL; + LL_WARNS(LOG_TXT) << mID << "NOT_WRITE texture missing from server (404), abort: " << mUrl << LL_ENDL; } return true; } @@ -1526,6 +1519,10 @@ bool LLTextureFetchWorker::doWork(S32 param) LLViewerRegion* region = getRegion(); if (!region || mLastRegionId != region->getRegionID()) { + if (mFTType != FTT_MAP_TILE) + { + LL_INFOS(LOG_TXT) << "Texture missing from server (404), retrying: " << mUrl << " mRetryAttempt " << mRetryAttempt << LL_ENDL; + } // cap failure? try on new region. mUrl.clear(); ++mRetryAttempt; @@ -1534,6 +1531,11 @@ bool LLTextureFetchWorker::doWork(S32 param) return false; } } + + if (mFTType != FTT_MAP_TILE) + { + LL_WARNS(LOG_TXT) << "Texture missing from server (404): " << mUrl << LL_ENDL; + } } else if (http_service_unavail == mGetStatus) { @@ -1759,7 +1761,10 @@ bool LLTextureFetchWorker::doWork(S32 param) mRawImage = NULL; mAuxImage = NULL; llassert_always(mFormattedImage.notNull()); - S32 discard = mHaveAllData ? 0 : mLoadedDiscard; + + // if we have the entire image data (and the image is not J2C), decode the full res image + // DO NOT decode a higher res j2c than was requested. This is a waste of time and memory. + S32 discard = mHaveAllData && mFormattedImage->getCodec() != IMG_CODEC_J2C ? 0 : mLoadedDiscard; mDecoded = false; setState(DECODE_IMAGE_UPDATE); LL_DEBUGS(LOG_TXT) << mID << ": Decoding. Bytes: " << mFormattedImage->getDataSize() << " Discard: " << discard @@ -2090,7 +2095,7 @@ bool LLTextureFetchWorker::deleteOK() // Allow any pending reads or writes to complete if (mCacheReadHandle != LLTextureCache::nullHandle()) { - if (mFetcher->mTextureCache->readComplete(mCacheReadHandle, true)) + if (!mFetcher->mTextureCache || mFetcher->mTextureCache->readComplete(mCacheReadHandle, true)) { mCacheReadHandle = LLTextureCache::nullHandle(); } @@ -2101,7 +2106,7 @@ bool LLTextureFetchWorker::deleteOK() } if (mCacheWriteHandle != LLTextureCache::nullHandle()) { - if (mFetcher->mTextureCache->writeComplete(mCacheWriteHandle)) + if (!mFetcher->mTextureCache || mFetcher->mTextureCache->writeComplete(mCacheWriteHandle)) { mCacheWriteHandle = LLTextureCache::nullHandle(); } @@ -2316,6 +2321,10 @@ void LLTextureFetchWorker::callbackDecoded(bool success, const std::string &erro mRawImage = raw; mAuxImage = aux; mDecodedDiscard = mFormattedImage->getDiscardLevel(); + if (mDecodedDiscard < mDesiredDiscard) + { + LL_WARNS_ONCE(LOG_TXT) << "Decoded higher resolution than requested" << LL_ENDL; + } LL_DEBUGS(LOG_TXT) << mID << ": Decode Finished. Discard: " << mDecodedDiscard << " Raw Image: " << llformat("%dx%d",mRawImage->getWidth(),mRawImage->getHeight()) << LL_ENDL; } @@ -2479,7 +2488,7 @@ S32 LLTextureFetch::createRequest(FTType f_type, const std::string& url, const L LL_PROFILE_ZONE_SCOPED; if (mDebugPause) { - return -1; + return CREATE_REQUEST_ERROR_DEFAULT; } if (f_type == FTT_SERVER_BAKE) @@ -2495,7 +2504,7 @@ S32 LLTextureFetch::createRequest(FTType f_type, const std::string& url, const L << host << " != " << worker->mHost << LL_ENDL; removeRequest(worker, true); worker = NULL; - return -1; + return CREATE_REQUEST_ERROR_MHOSTS; } } @@ -2548,13 +2557,13 @@ S32 LLTextureFetch::createRequest(FTType f_type, const std::string& url, const L { if (worker->wasAborted()) { - return -1; // need to wait for previous aborted request to complete + return CREATE_REQUEST_ERROR_ABORTED; // need to wait for previous aborted request to complete } worker->lockWorkMutex(); // +Mw if (worker->mState == LLTextureFetchWorker::DONE && worker->mDesiredSize == llmax(desired_size, TEXTURE_CACHE_ENTRY_SIZE) && worker->mDesiredDiscard == desired_discard) { worker->unlockWorkMutex(); // -Mw - return -1; // similar request has failed or is in a transitional state + return CREATE_REQUEST_ERROR_TRANSITION; // similar request has finished, failed or is in a transitional state } worker->mActiveCount++; worker->mNeedsAux = needs_aux; @@ -2736,7 +2745,7 @@ LLTextureFetchWorker* LLTextureFetch::getWorker(const LLUUID& id) // Threads: T* -bool LLTextureFetch::getRequestFinished(const LLUUID& id, S32& discard_level, +bool LLTextureFetch::getRequestFinished(const LLUUID& id, S32& discard_level, S32& worker_state, LLPointer<LLImageRaw>& raw, LLPointer<LLImageRaw>& aux, LLCore::HttpStatus& last_http_get_status) { @@ -2745,6 +2754,7 @@ bool LLTextureFetch::getRequestFinished(const LLUUID& id, S32& discard_level, LLTextureFetchWorker* worker = getWorker(id); if (worker) { + worker_state = worker->mState; if (worker->wasAborted()) { res = true; @@ -2823,6 +2833,7 @@ bool LLTextureFetch::getRequestFinished(const LLUUID& id, S32& discard_level, } else { + worker_state = 0; res = true; } return res; @@ -3145,6 +3156,43 @@ S32 LLTextureFetch::getFetchState(const LLUUID& id, F32& data_progress_p, F32& r return state; } +// Threads: T* +S32 LLTextureFetch::getLastFetchState(const LLUUID& id, S32& requested_discard, S32& decoded_discard, bool& decoded) +{ + LL_PROFILE_ZONE_SCOPED; + S32 state = LLTextureFetchWorker::INVALID; + + LLTextureFetchWorker* worker = getWorker(id); + if (worker) // Don't check haveWork, intent is to get whatever is in the worker + { + worker->lockWorkMutex(); // +Mw + state = worker->mState; + requested_discard = worker->mDesiredDiscard; + decoded_discard = worker->mDecodedDiscard; + decoded = worker->mDecoded; + worker->unlockWorkMutex(); // -Mw + } + return state; +} + +// Threads: T* +S32 LLTextureFetch::getLastRawImage(const LLUUID& id, + LLPointer<LLImageRaw>& raw, LLPointer<LLImageRaw>& aux) +{ + LL_PROFILE_ZONE_SCOPED; + S32 decoded_discard = -1; + LLTextureFetchWorker* worker = getWorker(id); + if (worker && !worker->haveWork() && worker->mDecodedDiscard >= 0) + { + worker->lockWorkMutex(); // +Mw + raw = worker->mRawImage; + aux = worker->mAuxImage; + decoded_discard = worker->mDecodedDiscard; + worker->unlockWorkMutex(); // -Mw + } + return decoded_discard; +} + void LLTextureFetch::dump() { LL_INFOS(LOG_TXT) << "LLTextureFetch ACTIVE_HTTP:" << LL_ENDL; |