Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Side by Side Diff: content/gpu/gpu_info_collector_win.cc

Issue 10790060: Wire the AMD switchable videcard detection (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/gpu/gpu_info_collector.h ('k') | gpu/DEPS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/gpu/gpu_info_collector.h" 5 #include "content/gpu/gpu_info_collector.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <d3d9.h> 8 #include <d3d9.h>
9 #include <setupapi.h> 9 #include <setupapi.h>
10 10
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 UMA_HISTOGRAM_TIMES("GPU.WinSAT.ReadResultsFileTime", 146 UMA_HISTOGRAM_TIMES("GPU.WinSAT.ReadResultsFileTime",
147 base::TimeTicks::Now() - start_time); 147 base::TimeTicks::Now() - start_time);
148 148
149 return stats; 149 return stats;
150 } 150 }
151 151
152 } // namespace anonymous 152 } // namespace anonymous
153 153
154 namespace gpu_info_collector { 154 namespace gpu_info_collector {
155 155
156 #if !defined(OFFICIAL_BUILD)
157 AMDVideoCardType GetAMDVideocardType() {
158 return UNKNOWN;
159 }
160 #else
161 // This function has a real implementation for official builds that can
162 // be found in src/third_party/amd.
163 AMDVideoCardType GetAMDVideocardType();
164 #endif
165
156 bool CollectGraphicsInfo(content::GPUInfo* gpu_info) { 166 bool CollectGraphicsInfo(content::GPUInfo* gpu_info) {
157 TRACE_EVENT0("gpu", "CollectGraphicsInfo"); 167 TRACE_EVENT0("gpu", "CollectGraphicsInfo");
158 168
159 DCHECK(gpu_info); 169 DCHECK(gpu_info);
160 170
161 content::GpuPerformanceStats stats = RetrieveGpuPerformanceStats(); 171 content::GpuPerformanceStats stats = RetrieveGpuPerformanceStats();
162 UMA_HISTOGRAM_BOOLEAN( 172 UMA_HISTOGRAM_BOOLEAN(
163 "GPU.WinSAT.HasResults", 173 "GPU.WinSAT.HasResults",
164 stats.overall != 0.0 && stats.graphics != 0.0 && stats.gaming != 0.0); 174 stats.overall != 0.0 && stats.graphics != 0.0 && stats.gaming != 0.0);
165 gpu_info->performance_stats = stats; 175 gpu_info->performance_stats = stats;
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 if (result == ERROR_SUCCESS) 347 if (result == ERROR_SUCCESS)
338 driver_date = WideToASCII(std::wstring(value)); 348 driver_date = WideToASCII(std::wstring(value));
339 349
340 std::string driver_vendor; 350 std::string driver_vendor;
341 dwcb_data = sizeof(value); 351 dwcb_data = sizeof(value);
342 result = RegQueryValueExW( 352 result = RegQueryValueExW(
343 key, L"ProviderName", NULL, NULL, 353 key, L"ProviderName", NULL, NULL,
344 reinterpret_cast<LPBYTE>(value), &dwcb_data); 354 reinterpret_cast<LPBYTE>(value), &dwcb_data);
345 if (result == ERROR_SUCCESS) { 355 if (result == ERROR_SUCCESS) {
346 driver_vendor = WideToASCII(std::wstring(value)); 356 driver_vendor = WideToASCII(std::wstring(value));
347 // If it's an Intel GPU with a driver provided by AMD then it's 357 if (driver_vendor == "Advanced Micro Devices, Inc." ||
348 // probably AMD's Dynamic Switchable Graphics. 358 driver_vendor == "ATI Technologies Inc.") {
349 // TODO: detect only AMD switchable 359 // We are conservative and assume that in the absense of a clear
350 gpu_info->amd_switchable = 360 // signal the videocard is assumed to be switchable.
351 driver_vendor == "Advanced Micro Devices, Inc." || 361 AMDVideoCardType amd_card_type = GetAMDVideocardType();
352 driver_vendor == "ATI Technologies Inc."; 362 gpu_info->amd_switchable = (amd_card_type != STANDALONE);
363 }
353 } 364 }
354 365
355 gpu_info->driver_vendor = driver_vendor; 366 gpu_info->driver_vendor = driver_vendor;
356 gpu_info->driver_version = driver_version; 367 gpu_info->driver_version = driver_version;
357 gpu_info->driver_date = driver_date; 368 gpu_info->driver_date = driver_date;
358 found = true; 369 found = true;
359 RegCloseKey(key); 370 RegCloseKey(key);
360 break; 371 break;
361 } 372 }
362 } 373 }
(...skipping 14 matching lines...) Expand all
377 388
378 size_t pos = gl_version_string.find_last_not_of("0123456789."); 389 size_t pos = gl_version_string.find_last_not_of("0123456789.");
379 if (pos != std::string::npos && pos < gl_version_string.length() - 1) { 390 if (pos != std::string::npos && pos < gl_version_string.length() - 1) {
380 gpu_info->driver_version = gl_version_string.substr(pos + 1); 391 gpu_info->driver_version = gl_version_string.substr(pos + 1);
381 return true; 392 return true;
382 } 393 }
383 return false; 394 return false;
384 } 395 }
385 396
386 } // namespace gpu_info_collector 397 } // namespace gpu_info_collector
OLDNEW
« no previous file with comments | « content/gpu/gpu_info_collector.h ('k') | gpu/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698