summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/app_settings/settings.xml2
-rw-r--r--indra/newview/lltexturecache.cpp43
-rw-r--r--indra/newview/lltexturefetch.cpp3
-rw-r--r--indra/newview/skins/default/xui/en/panel_preferences_setup.xml8
4 files changed, 33 insertions, 23 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 8ad52784d3..75c8961d60 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -1132,7 +1132,7 @@
<key>Type</key>
<string>U32</string>
<key>Value</key>
- <integer>500</integer>
+ <integer>512</integer>
</map>
<key>CacheValidateCounter</key>
<map>
diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp
index 2e2f342cca..4f199e9da4 100644
--- a/indra/newview/lltexturecache.cpp
+++ b/indra/newview/lltexturecache.cpp
@@ -1002,7 +1002,7 @@ void LLTextureCache::closeHeaderEntriesFile()
void LLTextureCache::readEntriesHeader()
{
// mHeaderEntriesInfo initializes to default values so safe not to read it
- llassert_always(mHeaderAPRFile == NULL);
+ llassert_always(mHeaderAPRFile == NULL);
if (LLAPRFile::isExist(mHeaderEntriesFileName, getLocalAPRFilePool()))
{
LLAPRFile::readEx(mHeaderEntriesFileName, (U8*)&mHeaderEntriesInfo, 0, sizeof(EntriesInfo),
@@ -1192,7 +1192,7 @@ void LLTextureCache::writeEntriesAndClose(const std::vector<Entry>& entries)
// Called from either the main thread or the worker thread
void LLTextureCache::readHeaderCache()
{
- LLMutexLock lock(&mHeaderMutex);
+ mHeaderMutex.lock();
mLRU.clear(); // always clear the LRU
@@ -1214,14 +1214,14 @@ void LLTextureCache::readHeaderCache()
U32 empty_entries = 0;
typedef std::pair<U32, S32> lru_data_t;
std::set<lru_data_t> lru;
- std::vector<S32> purge_list;
+ std::set<LLUUID> purge_list;
for (U32 i=0; i<num_entries; i++)
{
Entry& entry = entries[i];
const LLUUID& id = entry.mID;
if (entry.mImageSize < 0)
{
- // This will be in the Free List, don't put it in the LRY
+ // This will be in the Free List, don't put it in the LRU
++empty_entries;
}
else
@@ -1233,7 +1233,8 @@ void LLTextureCache::readHeaderCache()
{
// Shouldn't happen, failsafe only
llwarns << "Bad entry: " << i << ": " << id << ": BodySize: " << entry.mBodySize << llendl;
- purge_list.push_back(i);
+ purge_list.insert(entry.mID);
+ entry.mImageSize = -1; // empty/available
}
}
}
@@ -1248,13 +1249,17 @@ void LLTextureCache::readHeaderCache()
{
for (std::set<lru_data_t>::iterator iter = lru.begin(); iter != lru.end(); ++iter)
{
- purge_list.push_back(iter->second);
- if (--entries_to_purge <= 0)
- break;
+ S32 idx = iter->second;
+ if (entries[idx].mImageSize >= 0)
+ {
+ purge_list.insert(entries[idx].mID);
+ entries[idx].mImageSize = -1;
+ if (purge_list.size() >= entries_to_purge)
+ break;
+ }
}
}
- llassert_always(entries_to_purge <= 0);
- llassert_always(purge_list.size() == entries_to_purge);
+ llassert_always(purge_list.size() >= entries_to_purge);
}
else
{
@@ -1272,11 +1277,9 @@ void LLTextureCache::readHeaderCache()
if (purge_list.size() > 0)
{
- for (std::vector<S32>::iterator iter = purge_list.begin(); iter != purge_list.end(); ++iter)
+ for (std::set<LLUUID>::iterator iter = purge_list.begin(); iter != purge_list.end(); ++iter)
{
- S32 idx = *iter;
- const LLUUID& id = entries[idx].mID;
- entries[idx].mImageSize = -1; // set cached entry size to -1
+ const LLUUID& id = *iter;
bool res = removeHeaderCacheEntry(id); // sets entry size on disk to -1
llassert_always(res);
LLAPRFile::remove(getTextureFileName(id), getLocalAPRFilePool());
@@ -1295,7 +1298,9 @@ void LLTextureCache::readHeaderCache()
llassert_always(new_entries.size() <= sCacheMaxEntries);
mHeaderEntriesInfo.mEntries = new_entries.size();
writeEntriesAndClose(new_entries);
+ mHeaderMutex.unlock(); // unlock the mutex before calling again
readHeaderCache(); // repeat with new entries file
+ mHeaderMutex.lock();
}
else
{
@@ -1303,6 +1308,7 @@ void LLTextureCache::readHeaderCache()
}
}
}
+ mHeaderMutex.unlock();
}
//////////////////////////////////////////////////////////////////////////////
@@ -1348,9 +1354,12 @@ void LLTextureCache::purgeTextures(bool validate)
return;
}
- // *FIX:Mani - watchdog off.
- LLAppViewer::instance()->pauseMainloopTimeout();
-
+ if (!mThreaded)
+ {
+ // *FIX:Mani - watchdog off.
+ LLAppViewer::instance()->pauseMainloopTimeout();
+ }
+
LLMutexLock lock(&mHeaderMutex);
llinfos << "TEXTURE CACHE: Purging." << llendl;
diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp
index c918f98895..6f3dabe5a7 100644
--- a/indra/newview/lltexturefetch.cpp
+++ b/indra/newview/lltexturefetch.cpp
@@ -524,6 +524,7 @@ void LLTextureFetchWorker::setDesiredDiscard(S32 discard, S32 size)
mDesiredSize = size;
prioritize = true;
}
+ mDesiredSize = llmax(mDesiredSize, TEXTURE_CACHE_ENTRY_SIZE);
if ((prioritize && mState == INIT) || mState == DONE)
{
mState = INIT;
@@ -613,6 +614,7 @@ bool LLTextureFetchWorker::doWork(S32 param)
mCacheReadHandle = LLTextureCache::nullHandle();
mCacheWriteHandle = LLTextureCache::nullHandle();
mState = LOAD_FROM_TEXTURE_CACHE;
+ 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;
// fall through
@@ -681,7 +683,6 @@ bool LLTextureFetchWorker::doWork(S32 param)
if (mState == CACHE_POST)
{
- mDesiredSize = llmax(mDesiredSize, TEXTURE_CACHE_ENTRY_SIZE);
mCachedSize = mFormattedImage.notNull() ? mFormattedImage->getDataSize() : 0;
// Successfully loaded
if ((mCachedSize >= mDesiredSize) || mHaveAllData)
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_setup.xml b/indra/newview/skins/default/xui/en/panel_preferences_setup.xml
index 9cf0bd26d8..5cabae5fa0 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_setup.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_setup.xml
@@ -169,12 +169,12 @@
decimal_digits="0"
follows="left|top"
height="15"
- increment="10"
- initial_value="50"
+ increment="16"
+ initial_value="512"
layout="topleft"
left_delta="150"
- max_val="1000"
- min_val="10"
+ max_val="1024"
+ min_val="32"
name="cache_size"
top_delta="-1"
width="180" />