From 14c281d47bf819645ba3645d2d423f29bfd57c7a Mon Sep 17 00:00:00 2001 From: "Eunki, Hong" Date: Tue, 7 May 2024 18:16:24 +0900 Subject: [PATCH] Set default level of log print + Clean up environment variables Define all environment values what dali-adaptor internally used at internal header. + Set level of DALI_LOG_~~~ as environment value Now we can ignore DALI_LOG_DEBUG_INFO at ubuntu platform. Change-Id: Ib564e442f457e475e526407f3872ed8d0965da45 Signed-off-by: Eunki, Hong --- dali/internal/adaptor/common/adaptor-impl.cpp | 6 ++-- dali/internal/graphics/gles/egl-implementation.cpp | 8 ++--- dali/internal/graphics/gles/gl-implementation.cpp | 10 +++--- .../tizen/native-image-source-queue-impl-tizen.cpp | 4 +-- dali/internal/system/android/logging-android.cpp | 37 ++++++++++++++++++++- .../system/common/async-task-manager-impl.cpp | 21 ++++++------ .../internal/system/common/environment-variables.h | 22 +++++++++++++ .../system/tizen-wayland/logging-tizen.cpp | 36 +++++++++++++++++++- dali/internal/system/ubuntu-x11/logging-x.cpp | 37 ++++++++++++++++++++- dali/internal/system/windows/logging-win.cpp | 38 +++++++++++++++++++++- .../plugin/font-client-plugin-cache-handler.cpp | 15 ++++----- .../plugin/font-face-cache-item.cpp | 11 +++---- .../trace/android/trace-manager-impl-android.cpp | 10 +++--- .../trace/generic/trace-manager-impl-generic.cpp | 10 +++--- .../streamline/trace-manager-impl-streamline.cpp | 8 ++--- .../trace/tizen/trace-manager-impl-tizen.cpp | 8 ++--- 16 files changed, 218 insertions(+), 63 deletions(-) diff --git a/dali/internal/adaptor/common/adaptor-impl.cpp b/dali/internal/adaptor/common/adaptor-impl.cpp index 7b5c5b3..a411c12 100644 --- a/dali/internal/adaptor/common/adaptor-impl.cpp +++ b/dali/internal/adaptor/common/adaptor-impl.cpp @@ -95,8 +95,6 @@ namespace 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) @@ -416,7 +414,7 @@ void Adaptor::Start() ProcessCoreEvents(); // Ensure any startup messages are processed. // Initialize the image loader plugin - auto enablePluginString = Dali::EnvironmentVariable::GetEnvironmentVariable(ENABLE_IMAGE_LOADER_PLUGIN_ENV); + auto enablePluginString = Dali::EnvironmentVariable::GetEnvironmentVariable(DALI_ENV_ENABLE_IMAGE_LOADER_PLUGIN); bool enablePlugin = enablePluginString ? std::atoi(enablePluginString) : false; if(enablePlugin) { @@ -540,7 +538,7 @@ void Adaptor::Stop() } // Destroy the image loader plugin - auto enablePluginString = Dali::EnvironmentVariable::GetEnvironmentVariable(ENABLE_IMAGE_LOADER_PLUGIN_ENV); + auto enablePluginString = Dali::EnvironmentVariable::GetEnvironmentVariable(DALI_ENV_ENABLE_IMAGE_LOADER_PLUGIN); bool enablePlugin = enablePluginString ? std::atoi(enablePluginString) : false; if(enablePlugin) { diff --git a/dali/internal/graphics/gles/egl-implementation.cpp b/dali/internal/graphics/gles/egl-implementation.cpp index b47898c..ab424cf 100644 --- a/dali/internal/graphics/gles/egl-implementation.cpp +++ b/dali/internal/graphics/gles/egl-implementation.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Samsung Electronics Co., Ltd. + * Copyright (c) 2024 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. @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -50,14 +51,11 @@ const char* EGL_KHR_CREATE_CONTEXT = "EGL_KHR_create_context const char* EGL_KHR_PARTIAL_UPDATE = "EGL_KHR_partial_update"; const char* EGL_KHR_SWAP_BUFFERS_WITH_DAMAGE = "EGL_KHR_swap_buffers_with_damage"; -// Threshold time in miliseconds -constexpr auto PERFORMANCE_LOG_THRESHOLD_TIME_ENV = "DALI_EGL_PERFORMANCE_LOG_THRESHOLD_TIME"; - DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_EGL, true); static uint32_t GetPerformanceLogThresholdTime() { - auto timeString = Dali::EnvironmentVariable::GetEnvironmentVariable(PERFORMANCE_LOG_THRESHOLD_TIME_ENV); + auto timeString = Dali::EnvironmentVariable::GetEnvironmentVariable(DALI_ENV_EGL_PERFORMANCE_LOG_THRESHOLD_TIME); uint32_t time = timeString ? static_cast(std::atoi(timeString)) : std::numeric_limits::max(); return time; } diff --git a/dali/internal/graphics/gles/gl-implementation.cpp b/dali/internal/graphics/gles/gl-implementation.cpp index ac45214..4a0bc42 100644 --- a/dali/internal/graphics/gles/gl-implementation.cpp +++ b/dali/internal/graphics/gles/gl-implementation.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Samsung Electronics Co., Ltd. + * Copyright (c) 2024 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. @@ -21,6 +21,9 @@ // EXTERNAL INCLUDES #include +// INTERNAL INCLUDES +#include + namespace Dali { namespace Internal @@ -54,12 +57,9 @@ static constexpr const char* OES_EGL_IMAGE_EXTERNAL_STRING = "#extension GL_OES_ static constexpr const char* OES_EGL_IMAGE_EXTERNAL_STRING_ESSL3 = "#extension GL_OES_EGL_image_external_essl3:require\n"; -// Threshold time in miliseconds -constexpr auto PERFORMANCE_LOG_THRESHOLD_TIME_ENV = "DALI_EGL_PERFORMANCE_LOG_THRESHOLD_TIME"; - static uint32_t GetPerformanceLogThresholdTime() { - auto timeString = Dali::EnvironmentVariable::GetEnvironmentVariable(PERFORMANCE_LOG_THRESHOLD_TIME_ENV); + auto timeString = Dali::EnvironmentVariable::GetEnvironmentVariable(DALI_ENV_EGL_PERFORMANCE_LOG_THRESHOLD_TIME); uint32_t time = timeString ? static_cast(std::atoi(timeString)) : std::numeric_limits::max(); return time; } diff --git a/dali/internal/imaging/tizen/native-image-source-queue-impl-tizen.cpp b/dali/internal/imaging/tizen/native-image-source-queue-impl-tizen.cpp index 602ce31..5307d34 100644 --- a/dali/internal/imaging/tizen/native-image-source-queue-impl-tizen.cpp +++ b/dali/internal/imaging/tizen/native-image-source-queue-impl-tizen.cpp @@ -29,6 +29,7 @@ #include #include #include +#include namespace Dali { @@ -57,11 +58,10 @@ const char* SAMPLER_TYPE = "samplerExternalOES"; constexpr int32_t NUM_FORMATS_BLENDING_REQUIRED = 18; constexpr int32_t DEFAULT_TBM_SURFACE_QUEUE_SIZE = 3u; -constexpr auto TBM_SURFACE_QUEUE_SIZE = "DALI_TBM_SURFACE_QUEUE_SIZE"; int32_t GetTbmSurfaceQueueSize() { - static auto queueSizeString = EnvironmentVariable::GetEnvironmentVariable(TBM_SURFACE_QUEUE_SIZE); + static auto queueSizeString = EnvironmentVariable::GetEnvironmentVariable(DALI_ENV_TBM_SURFACE_QUEUE_SIZE); static int32_t queueSize = queueSizeString ? std::atoi(queueSizeString) : DEFAULT_TBM_SURFACE_QUEUE_SIZE; return queueSize; } diff --git a/dali/internal/system/android/logging-android.cpp b/dali/internal/system/android/logging-android.cpp index 2ceb29f..9fa63cf 100644 --- a/dali/internal/system/android/logging-android.cpp +++ b/dali/internal/system/android/logging-android.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Samsung Electronics Co., Ltd. + * Copyright (c) 2024 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,15 +19,50 @@ #include // EXTERNAL INCLUDES +#include #include +// INTERNAL INCLUDES +#include + namespace Dali { namespace TizenPlatform { +namespace +{ +static Dali::Integration::Log::DebugPriority gPrintLogLevel = Dali::Integration::Log::DebugPriority::INFO; + +Dali::Integration::Log::DebugPriority GetAllowedPrintLogLevel() +{ + static bool gEnvironmentApplied = false; + + if(DALI_UNLIKELY(!gEnvironmentApplied)) + { + gEnvironmentApplied = true; + + const char* printLogLevel = Dali::EnvironmentVariable::GetEnvironmentVariable(DALI_ENV_PRINT_LOG_LEVEL); + if(printLogLevel) + { + auto logLevelInteger = std::strtoul(printLogLevel, nullptr, 10); + if(logLevelInteger >= static_cast(Dali::Integration::Log::DebugPriority::DEBUG) && logLevelInteger <= static_cast(Dali::Integration::Log::DebugPriority::ERROR)) + { + gPrintLogLevel = static_cast(logLevelInteger); + } + } + } + + return gPrintLogLevel; +} +} // namespace + void LogMessage(Dali::Integration::Log::DebugPriority level, std::string& message) { const char* DALI_TAG = "DALI"; + if(level < GetAllowedPrintLogLevel()) + { + return; + } switch(level) { diff --git a/dali/internal/system/common/async-task-manager-impl.cpp b/dali/internal/system/common/async-task-manager-impl.cpp index ab0c646..21d86b6 100644 --- a/dali/internal/system/common/async-task-manager-impl.cpp +++ b/dali/internal/system/common/async-task-manager-impl.cpp @@ -25,6 +25,9 @@ #include #include +// INTERNAL INCLUDES +#include + #include namespace Dali @@ -38,24 +41,22 @@ namespace constexpr auto FORCE_TRIGGER_THRESHOLD = 128u; ///< Trigger TasksCompleted() forcely if the number of completed task contain too much. constexpr auto DEFAULT_NUMBER_OF_ASYNC_THREADS = size_t{8u}; -constexpr auto NUMBER_OF_ASYNC_THREADS_ENV = "DALI_ASYNC_MANAGER_THREAD_POOL_SIZE"; // The number of threads for low priority task. constexpr auto DEFAULT_NUMBER_OF_LOW_PRIORITY_THREADS = size_t{6u}; -constexpr auto NUMBER_OF_LOW_PRIORITY_THREADS_ENV = "DALI_ASYNC_MANAGER_LOW_PRIORITY_THREAD_POOL_SIZE"; -size_t GetNumberOfThreads(const char* environmentVariable, size_t defaultValue) +size_t GetNumberOfThreads(size_t defaultValue) { - auto numberString = EnvironmentVariable::GetEnvironmentVariable(environmentVariable); + auto numberString = EnvironmentVariable::GetEnvironmentVariable(DALI_ENV_ASYNC_MANAGER_THREAD_POOL_SIZE); auto numberOfThreads = numberString ? std::strtoul(numberString, nullptr, 10) : 0; constexpr auto MAX_NUMBER_OF_THREADS = 16u; DALI_ASSERT_DEBUG(numberOfThreads <= MAX_NUMBER_OF_THREADS); return (numberOfThreads > 0 && numberOfThreads <= MAX_NUMBER_OF_THREADS) ? numberOfThreads : defaultValue; } -size_t GetNumberOfLowPriorityThreads(const char* environmentVariable, size_t defaultValue, size_t maxValue) +size_t GetNumberOfLowPriorityThreads(size_t defaultValue, size_t maxValue) { - auto numberString = EnvironmentVariable::GetEnvironmentVariable(environmentVariable); + auto numberString = EnvironmentVariable::GetEnvironmentVariable(DALI_ENV_ASYNC_MANAGER_LOW_PRIORITY_THREAD_POOL_SIZE); auto numberOfThreads = numberString ? std::strtoul(numberString, nullptr, 10) : 0; DALI_ASSERT_DEBUG(numberOfThreads <= maxValue); return (numberOfThreads > 0 && numberOfThreads <= maxValue) ? numberOfThreads : std::min(defaultValue, maxValue); @@ -608,8 +609,8 @@ Dali::AsyncTaskManager AsyncTaskManager::Get() } AsyncTaskManager::AsyncTaskManager() -: mTasks(GetNumberOfThreads(NUMBER_OF_ASYNC_THREADS_ENV, DEFAULT_NUMBER_OF_ASYNC_THREADS), [&]() { return TaskHelper(*this); }), - mAvaliableLowPriorityTaskCounts(GetNumberOfLowPriorityThreads(NUMBER_OF_LOW_PRIORITY_THREADS_ENV, DEFAULT_NUMBER_OF_LOW_PRIORITY_THREADS, mTasks.GetElementCount())), +: mTasks(GetNumberOfThreads(DEFAULT_NUMBER_OF_ASYNC_THREADS), [&]() { return TaskHelper(*this); }), + mAvaliableLowPriorityTaskCounts(GetNumberOfLowPriorityThreads(DEFAULT_NUMBER_OF_LOW_PRIORITY_THREADS, mTasks.GetElementCount())), mWaitingHighProirityTaskCounts(0u), mTrigger(new EventThreadCallback(MakeCallback(this, &AsyncTaskManager::TasksCompleted))), mTasksCompletedImpl(new TasksCompletedImpl(*this, mTrigger.get())), @@ -672,8 +673,8 @@ void AsyncTaskManager::AddTask(AsyncTaskPtr task) { Mutex::ScopedLock lock(mTasksMutex); - size_t count = mTasks.GetElementCount(); - size_t index = 0; + size_t count = mTasks.GetElementCount(); + size_t index = 0; while(index++ < count) { auto processHelperIt = mTasks.GetNext(); diff --git a/dali/internal/system/common/environment-variables.h b/dali/internal/system/common/environment-variables.h index 63ea73f..30c0102 100644 --- a/dali/internal/system/common/environment-variables.h +++ b/dali/internal/system/common/environment-variables.h @@ -151,9 +151,31 @@ namespace Adaptor #define DALI_ENV_DISABLE_VSYNC_RENDER "DALI_DISABLE_VSYNC_RENDER" +#define DALI_ENV_ENABLE_IMAGE_LOADER_PLUGIN "DALI_ENABLE_IMAGE_LOADER_PLUGIN" + +// Threshold time in miliseconds when we want to print the egl performance as a warning. +#define DALI_ENV_EGL_PERFORMANCE_LOG_THRESHOLD_TIME "DALI_EGL_PERFORMANCE_LOG_THRESHOLD_TIME" + +#define DALI_ENV_TBM_SURFACE_QUEUE_SIZE "DALI_TBM_SURFACE_QUEUE_SIZE" + +#define DALI_ENV_ASYNC_MANAGER_THREAD_POOL_SIZE "DALI_ASYNC_MANAGER_THREAD_POOL_SIZE" + +#define DALI_ENV_ASYNC_MANAGER_LOW_PRIORITY_THREAD_POOL_SIZE "DALI_ASYNC_MANAGER_LOW_PRIORITY_THREAD_POOL_SIZE" + +// Glyph Cache +#define DALI_ENV_MAX_NUMBER_OF_GLYPH_CACHE "DALI_GLYPH_CACHE_MAX" + +#define DALI_ENV_ENABLE_CACHE_RENDERED_GLYPH "DALI_ENABLE_CACHE_RENDERED_GLYPH" + +#define DALI_ENV_RENDERED_GLYPH_COMPRESS_POLICY "DALI_RENDERED_GLYPH_COMPRESS_POLICY" + // Debug relative environments #define DALI_ENV_CURLOPT_VERBOSE_MODE "DALI_CURLOPT_VERBOSE_MODE" +#define DALI_ENV_PRINT_LOG_LEVEL "DALI_PRINT_LOG_LEVEL" + +#define DALI_ENV_TRACE_ENABLE_PRINT_LOG "DALI_TRACE_ENABLE_PRINT_LOG" + } // namespace Adaptor } // namespace Internal diff --git a/dali/internal/system/tizen-wayland/logging-tizen.cpp b/dali/internal/system/tizen-wayland/logging-tizen.cpp index 5428f1a..b535cbc 100644 --- a/dali/internal/system/tizen-wayland/logging-tizen.cpp +++ b/dali/internal/system/tizen-wayland/logging-tizen.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Samsung Electronics Co., Ltd. + * Copyright (c) 2024 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. @@ -22,15 +22,49 @@ // Dlog uses C style casts internally #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wold-style-cast" +#include #include +// INTERNAL INCLUDES +#include + namespace Dali { namespace TizenPlatform { +namespace +{ +static Dali::Integration::Log::DebugPriority gPrintLogLevel = Dali::Integration::Log::DebugPriority::DEBUG; + +Dali::Integration::Log::DebugPriority GetAllowedPrintLogLevel() +{ + static bool gEnvironmentApplied = false; + + if(DALI_UNLIKELY(!gEnvironmentApplied)) + { + gEnvironmentApplied = true; + + const char* printLogLevel = Dali::EnvironmentVariable::GetEnvironmentVariable(DALI_ENV_PRINT_LOG_LEVEL); + if(printLogLevel) + { + auto logLevelInteger = std::strtoul(printLogLevel, nullptr, 10); + if(logLevelInteger >= static_cast(Dali::Integration::Log::DebugPriority::DEBUG) && logLevelInteger <= static_cast(Dali::Integration::Log::DebugPriority::ERROR)) + { + gPrintLogLevel = static_cast(logLevelInteger); + } + } + } + + return gPrintLogLevel; +} +} // namespace void LogMessage(Dali::Integration::Log::DebugPriority level, std::string& message) { const char* DALI_TAG = "DALI"; + if(level < GetAllowedPrintLogLevel()) + { + return; + } switch(level) { diff --git a/dali/internal/system/ubuntu-x11/logging-x.cpp b/dali/internal/system/ubuntu-x11/logging-x.cpp index 5ba89b6..4063aef 100644 --- a/dali/internal/system/ubuntu-x11/logging-x.cpp +++ b/dali/internal/system/ubuntu-x11/logging-x.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Samsung Electronics Co., Ltd. + * Copyright (c) 2024 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,17 +19,52 @@ #include // EXTERNAL INCLUDES +#include #include +// INTERNAL INCLUDES +#include + namespace Dali { namespace TizenPlatform { +namespace +{ +static Dali::Integration::Log::DebugPriority gPrintLogLevel = Dali::Integration::Log::DebugPriority::INFO; + +Dali::Integration::Log::DebugPriority GetAllowedPrintLogLevel() +{ + static bool gEnvironmentApplied = false; + + if(DALI_UNLIKELY(!gEnvironmentApplied)) + { + gEnvironmentApplied = true; + + const char* printLogLevel = Dali::EnvironmentVariable::GetEnvironmentVariable(DALI_ENV_PRINT_LOG_LEVEL); + if(printLogLevel) + { + auto logLevelInteger = std::strtoul(printLogLevel, nullptr, 10); + if(logLevelInteger >= static_cast(Dali::Integration::Log::DebugPriority::DEBUG) && logLevelInteger <= static_cast(Dali::Integration::Log::DebugPriority::ERROR)) + { + gPrintLogLevel = static_cast(logLevelInteger); + } + } + } + + return gPrintLogLevel; +} +} // namespace void LogMessage(Dali::Integration::Log::DebugPriority level, std::string& message) { const char* DALI_TAG = "DALI"; const char* format = NULL; + if(level < GetAllowedPrintLogLevel()) + { + return; + } + switch(level) { case Dali::Integration::Log::DEBUG: ///< Gray color diff --git a/dali/internal/system/windows/logging-win.cpp b/dali/internal/system/windows/logging-win.cpp index b3131bf..552330c 100644 --- a/dali/internal/system/windows/logging-win.cpp +++ b/dali/internal/system/windows/logging-win.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Samsung Electronics Co., Ltd. + * Copyright (c) 2024 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,17 +19,53 @@ #include // EXTERNAL INCLUDES +#include #include +// INTERNAL INCLUDES +#include + namespace Dali { namespace TizenPlatform { +namespace +{ +static Dali::Integration::Log::DebugPriority gPrintLogLevel = Dali::Integration::Log::DebugPriority::INFO; + +Dali::Integration::Log::DebugPriority GetAllowedPrintLogLevel() +{ + static bool gEnvironmentApplied = false; + + if(DALI_UNLIKELY(!gEnvironmentApplied)) + { + gEnvironmentApplied = true; + + const char* printLogLevel = Dali::EnvironmentVariable::GetEnvironmentVariable(DALI_ENV_PRINT_LOG_LEVEL); + if(printLogLevel) + { + auto logLevelInteger = std::strtoul(printLogLevel, nullptr, 10); + if(logLevelInteger >= static_cast(Dali::Integration::Log::DebugPriority::DEBUG) && logLevelInteger <= static_cast(Dali::Integration::Log::DebugPriority::ERROR)) + { + gPrintLogLevel = static_cast(logLevelInteger); + } + } + } + + return gPrintLogLevel; +} +} // namespace + void LogMessage(Dali::Integration::Log::DebugPriority level, std::string& message) { const char* DALI_TAG = "DALI"; const char* format = NULL; + if(level < GetAllowedPrintLogLevel()) + { + return; + } + switch(level) { case Dali::Integration::Log::DEBUG: ///< Gray color diff --git a/dali/internal/text/text-abstraction/plugin/font-client-plugin-cache-handler.cpp b/dali/internal/text/text-abstraction/plugin/font-client-plugin-cache-handler.cpp index d1d24a1..501bc5c 100644 --- a/dali/internal/text/text-abstraction/plugin/font-client-plugin-cache-handler.cpp +++ b/dali/internal/text/text-abstraction/plugin/font-client-plugin-cache-handler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Samsung Electronics Co., Ltd. + * Copyright (c) 2024 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. @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -81,7 +82,6 @@ extern Dali::Integration::Log::Filter* gFontClientLogFilter; namespace { - DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_FONT_PERFORMANCE_MARKER, false); /** @@ -100,8 +100,7 @@ constexpr auto MAX_NUMBER_OF_GLYPH_CACHE_ENV = "DALI_GLYPH_CACHE_MAX"; */ inline size_t GetMaxNumberOfGlyphCache() { - using Dali::EnvironmentVariable::GetEnvironmentVariable; - static auto numberString = GetEnvironmentVariable(MAX_NUMBER_OF_GLYPH_CACHE_ENV); + static auto numberString = Dali::EnvironmentVariable::GetEnvironmentVariable(DALI_ENV_MAX_NUMBER_OF_GLYPH_CACHE); static auto number = numberString ? std::strtoul(numberString, nullptr, 10) : DEFAULT_GLYPH_CACHE_MAX; return (number < MINIMUM_SIZE_OF_GLYPH_CACHE_MAX) ? MINIMUM_SIZE_OF_GLYPH_CACHE_MAX : number; } @@ -742,12 +741,12 @@ void FontClient::Plugin::CacheHandler::ValidateFont(const FontDescription& fontD if(matched && (nullptr != characterSet)) { - #if defined(TRACE_ENABLED) +#if defined(TRACE_ENABLED) if(gTraceFilter && gTraceFilter->IsTraceEnabled()) { DALI_LOG_DEBUG_INFO("DALI_TEXT_VALIDATE_FONT : FcFontMatch : %s, style : %s, %s, %s\n", fontDescription.family.c_str(), FontWidth::Name[fontDescription.width], FontWeight::Name[fontDescription.weight], FontSlant::Name[fontDescription.slant]); } - #endif +#endif // Add the path to the cache. description.type = FontDescription::FACE_FONT; @@ -825,12 +824,12 @@ void FontClient::Plugin::CacheHandler::CacheFallbackFontList(FontDescription&& DALI_TRACE_SCOPE(gTraceFilter, "DALI_TEXT_FALLBACK_FONTLIST"); - #if defined(TRACE_ENABLED) +#if defined(TRACE_ENABLED) if(gTraceFilter && gTraceFilter->IsTraceEnabled()) { DALI_LOG_DEBUG_INFO("DALI_TEXT_FALLBACK_FONTLIST : FcFontSort : %s\n", fontDescription.family.c_str()); } - #endif +#endif fontList = new FontList; characterSetList = new CharacterSetList; diff --git a/dali/internal/text/text-abstraction/plugin/font-face-cache-item.cpp b/dali/internal/text/text-abstraction/plugin/font-face-cache-item.cpp index c1d4bc8..18c5b97 100644 --- a/dali/internal/text/text-abstraction/plugin/font-face-cache-item.cpp +++ b/dali/internal/text/text-abstraction/plugin/font-face-cache-item.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Samsung Electronics Co., Ltd. + * Copyright (c) 2024 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,6 +19,7 @@ // INTERNAL HEADERS #include +#include #include #include @@ -44,7 +45,6 @@ constexpr float MAXIMUM_RATE_OF_BITMAP_GLYPH_CACHE_RESIZE = 1.5f; * @brief Behavior about cache the rendered glyph cache. */ constexpr bool DEFAULT_ENABLE_CACHE_RENDERED_GLYPH = true; -constexpr auto ENABLE_CACHE_RENDERED_GLYPH_ENV = "DALI_ENABLE_CACHE_RENDERED_GLYPH"; /** * @brief Get whether we allow to cache rendered glyph from environment. @@ -54,8 +54,7 @@ constexpr auto ENABLE_CACHE_RENDERED_GLYPH_ENV = "DALI_ENABLE_CACHE_RENDERED */ inline bool EnableCacheRenderedGlyph() { - using Dali::EnvironmentVariable::GetEnvironmentVariable; - static auto numberString = GetEnvironmentVariable(ENABLE_CACHE_RENDERED_GLYPH_ENV); + static auto numberString = Dali::EnvironmentVariable::GetEnvironmentVariable(DALI_ENV_ENABLE_CACHE_RENDERED_GLYPH); static auto number = numberString ? (std::strtoul(numberString, nullptr, 10) ? true : false) : DEFAULT_ENABLE_CACHE_RENDERED_GLYPH; return number; } @@ -70,7 +69,6 @@ constexpr auto DEFAULT_RENDERED_GLYPH_COMPRESS_POLICY = #else GlyphCacheManager::CompressionPolicyType::SPEED; // If not tizen target #endif -constexpr auto RENDERED_GLYPH_COMPRESS_POLICY_ENV = "DALI_RENDERED_GLYPH_COMPRESS_POLICY"; /** * @brief Get whether we allow to cache rendered glyph from environment. @@ -80,8 +78,7 @@ constexpr auto RENDERED_GLYPH_COMPRESS_POLICY_ENV = "DALI_RENDERED_GLYPH_COMPRES */ inline GlyphCacheManager::CompressionPolicyType GetRenderedGlyphCompressPolicy() { - using Dali::EnvironmentVariable::GetEnvironmentVariable; - static auto policyString = GetEnvironmentVariable(RENDERED_GLYPH_COMPRESS_POLICY_ENV); + static auto policyString = Dali::EnvironmentVariable::GetEnvironmentVariable(DALI_ENV_RENDERED_GLYPH_COMPRESS_POLICY); static auto policy = policyString ? policyString[0] == 's' || policyString[0] == 'S' ? GlyphCacheManager::CompressionPolicyType::SPEED : policyString[0] == 'm' || policyString[0] == 'M' ? GlyphCacheManager::CompressionPolicyType::MEMORY diff --git a/dali/internal/trace/android/trace-manager-impl-android.cpp b/dali/internal/trace/android/trace-manager-impl-android.cpp index c6dcc38..40dc8a4 100644 --- a/dali/internal/trace/android/trace-manager-impl-android.cpp +++ b/dali/internal/trace/android/trace-manager-impl-android.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Samsung Electronics Co., Ltd. + * Copyright (c) 2024 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. @@ -24,6 +24,7 @@ // INTERNAL INCLUDES #include +#include namespace Dali { @@ -33,9 +34,8 @@ namespace Adaptor { namespace { -const char* DALI_TRACE_ENABLE_PRINT_LOG_ENV = "DALI_TRACE_ENABLE_PRINT_LOG"; -const char* EMPTY_TAG = "(null)"; -static bool gTraceManagerEnablePrintLog = false; +const char* EMPTY_TAG = "(null)"; +static bool gTraceManagerEnablePrintLog = false; } // namespace TraceManagerAndroid* TraceManagerAndroid::traceManagerAndroid = nullptr; @@ -43,7 +43,7 @@ TraceManagerAndroid* TraceManagerAndroid::traceManagerAndroid = nullptr; TraceManagerAndroid::TraceManagerAndroid(PerformanceInterface* performanceInterface) : TraceManager(performanceInterface) { - const char* enablePrintLog = Dali::EnvironmentVariable::GetEnvironmentVariable(DALI_TRACE_ENABLE_PRINT_LOG_ENV); + const char* enablePrintLog = Dali::EnvironmentVariable::GetEnvironmentVariable(DALI_ENV_TRACE_ENABLE_PRINT_LOG); if(enablePrintLog && std::atoi(enablePrintLog) != 0) { gTraceManagerEnablePrintLog = true; diff --git a/dali/internal/trace/generic/trace-manager-impl-generic.cpp b/dali/internal/trace/generic/trace-manager-impl-generic.cpp index 8fc85b9..912e0c7 100644 --- a/dali/internal/trace/generic/trace-manager-impl-generic.cpp +++ b/dali/internal/trace/generic/trace-manager-impl-generic.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Samsung Electronics Co., Ltd. + * Copyright (c) 2024 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. @@ -24,6 +24,7 @@ // INTERNAL INCLUDES #include +#include namespace Dali { @@ -33,9 +34,8 @@ namespace Adaptor { namespace { -const char* DALI_TRACE_ENABLE_PRINT_LOG_ENV = "DALI_TRACE_ENABLE_PRINT_LOG"; -const char* EMPTY_TAG = "(null)"; -static bool gTraceManagerEnablePrintLog = false; +const char* EMPTY_TAG = "(null)"; +static bool gTraceManagerEnablePrintLog = false; } // namespace TraceManagerGeneric* TraceManagerGeneric::traceManagerGeneric = nullptr; @@ -43,7 +43,7 @@ TraceManagerGeneric* TraceManagerGeneric::traceManagerGeneric = nullptr; TraceManagerGeneric::TraceManagerGeneric(PerformanceInterface* performanceInterface) : TraceManager(performanceInterface) { - const char* enablePrintLog = Dali::EnvironmentVariable::GetEnvironmentVariable(DALI_TRACE_ENABLE_PRINT_LOG_ENV); + const char* enablePrintLog = Dali::EnvironmentVariable::GetEnvironmentVariable(DALI_ENV_TRACE_ENABLE_PRINT_LOG); if(enablePrintLog && std::atoi(enablePrintLog) != 0) { gTraceManagerEnablePrintLog = true; diff --git a/dali/internal/trace/streamline/trace-manager-impl-streamline.cpp b/dali/internal/trace/streamline/trace-manager-impl-streamline.cpp index 63536d5..a635153 100644 --- a/dali/internal/trace/streamline/trace-manager-impl-streamline.cpp +++ b/dali/internal/trace/streamline/trace-manager-impl-streamline.cpp @@ -24,6 +24,7 @@ // INTERNAL INCLUDES #include +#include #include ANNOTATE_DEFINE; @@ -32,9 +33,8 @@ namespace Dali::Internal::Adaptor { namespace { -const char* DALI_TRACE_ENABLE_PRINT_LOG_ENV = "DALI_TRACE_ENABLE_PRINT_LOG"; -const char* EMPTY_TAG = "(null)"; -bool gTraceManagerEnablePrintLog = false; +const char* EMPTY_TAG = "(null)"; +bool gTraceManagerEnablePrintLog = false; } // namespace TraceManagerStreamline* TraceManagerStreamline::traceManagerStreamline = nullptr; @@ -43,7 +43,7 @@ TraceManagerStreamline::TraceManagerStreamline(PerformanceInterface* performance : TraceManager(performanceInterface) { ANNOTATE_SETUP; - const char* enablePrintLog = Dali::EnvironmentVariable::GetEnvironmentVariable(DALI_TRACE_ENABLE_PRINT_LOG_ENV); + const char* enablePrintLog = Dali::EnvironmentVariable::GetEnvironmentVariable(DALI_ENV_TRACE_ENABLE_PRINT_LOG); if(enablePrintLog && std::atoi(enablePrintLog) != 0) { gTraceManagerEnablePrintLog = true; diff --git a/dali/internal/trace/tizen/trace-manager-impl-tizen.cpp b/dali/internal/trace/tizen/trace-manager-impl-tizen.cpp index 8061215..23988ec 100644 --- a/dali/internal/trace/tizen/trace-manager-impl-tizen.cpp +++ b/dali/internal/trace/tizen/trace-manager-impl-tizen.cpp @@ -24,6 +24,7 @@ // INTERNAL INCLUDES #include +#include namespace Dali { @@ -33,16 +34,15 @@ namespace Adaptor { namespace { -const char* DALI_TRACE_ENABLE_PRINT_LOG_ENV = "DALI_TRACE_ENABLE_PRINT_LOG"; -const char* EMPTY_TAG = "(null)"; -static bool gTraceManagerEnablePrintLog = false; +const char* EMPTY_TAG = "(null)"; +static bool gTraceManagerEnablePrintLog = false; } // namespace TraceManagerTizen::TraceManagerTizen(PerformanceInterface* performanceInterface) : TraceManager(performanceInterface) { - const char* enablePrintLog = Dali::EnvironmentVariable::GetEnvironmentVariable(DALI_TRACE_ENABLE_PRINT_LOG_ENV); + const char* enablePrintLog = Dali::EnvironmentVariable::GetEnvironmentVariable(DALI_ENV_TRACE_ENABLE_PRINT_LOG); if(enablePrintLog && std::atoi(enablePrintLog) != 0) { gTraceManagerEnablePrintLog = true; -- 2.7.4