From 5553d614211998b5a10529f6b3ec68d2b25dc07a Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 22 Oct 2021 17:01:33 +0000 Subject: SL-16203 Fix for wonky handling of mouse deltas. --- indra/llcommon/llsingleton.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llcommon/llsingleton.h') diff --git a/indra/llcommon/llsingleton.h b/indra/llcommon/llsingleton.h index 7c81d65a8b..2e43a3cbed 100644 --- a/indra/llcommon/llsingleton.h +++ b/indra/llcommon/llsingleton.h @@ -455,6 +455,7 @@ public: static DERIVED_TYPE* getInstance() { + LL_PROFILE_ZONE_SCOPED; // We know the viewer has LLSingleton dependency circularities. If you // feel strongly motivated to eliminate them, cheers and good luck. // (At that point we could consider a much simpler locking mechanism.) -- cgit v1.2.3 From 8d20480c5f77fe1fab8149d3cda79bdd61e77656 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 28 Oct 2021 18:06:21 +0000 Subject: SL-16148 SL-16244 SL-16270 SL-16253 Remove most BlockTimers, remove LLMemTracked, introduce alignas, hook most/all reamining allocs, disable synchronous occlusion, and convert frequently accessed LLSingletons to LLSimpleton --- indra/llcommon/llsingleton.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'indra/llcommon/llsingleton.h') diff --git a/indra/llcommon/llsingleton.h b/indra/llcommon/llsingleton.h index 2e43a3cbed..10a8ecfedb 100644 --- a/indra/llcommon/llsingleton.h +++ b/indra/llcommon/llsingleton.h @@ -839,4 +839,30 @@ private: \ /* LLSINGLETON() is carefully implemented to permit exactly this */ \ LLSINGLETON_C11(DERIVED_CLASS) {} +// Relatively unsafe singleton implementation that is much faster +// and simpler than LLSingleton, but has no dependency tracking +// or inherent thread safety and requires manual invocation of +// createInstance before first use. +template +class LLSimpleton +{ +public: + static T* sInstance; + + static void createInstance() + { + llassert(sInstance == nullptr); + sInstance = new T(); + } + + static inline T* getInstance() { return sInstance; } + static inline T& instance() { return *getInstance(); } + static inline bool instanceExists() { return sInstance != nullptr; } + + static void deleteSingleton() { + delete sInstance; + sInstance = nullptr; + } +}; + #endif -- cgit v1.2.3 From 8458ad8890cf0a11804996210d7bcfbdaa3eec2e Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 4 Nov 2021 16:40:05 -0400 Subject: SL-16202: Instantiate LLSimpleton::sInstance generically instead of requiring a separate declaration for each subclass. The previous way produces errors in clang. --- indra/llcommon/llsingleton.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/llcommon/llsingleton.h') diff --git a/indra/llcommon/llsingleton.h b/indra/llcommon/llsingleton.h index 10a8ecfedb..24d01812c9 100644 --- a/indra/llcommon/llsingleton.h +++ b/indra/llcommon/llsingleton.h @@ -865,4 +865,7 @@ public: } }; +template +T* LLSimpleton::sInstance{ nullptr }; + #endif -- cgit v1.2.3 From ff5496239bffadaca111b1e4380a01447f85843a Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 5 Nov 2021 12:33:31 -0400 Subject: SL-16202: Use WorkQueue::postTo() for texture create/post handshake. That is, when LLViewerFetchedTexture::scheduleCreateTexture() wants to call createTexture() on the LLImageGLThread, but postCreateTexture() on the main thread, use the "mainloop" WorkQueue to set up the handshake. Give ThreadPool a public virtual run() method so a subclass can override with desired behavior. This necessitates a virtual destructor. Add accessors for embedded WorkQueue (for post calls), ThreadPool name and width (in threads). Allow LLSimpleton::createInstance() to forward arguments to the subject constructor. Make LLImageGLThread an LLSimpleton - that abstraction didn't yet exist at the time LLImageGLThread was coded. Also derive from ThreadPool rather than LLThread. Make it a single-thread "pool" with a very large queue capacity. --- indra/llcommon/llsingleton.h | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'indra/llcommon/llsingleton.h') diff --git a/indra/llcommon/llsingleton.h b/indra/llcommon/llsingleton.h index 24d01812c9..fdd5bdfea9 100644 --- a/indra/llcommon/llsingleton.h +++ b/indra/llcommon/llsingleton.h @@ -847,22 +847,24 @@ template class LLSimpleton { public: - static T* sInstance; - - static void createInstance() - { + template + static void createInstance(ARGS&&... args) + { llassert(sInstance == nullptr); - sInstance = new T(); + sInstance = new T(std::forward(args)...); } - + static inline T* getInstance() { return sInstance; } static inline T& instance() { return *getInstance(); } static inline bool instanceExists() { return sInstance != nullptr; } - static void deleteSingleton() { - delete sInstance; - sInstance = nullptr; + static void deleteSingleton() { + delete sInstance; + sInstance = nullptr; } + +private: + static T* sInstance; }; template -- cgit v1.2.3 From 75110629de7786d667ea7c90b025f97c22650316 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 11 Nov 2021 10:23:16 -0500 Subject: SL-16094: Stylish braces! --- indra/llcommon/llsingleton.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/llcommon/llsingleton.h') diff --git a/indra/llcommon/llsingleton.h b/indra/llcommon/llsingleton.h index fdd5bdfea9..6042c0906c 100644 --- a/indra/llcommon/llsingleton.h +++ b/indra/llcommon/llsingleton.h @@ -858,7 +858,8 @@ public: static inline T& instance() { return *getInstance(); } static inline bool instanceExists() { return sInstance != nullptr; } - static void deleteSingleton() { + static void deleteSingleton() + { delete sInstance; sInstance = nullptr; } -- cgit v1.2.3 From 029b41c0419e975bbb28454538b46dc69ce5d2ba Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Mon, 15 Nov 2021 09:25:35 -0700 Subject: Revert "SL-16220: Merge branch 'origin/DRTVWR-546' into glthread" This reverts commit 5188a26a8521251dda07ac0140bb129f28417e49, reversing changes made to 819088563e13f1d75e048311fbaf0df4a79b7e19. --- indra/llcommon/llsingleton.h | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'indra/llcommon/llsingleton.h') diff --git a/indra/llcommon/llsingleton.h b/indra/llcommon/llsingleton.h index 6042c0906c..10a8ecfedb 100644 --- a/indra/llcommon/llsingleton.h +++ b/indra/llcommon/llsingleton.h @@ -847,28 +847,22 @@ template class LLSimpleton { public: - template - static void createInstance(ARGS&&... args) - { + static T* sInstance; + + static void createInstance() + { llassert(sInstance == nullptr); - sInstance = new T(std::forward(args)...); + sInstance = new T(); } - + static inline T* getInstance() { return sInstance; } static inline T& instance() { return *getInstance(); } static inline bool instanceExists() { return sInstance != nullptr; } - static void deleteSingleton() - { - delete sInstance; - sInstance = nullptr; + static void deleteSingleton() { + delete sInstance; + sInstance = nullptr; } - -private: - static T* sInstance; }; -template -T* LLSimpleton::sInstance{ nullptr }; - #endif -- cgit v1.2.3 From 106d52c6ee9b10dd7a7baca3b09a01073c61949d Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 4 Nov 2021 16:40:05 -0400 Subject: SL-16202: Instantiate LLSimpleton::sInstance generically instead of requiring a separate declaration for each subclass. The previous way produces errors in clang. (cherry picked from commit 8458ad8890cf0a11804996210d7bcfbdaa3eec2e) --- indra/llcommon/llsingleton.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/llcommon/llsingleton.h') diff --git a/indra/llcommon/llsingleton.h b/indra/llcommon/llsingleton.h index 10a8ecfedb..24d01812c9 100644 --- a/indra/llcommon/llsingleton.h +++ b/indra/llcommon/llsingleton.h @@ -865,4 +865,7 @@ public: } }; +template +T* LLSimpleton::sInstance{ nullptr }; + #endif -- cgit v1.2.3 From f997bcd186d00e30132f32be007bb3978bf3a8f5 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 11 Nov 2021 10:23:16 -0500 Subject: SL-16094: Stylish braces! (cherry picked from commit 18de6c9b989cc7060f2a314f5b68cc102677823b) --- indra/llcommon/llsingleton.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'indra/llcommon/llsingleton.h') diff --git a/indra/llcommon/llsingleton.h b/indra/llcommon/llsingleton.h index 24d01812c9..da2d6fd984 100644 --- a/indra/llcommon/llsingleton.h +++ b/indra/llcommon/llsingleton.h @@ -859,9 +859,16 @@ public: static inline T& instance() { return *getInstance(); } static inline bool instanceExists() { return sInstance != nullptr; } +<<<<<<< HEAD static void deleteSingleton() { delete sInstance; sInstance = nullptr; +======= + static void deleteSingleton() + { + delete sInstance; + sInstance = nullptr; +>>>>>>> 18de6c9b98 (SL-16094: Stylish braces!) } }; -- cgit v1.2.3 From 3171aaad9b1f2757f8b0d8cbb784a45a7bbebafa Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 19 Nov 2021 14:57:36 -0500 Subject: SL-16094: fix merge glitch --- indra/llcommon/llsingleton.h | 6 ------ 1 file changed, 6 deletions(-) (limited to 'indra/llcommon/llsingleton.h') diff --git a/indra/llcommon/llsingleton.h b/indra/llcommon/llsingleton.h index da2d6fd984..f85f961287 100644 --- a/indra/llcommon/llsingleton.h +++ b/indra/llcommon/llsingleton.h @@ -859,16 +859,10 @@ public: static inline T& instance() { return *getInstance(); } static inline bool instanceExists() { return sInstance != nullptr; } -<<<<<<< HEAD - static void deleteSingleton() { - delete sInstance; - sInstance = nullptr; -======= static void deleteSingleton() { delete sInstance; sInstance = nullptr; ->>>>>>> 18de6c9b98 (SL-16094: Stylish braces!) } }; -- cgit v1.2.3 From 0b066539fe68dc5750900c3452189645c40adb45 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 24 Nov 2021 10:47:54 -0500 Subject: DRTVWR-546, SL-16220, SL-16094: Undo previous glthread branch revert. Reverting a merge is sticky: it tells git you never want to see that branch again. Merging the DRTVWR-546 branch, which contained the revert, into the glthread branch undid much of the development work on that branch. To restore it we must revert the revert. This reverts commit 029b41c0419e975bbb28454538b46dc69ce5d2ba. --- indra/llcommon/llsingleton.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'indra/llcommon/llsingleton.h') diff --git a/indra/llcommon/llsingleton.h b/indra/llcommon/llsingleton.h index f85f961287..6042c0906c 100644 --- a/indra/llcommon/llsingleton.h +++ b/indra/llcommon/llsingleton.h @@ -847,14 +847,13 @@ template class LLSimpleton { public: - static T* sInstance; - - static void createInstance() - { + template + static void createInstance(ARGS&&... args) + { llassert(sInstance == nullptr); - sInstance = new T(); + sInstance = new T(std::forward(args)...); } - + static inline T* getInstance() { return sInstance; } static inline T& instance() { return *getInstance(); } static inline bool instanceExists() { return sInstance != nullptr; } @@ -864,6 +863,9 @@ public: delete sInstance; sInstance = nullptr; } + +private: + static T* sInstance; }; template -- cgit v1.2.3 From b504c692554d492113a10ef45427fe0ab0d8a85d Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Thu, 13 Jan 2022 12:55:53 -0800 Subject: SL-16606: Add profiler category THREAD --- indra/llcommon/llsingleton.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llcommon/llsingleton.h') diff --git a/indra/llcommon/llsingleton.h b/indra/llcommon/llsingleton.h index 6042c0906c..51ef514cf7 100644 --- a/indra/llcommon/llsingleton.h +++ b/indra/llcommon/llsingleton.h @@ -455,7 +455,7 @@ public: static DERIVED_TYPE* getInstance() { - LL_PROFILE_ZONE_SCOPED; + LL_PROFILE_ZONE_SCOPED_CATEGORY_THREAD; // We know the viewer has LLSingleton dependency circularities. If you // feel strongly motivated to eliminate them, cheers and good luck. // (At that point we could consider a much simpler locking mechanism.) -- cgit v1.2.3