From 09a6daabd2c4281b071f9213906872ea8a744956 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 6 Mar 2017 14:31:31 -0500 Subject: SL-409 - consolidated user of ViewerAsset cap for mesh and texture fetching as well. --- indra/newview/llmeshrepository.cpp | 143 +++++++++++---------------------- indra/newview/llmeshrepository.h | 13 +-- indra/newview/lltexturefetch.cpp | 4 +- indra/newview/llviewerassetstorage.cpp | 2 +- indra/newview/llviewerregion.cpp | 13 ++- indra/newview/llviewerregion.h | 4 +- 6 files changed, 58 insertions(+), 121 deletions(-) diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 9dacae2c4e..5cc8ab02da 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -808,10 +808,8 @@ LLMeshRepoThread::LLMeshRepoThread() mHttpLargeOptions(), mHttpHeaders(), mHttpPolicyClass(LLCore::HttpRequest::DEFAULT_POLICY_ID), - mHttpLegacyPolicyClass(LLCore::HttpRequest::DEFAULT_POLICY_ID), mHttpLargePolicyClass(LLCore::HttpRequest::DEFAULT_POLICY_ID), - mHttpPriority(0), - mGetMeshVersion(2) + mHttpPriority(0) { LLAppCoreHttp & app_core_http(LLAppViewer::instance()->getAppCoreHttp()); @@ -828,7 +826,6 @@ LLMeshRepoThread::LLMeshRepoThread() mHttpHeaders = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders); mHttpHeaders->append(HTTP_OUT_HEADER_ACCEPT, HTTP_CONTENT_VND_LL_MESH); mHttpPolicyClass = app_core_http.getPolicy(LLAppCoreHttp::AP_MESH2); - mHttpLegacyPolicyClass = app_core_http.getPolicy(LLAppCoreHttp::AP_MESH1); mHttpLargePolicyClass = app_core_http.getPolicy(LLAppCoreHttp::AP_LARGE_MESH); } @@ -1103,13 +1100,9 @@ void LLMeshRepoThread::loadMeshLOD(const LLVolumeParams& mesh_params, S32 lod) } // Mutex: must be holding mMutex when called -void LLMeshRepoThread::setGetMeshCaps(const std::string & get_mesh1, - const std::string & get_mesh2, - int pref_version) +void LLMeshRepoThread::setGetMeshCap(const std::string & mesh_cap) { - mGetMeshCapability = get_mesh1; - mGetMesh2Capability = get_mesh2; - mGetMeshVersion = pref_version; + mGetMeshCapability = mesh_cap; } @@ -1117,29 +1110,14 @@ void LLMeshRepoThread::setGetMeshCaps(const std::string & get_mesh1, // over a GetMesh cap. // // Mutex: acquires mMutex -void LLMeshRepoThread::constructUrl(LLUUID mesh_id, std::string * url, int * version) +void LLMeshRepoThread::constructUrl(LLUUID mesh_id, std::string * url) { std::string res_url; - int res_version(2); if (gAgent.getRegion()) { LLMutexLock lock(mMutex); - - // Get a consistent pair of (cap string, version). The - // locking could be eliminated here without loss of safety - // by using a set of staging values in setGetMeshCaps(). - - if (! mGetMesh2Capability.empty() && mGetMeshVersion > 1) - { - res_url = mGetMesh2Capability; - res_version = 2; - } - else - { - res_url = mGetMeshCapability; - res_version = 1; - } + res_url = mGetMeshCapability; } if (! res_url.empty()) @@ -1149,19 +1127,15 @@ void LLMeshRepoThread::constructUrl(LLUUID mesh_id, std::string * url, int * ver } else { - LL_WARNS_ONCE(LOG_MESH) << "Current region does not have GetMesh capability! Cannot load " + LL_WARNS_ONCE(LOG_MESH) << "Current region does not have ViewerAsset capability! Cannot load " << mesh_id << ".mesh" << LL_ENDL; } *url = res_url; - *version = res_version; } // Issue an HTTP GET request with byte range using the right -// policy class. Large requests go to the large request class. -// If the current region supports GetMesh2, we prefer that for -// smaller requests otherwise we try to use the traditional -// GetMesh capability and connection concurrency. +// policy class. // // @return Valid handle or LLCORE_HTTP_HANDLE_INVALID. // If the latter, actual status is found in @@ -1169,7 +1143,7 @@ void LLMeshRepoThread::constructUrl(LLUUID mesh_id, std::string * url, int * ver // next call to this method. // // Thread: repo -LLCore::HttpHandle LLMeshRepoThread::getByteRange(const std::string & url, int cap_version, +LLCore::HttpHandle LLMeshRepoThread::getByteRange(const std::string & url, size_t offset, size_t len, const LLCore::HttpHandler::ptr_t &handler) { @@ -1180,16 +1154,14 @@ LLCore::HttpHandle LLMeshRepoThread::getByteRange(const std::string & url, int c if (len < LARGE_MESH_FETCH_THRESHOLD) { - handle = mHttpRequest->requestGetByteRange((2 == cap_version - ? mHttpPolicyClass - : mHttpLegacyPolicyClass), - mHttpPriority, - url, - (disable_range_req ? size_t(0) : offset), - (disable_range_req ? size_t(0) : len), - mHttpOptions, - mHttpHeaders, - handler); + handle = mHttpRequest->requestGetByteRange( mHttpPolicyClass, + mHttpPriority, + url, + (disable_range_req ? size_t(0) : offset), + (disable_range_req ? size_t(0) : len), + mHttpOptions, + mHttpHeaders, + handler); if (LLCORE_HTTP_HANDLE_INVALID != handle) { ++LLMeshRepository::sHTTPRequestCount; @@ -1279,14 +1251,13 @@ bool LLMeshRepoThread::fetchMeshSkinInfo(const LLUUID& mesh_id) } //reading from VFS failed for whatever reason, fetch from sim - int cap_version(2); std::string http_url; - constructUrl(mesh_id, &http_url, &cap_version); + constructUrl(mesh_id, &http_url); if (!http_url.empty()) { LLMeshHandlerBase::ptr_t handler(new LLMeshSkinInfoHandler(mesh_id, offset, size)); - LLCore::HttpHandle handle = getByteRange(http_url, cap_version, offset, size, handler); + LLCore::HttpHandle handle = getByteRange(http_url, offset, size, handler); if (LLCORE_HTTP_HANDLE_INVALID == handle) { LL_WARNS(LOG_MESH) << "HTTP GET request failed for skin info on mesh " << mID @@ -1372,14 +1343,13 @@ bool LLMeshRepoThread::fetchMeshDecomposition(const LLUUID& mesh_id) } //reading from VFS failed for whatever reason, fetch from sim - int cap_version(2); std::string http_url; - constructUrl(mesh_id, &http_url, &cap_version); + constructUrl(mesh_id, &http_url); if (!http_url.empty()) { LLMeshHandlerBase::ptr_t handler(new LLMeshDecompositionHandler(mesh_id, offset, size)); - LLCore::HttpHandle handle = getByteRange(http_url, cap_version, offset, size, handler); + LLCore::HttpHandle handle = getByteRange(http_url, offset, size, handler); if (LLCORE_HTTP_HANDLE_INVALID == handle) { LL_WARNS(LOG_MESH) << "HTTP GET request failed for decomposition mesh " << mID @@ -1464,14 +1434,13 @@ bool LLMeshRepoThread::fetchMeshPhysicsShape(const LLUUID& mesh_id) } //reading from VFS failed for whatever reason, fetch from sim - int cap_version(2); std::string http_url; - constructUrl(mesh_id, &http_url, &cap_version); + constructUrl(mesh_id, &http_url); if (!http_url.empty()) { LLMeshHandlerBase::ptr_t handler(new LLMeshPhysicsShapeHandler(mesh_id, offset, size)); - LLCore::HttpHandle handle = getByteRange(http_url, cap_version, offset, size, handler); + LLCore::HttpHandle handle = getByteRange(http_url, offset, size, handler); if (LLCORE_HTTP_HANDLE_INVALID == handle) { LL_WARNS(LOG_MESH) << "HTTP GET request failed for physics shape on mesh " << mID @@ -1558,9 +1527,8 @@ bool LLMeshRepoThread::fetchMeshHeader(const LLVolumeParams& mesh_params) //either cache entry doesn't exist or is corrupt, request header from simulator bool retval = true; - int cap_version(2); std::string http_url; - constructUrl(mesh_params.getSculptID(), &http_url, &cap_version); + constructUrl(mesh_params.getSculptID(), &http_url); if (!http_url.empty()) { @@ -1569,7 +1537,7 @@ bool LLMeshRepoThread::fetchMeshHeader(const LLVolumeParams& mesh_params) //NOTE -- this will break of headers ever exceed 4KB LLMeshHandlerBase::ptr_t handler(new LLMeshHeaderHandler(mesh_params, 0, MESH_HEADER_SIZE)); - LLCore::HttpHandle handle = getByteRange(http_url, cap_version, 0, MESH_HEADER_SIZE, handler); + LLCore::HttpHandle handle = getByteRange(http_url, 0, MESH_HEADER_SIZE, handler); if (LLCORE_HTTP_HANDLE_INVALID == handle) { LL_WARNS(LOG_MESH) << "HTTP GET request failed for mesh header " << mID @@ -1645,14 +1613,13 @@ bool LLMeshRepoThread::fetchMeshLOD(const LLVolumeParams& mesh_params, S32 lod) } //reading from VFS failed for whatever reason, fetch from sim - int cap_version(2); std::string http_url; - constructUrl(mesh_id, &http_url, &cap_version); + constructUrl(mesh_id, &http_url); if (!http_url.empty()) { LLMeshHandlerBase::ptr_t handler(new LLMeshLODHandler(mesh_params, lod, offset, size)); - LLCore::HttpHandle handle = getByteRange(http_url, cap_version, offset, size, handler); + LLCore::HttpHandle handle = getByteRange(http_url, offset, size, handler); if (LLCORE_HTTP_HANDLE_INVALID == handle) { LL_WARNS(LOG_MESH) << "HTTP GET request failed for LOD on mesh " << mID @@ -3292,8 +3259,7 @@ void LLMeshPhysicsShapeHandler::processData(LLCore::BufferArray * /* body */, S3 LLMeshRepository::LLMeshRepository() : mMeshMutex(NULL), mMeshThreadCount(0), - mThread(NULL), - mGetMeshVersion(2) + mThread(NULL) { } @@ -3476,35 +3442,21 @@ void LLMeshRepository::notifyLoadedMeshes() { //called from main thread LL_RECORD_BLOCK_TIME(FTM_MESH_FETCH); - if (1 == mGetMeshVersion) - { - // Legacy GetMesh operation with high connection concurrency - LLMeshRepoThread::sMaxConcurrentRequests = gSavedSettings.getU32("MeshMaxConcurrentRequests"); - LLMeshRepoThread::sRequestHighWater = llclamp(2 * S32(LLMeshRepoThread::sMaxConcurrentRequests), - REQUEST_HIGH_WATER_MIN, - REQUEST_HIGH_WATER_MAX); - LLMeshRepoThread::sRequestLowWater = llclamp(LLMeshRepoThread::sRequestHighWater / 2, - REQUEST_LOW_WATER_MIN, - REQUEST_LOW_WATER_MAX); - } - else - { - // GetMesh2 operation with keepalives, etc. With pipelining, - // we'll increase this. See llappcorehttp and llcorehttp for - // discussion on connection strategies. - LLAppCoreHttp & app_core_http(LLAppViewer::instance()->getAppCoreHttp()); - S32 scale(app_core_http.isPipelined(LLAppCoreHttp::AP_MESH2) - ? (2 * LLAppCoreHttp::PIPELINING_DEPTH) - : 5); - - LLMeshRepoThread::sMaxConcurrentRequests = gSavedSettings.getU32("Mesh2MaxConcurrentRequests"); - LLMeshRepoThread::sRequestHighWater = llclamp(scale * S32(LLMeshRepoThread::sMaxConcurrentRequests), - REQUEST2_HIGH_WATER_MIN, - REQUEST2_HIGH_WATER_MAX); - LLMeshRepoThread::sRequestLowWater = llclamp(LLMeshRepoThread::sRequestHighWater / 2, - REQUEST2_LOW_WATER_MIN, - REQUEST2_LOW_WATER_MAX); - } + // GetMesh2 operation with keepalives, etc. With pipelining, + // we'll increase this. See llappcorehttp and llcorehttp for + // discussion on connection strategies. + LLAppCoreHttp & app_core_http(LLAppViewer::instance()->getAppCoreHttp()); + S32 scale(app_core_http.isPipelined(LLAppCoreHttp::AP_MESH2) + ? (2 * LLAppCoreHttp::PIPELINING_DEPTH) + : 5); + + LLMeshRepoThread::sMaxConcurrentRequests = gSavedSettings.getU32("Mesh2MaxConcurrentRequests"); + LLMeshRepoThread::sRequestHighWater = llclamp(scale * S32(LLMeshRepoThread::sMaxConcurrentRequests), + REQUEST2_HIGH_WATER_MIN, + REQUEST2_HIGH_WATER_MAX); + LLMeshRepoThread::sRequestLowWater = llclamp(LLMeshRepoThread::sRequestHighWater / 2, + REQUEST2_LOW_WATER_MIN, + REQUEST2_LOW_WATER_MAX); //clean up completed upload threads for (std::vector::iterator iter = mUploads.begin(); iter != mUploads.end(); ) @@ -3610,15 +3562,10 @@ void LLMeshRepository::notifyLoadedMeshes() if (gAgent.getRegion()->getName() != region_name && gAgent.getRegion()->capabilitiesReceived()) { region_name = gAgent.getRegion()->getName(); - const bool use_v1(gSavedSettings.getBOOL("MeshUseGetMesh1")); - const std::string mesh1(gAgent.getRegion()->getCapability("GetMesh")); - const std::string mesh2(gAgent.getRegion()->getCapability("GetMesh2")); - mGetMeshVersion = (mesh2.empty() || use_v1) ? 1 : 2; - mThread->setGetMeshCaps(mesh1, mesh2, mGetMeshVersion); + const std::string mesh_cap(gAgent.getRegion()->getViewerAssetUrl()); + mThread->setGetMeshCap(mesh_cap); LL_DEBUGS(LOG_MESH) << "Retrieving caps for region '" << region_name - << "', GetMesh2: " << mesh2 - << ", GetMesh: " << mesh1 - << ", using version: " << mGetMeshVersion + << "', ViewerAsset cap: " << mesh_cap << LL_ENDL; } } diff --git a/indra/newview/llmeshrepository.h b/indra/newview/llmeshrepository.h index 30f042845a..23af837f6f 100644 --- a/indra/newview/llmeshrepository.h +++ b/indra/newview/llmeshrepository.h @@ -279,7 +279,6 @@ public: LLCore::HttpOptions::ptr_t mHttpLargeOptions; LLCore::HttpHeaders::ptr_t mHttpHeaders; LLCore::HttpRequest::policy_t mHttpPolicyClass; - LLCore::HttpRequest::policy_t mHttpLegacyPolicyClass; LLCore::HttpRequest::policy_t mHttpLargePolicyClass; LLCore::HttpRequest::priority_t mHttpPriority; @@ -287,8 +286,6 @@ public: http_request_set mHttpRequestSet; // Outstanding HTTP requests std::string mGetMeshCapability; - std::string mGetMesh2Capability; - int mGetMeshVersion; LLMeshRepoThread(); ~LLMeshRepoThread(); @@ -335,12 +332,10 @@ public: // mesh fetch URLs. // // Mutex: must be holding mMutex when called - void setGetMeshCaps(const std::string & get_mesh1, - const std::string & get_mesh2, - int pref_version); + void setGetMeshCap(const std::string & get_mesh); // Mutex: acquires mMutex - void constructUrl(LLUUID mesh_id, std::string * url, int * version); + void constructUrl(LLUUID mesh_id, std::string * url); private: // Issue a GET request to a URL with 'Range' header using @@ -349,7 +344,7 @@ private: // or dispose of handler. // // Threads: Repo thread only - LLCore::HttpHandle getByteRange(const std::string & url, int cap_version, + LLCore::HttpHandle getByteRange(const std::string & url, size_t offset, size_t len, const LLCore::HttpHandler::ptr_t &handler); }; @@ -585,8 +580,6 @@ public: void uploadError(LLSD& args); void updateInventory(inventory_data data); - - int mGetMeshVersion; // Shadows value in LLMeshRepoThread }; extern LLMeshRepository gMeshRepo; diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 07b3dc1aa4..7c0d02c9ca 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -1351,7 +1351,7 @@ bool LLTextureFetchWorker::doWork(S32 param) if (region) { - std::string http_url = region->getHttpUrl() ; + std::string http_url = region->getViewerAssetUrl(); if (!http_url.empty()) { if (mFTType != FTT_DEFAULT) @@ -4580,7 +4580,7 @@ void LLTextureFetchDebugger::debugHTTP() return; } - mHTTPUrl = region->getHttpUrl(); + mHTTPUrl = region->getViewerAssetUrl(); if (mHTTPUrl.empty()) { LL_INFOS(LOG_TXT) << "Fetch Debugger : Current region URL undefined. Cannot fetch textures through HTTP." << LL_ENDL; diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp index fa3567620c..41f407b8d9 100644 --- a/indra/newview/llviewerassetstorage.cpp +++ b/indra/newview/llviewerassetstorage.cpp @@ -538,7 +538,7 @@ void LLViewerAssetStorage::assetRequestCoro( std::string LLViewerAssetStorage::getAssetURL(const LLUUID& uuid, LLAssetType::EType atype) { - std::string cap_url = gAgent.getRegion()->getCapability("ViewerAsset"); + std::string cap_url = gAgent.getRegion()->getViewerAssetUrl(); std::string type_name = LLAssetType::lookup(atype); std::string url = cap_url + "/?" + type_name + "_id=" + uuid.asString(); return url; diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 0188208cfd..eb37613c95 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -521,7 +521,7 @@ LLViewerRegion::LLViewerRegion(const U64 &handle, mColoName("unknown"), mProductSKU("unknown"), mProductName("unknown"), - mHttpUrl(""), + mViewerAssetUrl(""), mCacheLoaded(FALSE), mCacheDirty(FALSE), mReleaseNotesRequested(FALSE), @@ -2843,12 +2843,9 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) capabilityNames.append("IsExperienceAdmin"); capabilityNames.append("IsExperienceContributor"); capabilityNames.append("RegionExperiences"); - capabilityNames.append("GetMesh"); - capabilityNames.append("GetMesh2"); capabilityNames.append("GetMetadata"); capabilityNames.append("GetObjectCost"); capabilityNames.append("GetObjectPhysicsData"); - capabilityNames.append("GetTexture"); capabilityNames.append("GroupAPIv1"); capabilityNames.append("GroupMemberData"); capabilityNames.append("GroupProposalBallot"); @@ -2962,9 +2959,9 @@ void LLViewerRegion::setCapability(const std::string& name, const std::string& u else { mImpl->mCapabilities[name] = url; - if(name == "GetTexture") + if(name == "ViewerAsset") { - mHttpUrl = url ; + mViewerAssetUrl = url; } } } @@ -2975,9 +2972,9 @@ void LLViewerRegion::setCapabilityDebug(const std::string& name, const std::stri if ( ! ( name == "EventQueueGet" || name == "UntrustedSimulatorMessage" || name == "SimulatorFeatures" ) ) { mImpl->mSecondCapabilitiesTracker[name] = url; - if(name == "GetTexture") + if(name == "ViewerAsset") { - mHttpUrl = url ; + mViewerAssetUrl = url; } } } diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index a7bb546d2c..61ce5b454d 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -354,7 +354,7 @@ public: friend std::ostream& operator<<(std::ostream &s, const LLViewerRegion ®ion); /// implements LLCapabilityProvider virtual std::string getDescription() const; - std::string getHttpUrl() const { return mHttpUrl ;} + std::string getViewerAssetUrl() const { return mViewerAssetUrl; } U32 getNumOfVisibleGroups() const; U32 getNumOfActiveCachedObjects() const; @@ -506,7 +506,7 @@ private: std::string mColoName; std::string mProductSKU; std::string mProductName; - std::string mHttpUrl ; + std::string mViewerAssetUrl ; // Maps local ids to cache entries. // Regions can have order 10,000 objects, so assume -- cgit v1.2.3