/*
- * 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/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
mEventThreadSemaphore(0),
mSurfaceSemaphore(0),
mUpdateRenderThreadWaitCondition(),
+ mPostRenderWaitCondition(),
mAdaptorInterfaces(adaptorInterfaces),
mPerformanceInterface(adaptorInterfaces.GetPerformanceInterface()),
mCore(adaptorInterfaces.GetCore()),
mDefaultHalfFrameNanoseconds(0u),
mUpdateRequestCount(0u),
mRunning(FALSE),
+ mThreadId(0),
mThreadMode(threadMode),
mUpdateRenderRunCount(0),
mDestroyUpdateRenderThread(FALSE),
// Start replacing the surface.
{
ConditionalWait::ScopedLock lock(mUpdateRenderThreadWaitCondition);
- mPostRendering = FALSE; // Clear the post-rendering flag as Update/Render thread will replace the surface now
- mNewSurface = newSurface;
+ mNewSurface = newSurface;
mUpdateRenderThreadWaitCondition.Notify(lock);
}
// Start replacing the surface.
{
ConditionalWait::ScopedLock lock(mUpdateRenderThreadWaitCondition);
- mPostRendering = FALSE; // Clear the post-rendering flag as Update/Render thread will delete the surface now
mDeletedSurface = surface;
mUpdateRenderThreadWaitCondition.Notify(lock);
}
{
ConditionalWait::ScopedLock lock(mUpdateRenderThreadWaitCondition);
- mPostRendering = FALSE; // Clear the post-rendering flag as Update/Render thread will resize the surface now
// Surface is resized and the surface resized count is increased.
mSurfaceResized++;
mUpdateRenderThreadWaitCondition.Notify(lock);
}
}
+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();
uint64_t timeToSleepUntil = 0;
int extraFramesDropped = 0;
- const uint64_t memPoolInterval = mEnvironmentOptions.GetMemoryPoolInterval() * NANOSECONDS_PER_SECOND;
+ const uint64_t memPoolInterval = 1e9 * float(mEnvironmentOptions.GetMemoryPoolInterval());
const unsigned int renderToFboInterval = mEnvironmentOptions.GetRenderToFboInterval();
const bool renderToFboEnabled = 0u != renderToFboInterval;
void CombinedUpdateRenderController::PostRenderComplete()
{
- ConditionalWait::ScopedLock lock(mUpdateRenderThreadWaitCondition);
+ ConditionalWait::ScopedLock lock(mPostRenderWaitCondition);
mPostRendering = FALSE;
- mUpdateRenderThreadWaitCondition.Notify(lock);
+ mPostRenderWaitCondition.Notify(lock);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
void CombinedUpdateRenderController::PostRenderStarted()
{
- ConditionalWait::ScopedLock lock(mUpdateRenderThreadWaitCondition);
+ ConditionalWait::ScopedLock lock(mPostRenderWaitCondition);
mPostRendering = TRUE;
}
void CombinedUpdateRenderController::PostRenderWaitForCompletion()
{
- ConditionalWait::ScopedLock lock(mUpdateRenderThreadWaitCondition);
+ ConditionalWait::ScopedLock lock(mPostRenderWaitCondition);
while(mPostRendering &&
!mNewSurface && // We should NOT wait if we're replacing the surface
!mDeletedSurface && // We should NOT wait if we're deleting the surface
!mDestroyUpdateRenderThread)
{
- mUpdateRenderThreadWaitCondition.Wait(lock);
+ mPostRenderWaitCondition.Wait(lock);
}
}