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.
This commit is contained in:
Charles Krinke
2009-04-18 18:35:03 +00:00
parent 47d6dee657
commit 2578db3dfa
3 changed files with 134 additions and 58 deletions

View File

@@ -48,6 +48,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public class J2KImage
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public double m_designatedPriorityKey;
public double m_requestedPriority = 0.0d;
@@ -61,7 +62,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public AssetBase m_MissingSubstitute = null;
public bool m_decoded = false;
public bool m_completedSendAtCurrentDiscardLevel;
private sbyte m_discardLevel=-1;
private uint m_packetNumber;
private bool m_decoderequested = false;
@@ -72,7 +73,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private const int cImagePacketSize = 1000;
private const int cFirstPacketSize = 600;
private AssetBase m_asset = null;
private LLImageManager m_image;
public J2KImage(LLImageManager image)
{
m_image = image;
}
public uint m_pPacketNumber
{
@@ -103,6 +108,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void J2KDecodedCallback(UUID AssetId, OpenJPEG.J2KLayerInfo[] layers)
{
m_image.m_outstandingtextures++;
Layers = layers;
m_decoded = true;
RunUpdate();
@@ -130,8 +136,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
if (m_packetNumber == 1)
return m_asset.Data.Length;
return (m_asset.Data.Length - cFirstPacketSize) % cImagePacketSize;
}
int lastsize = (m_asset.Data.Length - cFirstPacketSize) % cImagePacketSize;
//If the last packet size is zero, it's really cImagePacketSize, it sits on the boundary
if (lastsize == 0)
{
lastsize = cImagePacketSize;
}
return lastsize;
}
public int CurrentBytePosition()
{
@@ -247,7 +260,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_sentinfo = true;
m_packetNumber++;
}
bool ignoreStop = false;
if (m_packetNumber < 2)
{
m_packetNumber = 2;
@@ -260,6 +273,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
SendMore = SendPacket(client);
m_packetNumber++;
}
if (m_packetNumber > m_stopPacket)
{
@@ -339,11 +353,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
m_discardLevel = m_requestedDiscardLevel;
}
//Calculate the m_stopPacket
if (Layers.Length > 0)
{
m_stopPacket = (uint)GetPacketForBytePosition(Layers[(Layers.Length - 1) - m_discardLevel].End);
//I don't know why, but the viewer seems to expect the final packet if the file
//is just one packet bigger.
if (TexturePacketCount() == m_stopPacket + 1)
{
m_stopPacket = TexturePacketCount();
}
}
else
{