Instrument threaded texture decode

includes fix for timeout in slow decoded bakes
master
Beq 2021-05-28 02:22:53 +01:00
parent fb7a9106cd
commit 20cd749175
5 changed files with 46 additions and 6 deletions

View File

@ -25,7 +25,7 @@
*/
#include "linden_common.h"
#include "fstelemetry.h" // <FS:Beq> add telemetry support.
#include "llimageworker.h"
#include "llimagedxt.h"
@ -135,7 +135,12 @@ LLImageDecodeThread::~LLImageDecodeThread()
// virtual
S32 LLImageDecodeThread::update(F32 max_time_ms)
{
FSZoneC(tracy::Color::Blue); // <FS:Beq/> instrument image decodes
LLMutexLock lock(mCreationMutex);
// <FS:Beq> instrument image decodes
{
FSZoneC(tracy::Color::Blue1);
// </FS:Beq>
for (creation_list_t::iterator iter = mCreationList.begin();
iter != mCreationList.end(); ++iter)
{
@ -155,13 +160,21 @@ S32 LLImageDecodeThread::update(F32 max_time_ms)
}
}
mCreationList.clear();
// <FS:Beq> instrument image decodes
}
{
FSZoneC(tracy::Color::Blue2);
// </FS:Beq>
S32 res = LLQueuedThread::update(max_time_ms);
// FSPlot("img_decode_pending", (int64_t)res); // <FS:Beq/> instrument image decodes
return res;
} // <FS:Beq/> instrument image decodes
}
LLImageDecodeThread::handle_t LLImageDecodeThread::decodeImage(LLImageFormatted* image,
U32 priority, S32 discard, BOOL needs_aux, Responder* responder)
{
FSZoneC(tracy::Color::Orange); // <FS:Beq> instrument the image decode pipeline
LLMutexLock lock(mCreationMutex);
handle_t handle = generateHandle();
mCreationList.push_back(creation_info(handle, image, priority, discard, needs_aux, responder));
@ -230,10 +243,19 @@ bool LLImageDecodeThread::ImageRequest::processRequest()
bool LLImageDecodeThread::ImageRequest::processRequestIntern()
{
const F32 decode_time_slice = .1f;
// <FS:Beq> allow longer timeout for async and add instrumentation
// const F32 decode_time_slice = .1f;
FSZoneC(tracy::Color::DarkOrange);
F32 decode_time_slice = .1f;
if(mFlags & FLAG_ASYNC)
{
decode_time_slice = 10.0f;// long time out as this is not an issue with async
}
// </FS:Beq>
bool done = true;
if (!mDecodedRaw && mFormattedImage.notNull())
{
FSZoneC(tracy::Color::DarkOrange1); // <FS:Beq> instrument the image decode pipeline
// Decode primary channels
if (mDecodedImageRaw.isNull())
{
@ -272,6 +294,7 @@ bool LLImageDecodeThread::ImageRequest::processRequestIntern()
}
if (done && mNeedsAux && !mDecodedAux && mFormattedImage.notNull())
{
FSZoneC(tracy::Color::DarkOrange2); // <FS:Beq> instrument the image decode pipeline
// Decode aux channel
if (!mDecodedImageAux)
{
@ -282,7 +305,12 @@ bool LLImageDecodeThread::ImageRequest::processRequestIntern()
done = mFormattedImage->decodeChannels(mDecodedImageAux, decode_time_slice, 4, 4); // 1ms
mDecodedAux = done && mDecodedImageAux->getData();
}
// <FS:Beq> report timeout on async thread (which leads to worker abort errors)
if(!done)
{
LL_WARNS("ImageDecode") << "Image decoding failed to complete with time slice=" << decode_time_slice << LL_ENDL;
}
// </FS:Beq>
//<FS:ND> Image thread pool from CoolVL
if (mFlags & FLAG_ASYNC)
{

View File

@ -25,6 +25,7 @@
*/
#include "linden_common.h"
#include "fstelemetry.h" // <FS:Beq> instrument image decodes
#include "llimagej2coj.h"
#define OPENJPEG2
@ -258,10 +259,11 @@ bool LLImageJ2COJ::initEncode(LLImageJ2C &base, LLImageRaw &raw_image, int block
bool LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count)
{
// <FS:Techwolf Lupindo> texture comment metadata reader
FSZone; // <FS:Beq> instrument image decodes
U8* c_data = base.getData();
S32 c_size = base.getDataSize();
S32 position = 0;
while (position < 1024 && position < (c_size - 7)) // the comment field should be in the first 1024 bytes.
{
if (c_data[position] == 0xff && c_data[position + 1] == 0x64)

View File

@ -32,7 +32,7 @@
#include "llpointer.h"
#include "llmath.h"
#include "llkdumem.h"
#include "fstelemetry.h" // <FS:Beq> instrument image decodes
#define kdu_xxxx "kdu_block_coding.h"
#include "include_kdu_xxxx.h"
@ -287,6 +287,7 @@ void transfer_bytes(kdu_byte *dest, kdu_line_buf &src, int gap, int precision);
// as well, when that still existed, with keep_codestream true and MODE_FAST.
void LLImageJ2CKDU::setupCodeStream(LLImageJ2C &base, bool keep_codestream, ECodeStreamMode mode)
{
FSZone; // <FS:Beq> instrument image decodes
S32 data_size = base.getDataSize();
S32 max_bytes = (base.getMaxBytes() ? base.getMaxBytes() : data_size);
@ -436,6 +437,7 @@ bool LLImageJ2CKDU::initEncode(LLImageJ2C &base, LLImageRaw &raw_image, int bloc
// decodeImpl() usage matters for production.
bool LLImageJ2CKDU::initDecode(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, ECodeStreamMode mode, S32 first_channel, S32 max_channel_count, int discard_level, int* region)
{
FSZone; // <FS:Beq> instrument image decodes
base.resetLastError();
// *FIX: kdu calls our callback function if there's an error, and then bombs.
@ -519,6 +521,7 @@ bool LLImageJ2CKDU::initDecode(LLImageJ2C &base, LLImageRaw &raw_image, F32 deco
// Returns true to mean done, whether successful or not.
bool LLImageJ2CKDU::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decode_time, S32 first_channel, S32 max_channel_count)
{
FSZone; // <FS:Beq> instrument image decodes
ECodeStreamMode mode = MODE_FAST;
LLTimer decode_timer;

View File

@ -1882,8 +1882,13 @@ bool LLAppViewer::doFrame()
S32 work_pending = 0;
S32 io_pending = 0;
F32 max_time = llmin(gFrameIntervalSeconds.value() *10.f, 1.f);
// <FS:Beq> instrument image decodes
{
FSZoneN("updateTextureThreads");
// FSPlot("max_time_ms",max_time);
// <FS:Beq/>
work_pending += updateTextureThreads(max_time);
} // <FS:Beq/> instrument image decodes
{
LL_RECORD_BLOCK_TIME(FTM_LFS);
@ -3822,6 +3827,7 @@ LLSD LLAppViewer::getViewerInfo() const
// CPU
info["CPU"] = gSysCPU.getCPUString();
info["MEMORY_MB"] = LLSD::Integer(gSysMemory.getPhysicalMemoryKB().valueInUnits<LLUnits::Megabytes>());
info["CONCURRENCY"] = LLSD::Integer((S32)boost::thread::hardware_concurrency()); // <FS:Beq> Add hardware concurrency to info
// Moved hack adjustment to Windows memory size into llsys.cpp
info["OS_VERSION"] = LLOSInfo::instance().getOSString();
info["GRAPHICS_CARD_VENDOR"] = ll_safe_string((const char*)(glGetString(GL_VENDOR)));

View File

@ -51,6 +51,7 @@ You are in [REGION]
<string name="AboutSystem">
CPU: [CPU]
Memory: [MEMORY_MB] MB
Concurrency: [CONCURRENCY]
OS Version: [OS_VERSION]
Graphics Card Vendor: [GRAPHICS_CARD_VENDOR]
Graphics Card: [GRAPHICS_CARD]