From: Heeyong Song Date: Wed, 26 Apr 2023 06:52:47 +0000 (+0900) Subject: Add performance check logs X-Git-Tag: dali_2.2.24~1^2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git;a=commitdiff_plain;h=039437bf85671eea630c5427a51beaf4e71e1bc3 Add performance check logs Change-Id: Ib4c0cb4addb4356645ace5297d5b1217d4884cc5 --- diff --git a/dali/internal/graphics/gles/egl-implementation.cpp b/dali/internal/graphics/gles/egl-implementation.cpp index e389671..feea271 100644 --- a/dali/internal/graphics/gles/egl-implementation.cpp +++ b/dali/internal/graphics/gles/egl-implementation.cpp @@ -191,6 +191,9 @@ bool EglImplementation::InitializeGles(EGLNativeDisplayType display, bool isOwnS mPartialUpdateRequired = false; } + mLogThreshold = GetPerformanceLogThresholdTime(); + mLogEnabled = mLogThreshold > 0 ? true : false; + mGlesInitialized = true; // We want to display this information all the time, so use the LogMessage directly @@ -395,6 +398,12 @@ void EglImplementation::SwapBuffers(EGLSurface& eglSurface) { if(eglSurface != EGL_NO_SURFACE) // skip if using surfaceless context { + uint32_t startTime = 0, endTime = 0; + if(mLogEnabled) + { + startTime = TimeService::GetMilliSeconds(); + } + #ifndef DALI_PROFILE_UBUNTU if(mSwapBufferCountAfterResume < THRESHOLD_SWAPBUFFER_COUNT) { @@ -414,16 +423,22 @@ void EglImplementation::SwapBuffers(EGLSurface& eglSurface) mSwapBufferCountAfterResume++; } #endif //DALI_PROFILE_UBUNTU + + if(mLogEnabled) + { + endTime = TimeService::GetMilliSeconds(); + if(endTime - startTime > mLogThreshold) + { + DALI_LOG_DEBUG_INFO("eglSwapBuffers takes long time! [%u ms]\n", endTime - startTime); + } + } } } EGLint EglImplementation::GetBufferAge(EGLSurface& eglSurface) const { - static uint32_t logThreshold = GetPerformanceLogThresholdTime(); - static bool logEnabled = logThreshold > 0 ? true : false; - - uint32_t startTime, endTime; - if(logEnabled) + uint32_t startTime = 0, endTime = 0; + if(mLogEnabled) { startTime = TimeService::GetMilliSeconds(); } @@ -436,10 +451,10 @@ EGLint EglImplementation::GetBufferAge(EGLSurface& eglSurface) const age = 0; } - if(logEnabled) + if(mLogEnabled) { endTime = TimeService::GetMilliSeconds(); - if(endTime - startTime > logThreshold) + if(endTime - startTime > mLogThreshold) { DALI_LOG_DEBUG_INFO("eglQuerySurface takes long time! [%u ms]\n", endTime - startTime); } @@ -474,6 +489,12 @@ void EglImplementation::SwapBuffers(EGLSurface& eglSurface, const std::vector mLogThreshold) + { + DALI_LOG_DEBUG_INFO("eglSwapBuffersWithDamageKHR takes long time! [%u ms]\n", endTime - startTime); + } + } } } diff --git a/dali/internal/graphics/gles/egl-implementation.h b/dali/internal/graphics/gles/egl-implementation.h index 7712658..bee38dc 100644 --- a/dali/internal/graphics/gles/egl-implementation.h +++ b/dali/internal/graphics/gles/egl-implementation.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_EGL_IMPLEMENTATION_H /* - * Copyright (c) 2021 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. @@ -259,8 +259,9 @@ private: typedef std::vector EglWindowSurfaceContainer; EglWindowSurfaceContainer mEglWindowSurfaces; ///< The EGL surface for the window - int32_t mMultiSamplingLevel; - int32_t mGlesVersion; + int32_t mMultiSamplingLevel; + int32_t mGlesVersion; + uint32_t mLogThreshold{0}; ColorDepth mColorDepth; @@ -272,6 +273,7 @@ private: bool mPartialUpdateRequired; bool mIsSurfacelessContextSupported; bool mIsKhrCreateContextSupported; + bool mLogEnabled{false}; uint32_t mSwapBufferCountAfterResume; PFNEGLSETDAMAGEREGIONKHRPROC mEglSetDamageRegionKHR; diff --git a/dali/internal/graphics/gles/gl-implementation.h b/dali/internal/graphics/gles/gl-implementation.h index 5dac669..2d41b7d 100644 --- a/dali/internal/graphics/gles/gl-implementation.h +++ b/dali/internal/graphics/gles/gl-implementation.h @@ -30,10 +30,12 @@ #include // INTERNAL INCLUDES +#include #include #include #include #include +#include namespace Dali { @@ -68,6 +70,16 @@ 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"; + +uint32_t GetPerformanceLogThresholdTime() +{ + auto timeString = Dali::EnvironmentVariable::GetEnvironmentVariable(PERFORMANCE_LOG_THRESHOLD_TIME_ENV); + uint32_t time = timeString ? static_cast(std::atoi(timeString)) : 0u; + return time; +} + } // namespace /** @@ -170,6 +182,9 @@ public: } } + mLogThreshold = GetPerformanceLogThresholdTime(); + mLogEnabled = mLogThreshold > 0 ? true : false; + { ConditionalWait::ScopedLock lock(mContextCreatedWaitCondition); mIsContextCreated = true; @@ -540,7 +555,22 @@ public: void Clear(GLbitfield mask) override { + uint32_t startTime = 0, endTime = 0; + if(mLogEnabled) + { + startTime = TimeService::GetMilliSeconds(); + } + glClear(mask); + + if(mLogEnabled) + { + endTime = TimeService::GetMilliSeconds(); + if(endTime - startTime > mLogThreshold) + { + DALI_LOG_DEBUG_INFO("glClear takes long time! [%u ms]\n", endTime - startTime); + } + } } void ClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) override @@ -1722,9 +1752,11 @@ private: std::string mFragmentShaderPrefix; int32_t mGlesVersion; int32_t mShadingLanguageVersion; + uint32_t mLogThreshold{0}; bool mShadingLanguageVersionCached; bool mIsSurfacelessContextSupported; bool mIsContextCreated; + bool mLogEnabled{false}; }; } // namespace Adaptor