diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Application/OpenSim.cs | 20 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneManager.cs | 122 |
2 files changed, 0 insertions, 142 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 10071a0..b23cdc3 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -306,10 +306,6 @@ namespace OpenSim | |||
306 | "delete-region <name>", | 306 | "delete-region <name>", |
307 | "Delete a region from disk", RunCommand); | 307 | "Delete a region from disk", RunCommand); |
308 | 308 | ||
309 | m_console.Commands.AddCommand("region", false, "predecode-j2k", | ||
310 | "predecode-j2k [<num threads>]>", | ||
311 | "Precache assets,decode j2k layerdata", RunCommand); | ||
312 | |||
313 | m_console.Commands.AddCommand("region", false, "modules list", | 309 | m_console.Commands.AddCommand("region", false, "modules list", |
314 | "modules list", | 310 | "modules list", |
315 | "List modules", HandleModules); | 311 | "List modules", HandleModules); |
@@ -744,22 +740,6 @@ namespace OpenSim | |||
744 | } | 740 | } |
745 | break; | 741 | break; |
746 | 742 | ||
747 | case "predecode-j2k": | ||
748 | if (cmdparams.Length > 0) | ||
749 | { | ||
750 | m_sceneManager.CacheJ2kDecode(Convert.ToInt32(cmdparams[0])); | ||
751 | } | ||
752 | else | ||
753 | { | ||
754 | m_sceneManager.CacheJ2kDecode(1); | ||
755 | } | ||
756 | break; | ||
757 | |||
758 | case "link-region": | ||
759 | case "unlink-region": | ||
760 | case "link-mapping": | ||
761 | HGCommands.RunHGCommand(command, cmdparams, m_sceneManager.CurrentOrFirstScene); | ||
762 | break; | ||
763 | } | 743 | } |
764 | } | 744 | } |
765 | 745 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs index 091a2d5..1843e2c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneManager.cs +++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs | |||
@@ -540,127 +540,5 @@ namespace OpenSim.Region.Framework.Scenes | |||
540 | { | 540 | { |
541 | m_localScenes.ForEach(action); | 541 | m_localScenes.ForEach(action); |
542 | } | 542 | } |
543 | |||
544 | public void CacheJ2kDecode(int threads) | ||
545 | { | ||
546 | if (threads < 1) threads = 1; | ||
547 | |||
548 | IJ2KDecoder m_decoder = m_localScenes[0].RequestModuleInterface<IJ2KDecoder>(); | ||
549 | |||
550 | List<UUID> assetRequestList = new List<UUID>(); | ||
551 | |||
552 | #region AssetGathering! | ||
553 | foreach (Scene scene in m_localScenes) | ||
554 | { | ||
555 | List<EntityBase> entitles = scene.GetEntities(); | ||
556 | foreach (EntityBase entity in entitles) | ||
557 | { | ||
558 | if (entity is SceneObjectGroup) | ||
559 | { | ||
560 | SceneObjectGroup sog = (SceneObjectGroup) entity; | ||
561 | foreach (SceneObjectPart part in sog.Children.Values) | ||
562 | { | ||
563 | if (part.Shape != null) | ||
564 | { | ||
565 | if (part.Shape.TextureEntry.Length > 0) | ||
566 | { | ||
567 | OpenMetaverse.Primitive.TextureEntry te = | ||
568 | new Primitive.TextureEntry(part.Shape.TextureEntry, 0, | ||
569 | part.Shape.TextureEntry.Length); | ||
570 | if (te.DefaultTexture != null) // this has been null for some reason... | ||
571 | { | ||
572 | if (te.DefaultTexture.TextureID != UUID.Zero) | ||
573 | assetRequestList.Add(te.DefaultTexture.TextureID); | ||
574 | } | ||
575 | for (int i=0; i<te.FaceTextures.Length; i++) | ||
576 | { | ||
577 | if (te.FaceTextures[i] != null) | ||
578 | { | ||
579 | if (te.FaceTextures[i].TextureID != UUID.Zero) | ||
580 | { | ||
581 | assetRequestList.Add(te.FaceTextures[i].TextureID); | ||
582 | } | ||
583 | } | ||
584 | } | ||
585 | } | ||
586 | if (part.Shape.SculptTexture != UUID.Zero) | ||
587 | { | ||
588 | assetRequestList.Add(part.Shape.SculptTexture); | ||
589 | } | ||
590 | |||
591 | } | ||
592 | } | ||
593 | } | ||
594 | } | ||
595 | } | ||
596 | #endregion | ||
597 | |||
598 | int entries_per_thread = (assetRequestList.Count / threads) + 1; | ||
599 | |||
600 | UUID[] arrAssetRequestList = assetRequestList.ToArray(); | ||
601 | |||
602 | List<UUID[]> arrvalus = new List<UUID[]>(); | ||
603 | |||
604 | //split into separate arrays | ||
605 | for (int j = 0; j < threads; j++) | ||
606 | { | ||
607 | List<UUID> val = new List<UUID>(); | ||
608 | |||
609 | for (int k = j * entries_per_thread; k < ((j + 1) * entries_per_thread); k++) | ||
610 | { | ||
611 | if (k < arrAssetRequestList.Length) | ||
612 | { | ||
613 | val.Add(arrAssetRequestList[k]); | ||
614 | } | ||
615 | |||
616 | } | ||
617 | arrvalus.Add(val.ToArray()); | ||
618 | } | ||
619 | |||
620 | for (int l = 0; l < arrvalus.Count; l++) | ||
621 | { | ||
622 | DecodeThreadContents threadworkItem = new DecodeThreadContents(); | ||
623 | threadworkItem.sn = m_localScenes[0]; | ||
624 | threadworkItem.j2kdecode = m_decoder; | ||
625 | threadworkItem.arrassets = arrvalus[l]; | ||
626 | |||
627 | System.Threading.Thread decodethread = | ||
628 | new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(threadworkItem.run)); | ||
629 | |||
630 | threadworkItem.SetThread(decodethread); | ||
631 | |||
632 | decodethread.Priority = System.Threading.ThreadPriority.Lowest; | ||
633 | decodethread.Name = "J2kCacheDecodeThread_" + l + 1; | ||
634 | ThreadTracker.Add(decodethread); | ||
635 | decodethread.Start(); | ||
636 | |||
637 | } | ||
638 | } | ||
639 | } | ||
640 | |||
641 | public class DecodeThreadContents | ||
642 | { | ||
643 | public Scene sn; | ||
644 | public UUID[] arrassets; | ||
645 | public IJ2KDecoder j2kdecode; | ||
646 | private System.Threading.Thread thisthread; | ||
647 | |||
648 | public void run(object o) | ||
649 | { | ||
650 | for (int i=0;i<arrassets.Length;i++) | ||
651 | { | ||
652 | AssetBase ab = sn.AssetService.Get(arrassets[i].ToString()); | ||
653 | if (ab != null && ab.Data != null) | ||
654 | { | ||
655 | j2kdecode.Decode(arrassets[i], ab.Data); | ||
656 | } | ||
657 | } | ||
658 | ThreadTracker.Remove(thisthread); | ||
659 | } | ||
660 | |||
661 | public void SetThread(System.Threading.Thread thr) | ||
662 | { | ||
663 | thisthread = thr; | ||
664 | } | ||
665 | } | 543 | } |
666 | } | 544 | } |