summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorMonty Brandenberg <monty@lindenlab.com>2012-08-21 12:28:51 -0400
committerMonty Brandenberg <monty@lindenlab.com>2012-08-21 12:28:51 -0400
commit7bee4b58ff1e36ca39abc090991833c43c8903cc (patch)
tree2841504b6e2d208eaa5bda1e95bfbfb7a3992526 /indra
parent4b86f8983ad343b675e3f4960e91f0d4cb876dea (diff)
SH-3325 texture load slow on some machines
This doesn't really address 3325 directly but it is the result of research done while hunting it down. First, this is a thread safety improvement for canceled requests that have gone into resource wait state. I don't think we've seen a failure there but there was a window. It also cleans the resource wait queue earlier which lets us do less work and get requests more quickly into llcorehttp by bypassing the resource wait state. With this, I finally feel comfortable about rundown of requests.
Diffstat (limited to 'indra')
-rwxr-xr-xindra/newview/lltexturefetch.cpp39
-rw-r--r--indra/newview/lltexturefetch.h3
2 files changed, 36 insertions, 6 deletions
diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp
index 6ae20edb9f..faaa9ed86b 100755
--- a/indra/newview/lltexturefetch.cpp
+++ b/indra/newview/lltexturefetch.cpp
@@ -1945,10 +1945,14 @@ bool LLTextureFetchWorker::deleteOK()
if (WAIT_HTTP_RESOURCE2 == mState)
{
- // Don't delete the worker out from under the
- // releaseHttpWaiters() method. Keep the pointers
- // valid, clean up after transition.
- delete_ok = false;
+ if (mFetcher->isHttpWaiter(mID))
+ {
+ // Don't delete the worker out from under the releaseHttpWaiters()
+ // method. Keep the pointers valid, clean up after that method
+ // has recognized the cancelation and removed the UUID from the
+ // waiter list.
+ delete_ok = false;
+ }
}
// Allow any pending reads or writes to complete
@@ -2551,7 +2555,6 @@ void LLTextureFetch::deleteRequest(const LLUUID& id, bool cancel)
unlockQueue(); // -Mfq
llassert_always(erased_1 > 0) ;
-
removeFromNetworkQueue(worker, cancel);
llassert_always(!(worker->getFlags(LLWorkerClass::WCF_DELETE_REQUESTED))) ;
@@ -3370,6 +3373,16 @@ void LLTextureFetch::removeHttpWaiter(const LLUUID & tid)
mNetworkQueueMutex.unlock(); // -Mfnq
}
+// Threads: T*
+bool LLTextureFetch::isHttpWaiter(const LLUUID & tid)
+{
+ mNetworkQueueMutex.lock(); // +Mfnq
+ wait_http_res_queue_t::iterator iter(mHttpWaitResource.find(tid));
+ const bool ret(mHttpWaitResource.end() != iter);
+ mNetworkQueueMutex.unlock(); // -Mfnq
+ return ret;
+}
+
// Release as many requests as permitted from the WAIT_HTTP_RESOURCE2
// state to the SEND_HTTP_REQ state based on their current priority.
//
@@ -3424,6 +3437,15 @@ void LLTextureFetch::releaseHttpWaiters()
{
tids2.push_back(worker);
}
+ else
+ {
+ // If worker isn't found, this should be due to a request
+ // for deletion. We signal our recognition that this
+ // uuid shouldn't be used for resource waiting anymore by
+ // erasing it from the resource waiter list. That allows
+ // deleteOK to do final deletion on the worker.
+ removeHttpWaiter(* iter);
+ }
}
tids.clear();
@@ -3446,8 +3468,13 @@ void LLTextureFetch::releaseHttpWaiters()
worker->lockWorkMutex(); // +Mw
if (LLTextureFetchWorker::WAIT_HTTP_RESOURCE2 != worker->mState)
{
- // Not in expected state, try the next one
+ // Not in expected state, remove it, try the next one
worker->unlockWorkMutex(); // -Mw
+ LL_WARNS("Texture") << "Resource-waited texture " << worker->mID
+ << " in unexpected state: " << worker->mState
+ << ". Removing from wait list."
+ << LL_ENDL;
+ removeHttpWaiter(worker->mID);
continue;
}
diff --git a/indra/newview/lltexturefetch.h b/indra/newview/lltexturefetch.h
index 4294209f04..fd2223ecb0 100644
--- a/indra/newview/lltexturefetch.h
+++ b/indra/newview/lltexturefetch.h
@@ -185,6 +185,9 @@ public:
// Threads: T*
void removeHttpWaiter(const LLUUID & tid);
+ // Threads: T*
+ bool isHttpWaiter(const LLUUID & tid);
+
// If there are slots, release one or more LLTextureFetchWorker
// requests from resource wait state (WAIT_HTTP_RESOURCE) to
// active (SEND_HTTP_REQ).