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/llimage/llimage.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'indra/llimage/llimage.cpp') diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index aed8943439..5c49ec02ea 100644 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -623,8 +623,7 @@ void LLImage::setLastError(const std::string& message) //--------------------------------------------------------------------------- LLImageBase::LLImageBase() -: LLTrace::MemTrackable("LLImage"), - mData(NULL), +: mData(NULL), mDataSize(0), mWidth(0), mHeight(0), @@ -673,7 +672,6 @@ void LLImageBase::sanityCheck() void LLImageBase::deleteData() { ll_aligned_free_16(mData); - disclaimMem(mDataSize); mDataSize = 0; mData = NULL; } @@ -731,7 +729,6 @@ U8* LLImageBase::allocateData(S32 size) } } mDataSize = size; - claimMem(mDataSize); return mData; } @@ -752,9 +749,7 @@ U8* LLImageBase::reallocateData(S32 size) ll_aligned_free_16(mData) ; } mData = new_datap; - disclaimMem(mDataSize); mDataSize = size; - claimMem(mDataSize); mBadBufferAllocation = false; return mData; } @@ -2258,9 +2253,7 @@ void LLImageBase::setDataAndSize(U8 *data, S32 size) { ll_assert_aligned(data, 16); mData = data; - disclaimMem(mDataSize); mDataSize = size; - claimMem(mDataSize); } //static -- cgit v1.2.3 From c8926630af2b80c7db817b78df3a90378f0ecbbb Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Tue, 11 Jan 2022 17:29:04 -0700 Subject: SL-16418 optimize imageraw clear --- indra/llimage/llimage.cpp | 88 ++++++++++++++++++++++++++++------------------- 1 file changed, 53 insertions(+), 35 deletions(-) (limited to 'indra/llimage/llimage.cpp') diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index 15b07e5318..2855612158 100644 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -925,47 +925,65 @@ bool LLImageRaw::setSubImage(U32 x_pos, U32 y_pos, U32 width, U32 height, void LLImageRaw::clear(U8 r, U8 g, U8 b, U8 a) { - llassert( getComponents() <= 4 ); - // This is fairly bogus, but it'll do for now. - if (isBufferInvalid()) - { - LL_WARNS() << "Invalid image buffer" << LL_ENDL; - return; - } + LL_PROFILE_ZONE_NAMED("djh imageraw clear") + S8 components = getComponents(); + llassert( components > 0 && components <= 4 ); - U8 *pos = getData(); - U32 x, y; - for (x = 0; x < getWidth(); x++) - { - for (y = 0; y < getHeight(); y++) - { - *pos = r; - pos++; - if (getComponents() == 1) - { - continue; - } - *pos = g; - pos++; - if (getComponents() == 2) - { - continue; - } - *pos = b; - pos++; - if (getComponents() == 3) - { - continue; - } - *pos = a; - pos++; - } - } + // This is fairly bogus, but it'll do for now. + if (isBufferInvalid()) + { + LL_WARNS() << "Invalid image buffer" << LL_ENDL; + return; + } + + switch (components) + { + case 1: + { + U8 *dst = getData(); + S32 count = getWidth() * getHeight(); + llassert(count == getDataSize()); + std::fill_n(dst, count, r); + break; + } + case 2: + { + U16 *dst = (U16 *)getData(); + S32 count = getWidth() * getHeight(); + llassert(count == getDataSize() / 2); + U16 val = (U16)(r | g << 8); + std::fill_n(dst, count, val); + break; + } + case 3: + { + U8 *dst = getData(); + S32 count = getWidth() * getHeight(); + llassert(count == getDataSize() / 3); + for (S32 i = 0; i < count; i++) + { + *dst++ = r; + *dst++ = g; + *dst++ = b; + } + break; + } + case 4: + { + U32 *dst = (U32 *)getData(); + S32 count = getWidth() * getHeight(); + llassert(count == getDataSize() / 4); + U32 val = (U32)(r | g << 8 | b << 16 | a << 24); + std::fill_n(dst, count, val); + break; + } + } } // Reverses the order of the rows in the image void LLImageRaw::verticalFlip() { + LL_PROFILE_ZONE_SCOPED; S32 row_bytes = getWidth() * getComponents(); llassert(row_bytes > 0); std::vector line_buffer(row_bytes); -- 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/llimage/llimage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llimage/llimage.cpp') diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index 2855612158..fb02a131fd 100644 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -925,7 +925,7 @@ bool LLImageRaw::setSubImage(U32 x_pos, U32 y_pos, U32 width, U32 height, void LLImageRaw::clear(U8 r, U8 g, U8 b, U8 a) { - LL_PROFILE_ZONE_NAMED("djh imageraw clear") + LL_PROFILE_ZONE_SCOPED; S8 components = getComponents(); llassert( components > 0 && components <= 4 ); -- cgit v1.2.3 From d28a271fa819c076e2cedb87d9f305468e436b25 Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Fri, 28 Jan 2022 09:43:21 -0700 Subject: SL-16418 add some big-endian future-proofing --- indra/llimage/llimage.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'indra/llimage/llimage.cpp') diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index fb02a131fd..ba7ee0b465 100644 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -951,7 +951,11 @@ void LLImageRaw::clear(U8 r, U8 g, U8 b, U8 a) U16 *dst = (U16 *)getData(); S32 count = getWidth() * getHeight(); llassert(count == getDataSize() / 2); +#ifdef LL_LITTLE_ENDIAN U16 val = (U16)(r | g << 8); +#else + U16 val = (U16)(r << 8 | g); +#endif std::fill_n(dst, count, val); break; } @@ -973,7 +977,11 @@ void LLImageRaw::clear(U8 r, U8 g, U8 b, U8 a) U32 *dst = (U32 *)getData(); S32 count = getWidth() * getHeight(); llassert(count == getDataSize() / 4); +#ifdef LL_LITTLE_ENDIAN U32 val = (U32)(r | g << 8 | b << 16 | a << 24); +#else + U32 val = (U32)(r << 24 | g << 16 | b << 8 | a); +#endif std::fill_n(dst, count, val); break; } -- 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/llimage/llimage.cpp | 96 +++++++++++++++++------------------------------ 1 file changed, 35 insertions(+), 61 deletions(-) (limited to 'indra/llimage/llimage.cpp') diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index ba7ee0b465..15b07e5318 100644 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -925,73 +925,47 @@ bool LLImageRaw::setSubImage(U32 x_pos, U32 y_pos, U32 width, U32 height, void LLImageRaw::clear(U8 r, U8 g, U8 b, U8 a) { - LL_PROFILE_ZONE_SCOPED; - S8 components = getComponents(); - llassert( components > 0 && components <= 4 ); - - // This is fairly bogus, but it'll do for now. - if (isBufferInvalid()) - { - LL_WARNS() << "Invalid image buffer" << LL_ENDL; - return; - } + llassert( getComponents() <= 4 ); + // This is fairly bogus, but it'll do for now. + if (isBufferInvalid()) + { + LL_WARNS() << "Invalid image buffer" << LL_ENDL; + return; + } - switch (components) - { - case 1: - { - U8 *dst = getData(); - S32 count = getWidth() * getHeight(); - llassert(count == getDataSize()); - std::fill_n(dst, count, r); - break; - } - case 2: - { - U16 *dst = (U16 *)getData(); - S32 count = getWidth() * getHeight(); - llassert(count == getDataSize() / 2); -#ifdef LL_LITTLE_ENDIAN - U16 val = (U16)(r | g << 8); -#else - U16 val = (U16)(r << 8 | g); -#endif - std::fill_n(dst, count, val); - break; - } - case 3: - { - U8 *dst = getData(); - S32 count = getWidth() * getHeight(); - llassert(count == getDataSize() / 3); - for (S32 i = 0; i < count; i++) - { - *dst++ = r; - *dst++ = g; - *dst++ = b; - } - break; - } - case 4: - { - U32 *dst = (U32 *)getData(); - S32 count = getWidth() * getHeight(); - llassert(count == getDataSize() / 4); -#ifdef LL_LITTLE_ENDIAN - U32 val = (U32)(r | g << 8 | b << 16 | a << 24); -#else - U32 val = (U32)(r << 24 | g << 16 | b << 8 | a); -#endif - std::fill_n(dst, count, val); - break; - } - } + U8 *pos = getData(); + U32 x, y; + for (x = 0; x < getWidth(); x++) + { + for (y = 0; y < getHeight(); y++) + { + *pos = r; + pos++; + if (getComponents() == 1) + { + continue; + } + *pos = g; + pos++; + if (getComponents() == 2) + { + continue; + } + *pos = b; + pos++; + if (getComponents() == 3) + { + continue; + } + *pos = a; + pos++; + } + } } // Reverses the order of the rows in the image void LLImageRaw::verticalFlip() { - LL_PROFILE_ZONE_SCOPED; S32 row_bytes = getWidth() * getComponents(); llassert(row_bytes > 0); std::vector line_buffer(row_bytes); -- 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/llimage/llimage.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/llimage/llimage.cpp') diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index 15b07e5318..5fa19ce9c6 100644 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -860,6 +860,12 @@ U8* LLImageRaw::reallocateData(S32 size) return res; } +void LLImageRaw::releaseData() +{ + LLImageBase::setSize(0, 0, 0); + LLImageBase::setDataAndSize(nullptr, 0); +} + // virtual void LLImageRaw::deleteData() { -- cgit v1.2.3 From 5b67aa2c58a2c144d9013d4534520741e48596f5 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Mon, 7 Mar 2022 19:11:59 -0800 Subject: SL-16933: Fix texture stat Raw Total always increasing --- indra/llimage/llimage.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra/llimage/llimage.cpp') diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index 5fa19ce9c6..0fa027c9c3 100644 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -884,8 +884,6 @@ void LLImageRaw::setDataAndSize(U8 *data, S32 width, S32 height, S8 components) LLImageBase::setSize(width, height, components) ; LLImageBase::setDataAndSize(data, width * height * components) ; - - sGlobalRawMemory += getDataSize(); } bool LLImageRaw::resize(U16 width, U16 height, S8 components) -- cgit v1.2.3