Merge branch 'master' of ssh://opensimulator.org/var/git/opensim

cpu-performance
Diva Canto 2013-06-11 15:36:52 -07:00
commit a0fed03e10
13 changed files with 153 additions and 74 deletions

View File

@ -592,3 +592,11 @@ ALTER TABLE prims ADD COLUMN `Friction` double NOT NULL default '0.6';
ALTER TABLE prims ADD COLUMN `Restitution` double NOT NULL default '0.5';
COMMIT;
:VERSION 29 #---------------- Keyframes
BEGIN;
ALTER TABLE prims ADD COLUMN `KeyframeMotion` blob;
COMMIT;

View File

@ -732,6 +732,8 @@ namespace OpenSim.Data.SQLite
}
SceneObjectGroup group = new SceneObjectGroup(prim);
if (prim.KeyframeMotion != null)
prim.KeyframeMotion.UpdateSceneObject(group);
createdObjects.Add(group.UUID, group);
retvals.Add(group);
LoadItems(prim);
@ -1241,6 +1243,7 @@ namespace OpenSim.Data.SQLite
createCol(prims, "Friction", typeof(Double));
createCol(prims, "Restitution", typeof(Double));
createCol(prims, "KeyframeMotion", typeof(Byte[]));
// Add in contraints
prims.PrimaryKey = new DataColumn[] { prims.Columns["UUID"] };
@ -1736,6 +1739,20 @@ namespace OpenSim.Data.SQLite
prim.Friction = Convert.ToSingle(row["Friction"]);
prim.Restitution = Convert.ToSingle(row["Restitution"]);
if (!(row["KeyframeMotion"] is DBNull))
{
Byte[] data = (byte[])row["KeyframeMotion"];
if (data.Length > 0)
prim.KeyframeMotion = KeyframeMotion.FromData(null, data);
else
prim.KeyframeMotion = null;
}
else
{
prim.KeyframeMotion = null;
}
return prim;
}
@ -2168,6 +2185,13 @@ namespace OpenSim.Data.SQLite
row["GravityModifier"] = (double)prim.GravityModifier;
row["Friction"] = (double)prim.Friction;
row["Restitution"] = (double)prim.Restitution;
if (prim.KeyframeMotion != null)
row["KeyframeMotion"] = prim.KeyframeMotion.Serialize();
else
row["KeyframeMotion"] = new Byte[0];
}
/// <summary>

View File

@ -1805,6 +1805,7 @@ namespace OpenSim.Framework.Servers.HttpServer
// Long Poll Service Manager with 3 worker threads a 25 second timeout for no events
m_PollServiceManager = new PollServiceRequestManager(this, 3, 25000);
m_PollServiceManager.Start();
HTTPDRunning = true;
//HttpListenerContext context;
@ -1855,7 +1856,7 @@ namespace OpenSim.Framework.Servers.HttpServer
HTTPDRunning = false;
try
{
// m_PollServiceManager.Stop();
m_PollServiceManager.Stop();
m_httpListener2.ExceptionThrown -= httpServerException;
//m_httpListener2.DisconnectHandler = null;

View File

@ -66,14 +66,17 @@ namespace OpenSim.Framework.Servers.HttpServer
m_server = pSrv;
m_WorkerThreadCount = pWorkerThreadCount;
m_workerThreads = new Thread[m_WorkerThreadCount];
}
public void Start()
{
//startup worker threads
for (uint i = 0; i < m_WorkerThreadCount; i++)
{
m_workerThreads[i]
= Watchdog.StartThread(
PoolWorkerJob,
String.Format("PollServiceWorkerThread{0}", i),
string.Format("PollServiceWorkerThread{0}:{1}", i, m_server.Port),
ThreadPriority.Normal,
false,
false,
@ -83,7 +86,7 @@ namespace OpenSim.Framework.Servers.HttpServer
m_retrysThread = Watchdog.StartThread(
this.CheckRetries,
"PollServiceWatcherThread",
string.Format("PollServiceWatcherThread:{0}", m_server.Port),
ThreadPriority.Normal,
false,
true,
@ -91,7 +94,6 @@ namespace OpenSim.Framework.Servers.HttpServer
1000 * 60 * 10);
}
private void ReQueueEvent(PollServiceHttpRequest req)
{
if (m_running)
@ -142,14 +144,14 @@ namespace OpenSim.Framework.Servers.HttpServer
}
}
~PollServiceRequestManager()
public void Stop()
{
m_running = false;
// m_timeout = -10000; // cause all to expire
Thread.Sleep(1000); // let the world move
foreach (Thread t in m_workerThreads)
Watchdog.AbortThread(t.ManagedThreadId);
Watchdog.AbortThread(t.ManagedThreadId);
try
{

View File

@ -260,7 +260,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
return UUID.Zero;
}
remoteClient.SendAgentAlertMessage("Notecard saved", false);
remoteClient.SendAlertMessage("Notecard saved");
}
else if ((InventoryType)item.InvType == InventoryType.LSL)
{
@ -270,7 +270,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
return UUID.Zero;
}
remoteClient.SendAgentAlertMessage("Script saved", false);
remoteClient.SendAlertMessage("Script saved");
}
AssetBase asset =

View File

@ -93,7 +93,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.Tests
LocalAssetServicesConnector lasc = new LocalAssetServicesConnector();
lasc.Initialise(config);
// If it is local, it should not be stored
AssetBase a1 = AssetHelpers.CreateNotecardAsset();
a1.Local = true;
a1.Temporary = true;
lasc.Store(a1);
@ -102,6 +104,24 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.Tests
Assert.That(lasc.GetData(a1.ID), Is.Null);
Assert.That(lasc.GetMetadata(a1.ID), Is.Null);
// If it is remote, it should be stored
// AssetBase a2 = AssetHelpers.CreateNotecardAsset();
// a2.Local = false;
// a2.Temporary = true;
// lasc.Store(a2);
// AssetBase retreivedA2 = lasc.Get(a2.ID);
// Assert.That(retreivedA2.ID, Is.EqualTo(a2.ID));
// Assert.That(retreivedA2.Metadata.ID, Is.EqualTo(a2.Metadata.ID));
// Assert.That(retreivedA2.Data.Length, Is.EqualTo(a2.Data.Length));
// AssetMetadata retrievedA2Metadata = lasc.GetMetadata(a2.ID);
// Assert.That(retrievedA2Metadata.ID, Is.EqualTo(a2.ID));
// byte[] retrievedA2Data = lasc.GetData(a2.ID);
// Assert.That(retrievedA2Data.Length, Is.EqualTo(a2.Data.Length));
// TODO: Add cache and check that this does receive a copy of the asset
}

View File

@ -779,7 +779,8 @@ namespace OpenSim.Region.Framework.Scenes
}
// Tell the physics engines that this prim changed.
ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
if (ParentGroup != null && ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene != null)
ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
}
catch (Exception e)
{
@ -892,7 +893,7 @@ namespace OpenSim.Region.Framework.Scenes
//m_log.Info("[PART]: RO2:" + actor.Orientation.ToString());
}
if (ParentGroup != null)
if (ParentGroup != null && ParentGroup.Scene != null && ParentGroup.Scene.PhysicsScene != null)
ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
//}
}

View File

@ -148,7 +148,7 @@ public abstract class BSPhysObject : PhysicsActor
// The asset state is first 'Unknown' then 'Waiting' then either 'Failed' or 'Fetched'.
public enum PrimAssetCondition
{
Unknown, Waiting, Failed, Fetched
Unknown, Waiting, FailedAssetFetch, FailedMeshing, Fetched
}
public PrimAssetCondition PrimAssetState { get; set; }

View File

@ -249,7 +249,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
TerrainManager.CreateInitialGroundPlaneAndTerrain();
// Put some informational messages into the log file.
m_log.WarnFormat("{0} Linksets implemented with {1}", LogHeader, (BSLinkset.LinksetImplementation)BSParam.LinksetImplementation);
m_log.InfoFormat("{0} Linksets implemented with {1}", LogHeader, (BSLinkset.LinksetImplementation)BSParam.LinksetImplementation);
InTaintTime = false;
m_initialized = true;
@ -374,7 +374,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
}
else
{
m_log.WarnFormat("{0} Selected bullet engine {1} -> {2}/{3}", LogHeader, engineName, ret.BulletEngineName, ret.BulletEngineVersion);
m_log.InfoFormat("{0} Selected bullet engine {1} -> {2}/{3}", LogHeader, engineName, ret.BulletEngineName, ret.BulletEngineVersion);
}
return ret;

View File

@ -167,7 +167,7 @@ public abstract class BSShape
// Prevent trying to keep fetching the mesh by declaring failure.
if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.Fetched)
{
prim.PrimAssetState = BSPhysObject.PrimAssetCondition.Failed;
prim.PrimAssetState = BSPhysObject.PrimAssetCondition.FailedMeshing;
physicsScene.Logger.WarnFormat("{0} Fetched asset would not mesh. {1}, texture={2}",
LogHeader, prim.PhysObjectName, prim.BaseShape.SculptTexture);
physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,setFailed,objNam={1},tex={2}",
@ -177,7 +177,8 @@ public abstract class BSShape
{
// If this mesh has an underlying asset and we have not failed getting it before, fetch the asset
if (prim.BaseShape.SculptEntry
&& prim.PrimAssetState != BSPhysObject.PrimAssetCondition.Failed
&& prim.PrimAssetState != BSPhysObject.PrimAssetCondition.FailedAssetFetch
&& prim.PrimAssetState != BSPhysObject.PrimAssetCondition.FailedMeshing
&& prim.PrimAssetState != BSPhysObject.PrimAssetCondition.Waiting
&& prim.BaseShape.SculptTexture != OMV.UUID.Zero
)
@ -219,7 +220,7 @@ public abstract class BSShape
}
if (!assetFound)
{
yprim.PrimAssetState = BSPhysObject.PrimAssetCondition.Failed;
yprim.PrimAssetState = BSPhysObject.PrimAssetCondition.FailedAssetFetch;
}
physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,fetchAssetCallback,found={1},isSculpt={2},ids={3}",
yprim.LocalID, assetFound, yprim.BaseShape.SculptEntry, mismatchIDs );
@ -227,7 +228,7 @@ public abstract class BSShape
}
else
{
xprim.PrimAssetState = BSPhysObject.PrimAssetCondition.Failed;
xprim.PrimAssetState = BSPhysObject.PrimAssetCondition.FailedAssetFetch;
physicsScene.Logger.ErrorFormat("{0} Physical object requires asset but no asset provider. Name={1}",
LogHeader, physicsScene.Name);
}
@ -235,13 +236,20 @@ public abstract class BSShape
}
else
{
if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.Failed)
if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedAssetFetch)
{
physicsScene.Logger.WarnFormat("{0} Mesh failed to fetch asset. obj={1}, texture={2}",
LogHeader, prim.PhysObjectName, prim.BaseShape.SculptTexture);
physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,wasFailed,objNam={1},tex={2}",
prim.LocalID, prim.PhysObjectName, prim.BaseShape.SculptTexture);
}
if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedMeshing)
{
physicsScene.Logger.WarnFormat("{0} Mesh asset would not mesh. obj={1}, texture={2}",
LogHeader, prim.PhysObjectName, prim.BaseShape.SculptTexture);
physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,wasFailedMeshing,objNam={1},tex={2}",
prim.LocalID, prim.PhysObjectName, prim.BaseShape.SculptTexture);
}
}
}
@ -374,7 +382,9 @@ public class BSShapeMesh : BSShape
// Check to see if mesh was created (might require an asset).
newShape = VerifyMeshCreated(physicsScene, newShape, prim);
if (!newShape.isNativeShape || prim.PrimAssetState == BSPhysObject.PrimAssetCondition.Failed)
if (!newShape.isNativeShape
|| prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedMeshing
|| prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedAssetFetch)
{
// If a mesh was what was created, remember the built shape for later sharing.
// Also note that if meshing failed we put it in the mesh list as there is nothing else to do about the mesh.
@ -517,7 +527,7 @@ public class BSShapeMesh : BSShape
else
{
// Force the asset condition to 'failed' so we won't try to keep fetching and processing this mesh.
prim.PrimAssetState = BSPhysObject.PrimAssetCondition.Failed;
prim.PrimAssetState = BSPhysObject.PrimAssetCondition.FailedMeshing;
physicsScene.Logger.DebugFormat("{0} All mesh triangles degenerate. Prim {1} at {2} in {3}",
LogHeader, prim.PhysObjectName, prim.RawPosition, physicsScene.Name);
physicsScene.DetailLog("{0},BSShapeMesh.CreatePhysicalMesh,allDegenerate,key={1}", prim.LocalID, newMeshKey);
@ -559,7 +569,9 @@ public class BSShapeHull : BSShape
// Check to see if hull was created (might require an asset).
newShape = VerifyMeshCreated(physicsScene, newShape, prim);
if (!newShape.isNativeShape || prim.PrimAssetState == BSPhysObject.PrimAssetCondition.Failed)
if (!newShape.isNativeShape
|| prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedMeshing
|| prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedAssetFetch)
{
// If a mesh was what was created, remember the built shape for later sharing.
Hulls.Add(newHullKey, retHull);
@ -1079,10 +1091,13 @@ public class BSShapeGImpact : BSShape
// Check to see if mesh was created (might require an asset).
newShape = VerifyMeshCreated(physicsScene, newShape, prim);
newShape.shapeKey = newMeshKey;
if (!newShape.isNativeShape || prim.PrimAssetState == BSPhysObject.PrimAssetCondition.Failed)
if (!newShape.isNativeShape
|| prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedMeshing
|| prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedAssetFetch)
{
// If a mesh was what was created, remember the built shape for later sharing.
// Also note that if meshing failed we put it in the mesh list as there is nothing else to do about the mesh.
// Also note that if meshing failed we put it in the mesh list as there is nothing
// else to do about the mesh.
GImpacts.Add(newMeshKey, retGImpact);
}

View File

@ -2,11 +2,6 @@ CURRENT PROBLEMS TO FIX AND/OR LOOK AT
=================================================
Script changing rotation of child prim while vehicle moving (eg turning wheel) causes
the wheel to appear to jump back. Looks like sending position from previous update.
Vehicle ride, get up, ride again. Second time vehicle does not act correctly.
Have to rez new vehicle and delete the old to fix situation.
Hitting RESET on Nebadon's vehicle while riding causes vehicle to get into odd
position state where it will not settle onto ground properly, etc
Two of Nebadon vehicles in a sim max the CPU. This is new.
Enable vehicle border crossings (at least as poorly as ODE)
Terrain skirts
Avatar created in previous region and not new region when crossing border
@ -23,24 +18,17 @@ vehicle angular banking
Center-of-gravity
Vehicle angular deflection
Preferred orientation angular correction fix
when should angular and linear motor targets be zeroed? when selected?
Need a vehicle.clear()? Or an 'else' in prestep if not physical.
Teravus llMoveToTarget script debug
Mixing of hover, buoyancy/gravity, moveToTarget, into one force
Setting hover height to zero disables hover even if hover flags are on (from SL wiki)
limitMotorUp calibration (more down?)
llRotLookAt
llLookAt
Avatars walking up stairs (HALF DONE)
Avatar movement
flying into a wall doesn't stop avatar who keeps appearing to move through the obstacle (DONE)
walking up stairs is not calibrated correctly (stairs out of Kepler cabin) (DONE)
avatar capsule rotation completed (NOT DONE - Bullet's capsule shape is not the solution)
Convert to avatar mesh capsule. Include rotation of capsule.
Vehicle script tuning/debugging
Avanti speed script
Weapon shooter script
Move material definitions (friction, ...) into simulator.
Add material densities to the material types.
One sided meshes? Should terrain be built into a closed shape?
When meshes get partially wedged into the terrain, they cannot push themselves out.
It is possible that Bullet processes collisions whether entering or leaving a mesh.
@ -53,12 +41,8 @@ LINEAR_MOTOR_DIRECTION values should be clamped to reasonable numbers.
Same for other velocity settings.
UBit improvements to remove rubber-banding of avatars sitting on vehicle child prims:
https://github.com/UbitUmarov/Ubit-opensim
Border crossing with linked vehicle causes crash
20121129.1411: editting/moving phys object across region boundries causes crash
getPos-> btRigidBody::upcast -> getBodyType -> BOOM
Vehicles (Move smoothly)
Some vehicles should not be able to turn if no speed or off ground.
What to do if vehicle and prim buoyancy differ?
Cannot edit/move a vehicle being ridden: it jumps back to the origional position.
Neb car jiggling left and right
Happens on terrain and any other mesh object. Flat cubes are much smoother.
@ -68,8 +52,6 @@ For limitMotorUp, use raycast down to find if vehicle is in the air.
Verify llGetVel() is returning a smooth and good value for vehicle movement.
llGetVel() should return the root's velocity if requested in a child prim.
Implement function efficiency for lineaar and angular motion.
After getting off a vehicle, the root prim is phantom (can be walked through)
Need to force a position update for the root prim after compound shape destruction
Linkset explosion after three "rides" on Nebadon lite vehicle (LinksetConstraint)
Remove vehicle angular velocity zeroing in BSPrim.UpdateProperties().
A kludge that isn't fixing the real problem of Bullet adding extra motion.
@ -78,11 +60,10 @@ Incorporate inter-relationship of angular corrections. For instance, angularDefl
creates over-correction and over-shoot and wabbling.
Vehicle attributes are not restored when a vehicle is rezzed on region creation
Create vehicle, setup vehicle properties, restart region, vehicle is not reinitialized.
What to do if vehicle and prim buoyancy differ?
GENERAL TODO LIST:
=================================================
Explore btGImpactMeshShape as alternative to convex hulls for simplified physical objects.
Regular triangle meshes don't do physical collisions.
Resitution of a prim works on another prim but not on terrain.
The dropped prim doesn't bounce properly on the terrain.
Add a sanity check for PIDTarget location.
@ -359,4 +340,25 @@ Lock axis (DONE 20130401)
Terrain detail: double terrain mesh detail (DONE)
Use the HACD convex hull routine in Bullet rather than the C# version.
Speed up hullifying large meshes. (DONE)
Vehicle ride, get up, ride again. Second time vehicle does not act correctly.
Have to rez new vehicle and delete the old to fix situation.
(DONE 20130520: normalize rotations)
Hitting RESET on Nebadon's vehicle while riding causes vehicle to get into odd
position state where it will not settle onto ground properly, etc
(DONE 20130520: normalize rotations)
Two of Nebadon vehicles in a sim max the CPU. This is new.
(DONE 20130520: two problems: if asset failed to mesh, constantly refetched
asset; vehicle was sending too many messages to all linkset members)
Add material densities to the material types. (WILL NOT BE DONE: not how it is done)
Avatars walking up stairs (DONE)
Avatar movement
flying into a wall doesn't stop avatar who keeps appearing to move through the obstacle (DONE)
walking up stairs is not calibrated correctly (stairs out of Kepler cabin) (DONE)
avatar capsule rotation completed (NOT DONE - Bullet's capsule shape is not the solution)
After getting off a vehicle, the root prim is phantom (can be walked through)
Need to force a position update for the root prim after compound shape destruction
(DONE)
Explore btGImpactMeshShape as alternative to convex hulls for simplified physical objects.
Regular triangle meshes don't do physical collisions.
(DONE: discovered GImpact is VERY CPU intensive)

View File

@ -4665,35 +4665,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Vector llRot2Axis(LSL_Rotation rot)
{
m_host.AddScriptLPS(1);
double x,y,z;
double x, y, z;
if (rot.s > 1) // normalization needed
{
double length = Math.Sqrt(rot.x * rot.x + rot.y * rot.y +
rot.z * rot.z + rot.s * rot.s);
if (Math.Abs(rot.s) > 1) // normalization needed
rot.Normalize();
rot.x /= length;
rot.y /= length;
rot.z /= length;
rot.s /= length;
}
// double angle = 2 * Math.Acos(rot.s);
double s = Math.Sqrt(1 - rot.s * rot.s);
if (s < 0.001)
{
x = 1;
y = z = 0;
return new LSL_Vector(1, 0, 0);
}
else
{
x = rot.x / s; // normalise axis
y = rot.y / s;
z = rot.z / s;
double invS = 1.0 / s;
if (rot.s < 0) invS = -invS;
return new LSL_Vector(rot.x * invS, rot.y * invS, rot.z * invS);
}
return new LSL_Vector(x,y,z);
}
@ -4702,18 +4689,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
m_host.AddScriptLPS(1);
if (rot.s > 1) // normalization needed
{
double length = Math.Sqrt(rot.x * rot.x + rot.y * rot.y +
rot.z * rot.z + rot.s * rot.s);
rot.x /= length;
rot.y /= length;
rot.z /= length;
rot.s /= length;
}
if (Math.Abs(rot.s) > 1) // normalization needed
rot.Normalize();
double angle = 2 * Math.Acos(rot.s);
if (angle > Math.PI)
angle = 2 * Math.PI - angle;
return angle;
}

View File

@ -371,6 +371,31 @@ namespace OpenSim.Region.ScriptEngine.Shared
#endregion
#region Methods
public Quaternion Normalize()
{
double length = Math.Sqrt(x * x + y * y + z * z + s * s);
if (length < float.Epsilon)
{
x = 0;
y = 0;
z = 0;
s = 1;
}
else
{
double invLength = 1.0 / length;
x *= invLength;
y *= invLength;
z *= invLength;
s *= invLength;
}
return this;
}
#endregion
#region Overriders
public override int GetHashCode()