summaryrefslogtreecommitdiff
path: root/indra/newview/lltexturefetch.cpp
diff options
context:
space:
mode:
authorAnsariel <ansariel.hiller@phoenixviewer.com>2024-04-11 21:59:38 +0200
committerAnsariel <ansariel.hiller@phoenixviewer.com>2024-04-11 21:59:38 +0200
commitd0102af56d3b1d5b1d9bf3c8eb9aeea77028b70e (patch)
treee31cee85f651a874c4b6edc7491efa0cb2ec93d5 /indra/newview/lltexturefetch.cpp
parent17e1f3692c5c1e9cbc6ba6895b312a8baae9aec2 (diff)
parentda9a1dcb55548a249ff7a1255f3e518696b81245 (diff)
Merge branch 'main' of https://github.com/secondlife/viewer into DRTVWR-600-maint-A
# Conflicts: # indra/llcommon/llapp.cpp # indra/llcommon/llapp.h # indra/llimage/llimageworker.cpp # indra/llui/llcontainerview.cpp # indra/llui/llcontainerview.h # indra/llui/llkeywords.cpp # indra/llui/lltabcontainer.cpp # indra/llui/lltextbase.cpp # indra/newview/llappviewer.cpp # indra/newview/llfavoritesbar.cpp # indra/newview/llfavoritesbar.h # indra/newview/llfloaterimnearbychathandler.cpp # indra/newview/llfloaterpreference.cpp # indra/newview/llhudnametag.h # indra/newview/llinventorypanel.cpp # indra/newview/llinventorypanel.h # indra/newview/llmeshrepository.cpp # indra/newview/lloutfitgallery.cpp # indra/newview/lloutfitslist.cpp # indra/newview/llpaneleditwearable.cpp # indra/newview/llpanelprofilepicks.cpp # indra/newview/llpanelvoicedevicesettings.h # indra/newview/llpreviewscript.cpp # indra/newview/llpreviewscript.h # indra/newview/llselectmgr.cpp # indra/newview/lltranslate.cpp # indra/newview/llviewerassetupload.cpp # indra/newview/llviewermessage.cpp
Diffstat (limited to 'indra/newview/lltexturefetch.cpp')
-rw-r--r--indra/newview/lltexturefetch.cpp36
1 files changed, 29 insertions, 7 deletions
diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp
index 7a0da6ec9b..5fd3fb6e29 100644
--- a/indra/newview/lltexturefetch.cpp
+++ b/indra/newview/lltexturefetch.cpp
@@ -348,13 +348,13 @@ private:
}
// Threads: Tid
- virtual void completed(bool success, LLImageRaw* raw, LLImageRaw* aux)
+ virtual void completed(bool success, LLImageRaw* raw, LLImageRaw* aux, U32 request_id)
{
LL_PROFILE_ZONE_SCOPED;
LLTextureFetchWorker* worker = mFetcher->getWorker(mID);
if (worker)
{
- worker->callbackDecoded(success, raw, aux);
+ worker->callbackDecoded(success, raw, aux, request_id);
}
}
private:
@@ -398,7 +398,7 @@ public:
void callbackCacheWrite(bool success);
// Threads: Tid
- void callbackDecoded(bool success, LLImageRaw* raw, LLImageRaw* aux);
+ void callbackDecoded(bool success, LLImageRaw* raw, LLImageRaw* aux, S32 decode_id);
// Threads: T*
void setGetStatus(LLCore::HttpStatus status, const std::string& reason)
@@ -1802,8 +1802,22 @@ bool LLTextureFetchWorker::doWork(S32 param)
setState(DECODE_IMAGE_UPDATE);
LL_DEBUGS(LOG_TXT) << mID << ": Decoding. Bytes: " << mFormattedImage->getDataSize() << " Discard: " << discard
<< " All Data: " << mHaveAllData << LL_ENDL;
- mDecodeHandle = LLAppViewer::getImageDecodeThread()->decodeImage(mFormattedImage, discard, mNeedsAux,
- new DecodeResponder(mFetcher, mID, this));
+
+ // In case worked manages to request decode, be shut down,
+ // then init and request decode again with first decode
+ // still in progress, assign a sufficiently unique id
+ mDecodeHandle = LLAppViewer::getImageDecodeThread()->decodeImage(mFormattedImage,
+ discard,
+ mNeedsAux,
+ new DecodeResponder(mFetcher, mID, this));
+ if (mDecodeHandle == 0)
+ {
+ // Abort, failed to put into queue.
+ // Happens if viewer is shutting down
+ setState(DONE);
+ LL_DEBUGS(LOG_TXT) << mID << " DECODE_IMAGE abort: failed to post for decoding" << LL_ENDL;
+ return true;
+ }
// fall though
}
@@ -2310,16 +2324,24 @@ void LLTextureFetchWorker::callbackCacheWrite(bool success)
//////////////////////////////////////////////////////////////////////////////
// Threads: Tid
-void LLTextureFetchWorker::callbackDecoded(bool success, LLImageRaw* raw, LLImageRaw* aux)
+void LLTextureFetchWorker::callbackDecoded(bool success, LLImageRaw* raw, LLImageRaw* aux, S32 decode_id)
{
LLMutexLock lock(&mWorkMutex); // +Mw
if (mDecodeHandle == 0)
{
return; // aborted, ignore
}
+ if (mDecodeHandle != decode_id)
+ {
+ // Queue doesn't support canceling old requests.
+ // This shouldn't normally happen, but in case it's possible that a worked
+ // will request decode, be aborted, reinited then start a new decode
+ LL_DEBUGS(LOG_TXT) << mID << " received obsolete decode's callback" << LL_ENDL;
+ return; // ignore
+ }
if (mState != DECODE_IMAGE_UPDATE)
{
-// LL_WARNS(LOG_TXT) << "Decode callback for " << mID << " with state = " << mState << LL_ENDL;
+ LL_DEBUGS(LOG_TXT) << "Decode callback for " << mID << " with state = " << mState << LL_ENDL;
mDecodeHandle = 0;
return;
}