From 32f46e17d3b621e09438aa36325a1681f198c7df Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Fri, 15 Oct 2021 16:13:06 -0700 Subject: [PATCH 1/4] SL-16027: Fix SL-15962 breaking Tracy OpenGL. Can now log memory + OpenGL in Tracy at the same time. --- doc/contributions.txt | 1 + indra/llcommon/linden_common.h | 2 +- indra/llcommon/llmemory.h | 4 ++-- indra/llwindow/llwindowwin32.cpp | 4 ++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/doc/contributions.txt b/doc/contributions.txt index a8deb9c2ae..ca42aedfc4 100755 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -271,6 +271,7 @@ Beq Janus SL-14766 SL-14927 SL-15709 + SL-16027 Beth Walcher Bezilon Kasei Biancaluce Robbiani diff --git a/indra/llcommon/linden_common.h b/indra/llcommon/linden_common.h index a228fd22be..bb7fd9a868 100644 --- a/indra/llcommon/linden_common.h +++ b/indra/llcommon/linden_common.h @@ -28,7 +28,7 @@ #define LL_LINDEN_COMMON_H #include "llprofiler.h" -#if TRACY_ENABLE && !defined(LL_PROFILER_ENABLE_TRACY_OPENGL) // hooks for memory profiling +#if TRACY_ENABLE // hooks for memory profiling void *tracy_aligned_malloc(size_t size, size_t alignment); void tracy_aligned_free(void *memblock); #define _aligned_malloc(X, Y) tracy_aligned_malloc((X), (Y)) diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h index 24f86cc11e..abed23bf01 100644 --- a/indra/llcommon/llmemory.h +++ b/indra/llcommon/llmemory.h @@ -114,7 +114,7 @@ template T* LL_NEXT_ALIGNED_ADDRESS_64(T* address) inline void* ll_aligned_malloc_fallback( size_t size, int align ) { #if defined(LL_WINDOWS) - return _aligned_malloc(size, align); + return (_aligned_malloc)(size, align); #else char* aligned = NULL; void* mem = malloc( size + (align - 1) + sizeof(void*) ); @@ -132,7 +132,7 @@ template T* LL_NEXT_ALIGNED_ADDRESS_64(T* address) inline void ll_aligned_free_fallback( void* ptr ) { #if defined(LL_WINDOWS) - _aligned_free(ptr); + (_aligned_free)(ptr); #else if (ptr) { diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 1b8881cc86..0a6eef072b 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -1748,8 +1748,6 @@ const S32 max_format = (S32)num_formats - 1; return FALSE; } - LL_PROFILER_GPU_CONTEXT - if (!gGLManager.initGL()) { close(); @@ -1757,6 +1755,8 @@ const S32 max_format = (S32)num_formats - 1; return FALSE; } + LL_PROFILER_GPU_CONTEXT + // Disable vertical sync for swap if (disable_vsync && wglSwapIntervalEXT) { From 6b699452af4d7b68c6dd357af40d92fcd05c38ab Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Fri, 15 Oct 2021 16:22:20 -0700 Subject: [PATCH 2/4] SL-15709: Fix typo in macro name --- indra/llcommon/llprofiler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/llcommon/llprofiler.h b/indra/llcommon/llprofiler.h index 195fd22f91..4e365de73e 100644 --- a/indra/llcommon/llprofiler.h +++ b/indra/llcommon/llprofiler.h @@ -76,8 +76,8 @@ #define LL_RECORD_BLOCK_TIME(name) const LLTrace::BlockTimer& LL_GLUE_TOKENS(block_time_recorder, __LINE__)(LLTrace::timeThisBlock(name)); (void)LL_GLUE_TOKENS(block_time_recorder, __LINE__); #define LL_PROFILE_ZONE_NAMED(name) // LL_PROFILE_ZONE_NAMED is a no-op when Tracy is disabled + #define LL_PROFILE_ZONE_NAMED_COLOR(name,color) // LL_RECORD_BLOCK_TIME(name) #define LL_PROFILE_ZONE_SCOPED // LL_PROFILE_ZONE_SCOPED is a no-op when Tracy is disabled - #define LL_PROFILE_ZONE_COLOR(name,color) // LL_RECORD_BLOCK_TIME(name) #define LL_PROFILE_ZONE_NUM( val ) (void)( val ); // Not supported #define LL_PROFILE_ZONE_TEXT( text, size ) (void)( text ); void( size ); // Not supported From 802c50649441849fe662f2c434da6bce4418646e Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Mon, 25 Oct 2021 15:51:35 -0600 Subject: [PATCH 3/4] SL-16246 protect null deference --- indra/newview/llappviewer.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 230fc5a00d..9b6cbc72ee 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -865,8 +865,6 @@ bool LLAppViewer::init() LLNotifications::instance(); LL_INFOS("InitInfo") << "Notifications initialized." << LL_ENDL ; - writeSystemInfo(); - ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// @@ -987,6 +985,9 @@ bool LLAppViewer::init() initWindow(); LL_INFOS("InitInfo") << "Window is initialized." << LL_ENDL ; + // writeSystemInfo can be called after window is initialized (gViewerWindow non-null) + writeSystemInfo(); + // initWindow also initializes the Feature List, so now we can initialize this global. LLCubeMap::sUseCubeMaps = LLFeatureManager::getInstance()->isFeatureAvailable("RenderCubeMap"); @@ -3551,12 +3552,15 @@ void LLAppViewer::writeSystemInfo() gDebugInfo["FirstLogin"] = LLSD::Boolean(gAgent.isFirstLogin()); gDebugInfo["FirstRunThisInstall"] = gSavedSettings.getBOOL("FirstRunThisInstall"); gDebugInfo["StartupState"] = LLStartUp::getStartupStateString(); - - std::vector resolutions = gViewerWindow->getWindow()->getDisplaysResolutionList(); - for (auto res_iter : resolutions) - { - gDebugInfo["DisplayInfo"].append(res_iter); - } + + if (gViewerWindow) + { + std::vector resolutions = gViewerWindow->getWindow()->getDisplaysResolutionList(); + for (auto res_iter : resolutions) + { + gDebugInfo["DisplayInfo"].append(res_iter); + } + } writeDebugInfo(); // Save out debug_info.log early, in case of crash. } From 019bf999cd8302252d12f7e3d1ef69d25af0c628 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Tue, 26 Oct 2021 18:07:31 -0700 Subject: [PATCH 4/4] SL-15709: Add missing macros when no profiling is set --- indra/llcommon/llprofiler.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/indra/llcommon/llprofiler.h b/indra/llcommon/llprofiler.h index 4e365de73e..cfa74483a0 100644 --- a/indra/llcommon/llprofiler.h +++ b/indra/llcommon/llprofiler.h @@ -106,7 +106,21 @@ #endif #else #define LL_PROFILER_FRAME_END - #define LL_PROFILER_SET_THREAD_NAME( name ) (void)(name) + #define LL_PROFILER_SET_THREAD_NAME(name) + #define LL_PROFILER_THREAD_BEGIN(name) + #define LL_PROFILER_THREAD_END(name) + + #define LL_RECORD_BLOCK_TIME(name) + #define LL_PROFILE_ZONE_NAMED(name) + #define LL_PROFILE_ZONE_NAMED_COLOR(name,color) + #define LL_PROFILE_ZONE_SCOPED + + #define LL_PROFILE_ZONE_NUM(val) + #define LL_PROFILE_ZONE_TEXT(text, size) + + #define LL_PROFILE_ZONE_ERR(name) + #define LL_PROFILE_ZONE_INFO(name) + #define LL_PROFILE_ZONE_WARN(name) #endif // LL_PROFILER #endif // LL_PROFILER_H