From 965087284e07e1fe0add70ee1855aaea8719925c Mon Sep 17 00:00:00 2001
From: "cpu@chromium.org"
 <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Date: Wed, 18 Jul 2012 23:20:34 +0000
Subject: Wire the AMD switchable videcard detection

So we don't bucket all AMD cards as crappy.

BUG=117371
Review URL: https://chromiumcodereview.appspot.com/10790060

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@147334 0039d316-1c4b-4281-b951-d872f2087c98
---
 content/gpu/gpu_info_collector_win.cc | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

(limited to 'content/gpu/gpu_info_collector_win.cc')

diff --git a/content/gpu/gpu_info_collector_win.cc b/content/gpu/gpu_info_collector_win.cc
index 6e28b51..fed4347 100644
--- a/content/gpu/gpu_info_collector_win.cc
+++ b/content/gpu/gpu_info_collector_win.cc
@@ -153,6 +153,16 @@ content::GpuPerformanceStats RetrieveGpuPerformanceStats() {
 
 namespace gpu_info_collector {
 
+#if !defined(OFFICIAL_BUILD)
+AMDVideoCardType GetAMDVideocardType() {
+  return UNKNOWN;
+}
+#else
+// This function has a real implementation for official builds that can
+// be found in src/third_party/amd.
+AMDVideoCardType GetAMDVideocardType();
+#endif
+
 bool CollectGraphicsInfo(content::GPUInfo* gpu_info) {
   TRACE_EVENT0("gpu", "CollectGraphicsInfo");
 
@@ -344,12 +354,13 @@ bool CollectDriverInfoD3D(const std::wstring& device_id,
             reinterpret_cast<LPBYTE>(value), &dwcb_data);
         if (result == ERROR_SUCCESS) {
           driver_vendor = WideToASCII(std::wstring(value));
-          // If it's an Intel GPU with a driver provided by AMD then it's
-          // probably AMD's Dynamic Switchable Graphics.
-          // TODO: detect only AMD switchable
-          gpu_info->amd_switchable =
-              driver_vendor == "Advanced Micro Devices, Inc." ||
-              driver_vendor == "ATI Technologies Inc.";
+          if (driver_vendor == "Advanced Micro Devices, Inc." ||
+              driver_vendor == "ATI Technologies Inc.") {
+            // We are conservative and assume that in the absense of a clear
+            // signal the videocard is assumed to be switchable.
+            AMDVideoCardType amd_card_type = GetAMDVideocardType();
+            gpu_info->amd_switchable = (amd_card_type != STANDALONE);
+          }
         }
 
         gpu_info->driver_vendor = driver_vendor;
-- 
cgit v1.1