summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/app_settings/settings.xml22
-rw-r--r--indra/newview/llviewerdisplay.cpp29
-rw-r--r--indra/newview/llviewertexture.cpp43
-rw-r--r--indra/newview/skins/default/xui/en/notifications.xml30
4 files changed, 117 insertions, 7 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index e5d48f1652..8802644e8c 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -11468,6 +11468,28 @@
<key>Value</key>
<integer>0</integer>
</map>
+ <key>TextureDiscardBackgroundedTime</key>
+ <map>
+ <key>Comment</key>
+ <string>Specify how long to wait before discarding texture data after viewer is backgrounded. (zero or negative to disable)</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>F32</string>
+ <key>Value</key>
+ <real>60.0</real>
+ </map>
+ <key>TextureDiscardMinimizedTime</key>
+ <map>
+ <key>Comment</key>
+ <string>Specify how long to wait before discarding texture data after viewer is minimized. (zero or negative to disable)</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>F32</string>
+ <key>Value</key>
+ <real>1.0</real>
+ </map>
<key>TextureFetchConcurrency</key>
<map>
<key>Comment</key>
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index f722d0bd1d..6b90fea707 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -474,6 +474,35 @@ void display(bool rebuild, F32 zoom_factor, int subfield, bool for_snapshot)
// true = minimized, do not show/update the TP screen. HB
update_tp_display(true);
}
+
+ // Run texture subsystem to discard memory while backgrounded
+ if (!gNonInteractive)
+ {
+ LL_PROFILE_ZONE_NAMED("Update Images");
+
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("Class");
+ LLViewerTexture::updateClass();
+ }
+
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("Image Update Bump");
+ gBumpImageList.updateImages(); // must be called before gTextureList version so that it's textures are thrown out first.
+ }
+
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("List");
+ F32 max_image_decode_time = 0.050f * gFrameIntervalSeconds.value(); // 50 ms/second decode time
+ max_image_decode_time = llclamp(max_image_decode_time, 0.002f, 0.005f); // min 2ms/frame, max 5ms/frame)
+ gTextureList.updateImages(max_image_decode_time);
+ }
+
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("GLTF Materials Cleanup");
+ // remove dead gltf materials
+ gGLTFMaterialList.flushMaterials();
+ }
+ }
return;
}
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index f1c0a4f0fc..7feb807c62 100644
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -43,6 +43,7 @@
#include "message.h"
#include "lltimer.h"
#include "v4coloru.h"
+#include "llnotificationsutil.h"
// viewer includes
#include "llimagegl.h"
@@ -546,7 +547,6 @@ void LLViewerTexture::updateClass()
{
static LLCachedControl<F32> low_mem_min_discard_increment(gSavedSettings, "RenderLowMemMinDiscardIncrement", .1f);
sDesiredDiscardBias += (F32) low_mem_min_discard_increment * (F32) gFrameIntervalSeconds;
- sEvaluationTimer.reset();
}
}
else
@@ -562,20 +562,49 @@ void LLViewerTexture::updateClass()
}
// set to max discard bias if the window has been backgrounded for a while
+ static F32 last_desired_discard_bias = 1.f;
static bool was_backgrounded = false;
static LLFrameTimer backgrounded_timer;
+ static LLCachedControl<F32> minimized_discard_time(gSavedSettings, "TextureDiscardMinimizedTime", 1.f);
+ static LLCachedControl<F32> backgrounded_discard_time(gSavedSettings, "TextureDiscardBackgroundedTime", 60.f);
bool in_background = (gViewerWindow && !gViewerWindow->getWindow()->getVisible()) || !gFocusMgr.getAppHasFocus();
-
+ bool is_minimized = gViewerWindow && gViewerWindow->getWindow()->getMinimized() && in_background;
if (in_background)
{
- if (backgrounded_timer.getElapsedTimeF32() > 10.f)
+ F32 discard_time = is_minimized ? minimized_discard_time : backgrounded_discard_time;
+ if (discard_time > 0.f && backgrounded_timer.getElapsedTimeF32() > discard_time)
{
if (!was_backgrounded)
{
- LL_INFOS() << "Viewer is backgrounded, freeing up video memory." << LL_ENDL;
+ std::string notification_name;
+ std::string setting;
+ if (is_minimized)
+ {
+ notification_name = "TextureDiscardMinimized";
+ setting = "TextureDiscardMinimizedTime";
+ }
+ else
+ {
+ notification_name = "TextureDiscardBackgrounded";
+ setting = "TextureDiscardBackgroundedTime";
+ }
+
+ LL_INFOS() << "Viewer was " << (is_minimized ? "minimized" : "backgrounded") << " for " << discard_time
+ << "s, freeing up video memory." << LL_ENDL;
+
+ LLNotificationsUtil::add(notification_name, llsd::map("DELAY", discard_time), LLSD(),
+ [=](const LLSD& notification, const LLSD& response)
+ {
+ if (response["Cancel_okcancelignore"].asBoolean())
+ {
+ LL_INFOS() << "User chose to disable texture discard on " << (is_minimized ? "minimizing." : "backgrounding.") << LL_ENDL;
+ gSavedSettings.setF32(setting, -1.f);
+ }
+ });
+ last_desired_discard_bias = sDesiredDiscardBias;
+ was_backgrounded = true;
}
- was_backgrounded = true;
sDesiredDiscardBias = 4.f;
}
}
@@ -584,9 +613,9 @@ void LLViewerTexture::updateClass()
backgrounded_timer.reset();
if (was_backgrounded)
{ // if the viewer was backgrounded
- LL_INFOS() << "Viewer is no longer backgrounded, resuming normal texture usage." << LL_ENDL;
+ LL_INFOS() << "Viewer is no longer backgrounded or minimized, resuming normal texture usage." << LL_ENDL;
was_backgrounded = false;
- sDesiredDiscardBias = 1.f;
+ sDesiredDiscardBias = last_desired_discard_bias;
}
}
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index a03259bd1b..ee93c8b000 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -12587,4 +12587,34 @@ are wearing now.
yestext="OK"/>
</notification>
+ <notification
+ icon="notify.tga"
+ name="TextureDiscardBackgrounded"
+ type="notify">
+ <unique>
+ <context>DELAY</context>
+ </unique>
+ To improve system performance, [SECOND_LIFE] has reduced texture memory usage after being in the background for [DELAY] seconds. It may take some time for texture image quality to return to normal.
+ <usetemplate
+ ignoretext="Ask me about background texture memory usage and recovery"
+ name="okcancelignore"
+ yestext="OK"
+ notext="Disable"/>
+ </notification>
+
+ <notification
+ icon="notify.tga"
+ name="TextureDiscardMinimized"
+ type="notify">
+ <unique>
+ <context>DELAY</context>
+ </unique>
+ To improve system performance, [SECOND_LIFE] has reduced texture memory usage after being minimized for [DELAY] seconds. It may take some time for texture image quality to return to normal.
+ <usetemplate
+ ignoretext="Ask me about minimized texture memory usage and recovery"
+ name="okcancelignore"
+ yestext="OK"
+ notext="Disable"/>
+ </notification>
+
</notifications>