/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#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;
mPlatform(platform),
mGraphicsController(graphicsController),
mProcessingEvent(false),
- mForceNextUpdate(false),
mProcessorUnregistered(false),
- mPostProcessorUnregistered(false)
+ mPostProcessorUnregistered(false),
+ mRelayoutFlush(false)
{
// Create the thread local storage
CreateThreadLocalStorage();
RenderQueue& renderQueue = mRenderManager->GetRenderQueue();
- mDiscardQueue = new DiscardQueue(renderQueue);
-
mUpdateManager = new UpdateManager(*mNotificationManager,
*mAnimationPlaylist,
*mPropertyNotificationManager,
- *mDiscardQueue,
renderController,
*mRenderManager,
renderQueue,
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()
}
}
+void Core::ForceRelayout()
+{
+ if(mRelayoutFlush)
+ {
+ DALI_LOG_ERROR("ForceRelayout should not be called from within RelayoutAndFlush!\n");
+ return;
+ }
+
+ // Scene could be added or removed while processing the events
+ // Copy the Scene container locally to avoid possibly invalid iterator
+ SceneContainer scenes = mScenes;
+
+ RelayoutAndFlush(scenes);
+}
+
void Core::ProcessEvents()
{
// Guard against calls to ProcessEvents() during ProcessEvents()
if(mProcessingEvent)
{
DALI_LOG_ERROR("ProcessEvents should not be called from within ProcessEvents!\n");
- mRenderController.RequestProcessEventsOnIdle(false);
+ mRenderController.RequestProcessEventsOnIdle();
return;
}
scene->EmitEventProcessingFinishedSignal();
}
+ RelayoutAndFlush(scenes);
+
+ mUpdateManager->EventProcessingFinished();
+
+ // Check if the touch or gestures require updates.
+ const bool gestureNeedsUpdate = mGestureEventProcessor->NeedsUpdate();
+
+ if(gestureNeedsUpdate)
+ {
+ // tell the render controller to keep update thread running
+ mRenderController.RequestUpdate();
+ }
+
+ mRelayoutController->SetProcessingCoreEvents(false);
+
+ // ProcessEvents() may now be called again
+ mProcessingEvent = false;
+}
+
+void Core::RelayoutAndFlush(SceneContainer& scenes)
+{
+ if(mRelayoutFlush)
+ {
+ DALI_LOG_ERROR("RelayoutAndFlush should not be called from within RelayoutAndFlush!\n");
+ return;
+ }
+
+ const bool isProcessEvents = mProcessingEvent;
+
+ if(!isProcessEvents)
+ {
+ // Fake that we are in ProcessEvents()
+ mProcessingEvent = true;
+ mRelayoutController->SetProcessingCoreEvents(true);
+
+ // Signal that any messages received will be flushed soon
+ mUpdateManager->EventProcessingStarted();
+ }
+
+ mRelayoutFlush = true;
+
// Run any registered processors
RunProcessors();
RunPostProcessors();
// Rebuild depth tree after event processing has finished
- for(auto scene : scenes)
+ for(auto& scene : scenes)
{
scene->RebuildDepthTree();
}
// Flush any queued messages for the update-thread
const bool messagesToProcess = mUpdateManager->FlushQueue();
- // Check if the touch or gestures require updates.
- const bool gestureNeedsUpdate = mGestureEventProcessor->NeedsUpdate();
- // Check if the next update is forced.
- const bool forceUpdate = IsNextUpdateForced();
-
- if(messagesToProcess || gestureNeedsUpdate || forceUpdate)
+ if(messagesToProcess)
{
// tell the render controller to keep update thread running
- mRenderController.RequestUpdate(forceUpdate);
+ mRenderController.RequestUpdate();
}
- mRelayoutController->SetProcessingCoreEvents(false);
+ mRelayoutFlush = false;
- // ProcessEvents() may now be called again
- mProcessingEvent = false;
+ if(!isProcessEvents)
+ {
+ // Revert fake informations
+ mProcessingEvent = false;
+ mRelayoutController->SetProcessingCoreEvents(false);
+
+ mUpdateManager->EventProcessingFinished();
+ }
}
uint32_t Core::GetMaximumUpdateCount() const
{
if(mProcessors.Count() != 0)
{
- DALI_TRACE_BEGIN(gTraceFilter, "DALI_CORE_RUN_PROCESSORS");
+#ifdef TRACE_ENABLED
+ if(gTraceFilter && gTraceFilter->IsTraceEnabled())
+ {
+ std::ostringstream stream;
+ stream << "[" << mProcessors.Count() << "]";
+ DALI_TRACE_BEGIN_WITH_MESSAGE(gTraceFilter, "DALI_CORE_RUN_PROCESSORS", stream.str().c_str());
+ }
+#endif
// Copy processor pointers to prevent changes to vector affecting loop iterator.
Dali::Vector<Integration::Processor*> processors(mProcessors);
}
}
}
- DALI_TRACE_END(gTraceFilter, "DALI_CORE_RUN_PROCESSORS");
+#ifdef TRACE_ENABLED
+ if(gTraceFilter && gTraceFilter->IsTraceEnabled())
+ {
+ std::ostringstream stream;
+ stream << "[" << mProcessors.Count();
+ if(mProcessorUnregistered)
+ {
+ stream << ", processor changed";
+ }
+ stream << "]";
+ DALI_TRACE_END_WITH_MESSAGE(gTraceFilter, "DALI_CORE_RUN_PROCESSORS", stream.str().c_str());
+ }
+#endif
}
}
{
if(mPostProcessors.Count() != 0)
{
- DALI_TRACE_BEGIN(gTraceFilter, "DALI_CORE_RUN_POST_PROCESSORS");
+#ifdef TRACE_ENABLED
+ if(gTraceFilter && gTraceFilter->IsTraceEnabled())
+ {
+ std::ostringstream stream;
+ stream << "[" << mPostProcessors.Count() << "]";
+ DALI_TRACE_BEGIN_WITH_MESSAGE(gTraceFilter, "DALI_CORE_RUN_POST_PROCESSORS", stream.str().c_str());
+ }
+#endif
// Copy processor pointers to prevent changes to vector affecting loop iterator.
Dali::Vector<Integration::Processor*> processors(mPostProcessors);
}
}
}
- DALI_TRACE_END(gTraceFilter, "DALI_CORE_RUN_POST_PROCESSORS");
+
+#ifdef TRACE_ENABLED
+ if(gTraceFilter && gTraceFilter->IsTraceEnabled())
+ {
+ std::ostringstream stream;
+ stream << "[" << mPostProcessors.Count();
+ if(mPostProcessorUnregistered)
+ {
+ stream << ", post processor changed";
+ }
+ stream << "]";
+ DALI_TRACE_END_WITH_MESSAGE(gTraceFilter, "DALI_CORE_RUN_POST_PROCESSORS", stream.str().c_str());
+ }
+#endif
}
}
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;
return mUpdateManager->GetEventBufferIndex();
}
-void Core::ForceNextUpdate()
-{
- mForceNextUpdate = true;
-}
-
-bool Core::IsNextUpdateForced()
-{
- bool nextUpdateForced = mForceNextUpdate;
- mForceNextUpdate = false;
- return nextUpdateForced;
-}
-
} // namespace Internal
} // namespace Dali