From 80c055877cdc8d89a9662d7a56fc0cc2bc8e0eae Mon Sep 17 00:00:00 2001 From: "Eunki, Hong" Date: Wed, 2 Aug 2023 18:15:35 +0900 Subject: [PATCH] Flush update messages for application Make a way to relayout & flush events messages by core API. Since we cannot access adaptor directly, let we ask to application to relayout calculation forcibly. Change-Id: I0dba32b7b136ceefc07b99fc404cf330e5c2dff7 Signed-off-by: Eunki, Hong --- dali/devel-api/adaptor-framework/application-devel.cpp | 5 +++++ dali/devel-api/adaptor-framework/application-devel.h | 8 +++++++- dali/integration-api/adaptor-framework/adaptor.h | 5 +++++ dali/internal/adaptor/common/adaptor-impl.cpp | 10 ++++++++++ dali/internal/adaptor/common/adaptor-impl.h | 7 ++++++- dali/internal/adaptor/common/adaptor.cpp | 5 +++++ dali/internal/adaptor/common/application-impl.cpp | 5 +++++ dali/internal/adaptor/common/application-impl.h | 5 +++++ dali/internal/system/common/core-event-interface.h | 7 ++++++- 9 files changed, 54 insertions(+), 3 deletions(-) diff --git a/dali/devel-api/adaptor-framework/application-devel.cpp b/dali/devel-api/adaptor-framework/application-devel.cpp index 11ab483..b33f173 100644 --- a/dali/devel-api/adaptor-framework/application-devel.cpp +++ b/dali/devel-api/adaptor-framework/application-devel.cpp @@ -86,6 +86,11 @@ int32_t GetRenderThreadId(Application application) return Internal::Adaptor::GetImplementation(application).GetRenderThreadId(); } +void FlushUpdateMessages(Application application) +{ + Internal::Adaptor::GetImplementation(application).FlushUpdateMessages(); +} + } // namespace DevelApplication } // namespace Dali diff --git a/dali/devel-api/adaptor-framework/application-devel.h b/dali/devel-api/adaptor-framework/application-devel.h index 19c96d5..0e04b0b 100644 --- a/dali/devel-api/adaptor-framework/application-devel.h +++ b/dali/devel-api/adaptor-framework/application-devel.h @@ -2,7 +2,7 @@ #define DALI_APPLICATION_DEVEL_H /* - * 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. @@ -106,6 +106,12 @@ DALI_ADAPTOR_API CustomCommandReceivedSignalType& CustomCommandReceivedSignal(Ap */ DALI_ADAPTOR_API int32_t GetRenderThreadId(Application application); +/** + * @brief Relayout the application and ensure all pending operations are flushed to the update thread. + * @param application A handle to the Application + */ +DALI_ADAPTOR_API void FlushUpdateMessages(Application application); + } // namespace DevelApplication } // namespace Dali diff --git a/dali/integration-api/adaptor-framework/adaptor.h b/dali/integration-api/adaptor-framework/adaptor.h index 26deedf..98db7e6 100644 --- a/dali/integration-api/adaptor-framework/adaptor.h +++ b/dali/integration-api/adaptor-framework/adaptor.h @@ -399,6 +399,11 @@ public: void RenderOnce(); /** + * @brief Relayout and ensure all pending operations are flushed to the update thread. + */ + void FlushUpdateMessages(); + + /** * @brief The log factory allows installation of a logger function in worker threads. * @return An interface to a logging factory */ diff --git a/dali/internal/adaptor/common/adaptor-impl.cpp b/dali/internal/adaptor/common/adaptor-impl.cpp index fd8238b..ef0ca77 100644 --- a/dali/internal/adaptor/common/adaptor-impl.cpp +++ b/dali/internal/adaptor/common/adaptor-impl.cpp @@ -934,6 +934,16 @@ void Adaptor::QueueCoreEvent(const Dali::Integration::Event& event) } } +void Adaptor::FlushUpdateMessages() +{ + if(mCore) + { + DALI_TRACE_SCOPE(gTraceFilter, "DALI_FLUSH_UPDATE_MESSAGES"); + + mCore->ForceRelayout(); + } +} + void Adaptor::ProcessCoreEvents() { if(mCore) diff --git a/dali/internal/adaptor/common/adaptor-impl.h b/dali/internal/adaptor/common/adaptor-impl.h index 2b27610..cced74b 100644 --- a/dali/internal/adaptor/common/adaptor-impl.h +++ b/dali/internal/adaptor/common/adaptor-impl.h @@ -562,7 +562,12 @@ public: // Signals public: // From Dali::Internal::Adaptor::CoreEventInterface /** - * @copydoc Dali::Internal::Adaptor:CoreEventInterface:::ProcessCoreEvents() + * @copydoc Dali::Internal::Adaptor::CoreEventInterface:::FlushUpdateMessages() + */ + void FlushUpdateMessages() override; + + /** + * @copydoc Dali::Internal::Adaptor::CoreEventInterface:::ProcessCoreEvents() */ void ProcessCoreEvents() override; diff --git a/dali/internal/adaptor/common/adaptor.cpp b/dali/internal/adaptor/common/adaptor.cpp index f84547d..c32a2a2 100644 --- a/dali/internal/adaptor/common/adaptor.cpp +++ b/dali/internal/adaptor/common/adaptor.cpp @@ -225,6 +225,11 @@ void Adaptor::RenderOnce() mImpl->RenderOnce(); } +void Adaptor::FlushUpdateMessages() +{ + mImpl->FlushUpdateMessages(); +} + const LogFactoryInterface& Adaptor::GetLogFactory() { return mImpl->GetLogFactory(); diff --git a/dali/internal/adaptor/common/application-impl.cpp b/dali/internal/adaptor/common/application-impl.cpp index 13a5fe6..c5d0c23 100644 --- a/dali/internal/adaptor/common/application-impl.cpp +++ b/dali/internal/adaptor/common/application-impl.cpp @@ -604,6 +604,11 @@ std::string Application::GetDataPath() return SystemSettings::GetDataPath(); } +void Application::FlushUpdateMessages() +{ + Internal::Adaptor::Adaptor::GetImplementation(*mAdaptor).FlushUpdateMessages(); +} + void Application::SetStyleSheet(const std::string& stylesheet) { mStylesheet = stylesheet; diff --git a/dali/internal/adaptor/common/application-impl.h b/dali/internal/adaptor/common/application-impl.h index 26d478f..109b5a9 100644 --- a/dali/internal/adaptor/common/application-impl.h +++ b/dali/internal/adaptor/common/application-impl.h @@ -300,6 +300,11 @@ public: */ void SetDefaultWindowType(WindowType type); + /** + * @brief Relayout the application and ensure all pending operations are flushed to the update thread. + */ + void FlushUpdateMessages(); + public: // Signals /** * @copydoc Dali::Application::InitSignal() diff --git a/dali/internal/system/common/core-event-interface.h b/dali/internal/system/common/core-event-interface.h index c1c8579..7e4641b 100644 --- a/dali/internal/system/common/core-event-interface.h +++ b/dali/internal/system/common/core-event-interface.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_ADAPTOR_CORE_EVENT_INTERFACE_H /* - * Copyright (c) 2021 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. @@ -43,6 +43,11 @@ public: virtual void QueueCoreEvent(const Dali::Integration::Event& event) = 0; /** + * Relayout and ensure all pending operations are flushed to the update thread. + */ + virtual void FlushUpdateMessages() = 0; + + /** * Process the events queued with QueueEvent(). */ virtual void ProcessCoreEvents() = 0; -- 2.7.4