From: Eunki Hong Date: Fri, 30 Dec 2022 08:22:16 +0000 (+0000) Subject: Merge "Trace use scope macro instead of begin-end" into devel/master X-Git-Tag: dali_2.2.8~3 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git;a=commitdiff_plain;h=0611c992765b21bfc0be36074ac3452b3859b28c;hp=b901daa6ea05561c291aab6ab2e8a5fe6cfd2f8d Merge "Trace use scope macro instead of begin-end" into devel/master --- diff --git a/build/tizen/profiles/android-profile.cmake b/build/tizen/profiles/android-profile.cmake index 5501ba7..36b45e0 100644 --- a/build/tizen/profiles/android-profile.cmake +++ b/build/tizen/profiles/android-profile.cmake @@ -44,6 +44,7 @@ SET( SOURCES ${adaptor_window_system_android_src_files} ${adaptor_trace_common_src_files} ${adaptor_thread_common_src_files} + ${adaptor_thread_linux_src_files} ${devel_api_text_abstraction_src_files} ${static_libraries_libunibreak_src_files} ${adaptor_addons_common_src_files} diff --git a/build/tizen/profiles/common-profile.cmake b/build/tizen/profiles/common-profile.cmake index 14b574c..8959963 100644 --- a/build/tizen/profiles/common-profile.cmake +++ b/build/tizen/profiles/common-profile.cmake @@ -45,6 +45,7 @@ SET( SOURCES ${adaptor_window_system_tizen_wayland_src_files} ${adaptor_trace_common_src_files} ${adaptor_thread_common_src_files} + ${adaptor_thread_linux_src_files} ${adaptor_addons_common_src_files} ${adaptor_addons_tizen_src_files} ${devel_api_text_abstraction_src_files} diff --git a/build/tizen/profiles/glib-x11-profile.cmake b/build/tizen/profiles/glib-x11-profile.cmake index 7914fb0..7a45b3d 100644 --- a/build/tizen/profiles/glib-x11-profile.cmake +++ b/build/tizen/profiles/glib-x11-profile.cmake @@ -36,6 +36,7 @@ SET( SOURCES ${adaptor_resampler_src_files} ${adaptor_text_common_src_files} ${adaptor_thread_common_src_files} + ${adaptor_thread_linux_src_files} ${adaptor_trace_common_src_files} ${adaptor_vector_animation_common_src_files} ${adaptor_vector_image_common_src_files} diff --git a/build/tizen/profiles/ivi-profile.cmake b/build/tizen/profiles/ivi-profile.cmake index 268e690..86bc9f2 100644 --- a/build/tizen/profiles/ivi-profile.cmake +++ b/build/tizen/profiles/ivi-profile.cmake @@ -46,6 +46,7 @@ SET( SOURCES ${adaptor_window_system_tizen_wayland_src_files} ${adaptor_trace_common_src_files} ${adaptor_thread_common_src_files} + ${adaptor_thread_linux_src_files} ${adaptor_addons_common_src_files} ${adaptor_addons_tizen_src_files} ${devel_api_text_abstraction_src_files} diff --git a/build/tizen/profiles/libuv-x11-profile.cmake b/build/tizen/profiles/libuv-x11-profile.cmake index 91b237e..8b8e5d0 100644 --- a/build/tizen/profiles/libuv-x11-profile.cmake +++ b/build/tizen/profiles/libuv-x11-profile.cmake @@ -36,6 +36,7 @@ SET( SOURCES ${adaptor_resampler_src_files} ${adaptor_text_common_src_files} ${adaptor_thread_common_src_files} + ${adaptor_thread_linux_src_files} ${adaptor_trace_common_src_files} ${adaptor_vector_animation_common_src_files} ${adaptor_vector_image_common_src_files} diff --git a/build/tizen/profiles/macos-profile.cmake b/build/tizen/profiles/macos-profile.cmake index e247819..8111ce5 100644 --- a/build/tizen/profiles/macos-profile.cmake +++ b/build/tizen/profiles/macos-profile.cmake @@ -44,6 +44,7 @@ SET( SOURCES ${adaptor_macos_platform_src_files} ${adaptor_trace_common_src_files} ${adaptor_thread_common_src_files} + ${adaptor_thread_linux_src_files} ${adaptor_window_system_macos_src_files} ${devel_api_text_abstraction_src_files} ${adaptor_addons_common_src_files} diff --git a/build/tizen/profiles/mobile-profile.cmake b/build/tizen/profiles/mobile-profile.cmake index 05e453d..3b1d651 100644 --- a/build/tizen/profiles/mobile-profile.cmake +++ b/build/tizen/profiles/mobile-profile.cmake @@ -45,6 +45,7 @@ SET( SOURCES ${adaptor_window_system_tizen_wayland_src_files} ${adaptor_trace_common_src_files} ${adaptor_thread_common_src_files} + ${adaptor_thread_linux_src_files} ${adaptor_addons_common_src_files} ${adaptor_addons_tizen_src_files} ${devel_api_text_abstraction_src_files} diff --git a/build/tizen/profiles/tv-profile.cmake b/build/tizen/profiles/tv-profile.cmake index b3c17bb..8305c24 100644 --- a/build/tizen/profiles/tv-profile.cmake +++ b/build/tizen/profiles/tv-profile.cmake @@ -45,6 +45,7 @@ SET( SOURCES ${adaptor_window_system_tizen_wayland_src_files} ${adaptor_trace_common_src_files} ${adaptor_thread_common_src_files} + ${adaptor_thread_linux_src_files} ${devel_api_text_abstraction_src_files} ${adaptor_addons_common_src_files} ${adaptor_addons_tizen_src_files} diff --git a/build/tizen/profiles/ubuntu-profile.cmake b/build/tizen/profiles/ubuntu-profile.cmake index 79dd1a7..2429239 100644 --- a/build/tizen/profiles/ubuntu-profile.cmake +++ b/build/tizen/profiles/ubuntu-profile.cmake @@ -43,6 +43,7 @@ SET( SOURCES ${adaptor_window_system_common_src_files} ${adaptor_trace_common_src_files} ${adaptor_thread_common_src_files} + ${adaptor_thread_linux_src_files} ${adaptor_window_system_ubuntu_x11_src_files} ${devel_api_text_abstraction_src_files} ${adaptor_addons_common_src_files} diff --git a/build/tizen/profiles/wearable-profile.cmake b/build/tizen/profiles/wearable-profile.cmake index f0211db..ee6060c 100644 --- a/build/tizen/profiles/wearable-profile.cmake +++ b/build/tizen/profiles/wearable-profile.cmake @@ -47,6 +47,7 @@ SET( SOURCES ${adaptor_window_system_tizen_wayland_src_files} ${adaptor_trace_common_src_files} ${adaptor_thread_common_src_files} + ${adaptor_thread_linux_src_files} ${adaptor_addons_common_src_files} ${adaptor_addons_tizen_src_files} ${devel_api_text_abstraction_src_files} diff --git a/build/tizen/profiles/windows-profile.cmake b/build/tizen/profiles/windows-profile.cmake index 7a03885..3ab536f 100644 --- a/build/tizen/profiles/windows-profile.cmake +++ b/build/tizen/profiles/windows-profile.cmake @@ -35,6 +35,7 @@ SET( SOURCES ${adaptor_window_system_common_src_files} ${adaptor_trace_common_src_files} ${adaptor_thread_common_src_files} + ${adaptor_thread_windows_src_files} ${devel_api_text_abstraction_src_files} ${static_libraries_libunibreak_src_files} ${adaptor_windows_platform_src_files} diff --git a/dali/devel-api/adaptor-framework/application-devel.cpp b/dali/devel-api/adaptor-framework/application-devel.cpp index 8ce55e2..18a233c 100644 --- a/dali/devel-api/adaptor-framework/application-devel.cpp +++ b/dali/devel-api/adaptor-framework/application-devel.cpp @@ -46,7 +46,8 @@ Application New(int* argc, char** argv[], const std::string& stylesheet, Applica //Store only the value before adaptor is created internal->StoreWindowPositionSize(positionSize); - } else + } + else { internal = Internal::Adaptor::Application::New(argc, argv, stylesheet, windowMode, positionSize, Internal::Adaptor::Framework::NORMAL, type, false); } @@ -79,6 +80,11 @@ CustomCommandReceivedSignalType& CustomCommandReceivedSignal(Application applica return networkService->CustomCommandReceivedSignal(); } +int32_t GetRenderThreadId(Application application) +{ + return Internal::Adaptor::GetImplementation(application).GetRenderThreadId(); +} + } // 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 095c252..19c96d5 100644 --- a/dali/devel-api/adaptor-framework/application-devel.h +++ b/dali/devel-api/adaptor-framework/application-devel.h @@ -29,7 +29,6 @@ namespace Dali { namespace DevelApplication { - using CustomCommandReceivedSignalType = Signal; ///< Signal signature for CustomCommandReceivedSignal /** @@ -99,6 +98,14 @@ DALI_ADAPTOR_API Application DownCast(Dali::RefObject* refObject); */ DALI_ADAPTOR_API CustomCommandReceivedSignalType& CustomCommandReceivedSignal(Application application); +/** + * @brief Gets the render thread id of DALi. + * @note If render thread id getter doesn't supported, it will return 0 as default. + * @param application A handle to the Application + * @return The render thread id. + */ +DALI_ADAPTOR_API int32_t GetRenderThreadId(Application application); + } // namespace DevelApplication } // namespace Dali diff --git a/dali/internal/adaptor/common/adaptor-impl.cpp b/dali/internal/adaptor/common/adaptor-impl.cpp index 1ab6e70..42b9309 100644 --- a/dali/internal/adaptor/common/adaptor-impl.cpp +++ b/dali/internal/adaptor/common/adaptor-impl.cpp @@ -1140,6 +1140,15 @@ bool Adaptor::IsMultipleWindowSupported() const return mConfigurationManager->IsMultipleWindowSupported(); } +int32_t Adaptor::GetRenderThreadId() const +{ + if(mThreadController) + { + return mThreadController->GetThreadId(); + } + return 0; +} + void Adaptor::RequestUpdateOnce() { if(mThreadController) diff --git a/dali/internal/adaptor/common/adaptor-impl.h b/dali/internal/adaptor/common/adaptor-impl.h index d24b830..07f5df4 100644 --- a/dali/internal/adaptor/common/adaptor-impl.h +++ b/dali/internal/adaptor/common/adaptor-impl.h @@ -456,6 +456,13 @@ public: */ bool IsMultipleWindowSupported() const; + /** + * @brief Gets the render thread id of DALi. + * @note If render thread id getter doesn't supported, it will return 0 as default. + * @return The render thread id. + */ + int32_t GetRenderThreadId() const; + public: //AdaptorInternalServices /** * @copydoc Dali::Internal::Adaptor::AdaptorInternalServices::GetPlatformAbstractionInterface() diff --git a/dali/internal/adaptor/common/application-impl.cpp b/dali/internal/adaptor/common/application-impl.cpp index c44318e..e7d2687 100644 --- a/dali/internal/adaptor/common/application-impl.cpp +++ b/dali/internal/adaptor/common/application-impl.cpp @@ -529,6 +529,15 @@ void Application::SetDefaultWindowType(WindowType type) mMainWindow.SetType(type); } +int32_t Application::GetRenderThreadId() const +{ + if(mAdaptor) + { + return Internal::Adaptor::Adaptor::GetImplementation(*mAdaptor).GetRenderThreadId(); + } + return 0; +} + ApplicationPtr Application::GetPreInitializedApplication() { // Reset the handle to decrease the reference count diff --git a/dali/internal/adaptor/common/application-impl.h b/dali/internal/adaptor/common/application-impl.h index 2b2e872..8e334a7 100644 --- a/dali/internal/adaptor/common/application-impl.h +++ b/dali/internal/adaptor/common/application-impl.h @@ -160,6 +160,11 @@ public: */ void StoreWindowPositionSize(PositionSize positionSize); + /** + * @copydoc Dali::DevelApplication::GetRenderThreadId() + */ + int32_t GetRenderThreadId() const; + public: // From Framework::Observer /** * Called when the framework is initialised. diff --git a/dali/internal/adaptor/common/combined-update-render-controller.cpp b/dali/internal/adaptor/common/combined-update-render-controller.cpp index d32f881..53514de 100644 --- a/dali/internal/adaptor/common/combined-update-render-controller.cpp +++ b/dali/internal/adaptor/common/combined-update-render-controller.cpp @@ -25,7 +25,6 @@ #include "dali/public-api/common/dali-common.h" // INTERNAL INCLUDES -#include #include #include #include @@ -33,6 +32,7 @@ #include #include #include +#include #include namespace Dali @@ -105,6 +105,7 @@ CombinedUpdateRenderController::CombinedUpdateRenderController(AdaptorInternalSe mDefaultHalfFrameNanoseconds(0u), mUpdateRequestCount(0u), mRunning(FALSE), + mThreadId(0), mThreadMode(threadMode), mUpdateRenderRunCount(0), mDestroyUpdateRenderThread(FALSE), @@ -407,6 +408,11 @@ void CombinedUpdateRenderController::AddSurface(Dali::RenderSurfaceInterface* su } } +int32_t CombinedUpdateRenderController::GetThreadId() const +{ + return mThreadId; +} + /////////////////////////////////////////////////////////////////////////////////////////////////// // EVENT THREAD /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -497,7 +503,8 @@ void CombinedUpdateRenderController::ProcessSleepRequest() void CombinedUpdateRenderController::UpdateRenderThread() { - SetThreadName("RenderThread\0"); + ThreadSettings::SetThreadName("RenderThread\0"); + mThreadId = ThreadSettings::GetThreadId(); // Install a function for logging mEnvironmentOptions.InstallLogFunction(); diff --git a/dali/internal/adaptor/common/combined-update-render-controller.h b/dali/internal/adaptor/common/combined-update-render-controller.h index 7127d66..8902875 100644 --- a/dali/internal/adaptor/common/combined-update-render-controller.h +++ b/dali/internal/adaptor/common/combined-update-render-controller.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_COMBINED_UPDATE_RENDER_CONTROLLER_H /* - * 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. @@ -154,6 +154,11 @@ public: */ void AddSurface(Dali::RenderSurfaceInterface* surface) override; + /** + * @copydoc ThreadControllerInterface::GetThreadId() + */ + int32_t GetThreadId() const override; + private: // Undefined copy constructor. CombinedUpdateRenderController(const CombinedUpdateRenderController&); @@ -352,8 +357,9 @@ private: uint64_t mDefaultFrameDurationNanoseconds; ///< Default duration of a frame (used for sleeping if not enough time elapsed). Not protected by lock, but written to rarely so not worth adding a lock when reading. uint64_t mDefaultHalfFrameNanoseconds; ///< Is half of mDefaultFrameDurationNanoseconds. Using a member variable avoids having to do the calculation every frame. Not protected by lock, but written to rarely so not worth adding a lock when reading. - unsigned int mUpdateRequestCount; ///< Count of update-requests we have received to ensure we do not go to sleep too early. - unsigned int mRunning; ///< Read and set on the event-thread only to state whether we are running. + uint32_t mUpdateRequestCount; ///< Count of update-requests we have received to ensure we do not go to sleep too early. + uint32_t mRunning; ///< Read and set on the event-thread only to state whether we are running. + int32_t mThreadId; ///< UpdateRender thread id ThreadMode mThreadMode; ///< Whether the thread runs continuously or runs when it is requested. diff --git a/dali/internal/adaptor/common/thread-controller-interface.h b/dali/internal/adaptor/common/thread-controller-interface.h index 1ab348a..7d81c1f 100644 --- a/dali/internal/adaptor/common/thread-controller-interface.h +++ b/dali/internal/adaptor/common/thread-controller-interface.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_THREAD_CONTROLLER_INTERFACE_H /* - * 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. @@ -18,7 +18,9 @@ * */ +// EXTERNAL INCLUDES #include +#include namespace Dali { @@ -129,6 +131,12 @@ public: */ virtual void AddSurface(Dali::RenderSurfaceInterface* surface) = 0; + /** + * @brief Gets the thread id. + * @return The thread id. + */ + virtual int32_t GetThreadId() const = 0; + protected: /** * Constructor diff --git a/dali/internal/system/common/thread-controller.cpp b/dali/internal/system/common/thread-controller.cpp index 54633bd..b3874d2 100644 --- a/dali/internal/system/common/thread-controller.cpp +++ b/dali/internal/system/common/thread-controller.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. @@ -117,6 +117,11 @@ void ThreadController::AddSurface(Dali::RenderSurfaceInterface* newSurface) mThreadControllerInterface->AddSurface(newSurface); } +int32_t ThreadController::GetThreadId() const +{ + return mThreadControllerInterface->GetThreadId(); +} + } // namespace Adaptor } // namespace Internal diff --git a/dali/internal/system/common/thread-controller.h b/dali/internal/system/common/thread-controller.h index ba58948..5f22a6a 100644 --- a/dali/internal/system/common/thread-controller.h +++ b/dali/internal/system/common/thread-controller.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_THREAD_CONTROLLER_H /* - * 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. @@ -141,6 +141,13 @@ public: */ void AddSurface(Dali::RenderSurfaceInterface* surface); + /** + * @brief Gets the thread id. + * @note If thread id getter doesn't supported, it will return 0 as default. + * @return The thread id. + */ + int32_t GetThreadId() const; + private: // Undefined copy constructor. ThreadController(const ThreadController&) = delete; diff --git a/dali/internal/thread/common/thread-settings-impl.cpp b/dali/internal/thread/common/thread-settings-impl.cpp index aa0616e..bf898a0 100644 --- a/dali/internal/thread/common/thread-settings-impl.cpp +++ b/dali/internal/thread/common/thread-settings-impl.cpp @@ -18,6 +18,9 @@ // CLASS HEADER #include +// EXTERNAL INCLUDES +#include + // INTERNAL INCLUDES #include diff --git a/dali/internal/thread/common/thread-settings-impl.h b/dali/internal/thread/common/thread-settings-impl.h index b091736..addad67 100644 --- a/dali/internal/thread/common/thread-settings-impl.h +++ b/dali/internal/thread/common/thread-settings-impl.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_THREAD_SETTINGS_H /* - * 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. @@ -19,7 +19,6 @@ */ // EXTERNAL INCLUDES -#include #include namespace Dali @@ -40,6 +39,13 @@ namespace ThreadSettings */ void SetThreadName(const std::string& threadName); +/** + * @brief Get the thread id. + * @note If thread id getter doesn't supported, it will return 0 as default. + * @return The thread id. + */ +int32_t GetThreadId(); + } // namespace ThreadSettings } // namespace Adaptor diff --git a/dali/internal/thread/file.list b/dali/internal/thread/file.list index 4cc599c..1e17e06 100644 --- a/dali/internal/thread/file.list +++ b/dali/internal/thread/file.list @@ -1,6 +1,15 @@ - -# module: trace, backend: common -SET( adaptor_thread_common_src_files +# module: thread, backend: common +SET( adaptor_thread_common_src_files ${adaptor_thread_dir}/common/thread-settings-impl.cpp ) +# module: thread, backend: linux +SET( adaptor_thread_linux_src_files + ${adaptor_thread_dir}/linux/thread-settings-impl-linux.cpp +) + +# module: thread, backend: windows +SET( adaptor_thread_windows_src_files + ${adaptor_thread_dir}/windows/thread-settings-impl-win.cpp +) + diff --git a/dali/internal/thread/linux/thread-settings-impl-linux.cpp b/dali/internal/thread/linux/thread-settings-impl-linux.cpp new file mode 100644 index 0000000..2bb8ec2 --- /dev/null +++ b/dali/internal/thread/linux/thread-settings-impl-linux.cpp @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// CLASS HEADER +#include + +// EXTERNAL INCLUDES +#include +#include +#include + +namespace Dali +{ +namespace Internal +{ +namespace Adaptor +{ +namespace ThreadSettings +{ +int32_t GetThreadId() +{ + return static_cast(syscall(SYS_gettid)); +} + +} // namespace ThreadSettings +} // namespace Adaptor +} // namespace Internal +} // namespace Dali diff --git a/dali/internal/thread/windows/thread-settings-impl-win.cpp b/dali/internal/thread/windows/thread-settings-impl-win.cpp new file mode 100644 index 0000000..7e67307 --- /dev/null +++ b/dali/internal/thread/windows/thread-settings-impl-win.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// CLASS HEADER +#include + +namespace Dali +{ +namespace Internal +{ +namespace Adaptor +{ +namespace ThreadSettings +{ +int32_t GetThreadId() +{ + // TODO: Need to implement + return 0; +} + +} // namespace ThreadSettings +} // namespace Adaptor +} // namespace Internal +} // namespace Dali