Skip to content

Commit

Permalink
#3488 Prioritization adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
akleshchev committed Feb 19, 2025
1 parent 6d0b0a7 commit 483e85c
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 19 deletions.
40 changes: 23 additions & 17 deletions indra/newview/llmeshrepository.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,22 +343,22 @@ static LLFastTimer::DeclareTimer FTM_MESH_FETCH("Mesh Fetch");

LLMeshRepository gMeshRepo;

const U32 CACHE_PREAMBLE_VERSION = 1;
const S32 CACHE_PREAMBLE_SIZE = sizeof(U32) * 3; //version, header_size, flags
const S32 MESH_HEADER_SIZE = 4096; // Important: assumption is that headers fit in this space
constexpr U32 CACHE_PREAMBLE_VERSION = 1;
constexpr S32 CACHE_PREAMBLE_SIZE = sizeof(U32) * 3; //version, header_size, flags
constexpr S32 MESH_HEADER_SIZE = 4096; // Important: assumption is that headers fit in this space


const S32 REQUEST2_HIGH_WATER_MIN = 32; // Limits for GetMesh2 regions
const S32 REQUEST2_HIGH_WATER_MAX = 100;
const S32 REQUEST2_LOW_WATER_MIN = 16;
const S32 REQUEST2_LOW_WATER_MAX = 50;
constexpr S32 REQUEST2_HIGH_WATER_MIN = 32; // Limits for GetMesh2 regions
constexpr S32 REQUEST2_HIGH_WATER_MAX = 100;
constexpr S32 REQUEST2_LOW_WATER_MIN = 16;
constexpr S32 REQUEST2_LOW_WATER_MAX = 50;

const U32 LARGE_MESH_FETCH_THRESHOLD = 1U << 21; // Size at which requests goes to narrow/slow queue
const long SMALL_MESH_XFER_TIMEOUT = 120L; // Seconds to complete xfer, small mesh downloads
const long LARGE_MESH_XFER_TIMEOUT = 600L; // Seconds to complete xfer, large downloads
constexpr U32 LARGE_MESH_FETCH_THRESHOLD = 1U << 21; // Size at which requests goes to narrow/slow queue
constexpr long SMALL_MESH_XFER_TIMEOUT = 120L; // Seconds to complete xfer, small mesh downloads
constexpr long LARGE_MESH_XFER_TIMEOUT = 600L; // Seconds to complete xfer, large downloads

const U32 DOWNLOAD_RETRY_LIMIT = 8;
const F32 DOWNLOAD_RETRY_DELAY = 0.5f; // seconds
constexpr U32 DOWNLOAD_RETRY_LIMIT = 8;
constexpr F32 DOWNLOAD_RETRY_DELAY = 0.5f; // seconds

// Would normally like to retry on uploads as some
// retryable failures would be recoverable. Unfortunately,
Expand All @@ -368,15 +368,15 @@ const F32 DOWNLOAD_RETRY_DELAY = 0.5f; // seconds
// cap which then produces a 404 on retry destroying some
// (occasionally) useful error information. We'll leave
// upload retries to the user as in the past. SH-4667.
const long UPLOAD_RETRY_LIMIT = 0L;
constexpr long UPLOAD_RETRY_LIMIT = 0L;

// Maximum mesh version to support. Three least significant digits are reserved for the minor version,
// with major version changes indicating a format change that is not backwards compatible and should not
// be parsed by viewers that don't specifically support that version. For example, if the integer "1" is
// present, the version is 0.001. A viewer that can parse version 0.001 can also parse versions up to 0.999,
// but not 1.0 (integer 1000).
// See wiki at https://wiki.secondlife.com/wiki/Mesh/Mesh_Asset_Format
const S32 MAX_MESH_VERSION = 999;
constexpr S32 MAX_MESH_VERSION = 999;

U32 LLMeshRepository::sBytesReceived = 0;
U32 LLMeshRepository::sMeshRequestCount = 0;
Expand Down Expand Up @@ -1869,8 +1869,8 @@ bool LLMeshRepoThread::fetchMeshHeader(const LLVolumeParams& mesh_params)
if (size > 0)
{
// *NOTE: if the header size is ever more than 4KB, this will break
const S32 DISK_MINIMAL_READ = 4096;
static thread_local U8 buffer[DISK_MINIMAL_READ * 2];
constexpr S32 DISK_MINIMAL_READ = 4096;
U8 buffer[DISK_MINIMAL_READ * 2];
S32 bytes = llmin(size, DISK_MINIMAL_READ);
LLMeshRepository::sCacheBytesRead += bytes;
++LLMeshRepository::sCacheReads;
Expand Down Expand Up @@ -4337,6 +4337,12 @@ F32 calculate_score(LLVOVolume* object)
const LLVector3* box = avatar->getLastAnimExtents();
LLVector3 diag = box[1] - box[0];
radius = diag.magVec();

if (!avatar->isSelf() && !avatar->hasFirstFullAttachmentData())
{
// slightly deprioritize avatars that are still receiving data
radius *= 0.9f;
}
}
return radius / llmax(av_drawable->mDistanceWRTCamera, 1.f);
}
Expand Down Expand Up @@ -5385,7 +5391,7 @@ F32 LLMeshCostData::getEstTrisForStreamingCost()

F32 charged_tris = mEstTrisByLOD[3];
F32 allowed_tris = mEstTrisByLOD[3];
const F32 ENFORCE_FLOOR = 64.0f;
constexpr F32 ENFORCE_FLOOR = 64.0f;
for (S32 i=2; i>=0; i--)
{
// How many tris can we have in this LOD without affecting land impact?
Expand Down
2 changes: 1 addition & 1 deletion indra/newview/llviewermessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3333,7 +3333,7 @@ void send_agent_update(bool force_send, bool send_reliable)
// we reduce the number of attachments sent to the viewer, thus prioritizing
// closer ones.
// Todo: revise and remove once server gets distance sorting.
last_draw_disatance_step = llmax((F32)(gAgentCamera.mDrawDistance / 2.f), 64.f);
last_draw_disatance_step = llmax((F32)(gAgentCamera.mDrawDistance / 2.f), 50.f);
msg->addF32Fast(_PREHASH_Far, last_draw_disatance_step);
}
else if (last_draw_disatance_step < gAgentCamera.mDrawDistance)
Expand Down
14 changes: 13 additions & 1 deletion indra/newview/llvoavatar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3226,6 +3226,7 @@ void LLVOAvatar::idleUpdateLoadingEffect()
if (mFirstFullyVisible)
{
mFirstFullyVisible = false;
mLastCloudAttachmentCount = (S32)mSimAttachments.size();
mFirstDecloudTime = mFirstAppearanceMessageTimer.getElapsedTimeF32();
if (isSelf())
{
Expand Down Expand Up @@ -8398,7 +8399,7 @@ bool LLVOAvatar::updateIsFullyLoaded()
);

// compare amount of attachments to one reported by simulator
if (!loading && !isSelf() && rez_status < 4 && mLastCloudAttachmentCount < mSimAttachments.size())
if (!isSelf() && mLastCloudAttachmentCount < mSimAttachments.size() && mSimAttachments.size() > 0)
{
S32 attachment_count = getAttachmentCount();
if (mLastCloudAttachmentCount != attachment_count)
Expand All @@ -8416,6 +8417,11 @@ bool LLVOAvatar::updateIsFullyLoaded()
// waiting
loading = true;
}
else if (!loading)
{
// for hasFirstFullAttachmentData
mLastCloudAttachmentCount = (S32)mSimAttachments.size();
}
}
}
updateRezzedStatusTimers(rez_status);
Expand Down Expand Up @@ -8529,6 +8535,12 @@ bool LLVOAvatar::isFullyLoaded() const
return (mRenderUnloadedAvatar || mFullyLoaded);
}

bool LLVOAvatar::hasFirstFullAttachmentData() const
{
return !mFirstFullyVisible // Avatar is fully visible, have all data
|| mLastCloudAttachmentCount >= (S32)mSimAttachments.size();
}

bool LLVOAvatar::isTooComplex() const
{
bool too_complex;
Expand Down
1 change: 1 addition & 0 deletions indra/newview/llvoavatar.h
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ class LLVOAvatar :
//--------------------------------------------------------------------
public:
bool isFullyLoaded() const;
bool hasFirstFullAttachmentData() const;
F32 getFirstDecloudTime() const {return mFirstDecloudTime;}

// check and return current state relative to limits
Expand Down

0 comments on commit 483e85c

Please sign in to comment.