/*
- * 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/integration-api/input-options.h>
#include <dali/integration-api/processor-interface.h>
#include <dali/integration-api/profiling.h>
+#include <dali/integration-api/trace.h>
#include <dali/public-api/actors/layer.h>
#include <dali/public-api/events/wheel-event.h>
#include <dali/public-api/object/any.h>
#include <dali/internal/window-system/common/event-handler.h>
#include <dali/internal/window-system/common/window-impl.h>
#include <dali/internal/window-system/common/window-render-surface.h>
+#include <dali/internal/window-system/common/window-system.h>
#include <dali/devel-api/adaptor-framework/accessibility-bridge.h>
#include <dali/internal/system/common/logging.h>
#include <dali/internal/imaging/common/image-loader.h>
#include <dali/internal/system/common/locale-utils.h>
+#include <dali/devel-api/adaptor-framework/environment-variable.h>
#include <dali/internal/system/common/configuration-manager.h>
#include <dali/internal/system/common/environment-variables.h>
{
thread_local Adaptor* gThreadLocalAdaptor = NULL; // raw thread specific pointer to allow Adaptor::Get
+DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_PERFORMANCE_MARKER, false);
+
+const char* ENABLE_IMAGE_LOADER_PLUGIN_ENV = "DALI_ENABLE_IMAGE_LOADER_PLUGIN";
} // unnamed namespace
Dali::Adaptor* Adaptor::New(Dali::Integration::SceneHolder window, Dali::RenderSurfaceInterface* surface, EnvironmentOptions* environmentOptions, ThreadMode threadMode)
if(0 != dir_err && errno != EEXIST)
{
DALI_LOG_ERROR("Error creating system cache directory: %s!\n", systemCachePath.c_str());
- exit(1);
}
}
dpiHor = dpiVer = 0;
defaultWindow->GetSurface()->GetDpi(dpiHor, dpiVer);
-
- // set the DPI value for font rendering
- FontClient fontClient = FontClient::Get();
- fontClient.SetDpi(dpiHor, dpiVer);
+ Dali::Internal::Adaptor::WindowSystem::SetDpi(dpiHor, dpiVer);
// Initialize the thread controller
mThreadController->Initialize();
ProcessCoreEvents(); // Ensure any startup messages are processed.
// Initialize the image loader plugin
- Internal::Adaptor::ImageLoaderPluginProxy::Initialize();
+ auto enablePluginString = Dali::EnvironmentVariable::GetEnvironmentVariable(ENABLE_IMAGE_LOADER_PLUGIN_ENV);
+ bool enablePlugin = enablePluginString ? std::atoi(enablePluginString) : false;
+ if(enablePlugin)
+ {
+ Internal::Adaptor::ImageLoaderPluginProxy::Initialize();
+ }
for(ObserverContainer::iterator iter = mObservers.begin(), endIter = mObservers.end(); iter != endIter; ++iter)
{
}
// Destroy the image loader plugin
- Internal::Adaptor::ImageLoaderPluginProxy::Destroy();
+ auto enablePluginString = Dali::EnvironmentVariable::GetEnvironmentVariable(ENABLE_IMAGE_LOADER_PLUGIN_ENV);
+ bool enablePlugin = enablePluginString ? std::atoi(enablePluginString) : false;
+ if(enablePlugin)
+ {
+ Internal::Adaptor::ImageLoaderPluginProxy::Destroy();
+ }
delete mNotificationTrigger;
mNotificationTrigger = NULL;
mPerformanceInterface->AddMarker(PerformanceInterface::PROCESS_EVENTS_START);
}
-#if !defined(DALI_PROFILE_UBUNTU) && !defined(DALI_PROFILE_LIBUV_X11)
- DALI_LOG_RELEASE_INFO("Start ProcessEvents\n");
-#endif
+ DALI_TRACE_BEGIN(gTraceFilter, "DALI_PROCESS_CORE_EVENTS");
mCore->ProcessEvents();
-#if !defined(DALI_PROFILE_UBUNTU) && !defined(DALI_PROFILE_LIBUV_X11)
- DALI_LOG_RELEASE_INFO("End ProcessEvents\n");
-#endif
+ DALI_TRACE_END(gTraceFilter, "DALI_PROCESS_CORE_EVENTS");
if(mPerformanceInterface)
{
}
}
-void Adaptor::RequestUpdate(bool forceUpdate)
+void Adaptor::RequestUpdate()
{
switch(mState)
{
case PAUSED:
case PAUSED_WHILE_HIDDEN:
{
- if(forceUpdate)
- {
- // Update (and resource upload) without rendering
- mThreadController->RequestUpdateOnce(UpdateMode::SKIP_RENDER);
- }
+ // Update (and resource upload) without rendering
+ mThreadController->RequestUpdateOnce(UpdateMode::SKIP_RENDER);
break;
}
default:
}
}
-void Adaptor::RequestProcessEventsOnIdle(bool forceProcess)
+void Adaptor::RequestProcessEventsOnIdle()
{
- // Only request a notification if the Adaptor is actually running
- // and we haven't installed the idle notification
- if((!mNotificationOnIdleInstalled) && (RUNNING == mState || READY == mState || forceProcess))
+ // Only request a notification if we haven't installed the idle notification
+ // We want to run the processes even when paused
+ if(!mNotificationOnIdleInstalled && STOPPED != mState)
{
- mNotificationOnIdleInstalled = AddIdleEnterer(MakeCallback(this, &Adaptor::ProcessCoreEventsFromIdle), forceProcess);
+ mNotificationOnIdleInstalled = AddIdleEnterer(MakeCallback(this, &Adaptor::ProcessCoreEventsFromIdle), true);
}
}
void Adaptor::OnDamaged(const DamageArea& area)
{
// This is needed for the case where Dali window is partially obscured
- RequestUpdate(false);
+ RequestUpdate();
}
void Adaptor::SurfaceResizePrepare(Dali::RenderSurfaceInterface* surface, SurfaceSize surfaceSize)
ProcessCoreEvents();
}
+void Adaptor::IncreaseSurfaceResizeCounter()
+{
+ // Nofify surface resizing before flushing event queue
+ if(mThreadController)
+ {
+ mThreadController->ResizeSurface();
+ }
+}
+
void Adaptor::NotifySceneCreated()
{
GetCore().SceneCreated();
return mConfigurationManager->IsMultipleWindowSupported();
}
+int32_t Adaptor::GetRenderThreadId() const
+{
+ if(mThreadController)
+ {
+ return mThreadController->GetThreadId();
+ }
+ return 0;
+}
+
void Adaptor::RequestUpdateOnce()
{
if(mThreadController)