summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorMark Palange (Mani) <palange@lindenlab.com>2009-11-16 18:19:43 -0800
committerMark Palange (Mani) <palange@lindenlab.com>2009-11-16 18:19:43 -0800
commitd3b03c7f53388a4a43cbce7c5ab196ab469d4abd (patch)
tree1199b9a925e21a2a8d82dcb2cf4ee91927d82f0b /indra
parent6e7d131e5800d921ec9bcf7b51f619256367fa55 (diff)
parent27a555e443c98ce1a41ef21e6111bdfe903894e8 (diff)
Merge with viewer-2-0 changes
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/app_settings/settings.xml11
-rw-r--r--indra/newview/llmediactrl.cpp22
-rw-r--r--indra/newview/llmediactrl.h1
-rw-r--r--indra/newview/llviewermedia.cpp62
-rw-r--r--indra/newview/llviewermedia.h2
-rw-r--r--indra/newview/llviewertexture.cpp5
-rw-r--r--indra/newview/llvlcomposition.cpp13
-rw-r--r--indra/newview/skins/default/xui/en/panel_login.xml1
8 files changed, 84 insertions, 33 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index f2193c4139..94a2ca16f4 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -4545,6 +4545,17 @@
<key>Value</key>
<integer>1</integer>
</map>
+ <key>MediaPerformanceManagerDebug</key>
+ <map>
+ <key>Comment</key>
+ <string>Whether to show debug data for the media performance manager in the nearby media list.</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Boolean</string>
+ <key>Value</key>
+ <integer>0</integer>
+ </map>
<key>MemoryLogFrequency</key>
<map>
<key>Comment</key>
diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp
index 8f29f908e5..90c009887d 100644
--- a/indra/newview/llmediactrl.cpp
+++ b/indra/newview/llmediactrl.cpp
@@ -92,6 +92,7 @@ LLMediaCtrl::LLMediaCtrl( const Params& p) :
mStretchToFill( true ),
mMaintainAspectRatio ( true ),
mHideLoading (false),
+ mHidingInitialLoad (false),
mDecoupleTextureSize ( false ),
mTextureWidth ( 1024 ),
mTextureHeight ( 1024 )
@@ -616,6 +617,11 @@ bool LLMediaCtrl::ensureMediaSourceExists()
mMediaSource->setHomeURL(mHomePageUrl);
mMediaSource->setVisible( getVisible() );
mMediaSource->addObserver( this );
+
+ if(mHideLoading)
+ {
+ mHidingInitialLoad = true;
+ }
}
else
{
@@ -685,7 +691,13 @@ void LLMediaCtrl::draw()
{
setFrequentUpdates( false );
};
-
+
+ if(mHidingInitialLoad)
+ {
+ // If we're hiding loading, don't draw at all.
+ return;
+ }
+
// alpha off for this
LLGLSUIDefault gls_ui;
LLGLDisable gls_alphaTest( GL_ALPHA_TEST );
@@ -865,19 +877,15 @@ void LLMediaCtrl::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event)
case MEDIA_EVENT_NAVIGATE_BEGIN:
{
LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_NAVIGATE_BEGIN, url is " << self->getNavigateURI() << LL_ENDL;
- if(mMediaSource && mHideLoading)
- {
- mMediaSource->suspendUpdates(true);
- }
};
break;
case MEDIA_EVENT_NAVIGATE_COMPLETE:
{
LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_NAVIGATE_COMPLETE, result string is: " << self->getNavigateResultString() << LL_ENDL;
- if(mMediaSource && mHideLoading)
+ if(mHidingInitialLoad)
{
- mMediaSource->suspendUpdates(false);
+ mHidingInitialLoad = false;
}
};
break;
diff --git a/indra/newview/llmediactrl.h b/indra/newview/llmediactrl.h
index 76ddc61ebf..f07513a3fd 100644
--- a/indra/newview/llmediactrl.h
+++ b/indra/newview/llmediactrl.h
@@ -188,6 +188,7 @@ public:
bool mStretchToFill;
bool mMaintainAspectRatio;
bool mHideLoading;
+ bool mHidingInitialLoad;
bool mDecoupleTextureSize;
S32 mTextureWidth;
S32 mTextureHeight;
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 70490d3a6e..4663e9c8e6 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -32,6 +32,7 @@
#include "llviewerprecompiledheaders.h"
+#include "llagent.h"
#include "llviewermedia.h"
#include "llviewermediafocus.h"
#include "llmimetypes.h"
@@ -571,6 +572,11 @@ bool LLViewerMedia::priorityComparitor(const LLViewerMediaImpl* i1, const LLView
// Playable items sort above ones that wouldn't play even if they got high enough priority
return false;
}
+ else if(i1->getInterest() == i2->getInterest())
+ {
+ // Generally this will mean both objects have zero interest. In this case, sort on distance.
+ return (i1->getProximityDistance() < i2->getProximityDistance());
+ }
else
{
// The object with the larger interest value should be earlier in the list, so we reverse the sense of the comparison here.
@@ -578,6 +584,11 @@ bool LLViewerMedia::priorityComparitor(const LLViewerMediaImpl* i1, const LLView
}
}
+static bool proximity_comparitor(const LLViewerMediaImpl* i1, const LLViewerMediaImpl* i2)
+{
+ return (i1->getProximityDistance() < i2->getProximityDistance());
+}
+
//////////////////////////////////////////////////////////////////////////////////////////
// static
void LLViewerMedia::updateMedia()
@@ -603,12 +614,9 @@ void LLViewerMedia::updateMedia()
int impl_count_total = 0;
int impl_count_interest_low = 0;
int impl_count_interest_normal = 0;
- int i = 0;
-
-#if 0
- LL_DEBUGS("PluginPriority") << "Sorted impls:" << llendl;
-#endif
-
+
+ std::vector<LLViewerMediaImpl*> proximity_order;
+
U32 max_instances = gSavedSettings.getU32("PluginInstancesTotal");
U32 max_normal = gSavedSettings.getU32("PluginInstancesNormal");
U32 max_low = gSavedSettings.getU32("PluginInstancesLow");
@@ -714,23 +722,27 @@ void LLViewerMedia::updateMedia()
}
else
{
- // Other impls just get the same ordering as the priority list (for now).
- pimpl->mProximity = i;
+ proximity_order.push_back(pimpl);
}
-#if 0
- LL_DEBUGS("PluginPriority") << " " << pimpl
- << ", setting priority to " << new_priority
- << (pimpl->hasFocus()?", HAS FOCUS":"")
- << (pimpl->getUsedInUI()?", is UI":"")
- << ", cpu " << pimpl->getCPUUsage()
- << ", interest " << pimpl->getInterest()
- << ", media url " << pimpl->getMediaURL() << llendl;
-#endif
-
total_cpu += pimpl->getCPUUsage();
-
- i++;
+ }
+
+ if(gSavedSettings.getBOOL("MediaPerformanceManagerDebug"))
+ {
+ // Give impls the same ordering as the priority list
+ // they're already in the right order for this.
+ }
+ else
+ {
+ // Use a distance-based sort for proximity values.
+ std::stable_sort(proximity_order.begin(), proximity_order.end(), proximity_comparitor);
+ }
+
+ // Transfer the proximity order to the proximity fields in the objects.
+ for(int i = 0; i < proximity_order.size(); i++)
+ {
+ proximity_order[i]->mProximity = i;
}
LL_DEBUGS("PluginPriority") << "Total reported CPU usage is " << total_cpu << llendl;
@@ -782,6 +794,7 @@ LLViewerMediaImpl::LLViewerMediaImpl( const LLUUID& texture_id,
mIsDisabled(false),
mIsParcelMedia(false),
mProximity(-1),
+ mProximityDistance(0.0f),
mMimeTypeProbe(NULL),
mIsUpdated(false)
{
@@ -2109,6 +2122,15 @@ void LLViewerMediaImpl::calculateInterest()
mInterest = 0.0f;
}
+ // Calculate distance from the avatar, for use in the proximity calculation.
+ mProximityDistance = 0.0f;
+ if(!mObjectList.empty())
+ {
+ // Just use the first object in the list. We could go through the list and find the closest object, but this should work well enough.
+ LLVector3d global_delta = gAgent.getPositionGlobal() - (*mObjectList.begin())->getPositionGlobal();
+ mProximityDistance = global_delta.magVecSquared(); // use distance-squared because it's cheaper and sorts the same.
+ }
+
if(mNeedsMuteCheck)
{
// Check all objects this instance is associated with, and those objects' owners, against the mute list
diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h
index a06079786e..f4afce6c4c 100644
--- a/indra/newview/llviewermedia.h
+++ b/indra/newview/llviewermedia.h
@@ -270,6 +270,7 @@ public:
F64 getInterest() const { return mInterest; };
F64 getApproximateTextureInterest();
S32 getProximity() const { return mProximity; };
+ F64 getProximityDistance() const { return mProximityDistance; };
// Mark this object as being used in a UI panel instead of on a prim
// This will be used as part of the interest sorting algorithm.
@@ -339,6 +340,7 @@ public:
bool mIsDisabled;
bool mIsParcelMedia;
S32 mProximity;
+ F64 mProximityDistance;
LLMimeDiscoveryResponder *mMimeTypeProbe;
private:
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index 85bc26c9c0..0d29efaedf 100644
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -2121,10 +2121,11 @@ LLImageRaw* LLViewerFetchedTexture::reloadRawImage(S8 discard_level)
llassert_always(mGLTexturep.notNull()) ;
llassert_always(discard_level >= 0);
llassert_always(mComponents > 0);
+
if (mRawImage.notNull())
{
- llerrs << "called with existing mRawImage" << llendl;
- mRawImage = NULL;
+ //mRawImage is in use by somebody else, do not delete it.
+ return NULL ;
}
if(mSavedRawDiscardLevel >= 0 && mSavedRawDiscardLevel <= discard_level)
diff --git a/indra/newview/llvlcomposition.cpp b/indra/newview/llvlcomposition.cpp
index 999701ece1..6340189c93 100644
--- a/indra/newview/llvlcomposition.cpp
+++ b/indra/newview/llvlcomposition.cpp
@@ -287,17 +287,22 @@ BOOL LLVLComposition::generateTexture(const F32 x, const F32 y,
min_dim /= 2;
}
- mDetailTextures[i]->reloadRawImage(ddiscard) ;
+ BOOL delete_raw = (mDetailTextures[i]->reloadRawImage(ddiscard) != NULL) ;
if(mDetailTextures[i]->getRawImageLevel() != ddiscard)//raw iamge is not ready, will enter here again later.
{
- mDetailTextures[i]->destroyRawImage() ;
+ if(delete_raw)
+ {
+ mDetailTextures[i]->destroyRawImage() ;
+ }
lldebugs << "cached raw data for terrain detail texture is not ready yet: " << mDetailTextures[i]->getID() << llendl;
return FALSE;
}
mRawImages[i] = mDetailTextures[i]->getRawImage() ;
- mDetailTextures[i]->destroyRawImage() ;
-
+ if(delete_raw)
+ {
+ mDetailTextures[i]->destroyRawImage() ;
+ }
if (mDetailTextures[i]->getWidth(ddiscard) != BASE_SIZE ||
mDetailTextures[i]->getHeight(ddiscard) != BASE_SIZE ||
mDetailTextures[i]->getComponents() != 3)
diff --git a/indra/newview/skins/default/xui/en/panel_login.xml b/indra/newview/skins/default/xui/en/panel_login.xml
index cb5ec15387..a9a02e8fc7 100644
--- a/indra/newview/skins/default/xui/en/panel_login.xml
+++ b/indra/newview/skins/default/xui/en/panel_login.xml
@@ -27,6 +27,7 @@
border_visible="false"
bottom="600"
follows="all"
+ hide_loading="true"
left="0"
name="login_html"
start_url=""