${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}
${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}
${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}
${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}
${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}
${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}
${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}
${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}
${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}
${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}
${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}
//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);
}
return networkService->CustomCommandReceivedSignal();
}
+int32_t GetRenderThreadId(Application application)
+{
+ return Internal::Adaptor::GetImplementation(application).GetRenderThreadId();
+}
+
} // namespace DevelApplication
} // namespace Dali
{
namespace DevelApplication
{
-
using CustomCommandReceivedSignalType = Signal<void(const std::string&)>; ///< Signal signature for CustomCommandReceivedSignal
/**
*/
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
return mConfigurationManager->IsMultipleWindowSupported();
}
+int32_t Adaptor::GetRenderThreadId() const
+{
+ if(mThreadController)
+ {
+ return mThreadController->GetThreadId();
+ }
+ return 0;
+}
+
void Adaptor::RequestUpdateOnce()
{
if(mThreadController)
*/
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()
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
*/
void StoreWindowPositionSize(PositionSize positionSize);
+ /**
+ * @copydoc Dali::DevelApplication::GetRenderThreadId()
+ */
+ int32_t GetRenderThreadId() const;
+
public: // From Framework::Observer
/**
* Called when the framework is initialised.
#include "dali/public-api/common/dali-common.h"
// INTERNAL INCLUDES
-#include <dali/devel-api/adaptor-framework/thread-settings.h>
#include <dali/integration-api/adaptor-framework/trigger-event-factory.h>
#include <dali/internal/adaptor/common/adaptor-internal-services.h>
#include <dali/internal/adaptor/common/combined-update-render-controller-debug.h>
#include <dali/internal/graphics/gles/egl-graphics.h>
#include <dali/internal/system/common/environment-options.h>
#include <dali/internal/system/common/time-service.h>
+#include <dali/internal/thread/common/thread-settings-impl.h>
#include <dali/internal/window-system/common/window-impl.h>
namespace Dali
mDefaultHalfFrameNanoseconds(0u),
mUpdateRequestCount(0u),
mRunning(FALSE),
+ mThreadId(0),
mThreadMode(threadMode),
mUpdateRenderRunCount(0),
mDestroyUpdateRenderThread(FALSE),
}
}
+int32_t CombinedUpdateRenderController::GetThreadId() const
+{
+ return mThreadId;
+}
+
///////////////////////////////////////////////////////////////////////////////////////////////////
// EVENT THREAD
///////////////////////////////////////////////////////////////////////////////////////////////////
void CombinedUpdateRenderController::UpdateRenderThread()
{
- SetThreadName("RenderThread\0");
+ ThreadSettings::SetThreadName("RenderThread\0");
+ mThreadId = ThreadSettings::GetThreadId();
// Install a function for logging
mEnvironmentOptions.InstallLogFunction();
#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.
*/
void AddSurface(Dali::RenderSurfaceInterface* surface) override;
+ /**
+ * @copydoc ThreadControllerInterface::GetThreadId()
+ */
+ int32_t GetThreadId() const override;
+
private:
// Undefined copy constructor.
CombinedUpdateRenderController(const CombinedUpdateRenderController&);
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.
#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.
*
*/
+// EXTERNAL INCLUDES
#include <dali/public-api/signals/callback.h>
+#include <stdint.h>
namespace Dali
{
*/
virtual void AddSurface(Dali::RenderSurfaceInterface* surface) = 0;
+ /**
+ * @brief Gets the thread id.
+ * @return The thread id.
+ */
+ virtual int32_t GetThreadId() const = 0;
+
protected:
/**
* Constructor
/*
- * 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.
mThreadControllerInterface->AddSurface(newSurface);
}
+int32_t ThreadController::GetThreadId() const
+{
+ return mThreadControllerInterface->GetThreadId();
+}
+
} // namespace Adaptor
} // namespace Internal
#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.
*/
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;
// CLASS HEADER
#include <dali/internal/thread/common/thread-settings-impl.h>
+// EXTERNAL INCLUDES
+#include <sys/prctl.h>
+
// INTERNAL INCLUDES
#include <dali/integration-api/debug.h>
#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.
*/
// EXTERNAL INCLUDES
-#include <sys/prctl.h>
#include <string>
namespace Dali
*/
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
-
-# 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
+)
+
--- /dev/null
+/*
+ * 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 <dali/internal/thread/common/thread-settings-impl.h>
+
+// EXTERNAL INCLUDES
+#include <sys/syscall.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+namespace ThreadSettings
+{
+int32_t GetThreadId()
+{
+ return static_cast<int>(syscall(SYS_gettid));
+}
+
+} // namespace ThreadSettings
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
--- /dev/null
+/*
+ * 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 <dali/internal/thread/common/thread-settings-impl.h>
+
+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