aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs
diff options
context:
space:
mode:
authorCharles Krinke2009-04-18 18:35:03 +0000
committerCharles Krinke2009-04-18 18:35:03 +0000
commit2578db3dfad2d12519f5b1c0f5e63145475c0d07 (patch)
tree676c260058b39666a0dac750a2b1cb0e025c2b46 /OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs
parentRemove the default plywood texture from the library. Its presence can cause u... (diff)
downloadopensim-SC-2578db3dfad2d12519f5b1c0f5e63145475c0d07.zip
opensim-SC-2578db3dfad2d12519f5b1c0f5e63145475c0d07.tar.gz
opensim-SC-2578db3dfad2d12519f5b1c0f5e63145475c0d07.tar.bz2
opensim-SC-2578db3dfad2d12519f5b1c0f5e63145475c0d07.tar.xz
Thank you kindly, RemedyTomm for a patch that:
Following feedback from 0003440, i've made some changes to the new texture pipeline to optimise performance. The changes are: - Fixed a math issue where a small percentage of images with a certain size (on the packet boundary) would not have their final data delivered. This issue has been present since pre- 0003440 - It was suggested that a discardlevel of -1 and a prioriy of 0 meant to abandon the transfer, this is incorrect and caused some textures to clog. - The texture throttle blocking queue is now only filled in relation to the actual throttle amount.. i.e, on a connection throttled to 300k, only twenty packets will be placed in the queue at a time, on a larger connection it will be much more. This is to balance responsiveness to requests and speed, and to minimise wasted packets. - The engine now keeps track of the number of pending textures, and the stack will not be walked if there's no textures pending, saving CPU. Textures are only considered "pending" when they've already been decoded. - As part of the above, some textures may receive twice as much data per cycle if the number of pending textures is below the cycle threshold, this should prevent loading from slowing down when there are fewer textures in the queue.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs32
1 files changed, 26 insertions, 6 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs
index 276dfbe..a93a3e5 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/J2KImage.cs
@@ -48,6 +48,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
48 48
49 public class J2KImage 49 public class J2KImage
50 { 50 {
51
51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52 public double m_designatedPriorityKey; 53 public double m_designatedPriorityKey;
53 public double m_requestedPriority = 0.0d; 54 public double m_requestedPriority = 0.0d;
@@ -61,7 +62,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
61 public AssetBase m_MissingSubstitute = null; 62 public AssetBase m_MissingSubstitute = null;
62 public bool m_decoded = false; 63 public bool m_decoded = false;
63 public bool m_completedSendAtCurrentDiscardLevel; 64 public bool m_completedSendAtCurrentDiscardLevel;
64 65
65 private sbyte m_discardLevel=-1; 66 private sbyte m_discardLevel=-1;
66 private uint m_packetNumber; 67 private uint m_packetNumber;
67 private bool m_decoderequested = false; 68 private bool m_decoderequested = false;
@@ -72,7 +73,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
72 private const int cImagePacketSize = 1000; 73 private const int cImagePacketSize = 1000;
73 private const int cFirstPacketSize = 600; 74 private const int cFirstPacketSize = 600;
74 private AssetBase m_asset = null; 75 private AssetBase m_asset = null;
75 76 private LLImageManager m_image;
77 public J2KImage(LLImageManager image)
78 {
79 m_image = image;
80 }
76 81
77 public uint m_pPacketNumber 82 public uint m_pPacketNumber
78 { 83 {
@@ -103,6 +108,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
103 108
104 public void J2KDecodedCallback(UUID AssetId, OpenJPEG.J2KLayerInfo[] layers) 109 public void J2KDecodedCallback(UUID AssetId, OpenJPEG.J2KLayerInfo[] layers)
105 { 110 {
111 m_image.m_outstandingtextures++;
106 Layers = layers; 112 Layers = layers;
107 m_decoded = true; 113 m_decoded = true;
108 RunUpdate(); 114 RunUpdate();
@@ -130,8 +136,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
130 { 136 {
131 if (m_packetNumber == 1) 137 if (m_packetNumber == 1)
132 return m_asset.Data.Length; 138 return m_asset.Data.Length;
133 return (m_asset.Data.Length - cFirstPacketSize) % cImagePacketSize; 139 int lastsize = (m_asset.Data.Length - cFirstPacketSize) % cImagePacketSize;
134 } 140 //If the last packet size is zero, it's really cImagePacketSize, it sits on the boundary
141 if (lastsize == 0)
142 {
143 lastsize = cImagePacketSize;
144 }
145 return lastsize;
146 }
147
135 148
136 public int CurrentBytePosition() 149 public int CurrentBytePosition()
137 { 150 {
@@ -247,7 +260,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
247 m_sentinfo = true; 260 m_sentinfo = true;
248 m_packetNumber++; 261 m_packetNumber++;
249 } 262 }
250 263 bool ignoreStop = false;
251 if (m_packetNumber < 2) 264 if (m_packetNumber < 2)
252 { 265 {
253 m_packetNumber = 2; 266 m_packetNumber = 2;
@@ -260,6 +273,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
260 SendMore = SendPacket(client); 273 SendMore = SendPacket(client);
261 m_packetNumber++; 274 m_packetNumber++;
262 } 275 }
276
263 if (m_packetNumber > m_stopPacket) 277 if (m_packetNumber > m_stopPacket)
264 { 278 {
265 279
@@ -339,11 +353,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
339 { 353 {
340 m_discardLevel = m_requestedDiscardLevel; 354 m_discardLevel = m_requestedDiscardLevel;
341 } 355 }
342 356
343 //Calculate the m_stopPacket 357 //Calculate the m_stopPacket
344 if (Layers.Length > 0) 358 if (Layers.Length > 0)
345 { 359 {
346 m_stopPacket = (uint)GetPacketForBytePosition(Layers[(Layers.Length - 1) - m_discardLevel].End); 360 m_stopPacket = (uint)GetPacketForBytePosition(Layers[(Layers.Length - 1) - m_discardLevel].End);
361 //I don't know why, but the viewer seems to expect the final packet if the file
362 //is just one packet bigger.
363 if (TexturePacketCount() == m_stopPacket + 1)
364 {
365 m_stopPacket = TexturePacketCount();
366 }
347 } 367 }
348 else 368 else
349 { 369 {