SH-4325 Viewer working mixed grid with GetMesh and GetMesh2 caps

Thu, 18 Jul 2013 15:14:55 -0400

author
Monty Brandenberg <monty@lindenlab.com>
date
Thu, 18 Jul 2013 15:14:55 -0400
changeset 40695
916573da16a0
parent 40694
4291c258ebc4
child 40696
589d6dbc8c66

SH-4325 Viewer working mixed grid with GetMesh and GetMesh2 caps
Viewer modified for preference for GetMesh2 caps. When found,
uses this cap and uses 1/4 the connection concurrency specified
by MeshMaxConcurrentRequests. Also uses a modified calculation
for high/low water feeding into the llcorehttp library.

indra/newview/llmeshrepository.cpp file | annotate | diff | revisions
indra/newview/llmeshrepository.h file | annotate | diff | revisions
     1.1 --- a/indra/newview/llmeshrepository.cpp	Fri Jul 12 15:00:24 2013 -0400
     1.2 +++ b/indra/newview/llmeshrepository.cpp	Thu Jul 18 15:14:55 2013 -0400
     1.3 @@ -152,7 +152,11 @@
     1.4  //     [5]  Read of a double-checked lock.
     1.5  //
     1.6  //   So, in addition to documentation, take this as a to-do/review
     1.7 -//   list and see if you can improve things.
     1.8 +//   list and see if you can improve things.  For porters to non-x86
     1.9 +//   architectures, including amd64, the weaker memory models will
    1.10 +//   make these platforms probabilistically more susceptible to hitting
    1.11 +//   race conditions.  True here and in other multi-thread code such
    1.12 +//   as texture fetching.
    1.13  //
    1.14  //   LLMeshRepository:
    1.15  //
    1.16 @@ -237,8 +241,6 @@
    1.17  LLDeadmanTimer LLMeshRepository::sQuiescentTimer(15.0, true);	// true -> gather cpu metrics
    1.18  
    1.19  	
    1.20 -const U32 MAX_TEXTURE_UPLOAD_RETRIES = 5;
    1.21 -
    1.22  static S32 dump_num = 0;
    1.23  std::string make_dump_name(std::string prefix, S32 num)
    1.24  {
    1.25 @@ -797,7 +799,6 @@
    1.26  		}
    1.27  
    1.28  		mWaiting = true;
    1.29 -		ms_sleep(5);
    1.30  		mSignal->wait();
    1.31  		mWaiting = false;
    1.32  		
    1.33 @@ -982,20 +983,17 @@
    1.34  }
    1.35  
    1.36  // Constructs a Cap URL for the mesh.  Prefers a GetMesh2 cap
    1.37 -// over a GetMesh cap and returns what it finds to the caller
    1.38 -// as an int ([1..2]).
    1.39 +// over a GetMesh cap.
    1.40  //
    1.41  //static 
    1.42 -std::string LLMeshRepoThread::constructUrl(LLUUID mesh_id, int * cap_version)
    1.43 +std::string LLMeshRepoThread::constructUrl(LLUUID mesh_id)
    1.44  {
    1.45 -	int version(1);
    1.46  	std::string http_url;
    1.47  	
    1.48  	if (gAgent.getRegion())
    1.49  	{
    1.50  		if (! gMeshRepo.mGetMesh2Capability.empty())
    1.51  		{
    1.52 -			version = 2;
    1.53  			http_url = gMeshRepo.mGetMesh2Capability;
    1.54  		}
    1.55  		else
    1.56 @@ -1015,7 +1013,6 @@
    1.57  								<< mesh_id << ".mesh" << LL_ENDL;
    1.58  	}
    1.59  
    1.60 -	*cap_version = version;
    1.61  	return http_url;
    1.62  }
    1.63  
    1.64 @@ -1134,8 +1131,8 @@
    1.65  			{
    1.66  				return false;
    1.67  			}
    1.68 -			int cap_version(1);
    1.69 -			std::string http_url = constructUrl(mesh_id, &cap_version);
    1.70 +			int cap_version(gMeshRepo.mGetMeshVersion);
    1.71 +			std::string http_url = constructUrl(mesh_id);
    1.72  			if (!http_url.empty())
    1.73  			{
    1.74  				LLMeshSkinInfoHandler * handler = new LLMeshSkinInfoHandler(mesh_id, offset, size);
    1.75 @@ -1229,8 +1226,8 @@
    1.76  			{
    1.77  				return false;
    1.78  			}
    1.79 -			int cap_version(1);
    1.80 -			std::string http_url = constructUrl(mesh_id, &cap_version);
    1.81 +			int cap_version(gMeshRepo.mGetMeshVersion);
    1.82 +			std::string http_url = constructUrl(mesh_id);
    1.83  			if (!http_url.empty())
    1.84  			{
    1.85  				LLMeshDecompositionHandler * handler = new LLMeshDecompositionHandler(mesh_id, offset, size);
    1.86 @@ -1323,8 +1320,8 @@
    1.87  			{
    1.88  				return false;
    1.89  			}
    1.90 -			int cap_version(1);
    1.91 -			std::string http_url = constructUrl(mesh_id, &cap_version);
    1.92 +			int cap_version(gMeshRepo.mGetMeshVersion);
    1.93 +			std::string http_url = constructUrl(mesh_id);
    1.94  			if (!http_url.empty())
    1.95  			{
    1.96  				LLMeshPhysicsShapeHandler * handler = new LLMeshPhysicsShapeHandler(mesh_id, offset, size);
    1.97 @@ -1414,8 +1411,8 @@
    1.98  
    1.99  	//either cache entry doesn't exist or is corrupt, request header from simulator	
   1.100  	bool retval = true;
   1.101 -	int cap_version(1);
   1.102 -	std::string http_url = constructUrl(mesh_params.getSculptID(), &cap_version);
   1.103 +	int cap_version(gMeshRepo.mGetMeshVersion);
   1.104 +	std::string http_url = constructUrl(mesh_params.getSculptID());
   1.105  	if (!http_url.empty())
   1.106  	{
   1.107  		//grab first 4KB if we're going to bother with a fetch.  Cache will prevent future fetches if a full mesh fits
   1.108 @@ -1500,8 +1497,8 @@
   1.109  			}
   1.110  
   1.111  			//reading from VFS failed for whatever reason, fetch from sim
   1.112 -			int cap_version(1);
   1.113 -			std::string http_url = constructUrl(mesh_id, &cap_version);
   1.114 +			int cap_version(gMeshRepo.mGetMeshVersion);
   1.115 +			std::string http_url = constructUrl(mesh_id);
   1.116  			if (!http_url.empty())
   1.117  			{
   1.118  				LLMeshLODHandler * handler = new LLMeshLODHandler(mesh_params, lod, offset, size);
   1.119 @@ -2647,7 +2644,8 @@
   1.120  LLMeshRepository::LLMeshRepository()
   1.121  : mMeshMutex(NULL),
   1.122    mMeshThreadCount(0),
   1.123 -  mThread(NULL)
   1.124 +  mThread(NULL),
   1.125 +  mGetMeshVersion(2)
   1.126  {
   1.127  
   1.128  }
   1.129 @@ -2827,13 +2825,24 @@
   1.130  
   1.131  void LLMeshRepository::notifyLoadedMeshes()
   1.132  { //called from main thread
   1.133 -	// *FIXME:  Scaling down the setting by a factor of 4 for now to reflect
   1.134 -	// target goal.  May want to rename the setting before release.  Also
   1.135 -	// want/need to get these in a coordinated fashion from llappcorehttp.
   1.136 -	LLMeshRepoThread::sMaxConcurrentRequests = gSavedSettings.getU32("MeshMaxConcurrentRequests") / 4;
   1.137 -	LLMeshRepoThread::sRequestHighWater = llclamp(10 * S32(LLMeshRepoThread::sMaxConcurrentRequests),
   1.138 -												  REQUEST_HIGH_WATER_MIN,
   1.139 -												  REQUEST_HIGH_WATER_MAX);
   1.140 +	if (1 == mGetMeshVersion)
   1.141 +	{
   1.142 +		// Legacy GetMesh operation with high connection concurrency
   1.143 +		LLMeshRepoThread::sMaxConcurrentRequests = gSavedSettings.getU32("MeshMaxConcurrentRequests");
   1.144 +		LLMeshRepoThread::sRequestHighWater = llclamp(2 * S32(LLMeshRepoThread::sMaxConcurrentRequests),
   1.145 +													  REQUEST_HIGH_WATER_MIN,
   1.146 +													  REQUEST_HIGH_WATER_MAX);
   1.147 +	}
   1.148 +	else
   1.149 +	{
   1.150 +		// GetMesh2 operation with keepalives, etc.
   1.151 +		// *TODO:  Logic here is replicated from llappcorehttp.cpp, should really
   1.152 +		// unify this and keep it in one place only.
   1.153 +		LLMeshRepoThread::sMaxConcurrentRequests = gSavedSettings.getU32("MeshMaxConcurrentRequests") / 4;
   1.154 +		LLMeshRepoThread::sRequestHighWater = llclamp(5 * S32(LLMeshRepoThread::sMaxConcurrentRequests),
   1.155 +													  REQUEST_HIGH_WATER_MIN,
   1.156 +													  REQUEST_HIGH_WATER_MAX);
   1.157 +	}
   1.158  	LLMeshRepoThread::sRequestLowWater = llclamp(LLMeshRepoThread::sRequestHighWater / 2,
   1.159  												 REQUEST_LOW_WATER_MIN,
   1.160  												 REQUEST_LOW_WATER_MAX);
   1.161 @@ -2929,6 +2938,7 @@
   1.162  			region_name = gAgent.getRegion()->getName();
   1.163  			mGetMeshCapability = gAgent.getRegion()->getCapability("GetMesh");
   1.164  			mGetMesh2Capability = gAgent.getRegion()->getCapability("GetMesh2");
   1.165 +			mGetMeshVersion = mGetMesh2Capability.empty() ? 1 : 2;
   1.166  			LL_DEBUGS(LOG_MESH) << "Retrieving caps for region '" << region_name
   1.167  								<< "', GetMesh2:  " << mGetMesh2Capability
   1.168  								<< ", GetMesh:  " << mGetMeshCapability
   1.169 @@ -4152,7 +4162,7 @@
   1.170  	LLMeshRepository::metricsStart();
   1.171  }
   1.172  
   1.173 -// This comes from an edit in viewer-cat.  Unify this once that's
   1.174 +// *TODO:  This comes from an edit in viewer-cat.  Unify this once that's
   1.175  // available everywhere.
   1.176  bool is_retryable(LLCore::HttpStatus status)
   1.177  {
     2.1 --- a/indra/newview/llmeshrepository.h	Fri Jul 12 15:00:24 2013 -0400
     2.2 +++ b/indra/newview/llmeshrepository.h	Thu Jul 18 15:14:55 2013 -0400
     2.3 @@ -337,7 +337,7 @@
     2.4  	typedef std::set<LLCore::HttpHandler *> http_request_set;
     2.5  	http_request_set					mHttpRequestSet;			// Outstanding HTTP requests
     2.6  
     2.7 -	static std::string constructUrl(LLUUID mesh_id, int * cap_version);
     2.8 +	static std::string constructUrl(LLUUID mesh_id);
     2.9  
    2.10  	LLMeshRepoThread();
    2.11  	~LLMeshRepoThread();
    2.12 @@ -600,6 +600,7 @@
    2.13  
    2.14  	std::string mGetMeshCapability;
    2.15  	std::string mGetMesh2Capability;
    2.16 +	int mGetMeshVersion;
    2.17  };
    2.18  
    2.19  extern LLMeshRepository gMeshRepo;

mercurial