X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fcommon%2Fcore-impl.cpp;h=44f193bff03c7f9085da105a2d4d55f2538e1136;hb=124494de5be1dbc24ab0a6e682434f9f936c0b41;hp=3b50a24c67dcc1c3ee18016aabd84b517951e4b6;hpb=3aa909145b7d672d0b966d3595b138ed1537b091;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/common/core-impl.cpp b/dali/internal/common/core-impl.cpp index 3b50a24..44f193b 100644 --- a/dali/internal/common/core-impl.cpp +++ b/dali/internal/common/core-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 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. @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -49,7 +50,6 @@ #include #include -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 @@ -87,7 +89,9 @@ Core::Core(RenderController& renderController, mPlatform(platform), mGraphicsController(graphicsController), mProcessingEvent(false), - mForceNextUpdate(false) + mForceNextUpdate(false), + mProcessorUnregistered(false), + mPostProcessorUnregistered(false) { // Create the thread local storage CreateThreadLocalStorage(); @@ -107,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, @@ -133,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() @@ -185,7 +190,7 @@ void Core::ContextDestroyed() { } -void Core::Update(float elapsedSeconds, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds, Integration::UpdateStatus& status, bool renderToFboEnabled, bool isRenderingToFbo) +void Core::Update(float elapsedSeconds, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds, Integration::UpdateStatus& status, bool renderToFboEnabled, bool isRenderingToFbo, bool uploadOnly) { // set the time delta so adaptor can easily print FPS with a release build with 0 as // it is cached by frametime @@ -197,7 +202,8 @@ void Core::Update(float elapsedSeconds, uint32_t lastVSyncTimeMilliseconds, uint lastVSyncTimeMilliseconds, nextVSyncTimeMilliseconds, renderToFboEnabled, - isRenderingToFbo); + isRenderingToFbo, + uploadOnly); // Check the Notification Manager message queue to set needsNotification status.needsNotification = mNotificationManager->MessagesToProcess(); @@ -206,9 +212,9 @@ void Core::Update(float elapsedSeconds, uint32_t lastVSyncTimeMilliseconds, uint // Any message to update will wake it up anyways } -void Core::PreRender(RenderStatus& status, bool forceClear, bool uploadOnly) +void Core::PreRender(RenderStatus& status, bool forceClear) { - mRenderManager->PreRender(status, forceClear, uploadOnly); + mRenderManager->PreRender(status, forceClear); } void Core::PreRender(Integration::Scene& scene, std::vector>& damagedRects) @@ -226,9 +232,10 @@ void Core::RenderScene(RenderStatus& status, Integration::Scene& scene, bool ren mRenderManager->RenderScene(status, scene, renderToFbo, clippingRect); } -void Core::PostRender(bool uploadOnly) +void Core::PostRender() { - mRenderManager->PostRender(uploadOnly); + mUpdateManager->PostRender(); + mRenderManager->PostRender(); } void Core::SceneCreated() @@ -346,6 +353,7 @@ void Core::UnregisterProcessor(Integration::Processor& processor, bool postProce if(iter != mPostProcessors.End()) { mPostProcessors.Erase(iter); + mPostProcessorUnregistered = true; } } else @@ -354,34 +362,77 @@ void Core::UnregisterProcessor(Integration::Processor& processor, bool postProce if(iter != mProcessors.End()) { mProcessors.Erase(iter); + mProcessorUnregistered = true; } } } void Core::RunProcessors() { - // Copy processor pointers to prevent changes to vector affecting loop iterator. - Dali::Vector processors(mProcessors); - - for(auto processor : processors) + if(mProcessors.Count() != 0) { - if(processor) + DALI_TRACE_SCOPE(gTraceFilter, "DALI_CORE_RUN_PROCESSORS"); + + // Copy processor pointers to prevent changes to vector affecting loop iterator. + Dali::Vector processors(mProcessors); + + // To prevent accessing processor unregistered during the loop + mProcessorUnregistered = false; + + for(auto processor : processors) { - processor->Process(false); + if(processor) + { + 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); + } + } + } } } } void Core::RunPostProcessors() { - // Copy processor pointers to prevent changes to vector affecting loop iterator. - Dali::Vector processors(mPostProcessors); - - for(auto processor : processors) + if(mPostProcessors.Count() != 0) { - if(processor) + DALI_TRACE_SCOPE(gTraceFilter, "DALI_CORE_RUN_POST_PROCESSORS"); + + // Copy processor pointers to prevent changes to vector affecting loop iterator. + Dali::Vector processors(mPostProcessors); + + // To prevent accessing processor unregistered during the loop + mPostProcessorUnregistered = false; + + for(auto processor : processors) { - processor->Process(true); + if(processor) + { + 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); + } + } + } } } } @@ -431,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;