Changed DiscardQueue to templated class
[platform/core/uifw/dali-core.git] / dali / internal / common / core-impl.cpp
index c37dd21..44f193b 100644 (file)
@@ -27,6 +27,7 @@
 #include <dali/integration-api/platform-abstraction.h>
 #include <dali/integration-api/processor-interface.h>
 #include <dali/integration-api/render-controller.h>
+#include <dali/integration-api/trace.h>
 
 #include <dali/internal/event/actors/actor-impl.h>
 #include <dali/internal/event/animation/animation-playlist.h>
@@ -49,7 +50,6 @@
 #include <dali/internal/render/common/performance-monitor.h>
 #include <dali/internal/render/common/render-manager.h>
 
-using Dali::Internal::SceneGraph::DiscardQueue;
 using Dali::Internal::SceneGraph::RenderManager;
 using Dali::Internal::SceneGraph::RenderQueue;
 using Dali::Internal::SceneGraph::UpdateManager;
@@ -59,6 +59,8 @@ namespace
 // The Update for frame N+1 may be processed whilst frame N is being rendered.
 const uint32_t MAXIMUM_UPDATE_COUNT = 2u;
 
+DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_PERFORMANCE_MARKER, false);
+
 #if defined(DEBUG_ENABLED)
 Debug::Filter* gCoreFilter = Debug::Filter::New(Debug::Concise, false, "LOG_CORE");
 #endif
@@ -109,12 +111,9 @@ Core::Core(RenderController&                   renderController,
 
   RenderQueue& renderQueue = mRenderManager->GetRenderQueue();
 
-  mDiscardQueue = new DiscardQueue(renderQueue);
-
   mUpdateManager = new UpdateManager(*mNotificationManager,
                                      *mAnimationPlaylist,
                                      *mPropertyNotificationManager,
-                                     *mDiscardQueue,
                                      renderController,
                                      *mRenderManager,
                                      renderQueue,
@@ -135,6 +134,10 @@ Core::Core(RenderController&                   renderController,
   mUpdateManager->SetShaderSaver(*mShaderFactory);
 
   GetImplementation(Dali::TypeRegistry::Get()).CallInitFunctions();
+
+  DALI_LOG_RELEASE_INFO("Node size: %lu\n", sizeof(Dali::Internal::SceneGraph::Node));
+  DALI_LOG_RELEASE_INFO("Renderer size: %lu\n", sizeof(Dali::Internal::SceneGraph::Renderer));
+  DALI_LOG_RELEASE_INFO("RenderItem size: %lu\n", sizeof(Dali::Internal::SceneGraph::RenderItem));
 }
 
 Core::~Core()
@@ -231,6 +234,7 @@ void Core::RenderScene(RenderStatus& status, Integration::Scene& scene, bool ren
 
 void Core::PostRender()
 {
+  mUpdateManager->PostRender();
   mRenderManager->PostRender();
 }
 
@@ -365,29 +369,34 @@ void Core::UnregisterProcessor(Integration::Processor& processor, bool postProce
 
 void Core::RunProcessors()
 {
-  // Copy processor pointers to prevent changes to vector affecting loop iterator.
-  Dali::Vector<Integration::Processor*> processors(mProcessors);
+  if(mProcessors.Count() != 0)
+  {
+    DALI_TRACE_SCOPE(gTraceFilter, "DALI_CORE_RUN_PROCESSORS");
 
-  // To prevent accessing processor unregistered during the loop
-  mProcessorUnregistered = false;
+    // Copy processor pointers to prevent changes to vector affecting loop iterator.
+    Dali::Vector<Integration::Processor*> processors(mProcessors);
 
-  for(auto processor : processors)
-  {
-    if(processor)
+    // To prevent accessing processor unregistered during the loop
+    mProcessorUnregistered = false;
+
+    for(auto processor : processors)
     {
-      if(!mProcessorUnregistered)
-      {
-        processor->Process(false);
-      }
-      else
+      if(processor)
       {
-        // Run processor if the processor is still in the list.
-        // It may be removed during the loop.
-        auto iter = std::find(mProcessors.Begin(), mProcessors.End(), processor);
-        if(iter != mProcessors.End())
+        if(!mProcessorUnregistered)
         {
           processor->Process(false);
         }
+        else
+        {
+          // Run processor if the processor is still in the list.
+          // It may be removed during the loop.
+          auto iter = std::find(mProcessors.Begin(), mProcessors.End(), processor);
+          if(iter != mProcessors.End())
+          {
+            processor->Process(false);
+          }
+        }
       }
     }
   }
@@ -395,29 +404,34 @@ void Core::RunProcessors()
 
 void Core::RunPostProcessors()
 {
-  // Copy processor pointers to prevent changes to vector affecting loop iterator.
-  Dali::Vector<Integration::Processor*> processors(mPostProcessors);
+  if(mPostProcessors.Count() != 0)
+  {
+    DALI_TRACE_SCOPE(gTraceFilter, "DALI_CORE_RUN_POST_PROCESSORS");
 
-  // To prevent accessing processor unregistered during the loop
-  mPostProcessorUnregistered = false;
+    // Copy processor pointers to prevent changes to vector affecting loop iterator.
+    Dali::Vector<Integration::Processor*> processors(mPostProcessors);
 
-  for(auto processor : processors)
-  {
-    if(processor)
+    // To prevent accessing processor unregistered during the loop
+    mPostProcessorUnregistered = false;
+
+    for(auto processor : processors)
     {
-      if(!mPostProcessorUnregistered)
-      {
-        processor->Process(true);
-      }
-      else
+      if(processor)
       {
-        // Run processor if the processor is still in the list.
-        // It may be removed during the loop.
-        auto iter = std::find(mPostProcessors.Begin(), mPostProcessors.End(), processor);
-        if(iter != mPostProcessors.End())
+        if(!mPostProcessorUnregistered)
         {
           processor->Process(true);
         }
+        else
+        {
+          // Run processor if the processor is still in the list.
+          // It may be removed during the loop.
+          auto iter = std::find(mPostProcessors.Begin(), mPostProcessors.End(), processor);
+          if(iter != mPostProcessors.End())
+          {
+            processor->Process(true);
+          }
+        }
       }
     }
   }
@@ -468,6 +482,47 @@ ObjectRegistry& Core::GetObjectRegistry() const
   return *(mObjectRegistry.Get());
 }
 
+void Core::LogMemoryPools() const
+{
+  uint32_t animationPoolCapacity    = SceneGraph::Animation::GetMemoryPoolCapacity();
+  uint32_t renderItemPoolCapacity   = SceneGraph::RenderItem::GetMemoryPoolCapacity();
+  uint32_t relayoutItemPoolCapacity = mRelayoutController->GetMemoryPoolCapacity();
+  uint32_t rendererPoolCapacity     = SceneGraph::Renderer::GetMemoryPoolCapacity();
+  uint32_t textureSetPoolCapacity   = SceneGraph::TextureSet::GetMemoryPoolCapacity();
+  uint32_t renderTaskPoolCapacity   = SceneGraph::RenderTaskList::GetMemoryPoolCapacity();
+  uint32_t nodePoolCapacity         = SceneGraph::Node::GetMemoryPoolCapacity();
+
+  DALI_LOG_RELEASE_INFO(
+    "\nMemory Pool capacities:\n"
+    "  Animations:    %lu\n"
+    "  RenderItems:   %lu\n"
+    "  RelayoutItems: %lu\n"
+    "  Renderers:     %lu\n"
+    "  TextureSets:   %lu\n"
+    "  RenderTasks:   %lu\n"
+    "  Nodes:         %lu\n",
+    animationPoolCapacity,
+    renderItemPoolCapacity,
+    relayoutItemPoolCapacity,
+    rendererPoolCapacity,
+    textureSetPoolCapacity,
+    renderTaskPoolCapacity,
+    nodePoolCapacity);
+
+  uint32_t updateQCapacity = mUpdateManager->GetUpdateMessageQueueCapacity();
+  uint32_t renderQCapacity = mUpdateManager->GetRenderMessageQueueCapacity();
+
+  DALI_LOG_RELEASE_INFO(
+    "\nMessage Queue capacities:\n"
+    "  UpdateQueue: %lu\n"
+    "  RenderQueue: %lu\n",
+    updateQCapacity,
+    renderQCapacity);
+
+  size_t renderInstructionCapacity = mUpdateManager->GetRenderInstructionCapacity();
+  DALI_LOG_RELEASE_INFO("\nRenderInstruction capacity: %lu\n", renderInstructionCapacity);
+}
+
 EventThreadServices& Core::GetEventThreadServices()
 {
   return *this;