From 7dcca7f180c2204daefbc3648ebe766a46c7cf85 Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Fri, 14 Jan 2022 10:34:21 -0700 Subject: SL-16418 bg thread for media texture updates --- indra/newview/llviewermedia.h | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) (limited to 'indra/newview/llviewermedia.h') diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h index 71cec5125d..c2e6564166 100644 --- a/indra/newview/llviewermedia.h +++ b/indra/newview/llviewermedia.h @@ -197,7 +197,10 @@ public: U8 media_loop); ~LLViewerMediaImpl(); - + + static void initClass(LLWindow* window, bool multi_threaded = false); + static void cleanupClass(); + // Override inherited version from LLViewerMediaEventEmitter virtual void emitEvent(LLPluginClassMedia* self, LLViewerMediaObserver::EMediaEvent event); @@ -266,6 +269,9 @@ public: void scaleTextureCoords(const LLVector2& texture_coords, S32 *x, S32 *y); void update(); + bool preUpdateMediaTexture(); + void doMediaTexUpdate(); + bool postUpdateMediaTexture(); void updateImagesMediaStreams(); LLUUID getMediaTextureID() const; @@ -490,6 +496,34 @@ private: private: LLViewerMediaTexture *updatePlaceholderImage(); + LL::WorkQueue::weak_t mMainQueue; + LL::WorkQueue::weak_t mTexUpdateQueue; + +}; + +// Define a worker thread pool for media updates ( LLImageGLThread) +class LLMediaTextureUpdateThread : public LLSimpleton, LL::ThreadPool +{ +public: + // follows gSavedSettings "RenderGLMultiThreaded" + static bool sEnabled; + + LLMediaTextureUpdateThread(LLWindow* window); + + // post a function to be executed on the LLMediaTextureUpdateThread background thread + template + bool post(CALLABLE&& func) + { + return getQueue().postIfOpen(std::forward(func)); + } + + void run() override; + +private: + LLWindow* mWindow; + void* mContext = nullptr; + LLAtomicBool mFinished; }; + #endif // LLVIEWERMEDIA_H -- cgit v1.2.3 From 8d0efb54db96c87a2adb4a824998870ff397846e Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Thu, 27 Jan 2022 12:57:30 -0700 Subject: SL-16418 rename media tex image per-update to avoid contention stall --- indra/newview/llviewermedia.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'indra/newview/llviewermedia.h') diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h index c2e6564166..03a14421ff 100644 --- a/indra/newview/llviewermedia.h +++ b/indra/newview/llviewermedia.h @@ -269,9 +269,8 @@ public: void scaleTextureCoords(const LLVector2& texture_coords, S32 *x, S32 *y); void update(); - bool preUpdateMediaTexture(); void doMediaTexUpdate(); - bool postUpdateMediaTexture(); + void endMediaTexUpdate(); void updateImagesMediaStreams(); LLUUID getMediaTextureID() const; @@ -495,13 +494,13 @@ private: bool mCanceling; private: - LLViewerMediaTexture *updatePlaceholderImage(); + LLViewerMediaTexture *updateMediaImage(); LL::WorkQueue::weak_t mMainQueue; LL::WorkQueue::weak_t mTexUpdateQueue; }; -// Define a worker thread pool for media updates ( LLImageGLThread) +// Define a worker thread pool for media updates (ref LLImageGLThread) class LLMediaTextureUpdateThread : public LLSimpleton, LL::ThreadPool { public: -- cgit v1.2.3 From 25370e10b66231ff95086f0104c6aee641876763 Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Mon, 31 Jan 2022 16:38:53 -0700 Subject: SL-16418 add tear-down lock --- indra/newview/llviewermedia.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/llviewermedia.h') diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h index 03a14421ff..0afb2162ab 100644 --- a/indra/newview/llviewermedia.h +++ b/indra/newview/llviewermedia.h @@ -432,6 +432,7 @@ private: private: // a single media url with some data and an impl. boost::shared_ptr mMediaSource; + LLMutex mLock; F64 mZoomFactor; LLUUID mTextureId; bool mMovieImageHasMips; -- cgit v1.2.3 From 795a349b9f44183970b1e8abc632c4d7f8bbea37 Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Tue, 1 Feb 2022 15:44:09 -0700 Subject: Revert "Merged in euclid-16418-a (pull request #852)" This reverts commit dcf8f695367a1bcc9c495ea93a89927dd83802af, reversing changes made to 594910a8408f67f1af7c66d5a4dfde3626669245. --- indra/newview/llviewermedia.h | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/llviewermedia.h') diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h index 0afb2162ab..03a14421ff 100644 --- a/indra/newview/llviewermedia.h +++ b/indra/newview/llviewermedia.h @@ -432,7 +432,6 @@ private: private: // a single media url with some data and an impl. boost::shared_ptr mMediaSource; - LLMutex mLock; F64 mZoomFactor; LLUUID mTextureId; bool mMovieImageHasMips; -- cgit v1.2.3 From fdc4a81b578f26ce573d6b60760c8235312a6372 Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Tue, 1 Feb 2022 15:49:32 -0700 Subject: Revert "Merged in euclid-16418 (pull request #846)" This reverts commit 40fe5277e1390c975d9a3184ff8fc46d69dfb450, reversing changes made to af830e5fc5840194be95140f644a27011b9b7e06. --- indra/newview/llviewermedia.h | 37 ++----------------------------------- 1 file changed, 2 insertions(+), 35 deletions(-) (limited to 'indra/newview/llviewermedia.h') diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h index 03a14421ff..71cec5125d 100644 --- a/indra/newview/llviewermedia.h +++ b/indra/newview/llviewermedia.h @@ -197,10 +197,7 @@ public: U8 media_loop); ~LLViewerMediaImpl(); - - static void initClass(LLWindow* window, bool multi_threaded = false); - static void cleanupClass(); - + // Override inherited version from LLViewerMediaEventEmitter virtual void emitEvent(LLPluginClassMedia* self, LLViewerMediaObserver::EMediaEvent event); @@ -269,8 +266,6 @@ public: void scaleTextureCoords(const LLVector2& texture_coords, S32 *x, S32 *y); void update(); - void doMediaTexUpdate(); - void endMediaTexUpdate(); void updateImagesMediaStreams(); LLUUID getMediaTextureID() const; @@ -494,35 +489,7 @@ private: bool mCanceling; private: - LLViewerMediaTexture *updateMediaImage(); - LL::WorkQueue::weak_t mMainQueue; - LL::WorkQueue::weak_t mTexUpdateQueue; - -}; - -// Define a worker thread pool for media updates (ref LLImageGLThread) -class LLMediaTextureUpdateThread : public LLSimpleton, LL::ThreadPool -{ -public: - // follows gSavedSettings "RenderGLMultiThreaded" - static bool sEnabled; - - LLMediaTextureUpdateThread(LLWindow* window); - - // post a function to be executed on the LLMediaTextureUpdateThread background thread - template - bool post(CALLABLE&& func) - { - return getQueue().postIfOpen(std::forward(func)); - } - - void run() override; - -private: - LLWindow* mWindow; - void* mContext = nullptr; - LLAtomicBool mFinished; + LLViewerMediaTexture *updatePlaceholderImage(); }; - #endif // LLVIEWERMEDIA_H -- cgit v1.2.3 From f47730b92c309092d0a5a95e2d49d7ad53230a97 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 14 Feb 2022 18:07:24 +0000 Subject: SL-16418 Media texture update stall fix. Make media texture updates use LLImageGL thread to update, fix AMD sync issue on ImageGL thread and install debug callbacks on LLImageGL thread when debug gl enabled. --- indra/newview/llviewermedia.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'indra/newview/llviewermedia.h') diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h index 71cec5125d..806692929a 100644 --- a/indra/newview/llviewermedia.h +++ b/indra/newview/llviewermedia.h @@ -197,7 +197,7 @@ public: U8 media_loop); ~LLViewerMediaImpl(); - + // Override inherited version from LLViewerMediaEventEmitter virtual void emitEvent(LLPluginClassMedia* self, LLViewerMediaObserver::EMediaEvent event); @@ -266,6 +266,8 @@ public: void scaleTextureCoords(const LLVector2& texture_coords, S32 *x, S32 *y); void update(); + bool preMediaTexUpdate(LLViewerMediaTexture*& media_tex, U8*& data, S32& data_width, S32& data_height, S32& x_pos, S32& y_pos, S32& width, S32& height); + void doMediaTexUpdate(LLViewerMediaTexture* media_tex, U8* data, S32 data_width, S32 data_height, S32 x_pos, S32 y_pos, S32 width, S32 height, bool sync); void updateImagesMediaStreams(); LLUUID getMediaTextureID() const; @@ -427,6 +429,7 @@ private: private: // a single media url with some data and an impl. boost::shared_ptr mMediaSource; + LLMutex mLock; F64 mZoomFactor; LLUUID mTextureId; bool mMovieImageHasMips; @@ -446,6 +449,7 @@ private: S32 mTextureUsedWidth; S32 mTextureUsedHeight; bool mSuspendUpdates; + bool mTextureUpdatePending = false; bool mVisible; ECursorType mLastSetCursor; EMediaNavState mMediaNavState; @@ -479,7 +483,7 @@ private: LLNotificationPtr mNotification; bool mCleanBrowser; // force the creation of a clean browsing target with full options enabled static std::vector sMimeTypesFailed; - + LLPointer mRawImage; //backing buffer for texture updates private: BOOL mIsUpdated ; std::list< LLVOVolume* > mObjectList ; @@ -489,7 +493,10 @@ private: bool mCanceling; private: - LLViewerMediaTexture *updatePlaceholderImage(); + LLViewerMediaTexture *updateMediaImage(); + LL::WorkQueue::weak_t mMainQueue; + LL::WorkQueue::weak_t mTexUpdateQueue; + }; #endif // LLVIEWERMEDIA_H -- cgit v1.2.3