From 3a64522267352d1c68ef99ac76c65bd3c4f9eaf1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 4 Jan 2012 21:40:15 +0000 Subject: Minor formatting changes and commented out log lines for future debugging of image manager (udp texture fetch). No significant functional changes. --- OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs index 7dd9087..14dee84 100644 --- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs +++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs @@ -103,6 +103,10 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender // If it's cached, return the cached results if (m_decodedCache.TryGetValue(assetID, out result)) { +// m_log.DebugFormat( +// "[J2KDecoderModule]: Returning existing cached {0} layers j2k decode for {1}", +// result.Length, assetID); + callback(assetID, result); } else -- cgit v1.1 From 0634c3850563fc38a4026f70a7bfd64a05198fa3 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 4 Jan 2012 22:22:46 +0000 Subject: Separate out rebake request code from cache validation code AvatarFactoryModule. This allows some logic simplification and allows an external caller to manually request rebakes even if textures are uploaded (future command). --- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 72 ++++++++++++---------- 1 file changed, 41 insertions(+), 31 deletions(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index e8aee3e..d64a0c1 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -156,7 +156,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory changed = sp.Appearance.SetTextureEntries(textureEntry) || changed; // WriteBakedTexturesReport(sp, m_log.DebugFormat); - ValidateBakedTextureCache(sp, false); + if (!ValidateBakedTextureCache(sp)) + RequestRebake(sp, true); // This appears to be set only in the final stage of the appearance // update transaction. In theory, we should be able to do an immediate @@ -251,15 +252,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory } /// - /// Check for the existence of the baked texture assets. - /// - /// - public bool ValidateBakedTextureCache(IScenePresence sp) - { - return ValidateBakedTextureCache(sp, true); - } - - /// /// Queue up a request to send appearance. /// /// @@ -292,17 +284,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory } } - #endregion - - #region AvatarFactoryModule private methods - - /// - /// Check for the existence of the baked texture assets. Request a rebake - /// unless checkonly is true. - /// - /// - /// - private bool ValidateBakedTextureCache(IScenePresence sp, bool checkonly) + public bool ValidateBakedTextureCache(IScenePresence sp) { bool defonly = true; // are we only using default textures @@ -330,16 +312,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory defonly = false; // found a non-default texture reference if (m_scene.AssetService.Get(face.TextureID.ToString()) == null) - { - if (checkonly) - return false; - - m_log.DebugFormat( - "[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.", - face.TextureID, idx, sp.Name); - - sp.ControllingClient.SendRebakeAvatarTextures(face.TextureID); - } + return false; } m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0}", sp.UUID); @@ -348,6 +321,43 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory return (defonly ? false : true); } + public void RequestRebake(IScenePresence sp, bool missingTexturesOnly) + { + for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++) + { + int idx = AvatarAppearance.BAKE_INDICES[i]; + Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx]; + + // if there is no texture entry, skip it + if (face == null) + continue; + +// m_log.DebugFormat( +// "[AVFACTORY]: Looking for texture {0}, id {1} for {2} {3}", +// face.TextureID, idx, client.Name, client.AgentId); + + // if the texture is one of the "defaults" then skip it + // this should probably be more intelligent (skirt texture doesnt matter + // if the avatar isnt wearing a skirt) but if any of the main baked + // textures is default then the rest should be as well + if (face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE) + continue; + + if (missingTexturesOnly && m_scene.AssetService.Get(face.TextureID.ToString()) != null) + continue; + else + m_log.DebugFormat( + "[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.", + face.TextureID, idx, sp.Name); + + sp.ControllingClient.SendRebakeAvatarTextures(face.TextureID); + } + } + + #endregion + + #region AvatarFactoryModule private methods + private Dictionary GetBakedTextureFaces(ScenePresence sp) { if (sp.IsChildAgent) -- cgit v1.1 From 8fb70a2058e98dea63e7ee7c5b55532668fccd38 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 4 Jan 2012 22:45:07 +0000 Subject: Add "appearance rebake" command to ask a specific viewer to rebake textures from the server end. This is not as useful as it sounds, since you can only request rebakes for texture IDs already received. In other words, if the viewer has never sent the server this information (which happens quite often) then it will have no effect. Nonetheless, this is useful for diagnostic/debugging purposes. --- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index d64a0c1..9df0592 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -343,12 +343,21 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory if (face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE) continue; - if (missingTexturesOnly && m_scene.AssetService.Get(face.TextureID.ToString()) != null) - continue; + if (missingTexturesOnly) + { + if (m_scene.AssetService.Get(face.TextureID.ToString()) != null) + continue; + else + m_log.DebugFormat( + "[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.", + face.TextureID, idx, sp.Name); + } else + { m_log.DebugFormat( - "[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.", + "[AVFACTORY]: Requesting rebake of {0} ({1}) for {2}.", face.TextureID, idx, sp.Name); + } sp.ControllingClient.SendRebakeAvatarTextures(face.TextureID); } -- cgit v1.1 From c201b54b8524033310c59fe353616e84616a542e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 5 Jan 2012 19:40:54 +0000 Subject: Improve "app rebake" command to return a better message if no uploaded texture ids were available for the rebake request --- .../Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 9df0592..d68d28c 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -321,8 +321,10 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory return (defonly ? false : true); } - public void RequestRebake(IScenePresence sp, bool missingTexturesOnly) + public int RequestRebake(IScenePresence sp, bool missingTexturesOnly) { + int texturesRebaked = 0; + for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++) { int idx = AvatarAppearance.BAKE_INDICES[i]; @@ -359,8 +361,11 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory face.TextureID, idx, sp.Name); } + texturesRebaked++; sp.ControllingClient.SendRebakeAvatarTextures(face.TextureID); } + + return texturesRebaked; } #endregion -- cgit v1.1 From 5ea9740f1b2cc98601cfb15c19e190471c4c42ed Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 5 Jan 2012 22:40:49 +0000 Subject: Add a "j2k decode" region console command that allows a manual request for a JPEG2000 decode of an asset For debugging purposes. --- .../Agent/TextureSender/J2KDecoderModule.cs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs index 14dee84..349d3ac 100644 --- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs +++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs @@ -137,14 +137,9 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender } } - /// - /// Provides a synchronous decode so that caller can be assured that this executes before the next line - /// - /// - /// - public void Decode(UUID assetID, byte[] j2kData) + public bool Decode(UUID assetID, byte[] j2kData) { - DoJ2KDecode(assetID, j2kData); + return DoJ2KDecode(assetID, j2kData); } #endregion IJ2KDecoder @@ -154,11 +149,13 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender /// /// UUID of Asset /// JPEG2000 data - private void DoJ2KDecode(UUID assetID, byte[] j2kData) + private bool DoJ2KDecode(UUID assetID, byte[] j2kData) { // m_log.DebugFormat( // "[J2KDecoderModule]: Doing J2K decoding of {0} bytes for asset {1}", j2kData.Length, assetID); + bool decodedSuccessfully = true; + //int DecodeTime = 0; //DecodeTime = Environment.TickCount; OpenJPEG.J2KLayerInfo[] layers; @@ -196,6 +193,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender catch (Exception ex) { m_log.Warn("[J2KDecoderModule]: CSJ2K threw an exception decoding texture " + assetID + ": " + ex.Message); + decodedSuccessfully = false; } } else @@ -204,6 +202,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender if (!OpenJPEG.DecodeLayerBoundaries(j2kData, out layers, out components)) { m_log.Warn("[J2KDecoderModule]: OpenJPEG failed to decode texture " + assetID); + decodedSuccessfully = false; } } @@ -212,6 +211,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender m_log.Warn("[J2KDecoderModule]: Failed to decode layer data for texture " + assetID + ", guessing sane defaults"); // Layer decoding completely failed. Guess at sane defaults for the layer boundaries layers = CreateDefaultLayers(j2kData.Length); + decodedSuccessfully = false; } // Cache Decoded layers @@ -231,6 +231,8 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender m_notifyList.Remove(assetID); } } + + return decodedSuccessfully; } private OpenJPEG.J2KLayerInfo[] CreateDefaultLayers(int j2kLength) -- cgit v1.1