From e83700b56dcf2b0f392b49a79123b78bc7c8fbd9 Mon Sep 17 00:00:00 2001
From: Dave Parks <davep@lindenlab.com>
Date: Fri, 30 Nov 2012 17:03:12 -0600
Subject: MAINT-1991 Attempt to mitigate crashes in GL drivers by encouraging
 people to update their drivers.

Reviewed by Simon
---
 indra/newview/llappviewer.cpp                      | 17 +++++++---
 indra/newview/llfeaturemanager.cpp                 | 11 +++++-
 indra/newview/llfeaturemanager.h                   |  5 ++-
 .../newview/skins/default/xui/en/notifications.xml | 39 ++++++++++++++++++++++
 4 files changed, 66 insertions(+), 6 deletions(-)

(limited to 'indra/newview')

diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index f203ac224b..1000c0e1e8 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -1030,11 +1030,20 @@ bool LLAppViewer::init()
 	}
 
 #if LL_WINDOWS
-	if (gGLManager.mIsIntel && 
-		LLFeatureManager::getInstance()->getGPUClass() > 0 &&
-		gGLManager.mGLVersion <= 3.f)
+	if (gGLManager.mGLVersion < LLFeatureManager::getInstance()->getExpectedGLVersion())
 	{
-		LLNotificationsUtil::add("IntelOldDriver");
+		if (gGLManager.mIsIntel)
+		{
+			LLNotificationsUtil::add("IntelOldDriver");
+		}
+		else if (gGLManager.mIsNVIDIA)
+		{
+			LLNotificationsUtil::add("NVIDIAOldDriver");
+		}
+		else if (gGLManager.mIsATI)
+		{
+			LLNotificationsUtil::add("AMDOldDriver");
+		}
 	}
 #endif
 
diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp
index b211027d54..564cb046ce 100644
--- a/indra/newview/llfeaturemanager.cpp
+++ b/indra/newview/llfeaturemanager.cpp
@@ -419,7 +419,7 @@ void LLFeatureManager::parseGPUTable(std::string filename)
 
 		// setup the tokenizer
 		std::string buf(buffer);
-		std::string cls, label, expr, supported;
+		std::string cls, label, expr, supported, stats_based, expected_gl_version;
 		boost_tokenizer tokens(buf, boost::char_separator<char>("\t\n"));
 		boost_tokenizer::iterator token_iter = tokens.begin();
 
@@ -440,6 +440,14 @@ void LLFeatureManager::parseGPUTable(std::string filename)
 		{
 			supported = *token_iter++;
 		}
+		if (token_iter != tokens.end())
+		{
+			stats_based = *token_iter++;
+		}
+		if (token_iter != tokens.end())
+		{
+			expected_gl_version = *token_iter++;
+		}
 
 		if (label.empty() || expr.empty() || cls.empty() || supported.empty())
 		{
@@ -469,6 +477,7 @@ void LLFeatureManager::parseGPUTable(std::string filename)
 			mGPUString = label;
 			mGPUClass = (EGPUClass) strtol(cls.c_str(), NULL, 10);
 			mGPUSupported = (BOOL) strtol(supported.c_str(), NULL, 10);
+			sscanf(expected_gl_version.c_str(), "%f", &mExpectedGLVersion);
 		}
 	}
 #if LL_EXPORT_GPU_TABLE
diff --git a/indra/newview/llfeaturemanager.h b/indra/newview/llfeaturemanager.h
index 6f9d2e49c6..ad72c16743 100644
--- a/indra/newview/llfeaturemanager.h
+++ b/indra/newview/llfeaturemanager.h
@@ -103,7 +103,8 @@ public:
 		mTableVersion(0),
 		mSafe(FALSE),
 		mGPUClass(GPU_CLASS_UNKNOWN),
-		mGPUSupported(FALSE)
+		mExpectedGLVersion(0.f),
+		mGPUSupported(FALSE)		
 	{
 	}
 	~LLFeatureManager() {cleanupFeatureTables();}
@@ -118,6 +119,7 @@ public:
 	EGPUClass getGPUClass() 			{ return mGPUClass; }
 	std::string& getGPUString() 		{ return mGPUString; }
 	BOOL isGPUSupported()				{ return mGPUSupported; }
+	F32 getExpectedGLVersion()			{ return mExpectedGLVersion; }
 	
 	void cleanupFeatureTables();
 
@@ -157,6 +159,7 @@ protected:
 	S32			mTableVersion;
 	BOOL		mSafe;					// Reinitialize everything to the "safe" mask
 	EGPUClass	mGPUClass;
+	F32			mExpectedGLVersion;		//expected GL version according to gpu table
 	std::string	mGPUString;
 	BOOL		mGPUSupported;
 };
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index c32e23d553..648a1895c4 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -1291,6 +1291,45 @@ Visit [_URL] for more information?
     <tag>fail</tag>
   </notification>
 
+  <notification
+   icon="alertmodal.tga"
+   name="AMDOldDriver"
+   type="alertmodal">
+    There is likely a newer driver for your graphics chip.  Updating graphics drivers can substantially improve performance.
+
+    Visit [_URL] to check for driver updates?
+    <tag>confirm</tag>
+    <url option="0" name="url">
+      http://support.amd.com/us/Pages/AMDSupportHub.aspx
+    </url>
+    <usetemplate
+     ignoretext="My graphics driver is out of date"
+     name="okcancelignore"
+     notext="No"
+     yestext="Yes"/>
+    <tag>fail</tag>
+  </notification>
+
+  <notification
+ icon="alertmodal.tga"
+ name="NVIDIAOldDriver"
+ type="alertmodal">
+    There is likely a newer driver for your graphics chip.  Updating graphics drivers can substantially improve performance.
+
+    Visit [_URL] to check for driver updates?
+    <tag>confirm</tag>
+    <url option="0" name="url">
+      http://www.nvidia.com/Download/index.aspx?lang=en-us
+    </url>
+    <usetemplate
+     ignoretext="My graphics driver is out of date"
+     name="okcancelignore"
+     notext="No"
+     yestext="Yes"/>
+    <tag>fail</tag>
+  </notification>
+
+
   <notification
    icon="alertmodal.tga"
    name="UnknownGPU"
-- 
cgit v1.2.3